update
This commit is contained in:
@ -19,7 +19,7 @@ class HomePage extends GetView{
|
||||
),
|
||||
InkWell(
|
||||
onTap: (){
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const SearchPage()));
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => SearchPage()));
|
||||
},
|
||||
child: Container(
|
||||
height: 32,
|
||||
|
||||
@ -25,27 +25,42 @@ class IndexPage extends GetView<IndexController> {
|
||||
return Scaffold(
|
||||
drawer: const DrawerPage(),
|
||||
appBar: AppBar(
|
||||
// leading: IconButton(
|
||||
// icon: Icon(Icons.arrow_back_ios),
|
||||
// onPressed: (){
|
||||
// indexController.switchPage(AppPages.TRAVEL);
|
||||
// },
|
||||
// ),
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back_ios),
|
||||
onPressed: (){
|
||||
indexController.switchPage(AppPages.TRAVEL);
|
||||
},
|
||||
),
|
||||
//automaticallyImplyLeading: false,
|
||||
title: Text("Add locations"),
|
||||
actions: [
|
||||
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} ---- :::::");
|
||||
};
|
||||
});
|
||||
},
|
||||
),
|
||||
InkWell(
|
||||
onTap: (){
|
||||
Get.toNamed(AppPages.SEARCH);
|
||||
},
|
||||
child: Container(
|
||||
height: 32,
|
||||
width: 75,
|
||||
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,),
|
||||
],
|
||||
),
|
||||
|
||||
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/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/search/search_controller.dart';
|
||||
|
||||
class SearchPage extends StatelessWidget {
|
||||
const SearchPage({Key? key}) : super(key: key);
|
||||
SearchPage({Key? key}) : super(key: key);
|
||||
|
||||
SearchController searchController = Get.find<SearchController>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -20,6 +22,14 @@ class SearchPage extends StatelessWidget {
|
||||
title: const CupertinoSearchTextField(),
|
||||
|
||||
),
|
||||
body: Obx(() =>
|
||||
ListView.builder(
|
||||
itemCount: searchController.searchResults.length,
|
||||
itemBuilder: (context, index){
|
||||
return Text("hello");
|
||||
},
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user