diff --git a/lib/pages/category/category_page.dart b/lib/pages/category/category_page.dart new file mode 100644 index 0000000..12d7cb9 --- /dev/null +++ b/lib/pages/category/category_page.dart @@ -0,0 +1,10 @@ +import 'package:flutter/material.dart'; + +class CategoryPage extends StatelessWidget { + const CategoryPage({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container(); + } +} \ No newline at end of file diff --git a/lib/pages/city/city_page.dart b/lib/pages/city/city_page.dart new file mode 100644 index 0000000..1682025 --- /dev/null +++ b/lib/pages/city/city_page.dart @@ -0,0 +1,10 @@ +import 'package:flutter/material.dart'; + +class CityPage extends StatelessWidget { + const CityPage({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container(); + } +} \ No newline at end of file diff --git a/lib/pages/destination/destination_controller.dart b/lib/pages/destination/destination_controller.dart index c472977..d76ae38 100644 --- a/lib/pages/destination/destination_controller.dart +++ b/lib/pages/destination/destination_controller.dart @@ -150,7 +150,7 @@ class DestinationController extends GetxController { PopulateDestinations(); - print("------ in iniit"); + //print("------ in iniit"); @@ -195,14 +195,14 @@ class DestinationController extends GetxController { indexController.rogMapController!.move(LatLng(position!.latitude, position!.longitude), czoom); //String user_id = indexController.currentUser[0]["user"]["id"].toString(); //TrackingService.addTrack(user_id, position!.latitude, position.longitude).then((val){ - print("---- postion is ${position.latitude}, ${position.longitude}"); + //print("---- postion is ${position.latitude}, ${position.longitude}"); gps.clear(); gps.add("-- lat : ${position.latitude}, lon : ${position.longitude} --"); checkForCheckin(position!.latitude, position.longitude); //}); } - print(position == null ? 'Unknown' : 'current position is ${position.latitude.toString()}, ${position.longitude.toString()}'); + //print(position == null ? 'Unknown' : 'current position is ${position.latitude.toString()}, ${position.longitude.toString()}'); }); } catch (err){ locationPermission.clear(); diff --git a/lib/pages/index/index_controller.dart b/lib/pages/index/index_controller.dart index 2952200..34feeba 100644 --- a/lib/pages/index/index_controller.dart +++ b/lib/pages/index/index_controller.dart @@ -58,6 +58,7 @@ class IndexController extends GetxController { String dropdownValue = "9"; String subDropdownValue = "-1"; String areaDropdownValue = "-1"; + String cateogory = "-all-"; late Worker _ever; @@ -234,13 +235,13 @@ void login(String email, String password, BuildContext context){ void loadCatsv2(){ - dynamic initVal = {'category':'---'}; + dynamic initVal = {'category':'-all-'}; LatLngBounds bounds = mapController!.bounds!; if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){ - cats.clear(); CatService.loadCats(bounds.southWest!.latitude, bounds.southWest!.longitude, bounds.northWest.latitude, bounds.northWest.longitude, bounds.northEast!.latitude, bounds.northEast!.longitude, bounds.southEast.latitude, bounds.southEast.longitude).then((value) { - print(value); - cats.add(value); + cats.clear(); + cats.add(initVal); + cats.addAll(value!); }); } } diff --git a/lib/pages/index/index_page.dart b/lib/pages/index/index_page.dart index 1942e68..d621045 100644 --- a/lib/pages/index/index_page.dart +++ b/lib/pages/index/index_page.dart @@ -54,7 +54,7 @@ class IndexPage extends GetView { child: const Center(child: Icon(Icons.search),), ), ), - CatWidget(indexController: indexController,), + //CatWidget(indexController: indexController,), ], ), bottomNavigationBar: BottomAppBar( @@ -89,47 +89,47 @@ class IndexPage extends GetView { padding: const EdgeInsets.symmetric(horizontal: 16.0), alignment: Alignment.centerLeft, height: 50.0, - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child:Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - TextButton(child:Text("Main Pef >", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.SEARCH);},), - TextButton(child:Text("Sub Pef >", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.SEARCH);},), - TextButton(child:Text("Cities >", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.SEARCH);},), - TextButton(child:Text("Categories", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.SEARCH);},), - ], - ) - ), - // child: SingleChildScrollView( - // scrollDirection: Axis.horizontal, - // child: Obx(() => - // Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, + //child: SingleChildScrollView( + // scrollDirection: Axis.horizontal, + // child:Row( + // mainAxisAlignment: MainAxisAlignment.start, // children: [ - // indexController.is_mapController_loaded.value == false ? - // Center(child: CircularProgressIndicator()) - // : - // BreadCrumbWidget(mapController: indexController.mapController), - // Container(width: 24.0,), - // Row( - // children: [ - // indexController.currentCat.isNotEmpty ? Text(indexController.currentCat[0].toString()): Text(""), - // indexController.currentCat.isNotEmpty ? - // IconButton( - // onPressed: (){ - // indexController.currentCat.clear(); - // indexController.loadLocationsBound(); - // }, - // icon: Icon(Icons.cancel, color: Colors.red,) - // ) : - // Container(width: 0, height: 0,) - // ], - // ) + // TextButton(child:Text("Main Pef >", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.MAINPERF);},), + // TextButton(child:Text("Sub Pef >", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.SUBPERF);},), + // TextButton(child:Text("Cities >", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.CITY);},), + // TextButton(child:Text("Categories", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.CATEGORY);},), // ], // ) - // ), // ), + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Obx(() => + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + indexController.is_mapController_loaded.value == false ? + Center(child: CircularProgressIndicator()) + : + BreadCrumbWidget(mapController: indexController.mapController), + Container(width: 24.0,), + Row( + children: [ + indexController.currentCat.isNotEmpty ? Text(indexController.currentCat[0].toString()): Text(""), + indexController.currentCat.isNotEmpty ? + IconButton( + onPressed: (){ + indexController.currentCat.clear(); + indexController.loadLocationsBound(); + }, + icon: Icon(Icons.cancel, color: Colors.red,) + ) : + Container(width: 0, height: 0,) + ], + ) + ], + ) + ), + ), ), Expanded( child: Obx(() => diff --git a/lib/pages/mainperf/mainperf_page.dart b/lib/pages/mainperf/mainperf_page.dart new file mode 100644 index 0000000..47f1664 --- /dev/null +++ b/lib/pages/mainperf/mainperf_page.dart @@ -0,0 +1,31 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:rogapp/pages/index/index_controller.dart'; + +class MainPerfPage extends StatelessWidget { + MainPerfPage({Key? key}) : super(key: key); + + IndexController indexController = Get.find(); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text("Select Main Perfecture"), + ), + body: ListView.builder( + itemCount: indexController.perfectures.length, + itemBuilder: (context, index){ + return ListTile( + onTap: (){ + indexController.dropdownValue = indexController.perfectures[index][0]["id"].toString(); + indexController.populateForPerf(indexController.dropdownValue, indexController.mapController!); + Get.back(); + }, + title: Text(indexController.perfectures[index][0]["adm1_ja"].toString()), + ); + }, + ), + ); + } +} \ No newline at end of file diff --git a/lib/pages/subperf/subperf_page.dart b/lib/pages/subperf/subperf_page.dart new file mode 100644 index 0000000..31bf5e9 --- /dev/null +++ b/lib/pages/subperf/subperf_page.dart @@ -0,0 +1,31 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:rogapp/pages/index/index_controller.dart'; + +class SubPerfPage extends StatelessWidget { + SubPerfPage({Key? key}) : super(key: key); + + IndexController indexController = Get.find(); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text("Select Sub Perfecture"), + ), + body: ListView.builder( + itemCount: indexController.subPerfs.length, + itemBuilder: (context, index){ + return ListTile( + onTap: (){ + indexController.dropdownValue = indexController.perfectures[index][0]["id"].toString(); + //indexController.populateForPerf(indexController.dropdownValue, indexController.mapController!); + Get.back(); + }, + title: Text(indexController.perfectures[index][0]["adm1_ja"].toString()), + ); + }, + ), + ); + } +} \ No newline at end of file diff --git a/lib/routes/app_pages.dart b/lib/routes/app_pages.dart index 94df57f..fd98d57 100644 --- a/lib/routes/app_pages.dart +++ b/lib/routes/app_pages.dart @@ -1,19 +1,22 @@ import 'package:get/get.dart'; import 'package:get/get_navigation/src/routes/get_route.dart'; +import 'package:rogapp/pages/category/category_page.dart'; +import 'package:rogapp/pages/city/city_page.dart'; import 'package:rogapp/pages/destination/destination_binding.dart'; import 'package:rogapp/pages/destination/destination_page.dart'; import 'package:rogapp/pages/home/home_binding.dart'; import 'package:rogapp/pages/home/home_page.dart'; -import 'package:rogapp/pages/index/index_binding.dart'; -import 'package:rogapp/pages/index/index_controller.dart'; + import 'package:rogapp/pages/index/index_page.dart'; import 'package:rogapp/pages/landing/landing_page.dart'; import 'package:rogapp/pages/loading/loading_page.dart'; import 'package:rogapp/pages/login/login_page.dart'; +import 'package:rogapp/pages/mainperf/mainperf_page.dart'; import 'package:rogapp/pages/permission/permission.dart'; import 'package:rogapp/pages/register/register_page.dart'; import 'package:rogapp/pages/search/search_binding.dart'; import 'package:rogapp/pages/search/search_page.dart'; +import 'package:rogapp/pages/subperf/subperf_page.dart'; import 'package:rogapp/spa/spa_binding.dart'; import 'package:rogapp/spa/spa_page.dart'; @@ -35,6 +38,10 @@ class AppPages { static const HOME = Routes.HOME; static const PERMISSION = Routes.PERMISSION; static const SEARCH = Routes.SEARCH; + static const MAINPERF = Routes.MAINPERF; + static const SUBPERF = Routes.SUBPERF; + static const CITY = Routes.CITY; + static const CATEGORY = Routes.CATEOGORY; static final routes = [ // GetPage( @@ -100,6 +107,22 @@ class AppPages { name: Routes.SEARCH, page: () => SearchPage(), binding: SearchBinding(), + ), + GetPage( + name: Routes.MAINPERF, + page: () => MainPerfPage(), + ), + GetPage( + name: Routes.SUBPERF, + page: () => SubPerfPage(), + ), + GetPage( + name: Routes.CITY, + page: () => CityPage(), + ), + GetPage( + name: Routes.CATEOGORY, + page: () => CategoryPage(), ) ]; } \ No newline at end of file diff --git a/lib/routes/app_routes.dart b/lib/routes/app_routes.dart index b35c75f..df9fcf4 100644 --- a/lib/routes/app_routes.dart +++ b/lib/routes/app_routes.dart @@ -17,4 +17,8 @@ abstract class Routes { static const HOME = '/home'; static const PERMISSION = '/permission'; static const SEARCH = '/search'; + static const MAINPERF = '/mainperf'; + static const SUBPERF = '/subperf'; + static const CITY = '/city'; + static const CATEOGORY = '/category'; } diff --git a/lib/widgets/perfecture_widget.dart b/lib/widgets/perfecture_widget.dart index fdbfdbd..d3b3293 100644 --- a/lib/widgets/perfecture_widget.dart +++ b/lib/widgets/perfecture_widget.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_map/flutter_map.dart'; import 'package:get/get.dart'; import 'package:rogapp/pages/index/index_controller.dart'; +import 'package:rogapp/widgets/cat_widget.dart'; class PerfectureWidget extends StatefulWidget { @@ -97,6 +98,24 @@ class _PerfectureWidgetState extends State { return dropDownItems; } + List> getCategory(){ + List> dropDownItems = []; + + dropDownItems.clear(); + + //print("--------cats ------############### ${widget.indexController.cats.toString()} -------------"); + for(dynamic d in widget.indexController.cats){ + print("-------- ddd ------############### ${d} --------dddd-----"); + var newDropdown = DropdownMenuItem(child: Text(d['category'].toString()), value: d['category'].toString()); + //print("--------cats ------############### ${d['category'].toString()} -------------"); + dropDownItems.add(newDropdown); + } + + //return []; + + return dropDownItems; + } + @override Widget build(BuildContext context) { @@ -155,7 +174,6 @@ class _PerfectureWidgetState extends State { ): const Text(""), widget.indexController.subPerfs.isNotEmpty ? - DropdownButton( value: widget.indexController.subDropdownValue, icon: const Icon(Icons.arrow_downward), @@ -179,7 +197,31 @@ class _PerfectureWidgetState extends State { items: getSubDropdownItems() ) : - const Text("") + const Text(""), + //CatWidget(indexController: widget.indexController,), + DropdownButton( + value: widget.indexController.cateogory, + icon: const Icon(Icons.arrow_downward), + elevation: 16, + style: const TextStyle(color: Colors.deepPurple), + hint: const Text("select"), + underline: Container( + height: 2, + color: Colors.deepPurpleAccent, + ), + onChanged: (String? newValue) { + setState(() { + if(newValue != null){ + widget.indexController.is_loading.value = true; + widget.indexController.populateForSubPerf(newValue, widget.mapController); + //widget.indexController.loadLocationforSubPerf(newValue, widget.mapController); + //widget.indexController.subDropdownValue = newValue; + } + }); + }, + items: + getCategory(), + ) ], ),