update
This commit is contained in:
@ -19,7 +19,7 @@ class HomePage extends GetView{
|
|||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: (){
|
onTap: (){
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const SearchPage()));
|
Navigator.push(context, MaterialPageRoute(builder: (context) => SearchPage()));
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 32,
|
height: 32,
|
||||||
|
|||||||
@ -25,27 +25,42 @@ class IndexPage extends GetView<IndexController> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
drawer: const DrawerPage(),
|
drawer: const DrawerPage(),
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
// leading: IconButton(
|
leading: IconButton(
|
||||||
// icon: Icon(Icons.arrow_back_ios),
|
icon: Icon(Icons.arrow_back_ios),
|
||||||
// onPressed: (){
|
onPressed: (){
|
||||||
// indexController.switchPage(AppPages.TRAVEL);
|
indexController.switchPage(AppPages.TRAVEL);
|
||||||
// },
|
},
|
||||||
// ),
|
),
|
||||||
//automaticallyImplyLeading: false,
|
//automaticallyImplyLeading: false,
|
||||||
title: Text("Add locations"),
|
title: Text("Add locations"),
|
||||||
actions: [
|
actions: [
|
||||||
RaisedButton(
|
InkWell(
|
||||||
child: Text("db"),
|
onTap: (){
|
||||||
onPressed: (){
|
Get.toNamed(AppPages.SEARCH);
|
||||||
DatabaseHelper db = DatabaseHelper.instance;
|
},
|
||||||
db.getDestinations().then((value){
|
child: Container(
|
||||||
print("-------- lendth in db ${value.length} ---- :::::");
|
height: 32,
|
||||||
for(Destination d in value){
|
width: 75,
|
||||||
print("-------- values in db are ${d.checkedin} ---- :::::");
|
decoration: BoxDecoration(
|
||||||
};
|
color: Colors.blue,
|
||||||
});
|
borderRadius: BorderRadius.circular(25),
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
child: const Center(child: Icon(Icons.search),),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// RaisedButton(
|
||||||
|
// child: Text("db"),
|
||||||
|
// onPressed: (){
|
||||||
|
// DatabaseHelper db = DatabaseHelper.instance;
|
||||||
|
// db.getDestinations().then((value){
|
||||||
|
// print("-------- lendth in db ${value.length} ---- :::::");
|
||||||
|
// for(Destination d in value){
|
||||||
|
// print("-------- values in db are ${d.checkedin} ---- :::::");
|
||||||
|
// };
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
CatWidget(indexController: indexController,),
|
CatWidget(indexController: indexController,),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
9
lib/pages/search/search_binding.dart
Normal file
9
lib/pages/search/search_binding.dart
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:rogapp/pages/search/search_controller.dart';
|
||||||
|
|
||||||
|
class SearchBinding extends Bindings {
|
||||||
|
@override
|
||||||
|
void dependencies() {
|
||||||
|
Get.put<SearchController>(SearchController());
|
||||||
|
}
|
||||||
|
}
|
||||||
21
lib/pages/search/search_controller.dart
Normal file
21
lib/pages/search/search_controller.dart
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:geojson/geojson.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:get/get_state_manager/get_state_manager.dart';
|
||||||
|
import 'package:rogapp/model/destination.dart';
|
||||||
|
import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
|
|
||||||
|
class SearchController extends GetxController {
|
||||||
|
|
||||||
|
List<GeoJsonFeatureCollection> searchResults = <GeoJsonFeatureCollection>[].obs;
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
IndexController indexController = Get.find<IndexController>();
|
||||||
|
indexController.locations.addAll(indexController.locations);
|
||||||
|
super.onInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,10 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:rogapp/pages/search/search_controller.dart';
|
||||||
|
|
||||||
class SearchPage extends StatelessWidget {
|
class SearchPage extends StatelessWidget {
|
||||||
const SearchPage({Key? key}) : super(key: key);
|
SearchPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
SearchController searchController = Get.find<SearchController>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -20,6 +22,14 @@ class SearchPage extends StatelessWidget {
|
|||||||
title: const CupertinoSearchTextField(),
|
title: const CupertinoSearchTextField(),
|
||||||
|
|
||||||
),
|
),
|
||||||
|
body: Obx(() =>
|
||||||
|
ListView.builder(
|
||||||
|
itemCount: searchController.searchResults.length,
|
||||||
|
itemBuilder: (context, index){
|
||||||
|
return Text("hello");
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -12,6 +12,7 @@ import 'package:rogapp/pages/loading/loading_page.dart';
|
|||||||
import 'package:rogapp/pages/login/login_page.dart';
|
import 'package:rogapp/pages/login/login_page.dart';
|
||||||
import 'package:rogapp/pages/permission/permission.dart';
|
import 'package:rogapp/pages/permission/permission.dart';
|
||||||
import 'package:rogapp/pages/register/register_page.dart';
|
import 'package:rogapp/pages/register/register_page.dart';
|
||||||
|
import 'package:rogapp/pages/search/search_page.dart';
|
||||||
import 'package:rogapp/spa/spa_binding.dart';
|
import 'package:rogapp/spa/spa_binding.dart';
|
||||||
import 'package:rogapp/spa/spa_page.dart';
|
import 'package:rogapp/spa/spa_page.dart';
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ class AppPages {
|
|||||||
static const DESTINATION_MAP = Routes.DESTINATION_MAP;
|
static const DESTINATION_MAP = Routes.DESTINATION_MAP;
|
||||||
static const HOME = Routes.HOME;
|
static const HOME = Routes.HOME;
|
||||||
static const PERMISSION = Routes.PERMISSION;
|
static const PERMISSION = Routes.PERMISSION;
|
||||||
|
static const SEARCH = Routes.SEARCH;
|
||||||
|
|
||||||
static final routes = [
|
static final routes = [
|
||||||
// GetPage(
|
// GetPage(
|
||||||
@ -92,6 +94,10 @@ class AppPages {
|
|||||||
GetPage(
|
GetPage(
|
||||||
name: Routes.PERMISSION,
|
name: Routes.PERMISSION,
|
||||||
page: () => PermissionHandlerScreen(),
|
page: () => PermissionHandlerScreen(),
|
||||||
|
),
|
||||||
|
GetPage(
|
||||||
|
name: Routes.SEARCH,
|
||||||
|
page: () => SearchPage(),
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -16,4 +16,5 @@ abstract class Routes {
|
|||||||
static const DESTINATION_MAP = '/destination_map';
|
static const DESTINATION_MAP = '/destination_map';
|
||||||
static const HOME = '/home';
|
static const HOME = '/home';
|
||||||
static const PERMISSION = '/permission';
|
static const PERMISSION = '/permission';
|
||||||
|
static const SEARCH = '/search';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@ class FakeSearch extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: (){
|
onTap: (){
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const SearchPage()));
|
Navigator.push(context, MaterialPageRoute(builder: (context) => SearchPage()));
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 35,
|
height: 35,
|
||||||
|
|||||||
Reference in New Issue
Block a user