diff --git a/android/app/build.gradle b/android/app/build.gradle index 39b8e94..53345bb 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion flutter.compileSdkVersion + compileSdkVersion 33 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 diff --git a/lib/main.dart b/lib/main.dart index 1c21347..acc7d61 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -3,9 +3,10 @@ import 'package:flutter/services.dart'; import 'package:get/get.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:permission_handler/permission_handler.dart'; -import 'package:rogapp/pages/index/index_binding.dart'; +import 'package:rogapp/pages/rog/rog_binding.dart'; import 'package:rogapp/routes/app_pages.dart'; import 'package:rogapp/services/location_service.dart'; +import 'package:rogapp/utils/app_binding.dart'; import 'package:rogapp/utils/string_values.dart'; void main() { @@ -40,8 +41,8 @@ class MyApp extends StatelessWidget { opaqueRoute: Get.isOpaqueRouteDefault, popGesture: Get.isPopGestureEnable, transitionDuration: const Duration(milliseconds: 230), - initialBinding: IndexBinding(), //HomeBinding(), - initialRoute: AppPages.PERMISSION, + initialBinding: RogBinding(), //HomeBinding(), + initialRoute: AppPages.ROG, getPages: AppPages.routes, enableLog: true, ); diff --git a/lib/pages/destination/destination_binding.dart b/lib/pages/destination/destination_binding.dart deleted file mode 100644 index 89af555..0000000 --- a/lib/pages/destination/destination_binding.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:get/get.dart'; -import 'package:rogapp/pages/destination/destination_controller.dart'; -import 'package:rogapp/pages/index/index_controller.dart'; - -class DestinationBinding extends Bindings { - @override - void dependencies() { - Get.put(DestinationController()); - } -} diff --git a/lib/pages/destination/destination_controller.dart b/lib/pages/destination/destination_controller.dart deleted file mode 100644 index efb08f1..0000000 --- a/lib/pages/destination/destination_controller.dart +++ /dev/null @@ -1,306 +0,0 @@ -import 'dart:convert'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:geolocator/geolocator.dart'; -import 'package:get/get.dart'; -import 'package:latlong2/latlong.dart'; -import 'package:rogapp/model/destination.dart'; -import 'package:rogapp/model/location.dart'; -import 'package:rogapp/pages/index/index_controller.dart'; -import 'package:rogapp/routes/app_pages.dart'; -import 'package:rogapp/services/destination_service.dart'; -import 'package:rogapp/services/maxtrix_service.dart'; -import 'package:rogapp/services/reacking_service.dart'; -import 'package:rogapp/utils/database_helper.dart'; -import 'dart:async'; - -import 'package:rogapp/widgets/bottom_sheet_widget.dart'; - -class DestinationController extends GetxController { - - late LocationSettings locationSettings; - - var destinationCount = 0.obs; - List destinations = [].obs; - List> destination_index_data = >[].obs; - - List currentSelectedDestinations = [].obs; - - bool checking_in = false; - List isSelected = [true].obs; - BuildContext? context; - - List gps = ["-- stating --"].obs; - List locationPermission = [" -- starting -- "].obs; - - - Map matrix = {}; - - final IndexController indexController = Get.find(); - - - Future getDEstinationForLatLong(double lat, double long)async { - - String jjjj = '{"id":1,"type":"Feature","geometry":{"type":"MultiPoint","coordinates":[[136.731357,35.370094]]},"properties":{"location_id":915101,"location_name":"柳津","category":"買い物","zip":"〒501-6100","address":"柳津町字仙右城7696-1"}}'; - - for(final d in destinations){ - if(lat == d.latitude && long == d.longitude){ - return d; - } - } - } - - checkForCheckin(double la, double ln){ - - for(final d in destinations){ - - if(!checking_in) - { - checking_in = true; - double lat = d.latitude!; - double lon = d.longitude!; - getDEstinationForLatLong(lat, lon).then((value){ - var distance = Distance(); - double dist = distance.as(LengthUnit.Meter, LatLng(lat, lon), LatLng(la, ln)); - int rad = value!.checkin_radius! ?? 1000000; - bool auto_checkin = value.auto_checkin == 0 ? false : true; - - indexController.currentDestinationFeature.add(value); - - if(rad >= dist){ - if(auto_checkin){ - makeCheckin(value, true); - } - } - - }); - - } - - } - } - - void makeCheckin(Location destination, bool action) async { - print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${action}@@@@@@@@@@@"); - DatabaseHelper db = DatabaseHelper.instance; - int res = await db.updateAction(destination, action); - - List ddd = await db.getDestinationByLatLon(destination.lat!, destination.lon!); - print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ddddd ${ddd[0].checkedin} @@@@@@@@@@@"); - - print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${res}@@@@@@@@@@@"); - PopulateDestinations(); - print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ after populating ${res} @@@@@@@@@@@"); - print("---- database update resulr ------ res : ${res}-------"); - } - - - @override - void onInit() async { - super.onInit(); - checkPermission(); - PopulateDestinations(); - - - //print("------ in iniit"); - - - - if (defaultTargetPlatform == TargetPlatform.android) { - locationSettings = AndroidSettings( - accuracy: LocationAccuracy.bestForNavigation, - distanceFilter: 00, - forceLocationManager: true, - intervalDuration: const Duration(seconds: 1), - //(Optional) Set foreground notification config to keep the app alive - //when going to the background - foregroundNotificationConfig: const ForegroundNotificationConfig( - notificationText: - "Example app will continue to receive your location even when you aren't using it", - notificationTitle: "Running in Background", - enableWakeLock: true, - ) - ); - } else if (defaultTargetPlatform == TargetPlatform.iOS || defaultTargetPlatform == TargetPlatform.macOS) { - locationSettings = AppleSettings( - accuracy: LocationAccuracy.bestForNavigation, - activityType: ActivityType.fitness, - distanceFilter: 1, - pauseLocationUpdatesAutomatically: false, - // Only set to true if our app will be started up in the background. - showBackgroundLocationIndicator: true - ); - } else { - locationSettings = LocationSettings( - accuracy: LocationAccuracy.high, - distanceFilter: 30, - ); - } - - try { - - StreamSubscription positionStream = Geolocator.getPositionStream(locationSettings: locationSettings).listen( - - (Position? position) { - if(isSelected[0]){ - double czoom = indexController.rogMapController!.zoom; - 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}"); - 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()}'); - }); - } catch (err){ - locationPermission.clear(); - locationPermission.add(err.toString()); - } - - - } - - void checkPermission() async { - LocationPermission permission = await Geolocator.checkPermission(); - if (permission != LocationPermission.whileInUse || - permission != LocationPermission.always) { - locationPermission.clear(); - locationPermission.add(permission.name); - permission = await Geolocator.requestPermission(); - } - } - - void deleteDestination(Destination d){ - //int id = destinations[index].location_id!; - //print("---- index ${destinations[index].location_id!}-----"); - for(Destination ss in currentSelectedDestinations){ - if(ss.location_id == d.location_id){ - currentSelectedDestinations.remove(ss); - break; - } - } - DatabaseHelper db = DatabaseHelper.instance; - db.deleteDestination(d.location_id!).then((value){ - PopulateDestinations(); - }); - } - - // ---------- database ------------------/// - - void addDestinations(Destination dest){ - - print('------ destination controller in add destination ${dest.name} ---- :::::'); - - DatabaseHelper db = DatabaseHelper.instance; - db.getDestinationByLatLon(dest.lat!, dest.lon!).then((value){ - if(value.isNotEmpty){ - db.deleteDestination(value[0].location_id!).then((value){ - db.insertDestination(dest).then((value){ - print("----- destination controller deleted and inserted destination id $value ---- :::::"); - PopulateDestinations(); - }); - }); - } - else { - db.insertDestination(dest).then((value){ - print("----- destination controller added as new ${value}--- :::::"); - PopulateDestinations(); - }); - } - }); - - } - - void PopulateDestinations(){ - print("--------- destination controller populsting destinations ----------- ::::::"); - - destinations.clear(); - destinationCount.value = 0; - DatabaseHelper db = DatabaseHelper.instance; - db.getDestinations().then((value){ - for(Destination d in value){ - for(Destination s in currentSelectedDestinations){ - if(d.location_id == s.location_id){ - d.selected = !d.selected!; - } - } - - destinations.add(d); - } - // destinationCount.value = 0; - destinationCount.value = destinations.length; - print("------ destination controller destinationcount-------- ${destinationCount}-------- :::::"); - - - MatrixService.getDestinations(value).then((mat){ - print(mat); - matrix = mat; - - }); - }); - - } - - - void makeOrder(int action_id, int order, String dir){ - DestinationService.updateOrder(action_id, order, dir).then((value){ - //print("----action value----${value}"); - PopulateDestinations(); - destination_index_data.clear(); - }); - - } - - - void makeNext(Destination pt){ - - for(int i=0; i<= destinations.length - 1; i++){ - Destination p = destinations[i]; - - if(p.lat == pt.lat && p.lon == pt.lon ){ - - if(indexController.currentDestinationFeature.isNotEmpty){ - indexController.currentDestinationFeature.clear(); - } - if(i >= destinations.length - 1 ){ - indexController.currentDestinationFeature.add(destinations[0]); - //getAction(); - } - else{ - indexController.currentDestinationFeature.add(destinations[i + 1]); - //getAction(); - } - } - } - - } - - void makePrevious(Destination pt){ - - for(int i=0; i<= destinations.length - 1; i++){ - Destination p = destinations[i]; - - if(p.lat == pt.lat && p.lon == pt.lon ){ - - if(indexController.currentDestinationFeature.isNotEmpty){ - indexController.currentDestinationFeature.clear(); - } - if(i <= 0){ - indexController.currentDestinationFeature.add(destinations[destinations.length -1]); - //getAction(); - } - else{ - indexController.currentDestinationFeature.add(destinations[i - 1]); - //getAction(); - } - } - } - - } - - -} \ No newline at end of file diff --git a/lib/pages/destination/destination_page.dart b/lib/pages/destination/destination_page.dart deleted file mode 100644 index d905409..0000000 --- a/lib/pages/destination/destination_page.dart +++ /dev/null @@ -1,125 +0,0 @@ -import 'dart:developer'; - -import 'package:flutter/material.dart'; -import 'package:geolocator/geolocator.dart'; -import 'package:get/get.dart'; -import 'package:latlong2/latlong.dart'; -import 'package:rogapp/pages/destination/destination_controller.dart'; -import 'package:rogapp/pages/destination_map/destination_map_page.dart'; -import 'package:rogapp/pages/drawer/drawer_page.dart'; -import 'package:rogapp/pages/index/index_controller.dart'; -import 'package:rogapp/routes/app_pages.dart'; -import 'package:rogapp/widgets/destination_widget.dart'; -import 'package:timeline_tile/timeline_tile.dart'; - - -class DestinationPage extends StatefulWidget { - DestinationPage({ Key? key }) : super(key: key); - - @override - State createState() => _DestinationPageState(); -} - -class _DestinationPageState extends State { - final DestinationController destinationController = Get.find(); - - final IndexController indexController = Get.find(); - - final List _items = List.generate(50, (int index) => index); - - Future showCurrentPosition() async { - LocationPermission permission = await Geolocator.checkPermission(); - if (permission != LocationPermission.whileInUse || - permission != LocationPermission.always) { - permission = await Geolocator.requestPermission(); - } - Position position = await Geolocator.getCurrentPosition( - desiredAccuracy: LocationAccuracy.high); - indexController.rogMapController?.move(LatLng(position.latitude, position.longitude), 14); - } - - Image getImage(int index){ - if(destinationController.destinations[index].photos == null || destinationController.destinations[index].photos == ""){ - return Image(image: AssetImage('assets/images/empty_image.png')); - } - else{ - return Image(image: NetworkImage(destinationController.destinations[index].photos!)); - } - } - - @override - void initState() { - //destinationController.context = context; - //destinationController.PopulateDestinations(); - super.initState(); - } - - @override - Widget build(BuildContext context) { - final ColorScheme colorScheme = Theme.of(context).colorScheme; - final Color oddItemColor = colorScheme.primary.withOpacity(0.05); - final Color evenItemColor = colorScheme.primary.withOpacity(0.15); - return WillPopScope( - onWillPop: () async { - indexController.switchPage(AppPages.INITIAL); - return false; - }, - child: Scaffold( - drawer: const DrawerPage(), - bottomNavigationBar: BottomAppBar( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded(child: IconButton(icon: const Icon(Icons.camera_enhance), onPressed: (){},),), - const Expanded(child: Text('')), - Expanded(child: IconButton(icon: const Icon(Icons.travel_explore), onPressed: (){ - indexController.switchPage(AppPages.INITIAL); - }),), - ], - ), - ), - floatingActionButton: FloatingActionButton( - onPressed: (){ - //print("######"); - indexController.toggleDestinationMode(); - }, - tooltip: 'Increment', - child: const Icon(Icons.document_scanner), - elevation: 4.0, - ), - floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, - appBar:AppBar( - automaticallyImplyLeading: true, - title: Text("app_title".tr), - actions: [ - //Obx(() => - ToggleButtons( - disabledColor: Colors.grey.shade200, - selectedColor: Colors.red, - children: [ - Icon(Icons.explore - )], - onPressed: (int index) { - setState(() { - destinationController.isSelected[index] = !destinationController.isSelected[index]; - }); - }, - isSelected: destinationController.isSelected, - ), - //), - // IconButton(onPressed: (){ - // showCurrentPosition(); - // }, - // icon: Icon(Icons.location_on_outlined)) - ], - ), - body: Obx(() => - indexController.desination_mode.value == 0 ? - DestinationWidget(): - DestinationMapPage() - ) - ), - ); - - } -} \ No newline at end of file diff --git a/lib/pages/destination_map/destination_map_controller.dart b/lib/pages/destination_map/destination_map_controller.dart deleted file mode 100644 index e69de29..0000000 diff --git a/lib/pages/destination_map/destination_map_page.dart b/lib/pages/destination_map/destination_map_page.dart deleted file mode 100644 index 1662122..0000000 --- a/lib/pages/destination_map/destination_map_page.dart +++ /dev/null @@ -1,284 +0,0 @@ - -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:flutter_map/plugin_api.dart'; -import 'package:flutter_map_location_marker/flutter_map_location_marker.dart'; -import 'package:flutter_map_marker_popup/flutter_map_marker_popup.dart'; -import 'package:flutter_polyline_points/flutter_polyline_points.dart'; -import 'package:geolocator/geolocator.dart'; -import 'package:get/get.dart'; -import 'package:latlong2/latlong.dart'; -import 'package:rogapp/model/destination.dart'; -import 'package:rogapp/pages/destination/destination_controller.dart'; -//import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:rogapp/pages/index/index_controller.dart'; -import 'package:rogapp/services/destination_service.dart'; -import 'package:rogapp/widgets/bottom_sheet_new.dart'; -import 'package:rogapp/widgets/bottom_sheet_widget.dart'; -import 'package:rogapp/widgets/bread_crum_widget.dart'; - -class DestinationMapPage extends StatefulWidget { - DestinationMapPage({ Key? key }) : super(key: key); - - - @override - State createState() => _DestinationMapPageState(); -} - -class _DestinationMapPageState extends State { - final IndexController indexController = Get.find(); - - final DestinationController destinationController = Get.find(); - StreamSubscription? subscription; - final PopupController _popupLayerController = PopupController(); - - - - // Widget examplePopup(Marker marker){ - // return Padding( - // padding: const EdgeInsets.all(10), - // child: Container( - // constraints: const BoxConstraints(minWidth: 100, maxWidth: 200), - // color: Colors.white, - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // mainAxisAlignment: MainAxisAlignment.start, - // mainAxisSize: MainAxisSize.min, - // children: [ - // const Text( - // 'Popup for a marker!', - // overflow: TextOverflow.fade, - // softWrap: false, - // style: TextStyle( - // fontWeight: FontWeight.w500, - // fontSize: 14.0, - // ), - // ), - // const Padding(padding: EdgeInsets.symmetric(vertical: 4.0)), - // Text( - // 'Position: ${marker.point.latitude}, ${marker.point.longitude}', - // style: const TextStyle(fontSize: 12.0), - // ), - // Text( - // 'Marker size: ${marker.width}, ${marker.height}', - // style: const TextStyle(fontSize: 12.0), - // ), - // ], - // ), - // ), - // ); - // } - - - - List? getPoints(){ - //print("##### --- route point ${indexController.routePoints.length}"); - List pts = []; - for(PointLatLng p in indexController.routePoints){ - LatLng l = LatLng(p.latitude, p.longitude); - pts.add(l); - } - return pts; - } - - List? getMarkers() { - List pts = []; - int index = -1; - for (int i = 0; i < destinationController.destinations.length; i++) { - Destination d = destinationController.destinations[i]; - //for(Destination d in destinationController.destinations){ - //print("-----lat ${lat}, ----- lon ${lan}"); - Marker m = Marker( - point: LatLng(d.lat!, d.lon!), - anchorPos: AnchorPos.align(AnchorAlign.center), - builder:(cts){ - - return InkWell( - onTap: (){ - print("-- Destination is --- ${d.name} ------"); - if(d != null){ - if(indexController.currentDestinationFeature.length > 0) { - indexController.currentDestinationFeature.clear(); - } - indexController.currentDestinationFeature.add(d); - //indexController.getAction(); - - showModalBottomSheet(context: context, isScrollControlled: true, - //builder:((context) => BottomSheetWidget()) - builder:((context) => BottomSheetNew()) - ); - } - }, - child: Container( - decoration: BoxDecoration( - color: Colors.red, - shape: BoxShape.circle, - border: new Border.all( - color: Colors.white, - width: d.checkin_radious != null ? d.checkin_radious! : 1, - ), - ), - child: new Center( - child: new Text( - (i + 1).toString(), - style: TextStyle(color: Colors.white), - ), - ), - ), - ); - - //return Icon(Icons.pin_drop); - // return IconButton( - // onPressed: ()async { - // Destination? fs = await destinationController.getDEstinationForLatLong(d.lat!, d.lon!); - // print("-- Destination is --- ${fs!.name} ------"); - // if(fs != null){ - // if(indexController.currentDestinationFeature.length > 0) { - // indexController.currentDestinationFeature.clear(); - // } - // indexController.currentDestinationFeature.add(fs); - // //indexController.getAction(); - - // showModalBottomSheet(context: context, isScrollControlled: true, - // //builder:((context) => BottomSheetWidget()) - // builder:((context) => BottomSheetNew()) - // ); - // } - // }, - // icon: Container( - // width: 60, - // height: 60, - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(d.checkin_radious ?? 0), - // color: Colors.transparent, - // border: BoxBorder() - // ), - // child: Icon(Icons.pin_drop) - // ) - // ); - - }); - - pts.add(m); - } - return pts; - } - - @override - void initState() { - - DestinationService.getDestinationLine(destinationController.destinations)?.then((value){ - //print("---- loading destination points ------ ${value}"); - indexController.routePoints.clear(); - setState(() { - indexController.routePoints = value; - }); - }); - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Obx((() => - Stack( - children: [ - indexController.is_rog_mapcontroller_loaded.value == false ? - Center(child: CircularProgressIndicator()) - : - BreadCrumbWidget(mapController:indexController.rogMapController), - Padding( - padding: const EdgeInsets.only(top:50.0), - //child: TravelMap(), - child: - TravelMap(), - ), - // Positioned( - // bottom: 200, - // left: 10, - // child: Container( - // color: Colors.white, - // child: Row( - // children: [ - // Text(destinationController.gps[0]), - // Text(destinationController.locationPermission[0]) - // ], - // ), - // ) - // ), - ], - ) - )); - } - - FlutterMap TravelMap() { - return FlutterMap( - options: MapOptions( - onMapCreated: (c){ - indexController.rogMapController = c; - indexController.rogMapController!.onReady.then((_) { - indexController.is_rog_mapcontroller_loaded.value = true; - subscription = indexController.rogMapController!.mapEventStream.listen((MapEvent mapEvent) { - if (mapEvent is MapEventMoveStart) { - //print(DateTime.now().toString() + ' [MapEventMoveStart] START'); - // do something - } - if (mapEvent is MapEventMoveEnd) { - destinationController.isSelected.clear(); - destinationController.isSelected.add(false); - //print(DateTime.now().toString() + ' [MapEventMoveStart] END'); - //indexController.loadLocationsBound(); - } - }); - }); - } , - bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]), - zoom: 1, - maxZoom: 42, - interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag, - //plugins: [LocationMarkerPlugin(),] - ), - children: [ - TileLayerWidget( - options: TileLayerOptions( - urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', - subdomains: ['a', 'b', 'c'], - ), - ), - //Obx(() => - indexController.routePoints.length > 0 ? - PolylineLayerWidget( - options: PolylineLayerOptions( - polylines: [ - Polyline( - points: getPoints()!, - strokeWidth: 4.0, - color: Colors.purple), - ], - ), - ) - : - Container(), - //), - // PopupMarkerLayerWidget( - // options: PopupMarkerLayerOptions( - // popupController: _popupLayerController, - // markers: _markers, - // markerRotateAlignment: - // PopupMarkerLayerOptions.rotationAlignmentFor(AnchorAlign.top), - // popupBuilder: (BuildContext context, Marker marker) => - - // examplePopup(marker), - // ), - // ), - LocationMarkerLayerWidget(), - MarkerLayerWidget( - options: MarkerLayerOptions( - markers: getMarkers()! - ), - ), - ], - - ); - } -} \ No newline at end of file diff --git a/lib/pages/home/home_binding.dart b/lib/pages/home/home_binding.dart deleted file mode 100644 index 9e044a2..0000000 --- a/lib/pages/home/home_binding.dart +++ /dev/null @@ -1,12 +0,0 @@ - - -import 'package:get/get.dart'; -import 'package:rogapp/pages/home/home_controller.dart'; - -class HomeBinding extends Bindings{ - @override - void dependencies() { - Get.put(HomeController()); - } - -} \ No newline at end of file diff --git a/lib/pages/home/home_controller.dart b/lib/pages/home/home_controller.dart deleted file mode 100644 index 7d8b09e..0000000 --- a/lib/pages/home/home_controller.dart +++ /dev/null @@ -1,7 +0,0 @@ - -import 'package:get/get.dart'; -import 'package:get/get_state_manager/get_state_manager.dart'; - -class HomeController extends GetxController{ - -} \ No newline at end of file diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart deleted file mode 100644 index 47a2086..0000000 --- a/lib/pages/home/home_page.dart +++ /dev/null @@ -1,42 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:rogapp/pages/search/search_page.dart'; - -class HomePage extends GetView{ - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - elevation: 0, - backgroundColor: Colors.white, - title: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text("app_title".tr, - style: const TextStyle( - color: Colors.blue - ), - ), - InkWell( - onTap: (){ - Navigator.push(context, MaterialPageRoute(builder: (context) => SearchPage())); - }, - child: Container( - height: 32, - width: 75, - decoration: BoxDecoration( - color: Colors.blue, - borderRadius: BorderRadius.circular(25), - - ), - child: const Center(child: Icon(Icons.search),), - ), - ), - ], - ), - ), - body: Container(), - ); - } - -} \ No newline at end of file diff --git a/lib/pages/index/index_binding.dart b/lib/pages/index/index_binding.dart deleted file mode 100644 index 2d969ff..0000000 --- a/lib/pages/index/index_binding.dart +++ /dev/null @@ -1,11 +0,0 @@ - -import 'package:flutter_map/plugin_api.dart'; -import 'package:get/get.dart'; -import 'package:rogapp/pages/index/index_controller.dart'; - -class IndexBinding extends Bindings { - @override - void dependencies() { - Get.put(IndexController()); - } -} diff --git a/lib/pages/index/index_controller.dart b/lib/pages/index/index_controller.dart deleted file mode 100644 index 3371b4e..0000000 --- a/lib/pages/index/index_controller.dart +++ /dev/null @@ -1,514 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:flutter_map/flutter_map.dart'; -import 'package:flutter_map/plugin_api.dart'; -import 'package:flutter_polyline_points/flutter_polyline_points.dart'; -import 'package:get/get.dart'; -import 'package:latlong2/latlong.dart'; -import 'package:rogapp/model/destination.dart'; -import 'package:rogapp/model/location.dart'; -import 'package:rogapp/pages/destination/destination_binding.dart'; -import 'package:rogapp/pages/destination/destination_controller.dart'; -import 'package:rogapp/pages/destination/destination_page.dart'; -import 'package:rogapp/pages/destination_map/destination_map_page.dart'; -import 'package:rogapp/routes/app_pages.dart'; -import 'package:rogapp/services/action_service.dart'; -import 'package:rogapp/services/auth_service.dart'; -import 'package:rogapp/services/cat_service.dart'; -import 'package:rogapp/services/location_service.dart'; -import 'package:rogapp/services/perfecture_service.dart'; -import 'package:rogapp/utils/database_helper.dart'; - -class IndexController extends GetxController { - List locations = [].obs; - List currentFeature = [].obs; - List currentDestinationFeature = [].obs; - List perfectures = [].obs; - List currentBound = [].obs; - List subPerfs = [].obs; - List areas = [].obs; - List customAreas = [].obs; - List cats = [].obs; - - List currentCat = [].obs; - - List> currentUser = >[].obs; - List currentAction = [].obs; - List routePoints = [].obs; - - var is_loading = false.obs; - - var is_mapController_loaded = false.obs; - var is_rog_mapcontroller_loaded = false.obs; - - var is_custom_area_selected = false.obs; - - MapController? mapController; - MapController? rogMapController; - - var mode = 0.obs; - - // master mode, rog or selection - var rog_mode = 1.obs; - - var desination_mode = 1.obs; - - bool showPopup = true; - - - String dropdownValue = "9"; - String subDropdownValue = "-1"; - String areaDropdownValue = "-1"; - String cateogory = "-all-"; - - - LocationService locationService = Get.find(); - - - late Worker _ever; - - void toggleMode(){ - if(mode.value==0){ - mode += 1; - } - else{ - mode -= 1; - } - } - - void toggleDestinationMode(){ - if(desination_mode.value==0){ - desination_mode.value += 1; - } - else{ - desination_mode.value -= 1; - } - } - - void switchPage(String page){ - //print("######## ${currentUser[0]["user"]["id"]}"); - switch (page) { - case AppPages.INITIAL :{ - rog_mode.value = 0; - print("-- rog mode is ctrl is ${rog_mode.value}"); - Get.toNamed(page); - } - break; - case AppPages.TRAVEL : { - rog_mode.value = 1; - //Get.back(); - Get.off(DestinationPage(), binding: DestinationBinding()); - - } - break; - case AppPages.LOGIN :{ - rog_mode.value = 2; - Get.toNamed(page); - } - break; - default:{ - rog_mode.value = 0; - Get.toNamed(AppPages.INITIAL); - } - } - } - - @override - void onInit() { - - // if(locations.length == 0){ - // LocationService.loadLocations().then((value){ - // locations.add(value!); - // //print(value); - // }); - // } - - _ever = ever(rog_mode, (_) => print("$_ has been changed (ever)")); - - if(perfectures.length == 0){ - PerfectureService.loadPerfectures().then((value){ - perfectures.add(value); - loadAreaFor("9"); - - //loadSubPerfFor("9"); - }); - } - super.onInit(); -} - - -LatLngBounds boundsFromLatLngList(List list) { - double? x0, x1, y0, y1; - for (LatLng latLng in list) { - if (x0 == null || x1 == null || y0 == null || y1 == null) { - x0 = x1 = latLng.latitude; - y0 = y1 = latLng.longitude; - } else { - if (latLng.latitude > x1) x1 = latLng.latitude; - if (latLng.latitude < x0) x0 = latLng.latitude; - if (latLng.longitude > y1) y1 = latLng.longitude; - if (latLng.longitude < y0) y0 = latLng.longitude; - } - } - - return LatLngBounds(LatLng(x1!, y1!), LatLng(x0!, y0!)); -} - - -List getLocationsList(){ - List locs = []; - for(int i=0; i<= locations.length - 1; i++){ - Location p = locations[i]; - - LatLng latLng = LatLng(p.latitude!, p.longitude!); - locs.add(latLng); - } - return locs; -} - - -void login(String email, String password, BuildContext context){ - AuthService.login(email, password).then((value){ - if(value.isNotEmpty){ - currentUser.clear(); - currentUser.add(value); - is_loading.value = false; - Navigator.pop(context); - loadUserDetails(); - if(rog_mode.value == 1){ - switchPage(AppPages.TRAVEL); - } - else{ - switchPage(AppPages.INITIAL); - } - //Get.toNamed(AppPages.INITIAL); - }else{ - is_loading.value = false; - Get.snackbar( - "Failed", - "User login failed, please try again.", - icon: Icon(Icons.error, size: 40.0, color: Colors.blue), - snackPosition: SnackPosition.TOP, - duration: Duration(milliseconds: 800), - backgroundColor: Colors.yellow, - //icon:Image(image:AssetImage("assets/images/dora.png")) - ); - } - - }); - } - - void register(String email, String password, BuildContext context){ - AuthService.register(email, password).then((value){ - if(value.isNotEmpty){ - currentUser.clear(); - currentUser.add(value); - is_loading.value = false; - Navigator.pop(context); - loadUserDetails(); - Get.toNamed(AppPages.INITIAL); - }else{ - is_loading.value = false; - Get.snackbar( - "Failed", - "User registration failed, please try again.", - icon: Icon(Icons.error, size: 40.0, color: Colors.blue), - snackPosition: SnackPosition.TOP, - duration: Duration(milliseconds: 800), - backgroundColor: Colors.yellow, - //icon:Image(image:AssetImage("assets/images/dora.png")) - ); - } - }); - } - - - - void loadCatsv2(){ - dynamic initVal = {'category':'-all-'}; - LatLngBounds bounds = mapController!.bounds!; - if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){ - 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) { - cats.clear(); - cats.add(initVal); - for(dynamic cat in value!){ - if(cat['category'] != null){ - cats.add(cat!); - } - } - }); - } - } - - void loadCatForCity(String city){ - dynamic initVal = {'category':'-all-'}; - LatLngBounds bounds = mapController!.bounds!; - if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){ - CatService.loadCatByCity(city).then((value) { - cats.clear(); - cats.add(initVal); - for(dynamic cat in value!){ - if(cat['category'] != null){ - cats.add(cat!); - } - } - }); - } - } - - - - void refreshLocationForCat(){ - loadLocationsBound(); - } - - void loadAreaFor(String perf){ - areas.clear(); - dynamic initVal = {'id':'-1', 'adm2_ja':'----'}; - PerfectureService.loadGifuAreas(perf).then((value){ - value!.add(initVal); - areas.add(value); - }); - } - - void loadUserDetails(){ - if(currentUser.length > 0){ - int user_id = currentUser[0]["user"]["id"] as int; - AuthService.UserDetails(user_id).then((value){ - //print("--------- user details ----- ${value}"); - bool paid = value![0]["paid"] as bool; - if(paid){ - loadCustomAreas(); - } - }); - } - } - - - void loadCustomAreas(){ - customAreas.clear(); - PerfectureService.loadCustomAreas().then((value){ - print("--- loading custom areas ${value}"); - customAreas.add(value); - }); - } - - - void loadSubPerfFor(String perf){ - subPerfs.clear(); - dynamic initVal = {'id':'-1', 'adm2_ja':'----'}; - PerfectureService.loadSubPerfectures(perf).then((value){ - value!.add(initVal); - subPerfs.add(value); - subDropdownValue = getSubInitialVal(); - }); - } - - String getSubInitialVal(){ - int min = 0; - if(subPerfs.length > 0){ - min = int.parse(subPerfs[0][0]['id'].toString()); - for(var sub in subPerfs[0]){ - int x = int.parse(sub['id'].toString()); // as int; - if(x < min){ - min = x; - } - } - } - return min.toString(); - } - - void loadLocationforPerf(String perf, MapController mapController) async { - String cat = currentCat.isNotEmpty == true ? currentCat[0] : ""; - print(currentCat); - locations.clear(); - mapController.fitBounds(currentBound[0]); - } - - void loadLocationforSubPerf(String subperf, MapController mapController) async { - String cat = currentCat.isNotEmpty == true ? currentCat[0] : ""; - if(currentCat[0] == "-all-"){ - cat = ""; - } - locationService.loadLocationsSubFor(subperf, cat).then((value){ - locations.clear(); - locations.addAll(value); - }); - } - - void loadCustomLocation(String customarea) async { - String cat = currentCat.isNotEmpty == true ? currentCat[0] : ""; - print("----- ${customarea}"); - locationService.loadCustomLocations(customarea, cat).then((value){ - locations.clear(); - locations.addAll(value); - List locs = getLocationsList(); - LatLngBounds bounds = boundsFromLatLngList(locs); - mapController!.fitBounds(bounds); - setBound(bounds); - Future.delayed(Duration(microseconds: 400), () { - mapController!.fitBounds(bounds); - }); - - }); - } - - void loadLocationsBound(){ - if(is_custom_area_selected.value == true){ - return; - } - String cat = currentCat.isNotEmpty ? currentCat[0] : ""; - LatLngBounds bounds = mapController!.bounds!; - currentBound.clear(); - currentBound.add(bounds); - //print(currentCat); - if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){ - locationService.loadLocationsBound(bounds.southWest!.latitude, bounds.southWest!.longitude, bounds.northWest.latitude, bounds.northWest.longitude, bounds.northEast!.latitude, bounds.northEast!.longitude, bounds.southEast.latitude, bounds.southEast.longitude, cat).then((value){ - //print("---value length ------ ${value!.collection.length}"); - if(value == null){ - return; - } - locations.clear(); - if(value != null && value.isEmpty){ - if(showPopup == false) { - return; - } - Get.snackbar( - "Too many Points", - "please zoom in", - icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), - snackPosition: SnackPosition.TOP, - duration: Duration(milliseconds: 800), - backgroundColor: Colors.yellow, - //icon:Image(image:AssetImage("assets/images/dora.png")) - ); - showPopup = false; - //Get.showSnackbar(GetSnackBar(message: "Too many points, please zoom in",)); - } - if(value != null && value.isNotEmpty){ - //print("---- added---"); - locations.addAll(value); - loadCatsv2(); - } - }); - } - - } - - void setBound(LatLngBounds bounds){ - currentBound.clear(); - currentBound.add(bounds); - } - - void zoomtoMainPerf(String id){ - - PerfectureService.getMainPerfExt(id).then((value){ - LatLng lat1 = LatLng(value![1], value[0]); - LatLng lat2 = LatLng(value[3], value[2]); - LatLngBounds bound = LatLngBounds(lat1, lat2); - mapController!.fitBounds(bound); - setBound(bound); - }); - - } - - void zoomtoSubPerf(String id){ - - print("zooooom"); - - PerfectureService.getSubExt(id).then((value){ - LatLng lat1 = LatLng(value![1], value[0]); - LatLng lat2 = LatLng(value[3], value[2]); - LatLngBounds bound = LatLngBounds(lat1, lat2); - mapController!.fitBounds(bound); - setBound(bound); - }); - - } - - - void populateForPerf(String perf, MapController mapController){ - loadSubPerfFor(perf); - loadLocationforPerf(perf, mapController); - zoomtoMainPerf(perf); - is_loading.value = false; - } - - void populateForSubPerf(String subperf, MapController mapController){ - //subDropdownValue = subperf; - loadLocationforSubPerf(subperf, mapController); - zoomtoSubPerf(subperf); - is_loading.value = false; - } - - void populateSubPerForArea(String area, MapController mapController){ - loadSubPerfFor(area); - //loadCustomLocation("cus", mapController); - //zoomtoSubPerf(subperf); - is_loading.value = false; - } - - - Location? getFeatureForLatLong(double lat, double long){ - if(locations.length > 0){ - for(Location i in locations){ - if(i.latitude == lat && i.longitude == long){ - return i; - } - } - } - } - - void makeNext(Location fs){ - - if(rog_mode == 1){ - DestinationController destinationController = Get.find(); - print("---- destination index--- ${destinationController.destination_index_data} --------"); - } - - - for(int i=0; i<= locations.length - 1; i++){ - Location p = locations[i]; - - if(p.latitude == fs.latitude && p.longitude == fs.longitude ){ - - if(currentFeature.length > 0){ - currentFeature.clear(); - } - if(i >= locations.length - 1 ){ - currentFeature.add(locations[0]); - } - else{ - currentFeature.add(locations[i + 1]); - - } - } - } - } - - void makePrevious(Location fs){ - - if(rog_mode == 1){ - DestinationController destinationController = Get.find(); - print("---- destination index--- ${destinationController.destination_index_data} --------"); - } - - for(int i=0; i<= locations.length - 1; i++){ - Location p = locations[i]; - - if(p.latitude == fs.longitude && p.longitude == fs.longitude ){ - - if(currentFeature.length > 0){ - currentFeature.clear(); - } - if(i == 0 ){ - currentFeature.add(locations[locations.length -1]); - } - else{ - currentFeature.add(locations[i - 1]); - } - } - } - } -} \ No newline at end of file diff --git a/lib/pages/index/index_page.dart b/lib/pages/index/index_page.dart deleted file mode 100644 index 5828388..0000000 --- a/lib/pages/index/index_page.dart +++ /dev/null @@ -1,149 +0,0 @@ -import 'dart:ui'; - -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:rogapp/model/destination.dart'; -import 'package:rogapp/pages/drawer/drawer_page.dart'; -import 'package:rogapp/pages/index/index_controller.dart'; -import 'package:rogapp/routes/app_pages.dart'; -import 'package:rogapp/services/maxtrix_service.dart'; -import 'package:rogapp/utils/database_helper.dart'; -import 'package:rogapp/widgets/bread_crum_widget.dart'; -import 'package:rogapp/widgets/cat_widget.dart'; -import 'package:rogapp/widgets/list_widget.dart'; -import 'package:rogapp/widgets/map_widget.dart'; - -import 'package:flutter_polyline_points/flutter_polyline_points.dart'; - -class IndexPage extends GetView { - IndexPage({Key? key}) : super(key: key); - - final IndexController indexController = Get.find(); - - @override - Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () async { - indexController.switchPage(AppPages.INITIAL); - return false; - }, - child: Scaffold( - //drawer: const DrawerPage(), - appBar: AppBar( - leading: IconButton( - icon: Icon(Icons.arrow_back_ios), - onPressed: (){ - indexController.switchPage(AppPages.TRAVEL); - }, - ), - //automaticallyImplyLeading: false, - title: Text("Add locations"), - actions: [ - 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),), - ), - ), - //CatWidget(indexController: indexController,), - ], - ), - bottomNavigationBar: BottomAppBar( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded(child: IconButton(icon: const Icon(Icons.camera_enhance), onPressed: (){},),), - const Expanded(child: Text('')), - Expanded(child: IconButton(icon: const Icon(Icons.travel_explore), onPressed: (){ - indexController.switchPage(AppPages.TRAVEL); - }),), - ], - ), - ), - floatingActionButton: FloatingActionButton( - onPressed: (){ - indexController.toggleMode(); - if(indexController.currentCat.isNotEmpty){ - print(indexController.currentCat[0].toString()); - } - - }, - tooltip: 'Increment', - child: const Icon(Icons.document_scanner), - elevation: 4.0, - ), - floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, - body: SafeArea( - child: Column( - children: [ - Container( - 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.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(() => - indexController.mode == 0 ? - MapWidget() : - ListWidget(), - ) - - ) - ], - ), - ), - ), - ); - } - -} \ No newline at end of file diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 62aa073..60d97da 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -1,91 +1,91 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:rogapp/routes/app_pages.dart'; +// import 'package:flutter/material.dart'; +// import 'package:get/get.dart'; +// import 'package:rogapp/routes/app_pages.dart'; -class LandingPage extends StatefulWidget { - const LandingPage({ Key? key }) : super(key: key); +// class LandingPage extends StatefulWidget { +// const LandingPage({ Key? key }) : super(key: key); - @override - State createState() => _LandingPageState(); -} +// @override +// State createState() => _LandingPageState(); +// } -class _LandingPageState extends State { - @override - Widget build(BuildContext context) { - return Scaffold( - body: SafeArea( - child: Container( - width: double.infinity, - height: MediaQuery.of(context).size.height, - padding: EdgeInsets.symmetric(horizontal: 30,vertical: 30), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - "こんにちは!", - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 40), - ), - SizedBox(height: 30,), - Text("ログインを有効にして本人確認を行うと、サーバーが改善されます", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.grey[700], - fontSize: 15 - ), - ), - Container( - height: MediaQuery.of(context).size.height/3, - decoration: BoxDecoration( - image:DecorationImage(image: AssetImage('assets/gradient_japanese_temple.jpg')) - ), - ), - SizedBox(height: 20.0,), - MaterialButton( - minWidth: double.infinity, - height:60, - onPressed: (){ - Get.toNamed(AppPages.LOGIN); - }, - color: Colors.indigoAccent[400], - shape: RoundedRectangleBorder( - side: BorderSide( - color: Colors.black, - ), - borderRadius: BorderRadius.circular(40) - ), - child: Text("ログイン",style: TextStyle( - fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70 +// class _LandingPageState extends State { +// @override +// Widget build(BuildContext context) { +// return Scaffold( +// body: SafeArea( +// child: Container( +// width: double.infinity, +// height: MediaQuery.of(context).size.height, +// padding: EdgeInsets.symmetric(horizontal: 30,vertical: 30), +// child: Column( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: [ +// Column( +// crossAxisAlignment: CrossAxisAlignment.center, +// children: [ +// Text( +// "こんにちは!", +// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 40), +// ), +// SizedBox(height: 30,), +// Text("ログインを有効にして本人確認を行うと、サーバーが改善されます", +// textAlign: TextAlign.center, +// style: TextStyle( +// color: Colors.grey[700], +// fontSize: 15 +// ), +// ), +// Container( +// height: MediaQuery.of(context).size.height/3, +// decoration: BoxDecoration( +// image:DecorationImage(image: AssetImage('assets/gradient_japanese_temple.jpg')) +// ), +// ), +// SizedBox(height: 20.0,), +// MaterialButton( +// minWidth: double.infinity, +// height:60, +// onPressed: (){ +// Get.toNamed(AppPages.LOGIN); +// }, +// color: Colors.indigoAccent[400], +// shape: RoundedRectangleBorder( +// side: BorderSide( +// color: Colors.black, +// ), +// borderRadius: BorderRadius.circular(40) +// ), +// child: Text("ログイン",style: TextStyle( +// fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70 - ), - ), - ), - SizedBox(height: 15.0,), +// ), +// ), +// ), +// SizedBox(height: 15.0,), - MaterialButton( - minWidth: double.infinity, - height:60, - onPressed: (){ - Get.toNamed(AppPages.REGISTER); - }, - color: Colors.redAccent, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(40) - ), - child: Text("サインアップ",style: TextStyle( - fontWeight: FontWeight.w600,fontSize: 16, +// MaterialButton( +// minWidth: double.infinity, +// height:60, +// onPressed: (){ +// Get.toNamed(AppPages.REGISTER); +// }, +// color: Colors.redAccent, +// shape: RoundedRectangleBorder( +// borderRadius: BorderRadius.circular(40) +// ), +// child: Text("サインアップ",style: TextStyle( +// fontWeight: FontWeight.w600,fontSize: 16, - ),), - ), +// ),), +// ), - ], - ) - ], - ), - ), - ), - ); - } -} \ No newline at end of file +// ], +// ) +// ], +// ), +// ), +// ), +// ); +// } +// } \ No newline at end of file diff --git a/lib/pages/login/login_page.dart b/lib/pages/login/login_page.dart index 4fab71d..42a7281 100644 --- a/lib/pages/login/login_page.dart +++ b/lib/pages/login/login_page.dart @@ -1,178 +1,178 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:rogapp/pages/index/index_controller.dart'; -import 'package:rogapp/routes/app_pages.dart'; +// import 'package:flutter/material.dart'; +// import 'package:get/get.dart'; +// //import 'package:rogapp/pages/index/index_controller.dart'; +// import 'package:rogapp/routes/app_pages.dart'; -class LoginPage extends StatelessWidget { +// class LoginPage extends StatelessWidget { - final IndexController indexController = Get.find(); +// // final IndexController indexController = Get.find(); - TextEditingController emailController = TextEditingController(); - TextEditingController passwordController = TextEditingController(); +// TextEditingController emailController = TextEditingController(); +// TextEditingController passwordController = TextEditingController(); - @override - Widget build(BuildContext context) { - return Scaffold( - resizeToAvoidBottomInset: false, - backgroundColor: Colors.white, - appBar: AppBar( - elevation: 0, - brightness: Brightness.light, - backgroundColor: Colors.white, - leading: - IconButton( onPressed: (){ - Navigator.pop(context); - },icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)), - ), - body: Container( - height: MediaQuery.of(context).size.height, - width: double.infinity, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Column( - children: [ - Column( - children: [ - Text ("ログイン", style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - ),), - SizedBox(height: 20,), - Text("お帰りなさい !資格情報を使用してログインします",style: TextStyle( - fontSize: 15, - color: Colors.grey[700], - ),), - SizedBox(height: 30,) - ], - ), - Padding( - padding: EdgeInsets.symmetric( - horizontal: 40 - ), - child: Column( - children: [ - makeInput(label: "Eメール", controller: emailController), - makeInput(label: "パスワード", controller: passwordController, obsureText: true), - ], - ), - ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 40), - child: Container( - padding: EdgeInsets.only(top: 3,left: 3), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(40), - border: Border( - bottom: BorderSide(color: Colors.black), - top: BorderSide(color: Colors.black), - right: BorderSide(color: Colors.black), - left: BorderSide(color: Colors.black) - ) - ), - child: Obx((() => - indexController.is_loading == true ? MaterialButton( - minWidth: double.infinity, - height:60, - onPressed: (){ +// @override +// Widget build(BuildContext context) { +// return Scaffold( +// resizeToAvoidBottomInset: false, +// backgroundColor: Colors.white, +// appBar: AppBar( +// elevation: 0, +// brightness: Brightness.light, +// backgroundColor: Colors.white, +// leading: +// IconButton( onPressed: (){ +// Navigator.pop(context); +// },icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)), +// ), +// body: Container( +// height: MediaQuery.of(context).size.height, +// width: double.infinity, +// child: Column( +// mainAxisAlignment: MainAxisAlignment.spaceEvenly, +// children: [ +// Column( +// children: [ +// Column( +// children: [ +// Text ("ログイン", style: TextStyle( +// fontSize: 30, +// fontWeight: FontWeight.bold, +// ),), +// SizedBox(height: 20,), +// Text("お帰りなさい !資格情報を使用してログインします",style: TextStyle( +// fontSize: 15, +// color: Colors.grey[700], +// ),), +// SizedBox(height: 30,) +// ], +// ), +// Padding( +// padding: EdgeInsets.symmetric( +// horizontal: 40 +// ), +// child: Column( +// children: [ +// makeInput(label: "Eメール", controller: emailController), +// makeInput(label: "パスワード", controller: passwordController, obsureText: true), +// ], +// ), +// ), +// Padding( +// padding: EdgeInsets.symmetric(horizontal: 40), +// child: Container( +// padding: EdgeInsets.only(top: 3,left: 3), +// decoration: BoxDecoration( +// borderRadius: BorderRadius.circular(40), +// border: Border( +// bottom: BorderSide(color: Colors.black), +// top: BorderSide(color: Colors.black), +// right: BorderSide(color: Colors.black), +// left: BorderSide(color: Colors.black) +// ) +// ), +// child: Obx((() => +// indexController.is_loading == true ? MaterialButton( +// minWidth: double.infinity, +// height:60, +// onPressed: (){ - }, - color: Colors.grey[400], - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(40) - ), - child: CircularProgressIndicator(), - ) : - MaterialButton( - minWidth: double.infinity, - height:60, - onPressed: (){ - if(emailController.text.isEmpty || passwordController.text.isEmpty){ - Get.snackbar( - "No values", - "Email and password required", - icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), - snackPosition: SnackPosition.TOP, - duration: Duration(milliseconds: 800), - backgroundColor: Colors.yellow, - //icon:Image(image:AssetImage("assets/images/dora.png")) - ); - return; - } - indexController.is_loading.value = true; - indexController.login(emailController.text, passwordController.text, context); - }, - color: Colors.indigoAccent[400], - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(40) - ), - child: Text("ログイン",style: TextStyle( - fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70 - ), - ), - ) - ), - ), - ) - ), - SizedBox(height: 20,), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Flexible( - child: Text("アカウントをお持ちではありませんか?", style: TextStyle( - overflow: TextOverflow.ellipsis, - ),), - ), - TextButton( - onPressed: (){ - Get.toNamed(AppPages.REGISTER); - }, - child: Text("サインアップ",style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 18 - ),), - ), - ], - ) - ], +// }, +// color: Colors.grey[400], +// shape: RoundedRectangleBorder( +// borderRadius: BorderRadius.circular(40) +// ), +// child: CircularProgressIndicator(), +// ) : +// MaterialButton( +// minWidth: double.infinity, +// height:60, +// onPressed: (){ +// if(emailController.text.isEmpty || passwordController.text.isEmpty){ +// Get.snackbar( +// "No values", +// "Email and password required", +// icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), +// snackPosition: SnackPosition.TOP, +// duration: Duration(milliseconds: 800), +// backgroundColor: Colors.yellow, +// //icon:Image(image:AssetImage("assets/images/dora.png")) +// ); +// return; +// } +// indexController.is_loading.value = true; +// indexController.login(emailController.text, passwordController.text, context); +// }, +// color: Colors.indigoAccent[400], +// shape: RoundedRectangleBorder( +// borderRadius: BorderRadius.circular(40) +// ), +// child: Text("ログイン",style: TextStyle( +// fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70 +// ), +// ), +// ) +// ), +// ), +// ) +// ), +// SizedBox(height: 20,), +// Row( +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// Flexible( +// child: Text("アカウントをお持ちではありませんか?", style: TextStyle( +// overflow: TextOverflow.ellipsis, +// ),), +// ), +// TextButton( +// onPressed: (){ +// Get.toNamed(AppPages.REGISTER); +// }, +// child: Text("サインアップ",style: TextStyle( +// fontWeight: FontWeight.w600, +// fontSize: 18 +// ),), +// ), +// ], +// ) +// ], - ), - ], - ), - ), - ); - } -} +// ), +// ], +// ), +// ), +// ); +// } +// } -Widget makeInput({label, required TextEditingController controller, obsureText = false}){ - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(label,style:TextStyle( - fontSize: 15, - fontWeight: FontWeight.w400, - color: Colors.black87 - ),), - SizedBox(height: 5,), - TextField( - controller: controller, - obscureText: obsureText, - decoration: InputDecoration( - contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: (Colors.grey[400])!, - ), - ), - border: OutlineInputBorder( - borderSide: BorderSide(color: (Colors.grey[400])! - ), - ), - ), - ), - SizedBox(height: 30.0,) - ], - ); -} +// Widget makeInput({label, required TextEditingController controller, obsureText = false}){ +// return Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Text(label,style:TextStyle( +// fontSize: 15, +// fontWeight: FontWeight.w400, +// color: Colors.black87 +// ),), +// SizedBox(height: 5,), +// TextField( +// controller: controller, +// obscureText: obsureText, +// decoration: InputDecoration( +// contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10), +// enabledBorder: OutlineInputBorder( +// borderSide: BorderSide( +// color: (Colors.grey[400])!, +// ), +// ), +// border: OutlineInputBorder( +// borderSide: BorderSide(color: (Colors.grey[400])! +// ), +// ), +// ), +// ), +// SizedBox(height: 30.0,) +// ], +// ); +// } diff --git a/lib/pages/mainperf/mainperf_page.dart b/lib/pages/mainperf/mainperf_page.dart deleted file mode 100644 index 47f1664..0000000 --- a/lib/pages/mainperf/mainperf_page.dart +++ /dev/null @@ -1,31 +0,0 @@ -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/permission/permission.dart b/lib/pages/permission/permission.dart index c4b2890..b9d4f89 100644 --- a/lib/pages/permission/permission.dart +++ b/lib/pages/permission/permission.dart @@ -1,79 +1,79 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:permission_handler/permission_handler.dart'; -import 'package:rogapp/routes/app_pages.dart'; +// import 'package:flutter/material.dart'; +// import 'package:get/get.dart'; +// import 'package:permission_handler/permission_handler.dart'; +// import 'package:rogapp/routes/app_pages.dart'; -class PermissionHandlerScreen extends StatefulWidget { - PermissionHandlerScreen({Key? key}) : super(key: key); +// class PermissionHandlerScreen extends StatefulWidget { +// PermissionHandlerScreen({Key? key}) : super(key: key); - @override - State createState() => _PermissionHandlerScreenState(); -} +// @override +// State createState() => _PermissionHandlerScreenState(); +// } -class _PermissionHandlerScreenState extends State { +// class _PermissionHandlerScreenState extends State { - @override - void initState() { - // TODO: implement initState - super.initState(); - permissionServiceCall(); - } +// @override +// void initState() { +// // TODO: implement initState +// super.initState(); +// permissionServiceCall(); +// } - permissionServiceCall() async { - await permissionServices().then( - (value) { - if (value != null) { - if (value[Permission.location]!.isGranted ) { - /* ========= New Screen Added ============= */ +// permissionServiceCall() async { +// await permissionServices().then( +// (value) { +// if (value != null) { +// if (value[Permission.location]!.isGranted ) { +// /* ========= New Screen Added ============= */ - Get.toNamed(AppPages.TRAVEL); +// Get.toNamed(AppPages.TRAVEL); - // Navigator.pushReplacement( - // context, - // MaterialPageRoute(builder: (context) => SplashScreen()), - // ); - } - } - }, - ); - } +// // Navigator.pushReplacement( +// // context, +// // MaterialPageRoute(builder: (context) => SplashScreen()), +// // ); +// } +// } +// }, +// ); +// } - /*Permission services*/ - Future> permissionServices() async { - // You can request multiple permissions at once. - Map statuses = await [ - Permission.location, +// /*Permission services*/ +// Future> permissionServices() async { +// // You can request multiple permissions at once. +// Map statuses = await [ +// Permission.location, - //add more permission to request here. - ].request(); +// //add more permission to request here. +// ].request(); - if (statuses[Permission.location]!.isPermanentlyDenied) { - await openAppSettings().then( - (value) async { - if (value) { - if (await Permission.location.status.isPermanentlyDenied == true && - await Permission.location.status.isGranted == false) { - // openAppSettings(); - permissionServiceCall(); /* opens app settings until permission is granted */ - } - } - }, - ); - } else { - if (statuses[Permission.location]!.isDenied) { - permissionServiceCall(); - } - } +// if (statuses[Permission.location]!.isPermanentlyDenied) { +// await openAppSettings().then( +// (value) async { +// if (value) { +// if (await Permission.location.status.isPermanentlyDenied == true && +// await Permission.location.status.isGranted == false) { +// // openAppSettings(); +// permissionServiceCall(); /* opens app settings until permission is granted */ +// } +// } +// }, +// ); +// } else { +// if (statuses[Permission.location]!.isDenied) { +// permissionServiceCall(); +// } +// } - /*{Permission.camera: PermissionStatus.granted, Permission.storage: PermissionStatus.granted}*/ - return statuses; - } +// /*{Permission.camera: PermissionStatus.granted, Permission.storage: PermissionStatus.granted}*/ +// return statuses; +// } - @override - Widget build(BuildContext context) { - return Container(); - } -} \ No newline at end of file +// @override +// Widget build(BuildContext context) { +// return Container(); +// } +// } \ No newline at end of file diff --git a/lib/pages/register/register_page.dart b/lib/pages/register/register_page.dart index 32693b8..51d7106 100644 --- a/lib/pages/register/register_page.dart +++ b/lib/pages/register/register_page.dart @@ -1,179 +1,179 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:rogapp/pages/index/index_controller.dart'; -import 'package:rogapp/routes/app_pages.dart'; +// import 'package:flutter/material.dart'; +// import 'package:get/get.dart'; +// import 'package:rogapp/pages/index/index_controller.dart'; +// import 'package:rogapp/routes/app_pages.dart'; -class RegisterPage extends StatelessWidget { +// class RegisterPage extends StatelessWidget { - final IndexController indexController = Get.find(); +// final IndexController indexController = Get.find(); - TextEditingController emailController = TextEditingController(); - TextEditingController passwordController = TextEditingController(); - TextEditingController confirmPasswordController = TextEditingController(); +// TextEditingController emailController = TextEditingController(); +// TextEditingController passwordController = TextEditingController(); +// TextEditingController confirmPasswordController = TextEditingController(); - @override - Widget build(BuildContext context) { - return Scaffold( - resizeToAvoidBottomInset: false, - backgroundColor: Colors.white, - appBar: AppBar( - elevation: 0, - brightness: Brightness.light, - backgroundColor: Colors.white, - leading: - IconButton( onPressed: (){ - Navigator.pop(context); - },icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)), - ), - body: SafeArea( - child: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height, - width: double.infinity, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Text ("サインアップ", style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - ),), - SizedBox(height: 20,), - Text("アカウントを作成し、無料です",style: TextStyle( - fontSize: 15, - color: Colors.grey[700], - ),), - SizedBox(height: 30,) - ], - ), - Padding( - padding: EdgeInsets.symmetric( - horizontal: 40 - ), - child: Column( - children: [ - makeInput(label: "Eメール", controller: emailController), - makeInput(label: "パスワード", controller: passwordController,obsureText: true), - makeInput(label: "パスワードを認証する", controller: confirmPasswordController,obsureText: true) - ], - ), - ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 40), - child: Container( - padding: EdgeInsets.only(top: 3,left: 3), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(40), - border: Border( - bottom: BorderSide(color: Colors.black), - top: BorderSide(color: Colors.black), - right: BorderSide(color: Colors.black), - left: BorderSide(color: Colors.black) - ) - ), - child: MaterialButton( - minWidth: double.infinity, - height:60, - onPressed: (){ - if(passwordController.text != confirmPasswordController.text){ - Get.snackbar( - "No match", - "Passwords does not match", - icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), - snackPosition: SnackPosition.TOP, - duration: Duration(milliseconds: 800), - backgroundColor: Colors.yellow, - //icon:Image(image:AssetImage("assets/images/dora.png")) - ); - } - if(emailController.text.isEmpty || passwordController.text.isEmpty){ - Get.snackbar( - "No values", - "Email and password required", - icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), - snackPosition: SnackPosition.TOP, - duration: Duration(milliseconds: 800), - backgroundColor: Colors.yellow, - //icon:Image(image:AssetImage("assets/images/dora.png")) - ); - return; - } - indexController.is_loading.value = true; - indexController.register(emailController.text, passwordController.text, context); - }, - color: Colors.redAccent, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(40) - ), - child: Text("サインアップ",style: TextStyle( - fontWeight: FontWeight.w600,fontSize: 16, +// @override +// Widget build(BuildContext context) { +// return Scaffold( +// resizeToAvoidBottomInset: false, +// backgroundColor: Colors.white, +// appBar: AppBar( +// elevation: 0, +// brightness: Brightness.light, +// backgroundColor: Colors.white, +// leading: +// IconButton( onPressed: (){ +// Navigator.pop(context); +// },icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)), +// ), +// body: SafeArea( +// child: SingleChildScrollView( +// child: Container( +// height: MediaQuery.of(context).size.height, +// width: double.infinity, +// child: Column( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: [ +// Column( +// children: [ +// Column( +// mainAxisAlignment: MainAxisAlignment.spaceEvenly, +// children: [ +// Text ("サインアップ", style: TextStyle( +// fontSize: 30, +// fontWeight: FontWeight.bold, +// ),), +// SizedBox(height: 20,), +// Text("アカウントを作成し、無料です",style: TextStyle( +// fontSize: 15, +// color: Colors.grey[700], +// ),), +// SizedBox(height: 30,) +// ], +// ), +// Padding( +// padding: EdgeInsets.symmetric( +// horizontal: 40 +// ), +// child: Column( +// children: [ +// makeInput(label: "Eメール", controller: emailController), +// makeInput(label: "パスワード", controller: passwordController,obsureText: true), +// makeInput(label: "パスワードを認証する", controller: confirmPasswordController,obsureText: true) +// ], +// ), +// ), +// Padding( +// padding: EdgeInsets.symmetric(horizontal: 40), +// child: Container( +// padding: EdgeInsets.only(top: 3,left: 3), +// decoration: BoxDecoration( +// borderRadius: BorderRadius.circular(40), +// border: Border( +// bottom: BorderSide(color: Colors.black), +// top: BorderSide(color: Colors.black), +// right: BorderSide(color: Colors.black), +// left: BorderSide(color: Colors.black) +// ) +// ), +// child: MaterialButton( +// minWidth: double.infinity, +// height:60, +// onPressed: (){ +// if(passwordController.text != confirmPasswordController.text){ +// Get.snackbar( +// "No match", +// "Passwords does not match", +// icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), +// snackPosition: SnackPosition.TOP, +// duration: Duration(milliseconds: 800), +// backgroundColor: Colors.yellow, +// //icon:Image(image:AssetImage("assets/images/dora.png")) +// ); +// } +// if(emailController.text.isEmpty || passwordController.text.isEmpty){ +// Get.snackbar( +// "No values", +// "Email and password required", +// icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), +// snackPosition: SnackPosition.TOP, +// duration: Duration(milliseconds: 800), +// backgroundColor: Colors.yellow, +// //icon:Image(image:AssetImage("assets/images/dora.png")) +// ); +// return; +// } +// indexController.is_loading.value = true; +// indexController.register(emailController.text, passwordController.text, context); +// }, +// color: Colors.redAccent, +// shape: RoundedRectangleBorder( +// borderRadius: BorderRadius.circular(40) +// ), +// child: Text("サインアップ",style: TextStyle( +// fontWeight: FontWeight.w600,fontSize: 16, - ),), - ), - ), - ), - SizedBox(height: 20,), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Flexible(child: Text("すでにアカウントをお持ちですか?")), - TextButton( - onPressed: (){ - Get.toNamed(AppPages.LOGIN); - }, - child: Text("ログイン",style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 18 - ),), - ), - ], - ) - ], +// ),), +// ), +// ), +// ), +// SizedBox(height: 20,), +// Row( +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// Flexible(child: Text("すでにアカウントをお持ちですか?")), +// TextButton( +// onPressed: (){ +// Get.toNamed(AppPages.LOGIN); +// }, +// child: Text("ログイン",style: TextStyle( +// fontWeight: FontWeight.w600, +// fontSize: 18 +// ),), +// ), +// ], +// ) +// ], - ), - ], - ), - ), - ), - ), - ); - } -} +// ), +// ], +// ), +// ), +// ), +// ), +// ); +// } +// } -Widget makeInput({label, required TextEditingController controller, obsureText = false}){ - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(label,style:TextStyle( - fontSize: 15, - fontWeight: FontWeight.w400, - color: Colors.black87 - ),), - SizedBox(height: 5,), - TextField( - controller: controller, - obscureText: obsureText, - decoration: InputDecoration( - contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: (Colors.grey[400])!, - ), - ), - border: OutlineInputBorder( - borderSide: BorderSide(color: (Colors.grey[400])! - ), - ), - ), - ), - SizedBox(height: 30,) +// Widget makeInput({label, required TextEditingController controller, obsureText = false}){ +// return Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Text(label,style:TextStyle( +// fontSize: 15, +// fontWeight: FontWeight.w400, +// color: Colors.black87 +// ),), +// SizedBox(height: 5,), +// TextField( +// controller: controller, +// obscureText: obsureText, +// decoration: InputDecoration( +// contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10), +// enabledBorder: OutlineInputBorder( +// borderSide: BorderSide( +// color: (Colors.grey[400])!, +// ), +// ), +// border: OutlineInputBorder( +// borderSide: BorderSide(color: (Colors.grey[400])! +// ), +// ), +// ), +// ), +// SizedBox(height: 30,) - ], - ); -} +// ], +// ); +// } diff --git a/lib/pages/rog/rog_binding.dart b/lib/pages/rog/rog_binding.dart new file mode 100644 index 0000000..8c71248 --- /dev/null +++ b/lib/pages/rog/rog_binding.dart @@ -0,0 +1,11 @@ +import 'package:get/get.dart'; +import 'package:rogapp/pages/rog/rog_controller.dart'; +import 'package:rogapp/utils/app_controller.dart'; + +class RogBinding extends Bindings { + @override + void dependencies() { + Get.put(AppController()); + Get.put(RogController()); + } +} \ No newline at end of file diff --git a/lib/pages/rog/rog_controller.dart b/lib/pages/rog/rog_controller.dart new file mode 100644 index 0000000..64b7624 --- /dev/null +++ b/lib/pages/rog/rog_controller.dart @@ -0,0 +1,32 @@ + +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter_map/flutter_map.dart'; +import 'package:get/get.dart'; +import 'package:rogapp/model/location.dart'; +import 'package:sliding_up_panel/sliding_up_panel.dart'; + +class RogController extends GetxController { + + // RX vars + List locations = [].obs; + var currentLocation = {}.obs; + var currentUser = {}.obs; + var isLoading = false.obs; + + // Controllers in home page + PanelController panelController = PanelController(); + MapController mapController = MapController(); + + + Location? getIncidentForLatLong(double lat, double long){ + for(Location l in locations){ + print("i - ${l.latitude}, ${l.longitude} -- ${lat}, ${long}"); + if(l.latitude == lat && l.longitude == long){ + return l; + } + } + return null; + } + +} \ No newline at end of file diff --git a/lib/pages/rog/rog_page.dart b/lib/pages/rog/rog_page.dart new file mode 100644 index 0000000..f51ad41 --- /dev/null +++ b/lib/pages/rog/rog_page.dart @@ -0,0 +1,46 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_map/flutter_map.dart'; +import 'package:get/get.dart'; +import 'package:latlong2/latlong.dart'; +import 'package:rogapp/model/location.dart'; +import 'package:rogapp/pages/rog/rog_controller.dart'; +import 'package:rogapp/utils/app_controller.dart'; +import 'package:rogapp/widgets/collapsed_widget.dart'; +import 'package:sliding_up_panel/sliding_up_panel.dart'; + +class RogPage extends StatelessWidget { + RogPage({Key? key}) : super(key: key); + + final AppController appController = Get.find(); + final RogController rogController = Get.find(); + + void addlocation(){ + print("called add location"); + } + + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text("app_title".tr, style: TextStyle(fontSize: 28),), + ), + body: , + ); + } + + _scrollingList(ScrollController sc) { + return ListView.builder( + controller: sc, + itemCount: 50, + itemBuilder: (BuildContext context, int i){ + return Container( + padding: const EdgeInsets.all(12.0), + child: Text("$i"), + ); + }, + ); + } + + +} \ No newline at end of file diff --git a/lib/pages/search/search_binding.dart b/lib/pages/search/search_binding.dart index 09cde26..d878955 100644 --- a/lib/pages/search/search_binding.dart +++ b/lib/pages/search/search_binding.dart @@ -1,9 +1,9 @@ -import 'package:get/get.dart'; -import 'package:rogapp/pages/search/search_controller.dart'; +// import 'package:get/get.dart'; +// import 'package:rogapp/pages/search/search_controller.dart'; -class SearchBinding extends Bindings { - @override - void dependencies() { - Get.put(SearchController()); - } -} +// class SearchBinding extends Bindings { +// @override +// void dependencies() { +// Get.put(SearchController()); +// } +// } diff --git a/lib/pages/search/search_controller.dart b/lib/pages/search/search_controller.dart index 281c470..c9148e2 100644 --- a/lib/pages/search/search_controller.dart +++ b/lib/pages/search/search_controller.dart @@ -1,26 +1,26 @@ -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'; +// 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 { +// class SearchController extends GetxController { -List searchResults = [].obs; +// List searchResults = [].obs; -@override - void onInit() { - IndexController indexController = Get.find(); - if(indexController.locations.isNotEmpty){ - for(int i=0; i<= indexController.locations[0].collection.length - 1; i++){ - GeoJsonFeature p = indexController.locations[0].collection[i]; - searchResults.add(p); - } - } - super.onInit(); - } +// @override +// void onInit() { +// IndexController indexController = Get.find(); +// if(indexController.locations.isNotEmpty){ +// for(int i=0; i<= indexController.locations[0].collection.length - 1; i++){ +// GeoJsonFeature p = indexController.locations[0].collection[i]; +// searchResults.add(p); +// } +// } +// super.onInit(); +// } -} \ No newline at end of file +// } \ No newline at end of file diff --git a/lib/pages/search/search_page.dart b/lib/pages/search/search_page.dart index 78377dc..35bd672 100644 --- a/lib/pages/search/search_page.dart +++ b/lib/pages/search/search_page.dart @@ -1,96 +1,96 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_typeahead/flutter_typeahead.dart'; -import 'package:get/get.dart'; -import 'package:rogapp/pages/index/index_controller.dart'; -import 'package:rogapp/pages/search/search_controller.dart'; -import 'package:rogapp/widgets/bottom_sheet_new.dart'; +// import 'package:flutter/cupertino.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter_typeahead/flutter_typeahead.dart'; +// import 'package:get/get.dart'; +// import 'package:rogapp/pages/index/index_controller.dart'; +// import 'package:rogapp/pages/search/search_controller.dart'; +// import 'package:rogapp/widgets/bottom_sheet_new.dart'; -class SearchPage extends StatelessWidget { - SearchPage({Key? key}) : super(key: key); +// class SearchPage extends StatelessWidget { +// SearchPage({Key? key}) : super(key: key); - SearchController searchController = Get.find(); - IndexController indexController = Get.find(); +// SearchController searchController = Get.find(); +// IndexController indexController = Get.find(); - Image getImage(int index){ - if(searchController.searchResults[index].properties!["photos"] == null || searchController.searchResults[index].properties!["photos"] == ""){ - return Image(image: AssetImage('assets/images/empty_image.png')); - } - else{ - return Image( - image: NetworkImage(searchController.searchResults[index].properties!["photos"]), - errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { - return Image.asset("assets/images/empty_image.png"); - }, - ); - } - } +// Image getImage(int index){ +// if(searchController.searchResults[index].properties!["photos"] == null || searchController.searchResults[index].properties!["photos"] == ""){ +// return Image(image: AssetImage('assets/images/empty_image.png')); +// } +// else{ +// return Image( +// image: NetworkImage(searchController.searchResults[index].properties!["photos"]), +// errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { +// return Image.asset("assets/images/empty_image.png"); +// }, +// ); +// } +// } - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - elevation: 0, - backgroundColor: Colors.white, - leading: IconButton( - onPressed:(){ - Navigator.pop(context); - }, - icon: const Icon(Icons.arrow_back_ios_new, color: Colors.black,)), - title: TypeAheadField( - textFieldConfiguration: TextFieldConfiguration( - autofocus: true, - ), - suggestionsCallback: (pattern) async{ - return searchController.searchResults.where((GeoJsonFeature element) => element.properties!["location_name"].toString().contains(pattern)); - //return await - }, - itemBuilder: (context, GeoJsonFeature suggestion){ - return ListTile( - title: Text(suggestion.properties!["location_name"]), - subtitle: suggestion.properties!["category"] != null ? Text(suggestion.properties!["category"]) : Text(""), - //leading: getImage(index), - ); - }, - onSuggestionSelected: (GeoJsonFeature suggestion){ - indexController.currentFeature.clear(); - indexController.currentFeature.add(suggestion); - Get.back(); - showModalBottomSheet( - isScrollControlled: true, - context: context, - //builder: (context) => BottomSheetWidget(), - builder:((context) => BottomSheetNew()) - ); - }, - ), - //title: const CupertinoSearchTextField(), +// @override +// Widget build(BuildContext context) { +// return Scaffold( +// appBar: AppBar( +// elevation: 0, +// backgroundColor: Colors.white, +// leading: IconButton( +// onPressed:(){ +// Navigator.pop(context); +// }, +// icon: const Icon(Icons.arrow_back_ios_new, color: Colors.black,)), +// title: TypeAheadField( +// textFieldConfiguration: TextFieldConfiguration( +// autofocus: true, +// ), +// suggestionsCallback: (pattern) async{ +// return searchController.searchResults.where((GeoJsonFeature element) => element.properties!["location_name"].toString().contains(pattern)); +// //return await +// }, +// itemBuilder: (context, GeoJsonFeature suggestion){ +// return ListTile( +// title: Text(suggestion.properties!["location_name"]), +// subtitle: suggestion.properties!["category"] != null ? Text(suggestion.properties!["category"]) : Text(""), +// //leading: getImage(index), +// ); +// }, +// onSuggestionSelected: (GeoJsonFeature suggestion){ +// indexController.currentFeature.clear(); +// indexController.currentFeature.add(suggestion); +// Get.back(); +// showModalBottomSheet( +// isScrollControlled: true, +// context: context, +// //builder: (context) => BottomSheetWidget(), +// builder:((context) => BottomSheetNew()) +// ); +// }, +// ), +// //title: const CupertinoSearchTextField(), - ), - //body: - // Obx(() => - // ListView.builder( - // itemCount: searchController.searchResults.length, - // itemBuilder: (context, index){ - // return ListTile( - // title: searchController.searchResults[index].properties!["location_name"] != null ? Text(searchController.searchResults[index].properties!["location_name"]) : Text(""), - // subtitle: searchController.searchResults[index].properties!["category"] != null ? Text(searchController.searchResults[index].properties!["category"]) : Text(""), - // leading: getImage(index), - // onTap: (){ - // indexController.currentFeature.clear(); - // indexController.currentFeature.add(searchController.searchResults[index]); - // Get.back(); - // showModalBottomSheet( - // isScrollControlled: true, - // context: context, - // //builder: (context) => BottomSheetWidget(), - // builder:((context) => BottomSheetNew()) - // ); - // }, - // ); - // }, - // ), - // ) - ); - } -} \ No newline at end of file +// ), +// //body: +// // Obx(() => +// // ListView.builder( +// // itemCount: searchController.searchResults.length, +// // itemBuilder: (context, index){ +// // return ListTile( +// // title: searchController.searchResults[index].properties!["location_name"] != null ? Text(searchController.searchResults[index].properties!["location_name"]) : Text(""), +// // subtitle: searchController.searchResults[index].properties!["category"] != null ? Text(searchController.searchResults[index].properties!["category"]) : Text(""), +// // leading: getImage(index), +// // onTap: (){ +// // indexController.currentFeature.clear(); +// // indexController.currentFeature.add(searchController.searchResults[index]); +// // Get.back(); +// // showModalBottomSheet( +// // isScrollControlled: true, +// // context: context, +// // //builder: (context) => BottomSheetWidget(), +// // builder:((context) => BottomSheetNew()) +// // ); +// // }, +// // ); +// // }, +// // ), +// // ) +// ); +// } +// } \ No newline at end of file diff --git a/lib/pages/select/select_binding.dart b/lib/pages/select/select_binding.dart new file mode 100644 index 0000000..67a968d --- /dev/null +++ b/lib/pages/select/select_binding.dart @@ -0,0 +1,9 @@ +import 'package:get/get.dart'; +import 'package:rogapp/pages/select/select_controller.dart'; + +class SelectBinding extends Bindings { + @override + void dependencies() { + Get.put(SelectController()); + } +} \ No newline at end of file diff --git a/lib/pages/select/select_controller.dart b/lib/pages/select/select_controller.dart new file mode 100644 index 0000000..88eb385 --- /dev/null +++ b/lib/pages/select/select_controller.dart @@ -0,0 +1,5 @@ +import 'package:get/get_state_manager/get_state_manager.dart'; + +class SelectController extends GetxController{ + +} \ No newline at end of file diff --git a/lib/pages/select/select_page.dart b/lib/pages/select/select_page.dart new file mode 100644 index 0000000..2148a84 --- /dev/null +++ b/lib/pages/select/select_page.dart @@ -0,0 +1,10 @@ +import 'package:flutter/material.dart'; + +class SelectPage extends StatelessWidget { + const SelectPage({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container(); + } +} \ No newline at end of file diff --git a/lib/pages/select_slider/select_slider_page.dart b/lib/pages/select_slider/select_slider_page.dart new file mode 100644 index 0000000..fd39bb0 --- /dev/null +++ b/lib/pages/select_slider/select_slider_page.dart @@ -0,0 +1,76 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/src/foundation/key.dart'; +import 'package:flutter/src/widgets/container.dart'; +import 'package:flutter/src/widgets/framework.dart'; +import 'package:sliding_up_panel/sliding_up_panel.dart'; + +class SelectSliderPage extends StatelessWidget { + const SelectSliderPage({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return SlidingUpPanel( + //header: Text("header"), + minHeight: 55, + footer: Text("footer"), + //isDraggable: true, + backdropTapClosesPanel: true, + parallaxEnabled: true, + parallaxOffset: 0.6, + borderRadius: BorderRadius.only(topLeft: Radius.circular(10), topRight: Radius.circular(10)), + backdropEnabled: true, + backdropOpacity: 0.2, + controller: rogController.panelController, + collapsed: CollapsedWidget(addIncident : addlocation), + panelBuilder:(sc) => _scrollingList(sc), + body: Center( + child: Obx((() => + FlutterMap( + mapController: rogController.mapController, + options: MapOptions( + center: LatLng(8, 80), + zoom: 8, + ), + nonRotatedChildren: [ + //Center( + // child: Image( + // image: AssetImage('assets/icons/crosshair.512x512.png'), + // width: 35, + // height: 35, + // ), + // ), + ], + children: [ + TileLayer( + urlTemplate: "https://tile.openstreetmap.org/{z}/{x}/{y}.png", + userAgentPackageName: 'dev.fleaflet.flutter_map.example', + ), + MarkerLayer( + markers: rogController.locations.map((l) { + return Marker( + anchorPos: AnchorPos.align(AnchorAlign.center), + height: 70.0, + width: 70.0, + point: LatLng(l.latitude!, l.longitude!), + builder: (ctx){ + return IconButton( + onPressed: () { + Location? loc = rogController.getIncidentForLatLong(l.latitude!, l.longitude!); + if(loc != null){ + rogController.currentLocation.value = loc.toMap(); + rogController.panelController.open(); + } + }, + icon: Icon(Icons.pin_drop, size: 38, color: Colors.red,) + ); + }, + ); + }).toList(), + ) + ], + ) + )), + ), + ); + } +} \ No newline at end of file diff --git a/lib/pages/subperf/subperf_page.dart b/lib/pages/subperf/subperf_page.dart index 31bf5e9..e69de29 100644 --- a/lib/pages/subperf/subperf_page.dart +++ b/lib/pages/subperf/subperf_page.dart @@ -1,31 +0,0 @@ -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 fd98d57..2c9b878 100644 --- a/lib/routes/app_pages.dart +++ b/lib/routes/app_pages.dart @@ -2,20 +2,16 @@ 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_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/rog/rog_page.dart'; import 'package:rogapp/pages/search/search_binding.dart'; import 'package:rogapp/pages/search/search_page.dart'; +import 'package:rogapp/pages/select/select_page.dart'; import 'package:rogapp/pages/subperf/subperf_page.dart'; import 'package:rogapp/spa/spa_binding.dart'; import 'package:rogapp/spa/spa_page.dart'; @@ -30,92 +26,25 @@ class AppPages { // ignore: constant_identifier_names static const SPA = Routes.SPA; static const LANDING = Routes.LANDING; - static const LOGIN = Routes.LOGIN; - static const REGISTER = Routes.REGISTER; - static const TRAVEL = Routes.TRAVEL; static const LOADING = Routes.LOADING; static const DESTINATION_MAP = Routes.DESTINATION_MAP; - 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 const SELECT = Routes.SELECT; + static const ROG = Routes.ROG; static final routes = [ - // GetPage( - // name: Routes.HOME, - // page: () => HomePage(), - // binding: HomeBinding(), - // ), - // GetPage( - // name: Routes.MAP, - // page: () => MapPage(), - // binding: MapBinding(), - // ) - GetPage( - name: Routes.INDEX, - page: () => IndexPage(), - //binding: IndexBinding(), - ), GetPage( name: Routes.SPA, page: () => const SpaPage(), binding: SpaBinding(), ), - GetPage( - name: Routes.LANDING, - page: () => LandingPage(), - //binding: SpaBinding(), - ), - GetPage( - name: Routes.LOGIN, - page: () => LoginPage(), - //binding: SpaBinding(), - ), - GetPage( - name: Routes.REGISTER, - page: () => RegisterPage(), - //binding: SpaBinding(), - ), - GetPage( - name: Routes.TRAVEL, - page: () => DestinationPage(), - binding: DestinationBinding(), - ), GetPage( name: Routes.LOADING, page: () => LoadingPage(), //binding: DestinationBinding(), ), - GetPage( - name: Routes.DESTINATION_MAP, - page: () => DestinationPage(), - //binding: DestinationBinding(), - ), - GetPage( - name: Routes.HOME, - page: () => HomePage(), - binding: HomeBinding(), - ), - GetPage( - name: Routes.PERMISSION, - page: () => PermissionHandlerScreen(), - ), - GetPage( - 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(), @@ -123,6 +52,14 @@ class AppPages { GetPage( name: Routes.CATEOGORY, page: () => CategoryPage(), + ), + GetPage( + name: Routes.SELECT, + page: () => SelectPage(), + ), + GetPage( + name: Routes.ROG, + page: () => RogPage(), ) ]; } \ No newline at end of file diff --git a/lib/routes/app_routes.dart b/lib/routes/app_routes.dart index df9fcf4..405f3d4 100644 --- a/lib/routes/app_routes.dart +++ b/lib/routes/app_routes.dart @@ -21,4 +21,6 @@ abstract class Routes { static const SUBPERF = '/subperf'; static const CITY = '/city'; static const CATEOGORY = '/category'; + static const SELECT = '/select'; + static const ROG = '/rog'; } diff --git a/lib/services/destination_service.dart b/lib/services/destination_service.dart index 525b1c7..d4e8dd3 100644 --- a/lib/services/destination_service.dart +++ b/lib/services/destination_service.dart @@ -1,103 +1,103 @@ -import 'dart:convert'; -import 'package:flutter_polyline_points/flutter_polyline_points.dart'; -//import 'package:google_maps_webservice/directions.dart'; -import 'package:http/http.dart' as http; -import 'package:rogapp/model/destination.dart'; +// import 'dart:convert'; +// import 'package:flutter_polyline_points/flutter_polyline_points.dart'; +// //import 'package:google_maps_webservice/directions.dart'; +// import 'package:http/http.dart' as http; +// import 'package:rogapp/model/destination.dart'; -import '../utils/const.dart'; +// import '../utils/const.dart'; -class DestinationService{ +// class DestinationService{ - static Future> getDestinations(int user_id) async { - List cats = []; - String server_url = ConstValues.currentServer(); - String url = "${server_url}/api/destinations/?user_id=${user_id}"; - //String url = "http://localhost:8100/api/destinations/?user_id=${user_id}"; - final http.Response response = await http.get( - Uri.parse(url), - headers: { - 'Content-Type': 'application/json; charset=UTF-8', - } - ); +// static Future> getDestinations(int user_id) async { +// List cats = []; +// String server_url = ConstValues.currentServer(); +// String url = "${server_url}/api/destinations/?user_id=${user_id}"; +// //String url = "http://localhost:8100/api/destinations/?user_id=${user_id}"; +// final http.Response response = await http.get( +// Uri.parse(url), +// headers: { +// 'Content-Type': 'application/json; charset=UTF-8', +// } +// ); - if (response.statusCode == 200) { - cats = json.decode(utf8.decode(response.bodyBytes)); - } - return cats; - } +// if (response.statusCode == 200) { +// cats = json.decode(utf8.decode(response.bodyBytes)); +// } +// return cats; +// } - static Future> deleteDestination(int dest_id) async { - Map cats = {}; - String server_url = ConstValues.currentServer(); - String url = "${server_url}/api/delete_destination/?dest_id=${dest_id}"; - //String url = "http://localhost:8100/api/delete_destination/?dest_id=${dest_id}"; - final http.Response response = await http.get( - Uri.parse(url), - headers: { - 'Content-Type': 'application/json; charset=UTF-8', - } - ); +// static Future> deleteDestination(int dest_id) async { +// Map cats = {}; +// String server_url = ConstValues.currentServer(); +// String url = "${server_url}/api/delete_destination/?dest_id=${dest_id}"; +// //String url = "http://localhost:8100/api/delete_destination/?dest_id=${dest_id}"; +// final http.Response response = await http.get( +// Uri.parse(url), +// headers: { +// 'Content-Type': 'application/json; charset=UTF-8', +// } +// ); - if (response.statusCode == 200) { - cats = json.decode(utf8.decode(response.bodyBytes)); - } - print("####### ---- ${cats}"); - return cats; - } +// if (response.statusCode == 200) { +// cats = json.decode(utf8.decode(response.bodyBytes)); +// } +// print("####### ---- ${cats}"); +// return cats; +// } - static Future updateOrder(int action_id, int order, String dir) async { - int cats = 0; - String server_url = ConstValues.currentServer(); - String url = "${server_url}/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}"; - print("---- url is ${url} -----"); - //String url = "http://localhost:8100/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}"; - final http.Response response = await http.get( - Uri.parse(url), - headers: { - 'Content-Type': 'application/json; charset=UTF-8', - } - ); +// static Future updateOrder(int action_id, int order, String dir) async { +// int cats = 0; +// String server_url = ConstValues.currentServer(); +// String url = "${server_url}/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}"; +// print("---- url is ${url} -----"); +// //String url = "http://localhost:8100/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}"; +// final http.Response response = await http.get( +// Uri.parse(url), +// headers: { +// 'Content-Type': 'application/json; charset=UTF-8', +// } +// ); - if (response.statusCode == 200) { - cats = json.decode(utf8.decode(response.bodyBytes)); - } - return cats; - } +// if (response.statusCode == 200) { +// cats = json.decode(utf8.decode(response.bodyBytes)); +// } +// return cats; +// } - static Future>? getDestinationLine(List destinations) async{ - PolylinePoints polylinePoints = PolylinePoints(); +// static Future>? getDestinationLine(List destinations) async{ +// PolylinePoints polylinePoints = PolylinePoints(); - if(destinations.length <= 0){ - return []; - } +// if(destinations.length <= 0){ +// return []; +// } - //print("##### @@@@@ ${destinations[0].lat}"); - PointLatLng origin = PointLatLng(destinations[0].lat!, destinations[0].lon!); - PointLatLng dest = PointLatLng(destinations[destinations.length -1].lat!, destinations[destinations.length -1].lon!); +// //print("##### @@@@@ ${destinations[0].lat}"); +// PointLatLng origin = PointLatLng(destinations[0].lat!, destinations[0].lon!); +// PointLatLng dest = PointLatLng(destinations[destinations.length -1].lat!, destinations[destinations.length -1].lon!); - List wayPoints = []; - int i=0; - for(dynamic d in destinations){ - if(i == 0 || i == (destinations.length -1)){ - i+=1; - continue; - } - double la = d.lat; - double ln = d.lon; - PolylineWayPoint pwp = PolylineWayPoint(location: "${la},${ln}", stopOver: true); - //print("----- UUUUUU ${pwp}"); - //PointLatLng wp = PointLatLng(d["Location"]["geometry"][0][1], d["Location"]["geometry"][0][0]); - wayPoints.add(pwp); - i+=1; - } - //PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", PointLatLng(35.389282, 136.498027), PointLatLng(36.285848, 137.575186)); - PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", origin,dest, travelMode: TravelMode.driving, wayPoints: wayPoints); - //print("#####@@@@@ ${result.points}"); - return result.points; - } +// List wayPoints = []; +// int i=0; +// for(dynamic d in destinations){ +// if(i == 0 || i == (destinations.length -1)){ +// i+=1; +// continue; +// } +// double la = d.lat; +// double ln = d.lon; +// PolylineWayPoint pwp = PolylineWayPoint(location: "${la},${ln}", stopOver: true); +// //print("----- UUUUUU ${pwp}"); +// //PointLatLng wp = PointLatLng(d["Location"]["geometry"][0][1], d["Location"]["geometry"][0][0]); +// wayPoints.add(pwp); +// i+=1; +// } +// //PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", PointLatLng(35.389282, 136.498027), PointLatLng(36.285848, 137.575186)); +// PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", origin,dest, travelMode: TravelMode.driving, wayPoints: wayPoints); +// //print("#####@@@@@ ${result.points}"); +// return result.points; +// } -} +// } diff --git a/lib/services/maxtrix_service.dart b/lib/services/maxtrix_service.dart index acc7aa9..552aa32 100644 --- a/lib/services/maxtrix_service.dart +++ b/lib/services/maxtrix_service.dart @@ -1,47 +1,47 @@ -import 'dart:convert'; -import 'package:http/http.dart' as http; -import 'package:rogapp/model/destination.dart'; +// import 'dart:convert'; +// import 'package:http/http.dart' as http; +// import 'package:rogapp/model/destination.dart'; -class MatrixService{ +// class MatrixService{ - static Future> getDestinations(List destinations) async { +// static Future> getDestinations(List destinations) async { - String locs = ""; - String origin = ""; - int i = 0; - for(Destination d in destinations){ +// String locs = ""; +// String origin = ""; +// int i = 0; +// for(Destination d in destinations){ - print("---- getting matrix for ${d} ------------"); +// print("---- getting matrix for ${d} ------------"); - if(i==0){ - origin = "${d.lat}, ${d.lon}"; - } +// if(i==0){ +// origin = "${d.lat}, ${d.lon}"; +// } - print("lat is ${d.lat}, long is ${d.lon}"); - locs += "${d.lat}, ${d.lon}|"; - i++; - } +// print("lat is ${d.lat}, long is ${d.lon}"); +// locs += "${d.lat}, ${d.lon}|"; +// i++; +// } - //print(locs); +// //print(locs); - Map cats = {}; - String url = "https://maps.googleapis.com/maps/api/distancematrix/json?destinations=${locs}&origins=${origin}&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE"; - print(url); - final http.Response response = await http.get( - Uri.parse(url), - headers: { - 'Content-Type': 'application/json; charset=UTF-8', - } - ); +// Map cats = {}; +// String url = "https://maps.googleapis.com/maps/api/distancematrix/json?destinations=${locs}&origins=${origin}&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE"; +// print(url); +// final http.Response response = await http.get( +// Uri.parse(url), +// headers: { +// 'Content-Type': 'application/json; charset=UTF-8', +// } +// ); - if (response.statusCode == 200) { - cats = json.decode(utf8.decode(response.bodyBytes)); - } - return cats; - } +// if (response.statusCode == 200) { +// cats = json.decode(utf8.decode(response.bodyBytes)); +// } +// return cats; +// } -} +// } diff --git a/lib/utils/app_binding.dart b/lib/utils/app_binding.dart new file mode 100644 index 0000000..d0c27c7 --- /dev/null +++ b/lib/utils/app_binding.dart @@ -0,0 +1,9 @@ +import 'package:get/get.dart'; +import 'package:rogapp/utils/app_controller.dart'; + +class AppBinding extends Bindings{ + @override + void dependencies() { + Get.put(AppController()); + } +} \ No newline at end of file diff --git a/lib/utils/app_controller.dart b/lib/utils/app_controller.dart new file mode 100644 index 0000000..e0cd5f1 --- /dev/null +++ b/lib/utils/app_controller.dart @@ -0,0 +1,6 @@ + +import 'package:get/get_state_manager/get_state_manager.dart'; + +class AppController extends GetxController{ + +} \ No newline at end of file diff --git a/lib/widgets/base_layer_widget.dart b/lib/widgets/base_layer_widget.dart index 2123fb4..f9c6d7a 100644 --- a/lib/widgets/base_layer_widget.dart +++ b/lib/widgets/base_layer_widget.dart @@ -1,22 +1,22 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_map/flutter_map.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter_map/flutter_map.dart'; -class BaseLayer extends StatelessWidget { - const BaseLayer({Key? key}) : super(key: key); +// class BaseLayer extends StatelessWidget { +// const BaseLayer({Key? key}) : super(key: key); - @override - Widget build(BuildContext context) { - return TileLayerWidget( - options: TileLayerOptions( - backgroundColor: Colors.transparent, - urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', - //urlTemplate: 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', - subdomains: ['a', 'b', 'c'], - ), - ); - } -} +// @override +// Widget build(BuildContext context) { +// return TileLayerWidget( +// options: TileLayerOptions( +// backgroundColor: Colors.transparent, +// urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', +// //urlTemplate: 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', +// subdomains: ['a', 'b', 'c'], +// ), +// ); +// } +// } -// var Esri_WorldImagery = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', { -// attribution: 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community' -// }); \ No newline at end of file +// // var Esri_WorldImagery = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', { +// // attribution: 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community' +// // }); \ No newline at end of file diff --git a/lib/widgets/bottom_sheet_controller.dart b/lib/widgets/bottom_sheet_controller.dart index 94c5b5c..787d921 100644 --- a/lib/widgets/bottom_sheet_controller.dart +++ b/lib/widgets/bottom_sheet_controller.dart @@ -1,11 +1,11 @@ -import 'package:geojson/geojson.dart'; -import 'package:get/get_state_manager/get_state_manager.dart'; +// import 'package:geojson/geojson.dart'; +// import 'package:get/get_state_manager/get_state_manager.dart'; -class BottomSheetController extends GetxController{ +// class BottomSheetController extends GetxController{ - List? currentFeature = []; +// List? currentFeature = []; - BottomSheetController({this.currentFeature}); -} \ No newline at end of file +// BottomSheetController({this.currentFeature}); +// } \ No newline at end of file diff --git a/lib/widgets/bottom_sheet_new.dart b/lib/widgets/bottom_sheet_new.dart index 764b177..129140e 100644 --- a/lib/widgets/bottom_sheet_new.dart +++ b/lib/widgets/bottom_sheet_new.dart @@ -1,521 +1,521 @@ -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:image_picker/image_picker.dart'; -import 'package:latlong2/latlong.dart'; -import 'package:rogapp/model/destination.dart'; -import 'package:rogapp/pages/destination/destination_controller.dart'; -import 'package:rogapp/pages/index/index_controller.dart'; -import 'package:rogapp/routes/app_pages.dart'; -import 'package:rogapp/utils/database_helper.dart'; -import 'package:rogapp/widgets/bottom_sheet_controller.dart'; -import 'package:url_launcher/url_launcher.dart'; +// 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:image_picker/image_picker.dart'; +// import 'package:latlong2/latlong.dart'; +// import 'package:rogapp/model/destination.dart'; +// import 'package:rogapp/pages/destination/destination_controller.dart'; +// import 'package:rogapp/pages/index/index_controller.dart'; +// import 'package:rogapp/routes/app_pages.dart'; +// import 'package:rogapp/utils/database_helper.dart'; +// import 'package:rogapp/widgets/bottom_sheet_controller.dart'; +// import 'package:url_launcher/url_launcher.dart'; -class BottomSheetNew extends GetView { - BottomSheetNew({ Key? key }) : super(key: key); +// class BottomSheetNew extends GetView { +// BottomSheetNew({ Key? key }) : super(key: key); - final IndexController indexController = Get.find(); - final DestinationController destinationController = Get.find(); +// final IndexController indexController = Get.find(); +// final DestinationController destinationController = Get.find(); - Image getImage(){ +// Image getImage(){ - if(indexController.rog_mode == 1){ - if(indexController.currentDestinationFeature.length <= 0 || indexController.currentDestinationFeature[0].photos! == ""){ - return Image(image: AssetImage('assets/images/empty_image.png')); - } - else{ - //print("@@@@@@@@@@@@@ rog mode -------------------- ${indexController.currentDestinationFeature[0].photos} @@@@@@@@@@@"); - return Image(image: NetworkImage( - indexController.currentDestinationFeature[0].photos!, - ), - errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { - return Image.asset("assets/images/empty_image.png"); - }, - ); - } - } - else{ - GeoJsonFeature gf = indexController.currentFeature[0]; - if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){ - return Image(image: AssetImage('assets/images/empty_image.png')); - } - else{ - return Image(image: NetworkImage( - gf.properties!["photos"], - ), - errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { - return Image.asset("assets/images/empty_image.png"); - }, - ); - } - } +// if(indexController.rog_mode == 1){ +// if(indexController.currentDestinationFeature.length <= 0 || indexController.currentDestinationFeature[0].photos! == ""){ +// return Image(image: AssetImage('assets/images/empty_image.png')); +// } +// else{ +// //print("@@@@@@@@@@@@@ rog mode -------------------- ${indexController.currentDestinationFeature[0].photos} @@@@@@@@@@@"); +// return Image(image: NetworkImage( +// indexController.currentDestinationFeature[0].photos!, +// ), +// errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { +// return Image.asset("assets/images/empty_image.png"); +// }, +// ); +// } +// } +// else{ +// GeoJsonFeature gf = indexController.currentFeature[0]; +// if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){ +// return Image(image: AssetImage('assets/images/empty_image.png')); +// } +// else{ +// return Image(image: NetworkImage( +// gf.properties!["photos"], +// ), +// errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { +// return Image.asset("assets/images/empty_image.png"); +// }, +// ); +// } +// } - } +// } - void _launchURL(url) async { - if (!await launch(url)) throw 'Could not launch $url'; - } +// void _launchURL(url) async { +// if (!await launch(url)) throw 'Could not launch $url'; +// } - bool isInDestination(String locationid){ - int lid = int.parse(locationid); - if(destinationController.destinations.where((element) => element.location_id == lid).length > 0){ - return true; - } - else{ - return false; - } - } +// bool isInDestination(String locationid){ +// int lid = int.parse(locationid); +// if(destinationController.destinations.where((element) => element.location_id == lid).length > 0){ +// return true; +// } +// else{ +// return false; +// } +// } - @override - Widget build(BuildContext context) { +// @override +// Widget build(BuildContext context) { - return indexController.rog_mode == 0 ? detailsSheet(context) : destinationSheet(context); - } +// return indexController.rog_mode == 0 ? detailsSheet(context) : destinationSheet(context); +// } - SingleChildScrollView destinationSheet(BuildContext context) { - return SingleChildScrollView( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Row( - children: [ - MaterialButton( - onPressed: () { - destinationController.makePrevious(indexController.currentDestinationFeature[0]); - }, - color: Colors.blue, - textColor: Colors.white, - child: Icon( - Icons.arrow_back_ios, - size: 14, - ), - padding: EdgeInsets.all(16), - shape: CircleBorder(), - ), - Expanded( - child: Container( - alignment: Alignment.center, - child: Obx(() => - Text(indexController.currentDestinationFeature[0].name!, style: TextStyle( - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ) - ), - ), - ), - MaterialButton( - onPressed: () { - destinationController.makeNext(indexController.currentDestinationFeature[0]); - }, - color: Colors.blue, - textColor: Colors.white, - child: Icon( - Icons.arrow_forward_ios, - size: 14, - ), - padding: EdgeInsets.all(16), - shape: CircleBorder(), - ), - ], - ), - ), - ), - Row( - children: [ - Expanded( - child: SizedBox( - height: 260.0, - child: Obx(() => getImage()), - ) - ), - ], - ), - Obx(() => - indexController.currentDestinationFeature[0].address!.isNotEmpty ? - getDetails(context, "address".tr, indexController.currentDestinationFeature[0].address! ?? '') - : - Container(width: 0.0, height: 0,), - ), - Obx(() => - indexController.currentDestinationFeature[0].phone!.isNotEmpty ? - getDetails(context, "telephone".tr, indexController.currentDestinationFeature[0].phone! ?? '') - : - Container(width: 0.0, height: 0,), - ), - Obx(() => - indexController.currentDestinationFeature[0].email!.isNotEmpty ? - getDetails(context, "email".tr, indexController.currentDestinationFeature[0].email! ?? '') - : - Container(width: 0.0, height: 0,), - ), - Obx(() => - indexController.currentDestinationFeature[0].webcontents!.isNotEmpty ? - getDetails(context, "web".tr, indexController.currentDestinationFeature[0].webcontents! ?? '', isurl: true) - : - Container(width: 0.0, height: 0,), - ), - Obx(() => - indexController.currentDestinationFeature[0].videos!.isNotEmpty ? - getDetails(context, "video".tr, indexController.currentDestinationFeature[0].videos! ?? '', isurl: true) - : - Container(width: 0.0, height: 0,), - ), - SizedBox(height: 20.0,), - Obx(() => - //wantToGo(context), +// SingleChildScrollView destinationSheet(BuildContext context) { +// return SingleChildScrollView( +// child: Column( +// children: [ +// Padding( +// padding: const EdgeInsets.all(8.0), +// child: Container( +// child: Row( +// children: [ +// MaterialButton( +// onPressed: () { +// destinationController.makePrevious(indexController.currentDestinationFeature[0]); +// }, +// color: Colors.blue, +// textColor: Colors.white, +// child: Icon( +// Icons.arrow_back_ios, +// size: 14, +// ), +// padding: EdgeInsets.all(16), +// shape: CircleBorder(), +// ), +// Expanded( +// child: Container( +// alignment: Alignment.center, +// child: Obx(() => +// Text(indexController.currentDestinationFeature[0].name!, style: TextStyle( +// fontSize: 15.0, +// fontWeight: FontWeight.bold, +// ), +// ) +// ), +// ), +// ), +// MaterialButton( +// onPressed: () { +// destinationController.makeNext(indexController.currentDestinationFeature[0]); +// }, +// color: Colors.blue, +// textColor: Colors.white, +// child: Icon( +// Icons.arrow_forward_ios, +// size: 14, +// ), +// padding: EdgeInsets.all(16), +// shape: CircleBorder(), +// ), +// ], +// ), +// ), +// ), +// Row( +// children: [ +// Expanded( +// child: SizedBox( +// height: 260.0, +// child: Obx(() => getImage()), +// ) +// ), +// ], +// ), +// Obx(() => +// indexController.currentDestinationFeature[0].address!.isNotEmpty ? +// getDetails(context, "address".tr, indexController.currentDestinationFeature[0].address! ?? '') +// : +// Container(width: 0.0, height: 0,), +// ), +// Obx(() => +// indexController.currentDestinationFeature[0].phone!.isNotEmpty ? +// getDetails(context, "telephone".tr, indexController.currentDestinationFeature[0].phone! ?? '') +// : +// Container(width: 0.0, height: 0,), +// ), +// Obx(() => +// indexController.currentDestinationFeature[0].email!.isNotEmpty ? +// getDetails(context, "email".tr, indexController.currentDestinationFeature[0].email! ?? '') +// : +// Container(width: 0.0, height: 0,), +// ), +// Obx(() => +// indexController.currentDestinationFeature[0].webcontents!.isNotEmpty ? +// getDetails(context, "web".tr, indexController.currentDestinationFeature[0].webcontents! ?? '', isurl: true) +// : +// Container(width: 0.0, height: 0,), +// ), +// Obx(() => +// indexController.currentDestinationFeature[0].videos!.isNotEmpty ? +// getDetails(context, "video".tr, indexController.currentDestinationFeature[0].videos! ?? '', isurl: true) +// : +// Container(width: 0.0, height: 0,), +// ), +// SizedBox(height: 20.0,), +// Obx(() => +// //wantToGo(context), - FutureBuilder( - future: wantToGo(context), - builder: (context, snapshot) { - return Container( - child: snapshot.data, - ); - }, - ), +// FutureBuilder( +// future: wantToGo(context), +// builder: (context, snapshot) { +// return Container( +// child: snapshot.data, +// ); +// }, +// ), - ), - SizedBox(height: 60.0,) - ], - ), - ); - } +// ), +// SizedBox(height: 60.0,) +// ], +// ), +// ); +// } - SingleChildScrollView detailsSheet(BuildContext context) { - return SingleChildScrollView( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Row( - children: [ - MaterialButton( - onPressed: () { - indexController.makePrevious(indexController.currentFeature[0]); - }, - color: Colors.blue, - textColor: Colors.white, - child: Icon( - Icons.arrow_back_ios, - size: 14, - ), - padding: EdgeInsets.all(16), - shape: CircleBorder(), - ), - Expanded( - child: Container( - alignment: Alignment.center, - child: Obx(() => - Text(indexController.currentFeature[0].properties!["location_name"], style: TextStyle( - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ) - ), - ), - ), - MaterialButton( - onPressed: () { - //print("----- next is ${indexController.currentFeature[0]} ------"); - indexController.makeNext(indexController.currentFeature[0]); - }, - color: Colors.blue, - textColor: Colors.white, - child: Icon( - Icons.arrow_forward_ios, - size: 14, - ), - padding: EdgeInsets.all(16), - shape: CircleBorder(), - ), - ], - ), - ), - ), - Row( - children: [ - Expanded( - child: SizedBox( - height: 260.0, - child: Obx(() => getImage()), - ) - ), - ], - ), - Obx(() => - Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - children: [ - Row( - children: [ - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - FutureBuilder( - future: wantToGo(context), - builder: (context, snapshot) { - return Container( - child: snapshot.data, - ); - }, - ), - indexController.currentFeature[0].properties!["location_name"] != null && (indexController.currentFeature[0].properties!["location_name"] as String).isNotEmpty ? - Flexible(child: Text(indexController.currentFeature[0].properties!["location_name"])) - : - Container(width: 0.0, height: 0,), - ], - ), - ), - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Icon(Icons.thumb_up_alt_sharp), - Text("Like"), - ], - ), - ), - ], - ), - SizedBox(height: 8.0,), - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - Icon(Icons.roundabout_left), - SizedBox(width: 8.0,), - indexController.currentFeature[0].properties!["address"] != null && (indexController.currentFeature[0].properties!["address"] as String).isNotEmpty ? - getDetails(context, "address".tr, indexController.currentFeature[0].properties!["address"] ?? '') - : - Container(width: 0.0, height: 0,), - ], - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - Icon(Icons.phone), - SizedBox(width: 8.0,), - indexController.currentFeature[0].properties!["phone"] != null && (indexController.currentFeature[0].properties!["phone"] as String).isNotEmpty ? - getDetails(context, "telephone".tr, indexController.currentFeature[0].properties!["phone"] ?? '') - : - Container(width: 0.0, height: 0,), - ], - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - Icon(Icons.email), - SizedBox(width: 8.0,), - indexController.currentFeature[0].properties!["email"] != null && (indexController.currentFeature[0].properties!["email"] as String).isNotEmpty ? - getDetails(context, "email".tr, indexController.currentFeature[0].properties!["email"] ?? '') - : - Container(width: 0.0, height: 0,), - ], - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - Icon(Icons.language), - SizedBox(width: 8.0,), - indexController.currentFeature[0].properties!["webcontents"] != null && (indexController.currentFeature[0].properties!["webcontents"] as String).isNotEmpty ? - getDetails(context, "web".tr, indexController.currentFeature[0].properties!["webcontents"] ?? '', isurl: true) - : - Container(width: 0.0, height: 0,), - ], - ), - ) - ], - ), - ) - ), - SizedBox(height: 60.0,) - ], - ), - ); - } +// SingleChildScrollView detailsSheet(BuildContext context) { +// return SingleChildScrollView( +// child: Column( +// children: [ +// Padding( +// padding: const EdgeInsets.all(8.0), +// child: Container( +// child: Row( +// children: [ +// MaterialButton( +// onPressed: () { +// indexController.makePrevious(indexController.currentFeature[0]); +// }, +// color: Colors.blue, +// textColor: Colors.white, +// child: Icon( +// Icons.arrow_back_ios, +// size: 14, +// ), +// padding: EdgeInsets.all(16), +// shape: CircleBorder(), +// ), +// Expanded( +// child: Container( +// alignment: Alignment.center, +// child: Obx(() => +// Text(indexController.currentFeature[0].properties!["location_name"], style: TextStyle( +// fontSize: 15.0, +// fontWeight: FontWeight.bold, +// ), +// ) +// ), +// ), +// ), +// MaterialButton( +// onPressed: () { +// //print("----- next is ${indexController.currentFeature[0]} ------"); +// indexController.makeNext(indexController.currentFeature[0]); +// }, +// color: Colors.blue, +// textColor: Colors.white, +// child: Icon( +// Icons.arrow_forward_ios, +// size: 14, +// ), +// padding: EdgeInsets.all(16), +// shape: CircleBorder(), +// ), +// ], +// ), +// ), +// ), +// Row( +// children: [ +// Expanded( +// child: SizedBox( +// height: 260.0, +// child: Obx(() => getImage()), +// ) +// ), +// ], +// ), +// Obx(() => +// Padding( +// padding: const EdgeInsets.all(8.0), +// child: Column( +// children: [ +// Row( +// children: [ +// Expanded( +// child: Row( +// mainAxisAlignment: MainAxisAlignment.start, +// children: [ +// FutureBuilder( +// future: wantToGo(context), +// builder: (context, snapshot) { +// return Container( +// child: snapshot.data, +// ); +// }, +// ), +// indexController.currentFeature[0].properties!["location_name"] != null && (indexController.currentFeature[0].properties!["location_name"] as String).isNotEmpty ? +// Flexible(child: Text(indexController.currentFeature[0].properties!["location_name"])) +// : +// Container(width: 0.0, height: 0,), +// ], +// ), +// ), +// Expanded( +// child: Row( +// mainAxisAlignment: MainAxisAlignment.start, +// children: [ +// Icon(Icons.thumb_up_alt_sharp), +// Text("Like"), +// ], +// ), +// ), +// ], +// ), +// SizedBox(height: 8.0,), +// Padding( +// padding: const EdgeInsets.all(8.0), +// child: Row( +// children: [ +// Icon(Icons.roundabout_left), +// SizedBox(width: 8.0,), +// indexController.currentFeature[0].properties!["address"] != null && (indexController.currentFeature[0].properties!["address"] as String).isNotEmpty ? +// getDetails(context, "address".tr, indexController.currentFeature[0].properties!["address"] ?? '') +// : +// Container(width: 0.0, height: 0,), +// ], +// ), +// ), +// Padding( +// padding: const EdgeInsets.all(8.0), +// child: Row( +// children: [ +// Icon(Icons.phone), +// SizedBox(width: 8.0,), +// indexController.currentFeature[0].properties!["phone"] != null && (indexController.currentFeature[0].properties!["phone"] as String).isNotEmpty ? +// getDetails(context, "telephone".tr, indexController.currentFeature[0].properties!["phone"] ?? '') +// : +// Container(width: 0.0, height: 0,), +// ], +// ), +// ), +// Padding( +// padding: const EdgeInsets.all(8.0), +// child: Row( +// children: [ +// Icon(Icons.email), +// SizedBox(width: 8.0,), +// indexController.currentFeature[0].properties!["email"] != null && (indexController.currentFeature[0].properties!["email"] as String).isNotEmpty ? +// getDetails(context, "email".tr, indexController.currentFeature[0].properties!["email"] ?? '') +// : +// Container(width: 0.0, height: 0,), +// ], +// ), +// ), +// Padding( +// padding: const EdgeInsets.all(8.0), +// child: Row( +// children: [ +// Icon(Icons.language), +// SizedBox(width: 8.0,), +// indexController.currentFeature[0].properties!["webcontents"] != null && (indexController.currentFeature[0].properties!["webcontents"] as String).isNotEmpty ? +// getDetails(context, "web".tr, indexController.currentFeature[0].properties!["webcontents"] ?? '', isurl: true) +// : +// Container(width: 0.0, height: 0,), +// ], +// ), +// ) +// ], +// ), +// ) +// ), +// SizedBox(height: 60.0,) +// ], +// ), +// ); +// } - Future wantToGo(BuildContext context)async { +// Future wantToGo(BuildContext context)async { - DatabaseHelper db = DatabaseHelper.instance; - return - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - indexController.rog_mode == 0 ? - IconButton( - icon: Icon(Icons.pin_drop_sharp, size: 32,), - onPressed: (){ - GeoJsonMultiPoint mp = indexController.currentFeature[0].geometry as GeoJsonMultiPoint; - LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude, mp.geoSerie!.geoPoints[0].longitude); +// DatabaseHelper db = DatabaseHelper.instance; +// return +// Row( +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// Row( +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// indexController.rog_mode == 0 ? +// IconButton( +// icon: Icon(Icons.pin_drop_sharp, size: 32,), +// onPressed: (){ +// GeoJsonMultiPoint mp = indexController.currentFeature[0].geometry as GeoJsonMultiPoint; +// LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude, mp.geoSerie!.geoPoints[0].longitude); - Destination dest = Destination( - name: indexController.currentFeature[0].properties!["location_name"], - address: indexController.currentFeature[0].properties!["address"], - phone: indexController.currentFeature[0].properties!["phone"], - email: indexController.currentFeature[0].properties!["email"], - webcontents: indexController.currentFeature[0].properties!["webcontents"], - videos: indexController.currentFeature[0].properties!["videos"], - category: indexController.currentFeature[0].properties!["category"], - series: 1, - lat: pt.latitude, - lon: pt.longitude, - location_id: indexController.currentFeature[0].properties!["location_id"], - list_order: 1, - photos: indexController.currentFeature[0].properties!["photos"], - checkin_radious: indexController.currentFeature[0].properties!["checkin_radious"], - auto_checkin: indexController.currentFeature[0].properties!["auto_checkin"] == true ? 1 : 0, - selected: false, - checkedin: false - ); - destinationController.addDestinations(dest); - }, - ): - Container(), - SizedBox(width: 8.0,) , - Obx((() => +// Destination dest = Destination( +// name: indexController.currentFeature[0].properties!["location_name"], +// address: indexController.currentFeature[0].properties!["address"], +// phone: indexController.currentFeature[0].properties!["phone"], +// email: indexController.currentFeature[0].properties!["email"], +// webcontents: indexController.currentFeature[0].properties!["webcontents"], +// videos: indexController.currentFeature[0].properties!["videos"], +// category: indexController.currentFeature[0].properties!["category"], +// series: 1, +// lat: pt.latitude, +// lon: pt.longitude, +// location_id: indexController.currentFeature[0].properties!["location_id"], +// list_order: 1, +// photos: indexController.currentFeature[0].properties!["photos"], +// checkin_radious: indexController.currentFeature[0].properties!["checkin_radious"], +// auto_checkin: indexController.currentFeature[0].properties!["auto_checkin"] == true ? 1 : 0, +// selected: false, +// checkedin: false +// ); +// destinationController.addDestinations(dest); +// }, +// ): +// Container(), +// SizedBox(width: 8.0,) , +// Obx((() => - indexController.rog_mode == 1 ? - ElevatedButton( - onPressed: () async { - Destination dest = indexController.currentDestinationFeature[0]!; - //print("------ curent destination is ${dest!.checkedIn}-------"); - if(dest != null){ - //print("------ curent destination is ${dest!.checkedin}-------::::::::::"); - destinationController.makeCheckin(dest, !dest.checkedin!); - } - }, - child: indexController.currentDestinationFeature[0].checkedin == false ? - Text("Check in") - : - Text("Check out") - ): - Container() +// indexController.rog_mode == 1 ? +// ElevatedButton( +// onPressed: () async { +// Destination dest = indexController.currentDestinationFeature[0]!; +// //print("------ curent destination is ${dest!.checkedIn}-------"); +// if(dest != null){ +// //print("------ curent destination is ${dest!.checkedin}-------::::::::::"); +// destinationController.makeCheckin(dest, !dest.checkedin!); +// } +// }, +// child: indexController.currentDestinationFeature[0].checkedin == false ? +// Text("Check in") +// : +// Text("Check out") +// ): +// Container() - ) - ) - ], - ) - ], - ); - } +// ) +// ) +// ], +// ) +// ], +// ); +// } - Widget getCheckin(BuildContext context){ +// Widget getCheckin(BuildContext context){ - //print("------ currentAction ----- ${indexController.currentAction}-----"); +// //print("------ currentAction ----- ${indexController.currentAction}-----"); - return Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - indexController.currentAction[0][0]["checkin"] == false ? - Column( - children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - ElevatedButton( - child: Text("Image"), onPressed: (){ - final ImagePicker _picker = ImagePicker(); - _picker.pickImage(source: ImageSource.camera).then((value){ - //print("----- image---- ${value!.path}"); - }); - }, - ) - ], - ), - ElevatedButton( - onPressed: (){ - if(indexController.currentAction.isNotEmpty){ - //print(indexController.currentAction[0]); - indexController.currentAction[0][0]["checkin"] = true; - Map temp = Map.from(indexController.currentAction[0][0]); - indexController.currentAction.clear(); - //print("---temp---${temp}"); - indexController.currentAction.add([temp]); - } - indexController.makeAction(context); - }, - child: Text("checkin".tr) - ) - ], - ) - : - ElevatedButton( - onPressed: (){ - if(indexController.currentAction.isNotEmpty){ - //print(indexController.currentAction[0]); - indexController.currentAction[0][0]["checkin"] = false; - Map temp = Map.from(indexController.currentAction[0][0]); - indexController.currentAction.clear(); - //print("---temp---${temp}"); - indexController.currentAction.add([temp]); - } - indexController.makeAction(context); - }, +// return Row( +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// Row( +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// indexController.currentAction[0][0]["checkin"] == false ? +// Column( +// children: [ +// Row( +// mainAxisSize: MainAxisSize.max, +// children: [ +// ElevatedButton( +// child: Text("Image"), onPressed: (){ +// final ImagePicker _picker = ImagePicker(); +// _picker.pickImage(source: ImageSource.camera).then((value){ +// //print("----- image---- ${value!.path}"); +// }); +// }, +// ) +// ], +// ), +// ElevatedButton( +// onPressed: (){ +// if(indexController.currentAction.isNotEmpty){ +// //print(indexController.currentAction[0]); +// indexController.currentAction[0][0]["checkin"] = true; +// Map temp = Map.from(indexController.currentAction[0][0]); +// indexController.currentAction.clear(); +// //print("---temp---${temp}"); +// indexController.currentAction.add([temp]); +// } +// indexController.makeAction(context); +// }, +// child: Text("checkin".tr) +// ) +// ], +// ) +// : +// ElevatedButton( +// onPressed: (){ +// if(indexController.currentAction.isNotEmpty){ +// //print(indexController.currentAction[0]); +// indexController.currentAction[0][0]["checkin"] = false; +// Map temp = Map.from(indexController.currentAction[0][0]); +// indexController.currentAction.clear(); +// //print("---temp---${temp}"); +// indexController.currentAction.add([temp]); +// } +// indexController.makeAction(context); +// }, - child: Icon( - Icons.favorite, color: Colors.red) +// child: Icon( +// Icons.favorite, color: Colors.red) - , - ) - ], - ) - ], - ); - } +// , +// ) +// ], +// ) +// ], +// ); +// } - Widget getDetails(BuildContext context, String label, String text, {bool isurl=false}){ - return Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text(label), - SizedBox(width: 10.0,), - InkWell( - onTap: (){ - if(isurl){ - if(indexController.rog_mode == 0){ - _launchURL(indexController.currentFeature[0].properties!["webcontents"]); - } - else { - indexController.currentDestinationFeature[0].webcontents; - } +// Widget getDetails(BuildContext context, String label, String text, {bool isurl=false}){ +// return Row( +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// Text(label), +// SizedBox(width: 10.0,), +// InkWell( +// onTap: (){ +// if(isurl){ +// if(indexController.rog_mode == 0){ +// _launchURL(indexController.currentFeature[0].properties!["webcontents"]); +// } +// else { +// indexController.currentDestinationFeature[0].webcontents; +// } - } - }, - child: Text(text, - style: TextStyle( - color: Colors.blue, - ), - overflow: TextOverflow.ellipsis, - maxLines: 5, - ), - ), - ], - ); - } +// } +// }, +// child: Text(text, +// style: TextStyle( +// color: Colors.blue, +// ), +// overflow: TextOverflow.ellipsis, +// maxLines: 5, +// ), +// ), +// ], +// ); +// } -} \ No newline at end of file +// } \ No newline at end of file diff --git a/lib/widgets/bottom_sheet_widget.dart b/lib/widgets/bottom_sheet_widget.dart index 40c2698..99526cb 100644 --- a/lib/widgets/bottom_sheet_widget.dart +++ b/lib/widgets/bottom_sheet_widget.dart @@ -1,380 +1,380 @@ -import 'dart:io'; +// import 'dart:io'; -import 'package:flutter/material.dart'; -import 'package:geojson/geojson.dart'; -import 'package:get/get.dart'; -import 'package:image_picker/image_picker.dart'; -import 'package:rogapp/pages/index/index_controller.dart'; -import 'package:rogapp/routes/app_pages.dart'; -import 'package:url_launcher/url_launcher.dart'; +// import 'package:flutter/material.dart'; +// import 'package:geojson/geojson.dart'; +// import 'package:get/get.dart'; +// import 'package:image_picker/image_picker.dart'; +// import 'package:rogapp/pages/index/index_controller.dart'; +// import 'package:rogapp/routes/app_pages.dart'; +// import 'package:url_launcher/url_launcher.dart'; -class BottomSheetWidget extends StatelessWidget { - //const BottomSheetWidget({ Key? key }, GeoJsonFeature? pt) : super(key: key); +// class BottomSheetWidget extends StatelessWidget { +// //const BottomSheetWidget({ Key? key }, GeoJsonFeature? pt) : super(key: key); - final IndexController indexController = Get.find(); +// final IndexController indexController = Get.find(); - Image getImage(GeoJsonFeature? gf){ - if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){ - return Image(image: AssetImage('assets/images/empty_image.png')); - } - else{ - return Image(image: NetworkImage( - gf.properties!["photos"], - ), - errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { - return Image.asset("assets/images/empty_image.png"); - }, - ); - } - } +// Image getImage(GeoJsonFeature? gf){ +// if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){ +// return Image(image: AssetImage('assets/images/empty_image.png')); +// } +// else{ +// return Image(image: NetworkImage( +// gf.properties!["photos"], +// ), +// errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { +// return Image.asset("assets/images/empty_image.png"); +// }, +// ); +// } +// } - void _launchURL(url) async { - if (!await launch(url)) throw 'Could not launch $url'; - } +// void _launchURL(url) async { +// if (!await launch(url)) throw 'Could not launch $url'; +// } - @override - Widget build(BuildContext context) { - return SingleChildScrollView( - child: Column( - children: [ - SizedBox(height: 5.0,), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - MaterialButton( - onPressed: () { - indexController.makePrevious(indexController.currentFeature[0]); - }, - color: Colors.blue, - textColor: Colors.white, - child: Icon( - Icons.arrow_back_ios, - size: 14, - ), - padding: EdgeInsets.all(14), - shape: CircleBorder(), - ), - Expanded( - child: Container( - alignment: Alignment.center, - child: Obx(() => - Text(indexController.currentFeature[0].properties!["location_name"], style: TextStyle( - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ) - ), - ), - ), - MaterialButton( - onPressed: () { - indexController.makeNext(indexController.currentFeature[0]); - }, - color: Colors.blue, - textColor: Colors.white, - child: Icon( - Icons.arrow_forward_ios, - size: 14, - ), - padding: EdgeInsets.all(14), - shape: CircleBorder(), - ), - ], - ), - Row( - children: [ - Expanded( - child: SizedBox( - height: 260.0, - child: Obx(() => getImage(indexController.currentFeature[0])), - ) - ), - ], - ), - Row( - children: [ - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Column( - children: [ - indexController.currentFeature[0].properties!["address"] != null ? - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Container( - alignment: Alignment.topRight, - child: Text("address".tr, style: TextStyle(fontWeight: FontWeight.bold),)), - ), - SizedBox(width: 12.0,), - Expanded( - child: Container( - alignment: Alignment.topLeft, - child: Obx(() => Text(indexController.currentFeature[0].properties!["address"] ?? '', - style: TextStyle(color: Colors.blue,), - softWrap: true, - overflow: TextOverflow.ellipsis,) - ), - ), - ) - ], - ): Container(width: 0.0, height: 0,), - indexController.currentFeature[0].properties!["phone"] != null ? - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded(child: Container( - alignment: Alignment.topRight, - child: Text("telephone".tr, style: TextStyle(fontWeight: FontWeight.bold),))), - SizedBox(width: 12.0,), - Expanded( - child: Container( - alignment: Alignment.topLeft, - child: Obx(() => Text(indexController.currentFeature[0].properties!["phone"] ?? '', - style: TextStyle(color: Colors.blue,), - overflow: TextOverflow.ellipsis,) - ), - ), - ) - ], - ): Container(width: 0, height: 0,), - indexController.currentFeature[0].properties!["email"] != null ? - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded(child: Container( - alignment: Alignment.topRight, - child: Text("email".tr, style: TextStyle(fontWeight: FontWeight.bold),))), - SizedBox(width: 12.0,), - Expanded( - child: Container( - alignment: Alignment.topLeft, - child: Obx(() => Text(indexController.currentFeature[0].properties!["email"] ?? '', - style: TextStyle(color: Colors.blue,), - overflow: TextOverflow.ellipsis,) - ), - ), - ) - ], - ): Container(width: 0, height: 0,), - indexController.currentFeature[0].properties!["webcontents"] != null ? - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded(child: Container( - alignment: Alignment.topRight, - child: Text( - "web".tr, style: TextStyle(fontWeight: FontWeight.bold)))), - SizedBox(width: 12.0,), - Expanded( - child: Container( - alignment: Alignment.topLeft, - child: Obx(() => InkWell( - onTap: (){ - _launchURL(indexController.currentFeature[0].properties!["webcontents"]); - }, - child: Text(indexController.currentFeature[0].properties!["webcontents"] ?? '', - style: TextStyle(color: Colors.blue,), - softWrap: false, - overflow: TextOverflow.fade,), - )), - ), - ) - ], - ): Container(width: 0.0, height: 0.0,), - indexController.currentFeature[0].properties!["videos"] != null ? - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded(child: Container( - alignment: Alignment.topRight, - child: Text("video".tr, style: TextStyle(fontWeight: FontWeight.bold)))), - SizedBox(width: 12.0,), - Expanded( - child: Container( - alignment: Alignment.topLeft, - child: Obx(() => Text(indexController.currentFeature[0].properties!["videos"] ?? '', - style: TextStyle(color: Colors.blue,), - overflow: TextOverflow.ellipsis,) - ), - ), - ) - ], - ): Container(width: 0.0, height: 0.0,), - ], - ), - ), - ), - ], - ), - SizedBox(height: 20.0,), - Obx(() => - indexController.currentAction.isNotEmpty ? - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - indexController.rog_mode.value == 0 ? +// @override +// Widget build(BuildContext context) { +// return SingleChildScrollView( +// child: Column( +// children: [ +// SizedBox(height: 5.0,), +// Row( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: [ +// MaterialButton( +// onPressed: () { +// indexController.makePrevious(indexController.currentFeature[0]); +// }, +// color: Colors.blue, +// textColor: Colors.white, +// child: Icon( +// Icons.arrow_back_ios, +// size: 14, +// ), +// padding: EdgeInsets.all(14), +// shape: CircleBorder(), +// ), +// Expanded( +// child: Container( +// alignment: Alignment.center, +// child: Obx(() => +// Text(indexController.currentFeature[0].properties!["location_name"], style: TextStyle( +// fontSize: 15.0, +// fontWeight: FontWeight.bold, +// ), +// ) +// ), +// ), +// ), +// MaterialButton( +// onPressed: () { +// indexController.makeNext(indexController.currentFeature[0]); +// }, +// color: Colors.blue, +// textColor: Colors.white, +// child: Icon( +// Icons.arrow_forward_ios, +// size: 14, +// ), +// padding: EdgeInsets.all(14), +// shape: CircleBorder(), +// ), +// ], +// ), +// Row( +// children: [ +// Expanded( +// child: SizedBox( +// height: 260.0, +// child: Obx(() => getImage(indexController.currentFeature[0])), +// ) +// ), +// ], +// ), +// Row( +// children: [ +// Expanded( +// child: Padding( +// padding: const EdgeInsets.symmetric(horizontal: 10.0), +// child: Column( +// children: [ +// indexController.currentFeature[0].properties!["address"] != null ? +// Row( +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// Expanded( +// child: Container( +// alignment: Alignment.topRight, +// child: Text("address".tr, style: TextStyle(fontWeight: FontWeight.bold),)), +// ), +// SizedBox(width: 12.0,), +// Expanded( +// child: Container( +// alignment: Alignment.topLeft, +// child: Obx(() => Text(indexController.currentFeature[0].properties!["address"] ?? '', +// style: TextStyle(color: Colors.blue,), +// softWrap: true, +// overflow: TextOverflow.ellipsis,) +// ), +// ), +// ) +// ], +// ): Container(width: 0.0, height: 0,), +// indexController.currentFeature[0].properties!["phone"] != null ? +// Row( +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// Expanded(child: Container( +// alignment: Alignment.topRight, +// child: Text("telephone".tr, style: TextStyle(fontWeight: FontWeight.bold),))), +// SizedBox(width: 12.0,), +// Expanded( +// child: Container( +// alignment: Alignment.topLeft, +// child: Obx(() => Text(indexController.currentFeature[0].properties!["phone"] ?? '', +// style: TextStyle(color: Colors.blue,), +// overflow: TextOverflow.ellipsis,) +// ), +// ), +// ) +// ], +// ): Container(width: 0, height: 0,), +// indexController.currentFeature[0].properties!["email"] != null ? +// Row( +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// Expanded(child: Container( +// alignment: Alignment.topRight, +// child: Text("email".tr, style: TextStyle(fontWeight: FontWeight.bold),))), +// SizedBox(width: 12.0,), +// Expanded( +// child: Container( +// alignment: Alignment.topLeft, +// child: Obx(() => Text(indexController.currentFeature[0].properties!["email"] ?? '', +// style: TextStyle(color: Colors.blue,), +// overflow: TextOverflow.ellipsis,) +// ), +// ), +// ) +// ], +// ): Container(width: 0, height: 0,), +// indexController.currentFeature[0].properties!["webcontents"] != null ? +// Row( +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// Expanded(child: Container( +// alignment: Alignment.topRight, +// child: Text( +// "web".tr, style: TextStyle(fontWeight: FontWeight.bold)))), +// SizedBox(width: 12.0,), +// Expanded( +// child: Container( +// alignment: Alignment.topLeft, +// child: Obx(() => InkWell( +// onTap: (){ +// _launchURL(indexController.currentFeature[0].properties!["webcontents"]); +// }, +// child: Text(indexController.currentFeature[0].properties!["webcontents"] ?? '', +// style: TextStyle(color: Colors.blue,), +// softWrap: false, +// overflow: TextOverflow.fade,), +// )), +// ), +// ) +// ], +// ): Container(width: 0.0, height: 0.0,), +// indexController.currentFeature[0].properties!["videos"] != null ? +// Row( +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// Expanded(child: Container( +// alignment: Alignment.topRight, +// child: Text("video".tr, style: TextStyle(fontWeight: FontWeight.bold)))), +// SizedBox(width: 12.0,), +// Expanded( +// child: Container( +// alignment: Alignment.topLeft, +// child: Obx(() => Text(indexController.currentFeature[0].properties!["videos"] ?? '', +// style: TextStyle(color: Colors.blue,), +// overflow: TextOverflow.ellipsis,) +// ), +// ), +// ) +// ], +// ): Container(width: 0.0, height: 0.0,), +// ], +// ), +// ), +// ), +// ], +// ), +// SizedBox(height: 20.0,), +// Obx(() => +// indexController.currentAction.isNotEmpty ? +// Row( +// mainAxisAlignment: MainAxisAlignment.spaceAround, +// children: [ +// indexController.rog_mode.value == 0 ? - Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - indexController.currentAction[0][0]["wanttogo"] == false ? - ElevatedButton( - onPressed: (){ - if(indexController.currentAction.isNotEmpty){ - print(indexController.currentAction[0]); - indexController.currentAction[0][0]["wanttogo"] = true; - Map temp = Map.from(indexController.currentAction[0][0]); - indexController.currentAction.clear(); - print("---temp---${temp}"); - indexController.currentAction.add([temp]); - } - indexController.makeAction(context); - }, - child: Text("want_to_go".tr) - ) : - ElevatedButton( - onPressed: (){ - if(indexController.currentAction.isNotEmpty){ - print(indexController.currentAction[0]); - indexController.currentAction[0][0]["wanttogo"] = false; - Map temp = Map.from(indexController.currentAction[0][0]); - indexController.currentAction.clear(); - print("---temp---${temp}"); - indexController.currentAction.add([temp]); - } - indexController.makeAction(context); - }, +// Row( +// mainAxisSize: MainAxisSize.max, +// mainAxisAlignment: MainAxisAlignment.end, +// children: [ +// indexController.currentAction[0][0]["wanttogo"] == false ? +// ElevatedButton( +// onPressed: (){ +// if(indexController.currentAction.isNotEmpty){ +// print(indexController.currentAction[0]); +// indexController.currentAction[0][0]["wanttogo"] = true; +// Map temp = Map.from(indexController.currentAction[0][0]); +// indexController.currentAction.clear(); +// print("---temp---${temp}"); +// indexController.currentAction.add([temp]); +// } +// indexController.makeAction(context); +// }, +// child: Text("want_to_go".tr) +// ) : +// ElevatedButton( +// onPressed: (){ +// if(indexController.currentAction.isNotEmpty){ +// print(indexController.currentAction[0]); +// indexController.currentAction[0][0]["wanttogo"] = false; +// Map temp = Map.from(indexController.currentAction[0][0]); +// indexController.currentAction.clear(); +// print("---temp---${temp}"); +// indexController.currentAction.add([temp]); +// } +// indexController.makeAction(context); +// }, - child: IconButton( - icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "want_to_go".tr,), onPressed: () { +// child: IconButton( +// icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "want_to_go".tr,), onPressed: () { - }, +// }, - ) - ), - indexController.currentAction[0][0]["like"] == false ? - ElevatedButton( - onPressed: (){ - if(indexController.currentAction.isNotEmpty){ - print(indexController.currentAction[0]); - indexController.currentAction[0][0]["like"] = true; - Map temp = Map.from(indexController.currentAction[0][0]); - indexController.currentAction.clear(); - print("---temp---${temp}"); - indexController.currentAction.add([temp]); - } - indexController.makeAction(context); - }, - child: Text("like".tr) - ) : - ElevatedButton( - onPressed: (){ - if(indexController.currentAction.isNotEmpty){ - print(indexController.currentAction[0]); - indexController.currentAction[0][0]["like"] = false; - Map temp = Map.from(indexController.currentAction[0][0]); - indexController.currentAction.clear(); - print("---temp---${temp}"); - indexController.currentAction.add([temp]); - } - indexController.makeAction(context); - }, +// ) +// ), +// indexController.currentAction[0][0]["like"] == false ? +// ElevatedButton( +// onPressed: (){ +// if(indexController.currentAction.isNotEmpty){ +// print(indexController.currentAction[0]); +// indexController.currentAction[0][0]["like"] = true; +// Map temp = Map.from(indexController.currentAction[0][0]); +// indexController.currentAction.clear(); +// print("---temp---${temp}"); +// indexController.currentAction.add([temp]); +// } +// indexController.makeAction(context); +// }, +// child: Text("like".tr) +// ) : +// ElevatedButton( +// onPressed: (){ +// if(indexController.currentAction.isNotEmpty){ +// print(indexController.currentAction[0]); +// indexController.currentAction[0][0]["like"] = false; +// Map temp = Map.from(indexController.currentAction[0][0]); +// indexController.currentAction.clear(); +// print("---temp---${temp}"); +// indexController.currentAction.add([temp]); +// } +// indexController.makeAction(context); +// }, - child: IconButton( - icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "like".tr,), onPressed: () { +// child: IconButton( +// icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "like".tr,), onPressed: () { - }, +// }, - ) - ), - ], - ) +// ) +// ), +// ], +// ) - : - Container(width: 0, height: 0,), - indexController.rog_mode.value == 1 ? - indexController.currentAction[0][0]["checkin"] == false ? - Column( - children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - ElevatedButton( - child: Text("Image"), onPressed: (){ - final ImagePicker _picker = ImagePicker(); - _picker.pickImage(source: ImageSource.camera).then((value){ - print("----- image---- ${value!.path}"); - }); - }, - ) - ], - ), - ElevatedButton( - onPressed: (){ - if(indexController.currentAction.isNotEmpty){ - print(indexController.currentAction[0]); - indexController.currentAction[0][0]["checkin"] = true; - Map temp = Map.from(indexController.currentAction[0][0]); - indexController.currentAction.clear(); - print("---temp---${temp}"); - indexController.currentAction.add([temp]); - } - indexController.makeAction(context); - }, - child: Text("checkin".tr) - ) - ], - ) - : - ElevatedButton( - onPressed: (){ - if(indexController.currentAction.isNotEmpty){ - print(indexController.currentAction[0]); - indexController.currentAction[0][0]["checkin"] = false; - Map temp = Map.from(indexController.currentAction[0][0]); - indexController.currentAction.clear(); - print("---temp---${temp}"); - indexController.currentAction.add([temp]); - } - indexController.makeAction(context); - }, +// : +// Container(width: 0, height: 0,), +// indexController.rog_mode.value == 1 ? +// indexController.currentAction[0][0]["checkin"] == false ? +// Column( +// children: [ +// Row( +// mainAxisSize: MainAxisSize.max, +// children: [ +// ElevatedButton( +// child: Text("Image"), onPressed: (){ +// final ImagePicker _picker = ImagePicker(); +// _picker.pickImage(source: ImageSource.camera).then((value){ +// print("----- image---- ${value!.path}"); +// }); +// }, +// ) +// ], +// ), +// ElevatedButton( +// onPressed: (){ +// if(indexController.currentAction.isNotEmpty){ +// print(indexController.currentAction[0]); +// indexController.currentAction[0][0]["checkin"] = true; +// Map temp = Map.from(indexController.currentAction[0][0]); +// indexController.currentAction.clear(); +// print("---temp---${temp}"); +// indexController.currentAction.add([temp]); +// } +// indexController.makeAction(context); +// }, +// child: Text("checkin".tr) +// ) +// ], +// ) +// : +// ElevatedButton( +// onPressed: (){ +// if(indexController.currentAction.isNotEmpty){ +// print(indexController.currentAction[0]); +// indexController.currentAction[0][0]["checkin"] = false; +// Map temp = Map.from(indexController.currentAction[0][0]); +// indexController.currentAction.clear(); +// print("---temp---${temp}"); +// indexController.currentAction.add([temp]); +// } +// indexController.makeAction(context); +// }, - child: Icon( - Icons.favorite, color: Colors.red) +// child: Icon( +// Icons.favorite, color: Colors.red) - , - ): - Container(width: 0, height: 0,), - ], - ): Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - TextButton( - onPressed: (){ - Get.toNamed(AppPages.LOGIN); - }, - child: Flexible(child: Text("その他のオプションについてはログインしてください"))) - ], - ), - ), - Row( - children: [ - SizedBox(height: 60.0,), - ], - ) - ], - ), - ); - } -} \ No newline at end of file +// , +// ): +// Container(width: 0, height: 0,), +// ], +// ): Row( +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// TextButton( +// onPressed: (){ +// Get.toNamed(AppPages.LOGIN); +// }, +// child: Flexible(child: Text("その他のオプションについてはログインしてください"))) +// ], +// ), +// ), +// Row( +// children: [ +// SizedBox(height: 60.0,), +// ], +// ) +// ], +// ), +// ); +// } +// } \ No newline at end of file diff --git a/lib/widgets/bread_crum_widget.dart b/lib/widgets/bread_crum_widget.dart index 6b8e784..8947966 100644 --- a/lib/widgets/bread_crum_widget.dart +++ b/lib/widgets/bread_crum_widget.dart @@ -1,34 +1,34 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_map/flutter_map.dart'; -import 'package:get/get.dart'; -import 'package:flutter_breadcrumb/flutter_breadcrumb.dart'; -import 'package:rogapp/pages/index/index_controller.dart'; -import 'package:rogapp/widgets/perfecture_widget.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter_map/flutter_map.dart'; +// import 'package:get/get.dart'; +// import 'package:flutter_breadcrumb/flutter_breadcrumb.dart'; +// import 'package:rogapp/pages/index/index_controller.dart'; +// import 'package:rogapp/widgets/perfecture_widget.dart'; -class BreadCrumbWidget extends StatelessWidget { - BreadCrumbWidget({Key? key, this.mapController}) : super(key: key); +// class BreadCrumbWidget extends StatelessWidget { +// BreadCrumbWidget({Key? key, this.mapController}) : super(key: key); - final MapController? mapController; +// final MapController? mapController; - final IndexController indexController = Get.find(); +// final IndexController indexController = Get.find(); - @override - Widget build(BuildContext context) { - print("------ map controller is ${mapController}------------"); - return - Obx(()=> - indexController.perfectures.isNotEmpty && mapController != null ? - BreadCrumb.builder( - itemCount: indexController.perfectures.length, - builder: (index){ - return - BreadCrumbItem( - content: PerfectureWidget(indexController: indexController, mapController: mapController!) //Text('Item$index') - ); - } - ): - const Text("Empty") - ); - } -} \ No newline at end of file +// @override +// Widget build(BuildContext context) { +// print("------ map controller is ${mapController}------------"); +// return +// Obx(()=> +// indexController.perfectures.isNotEmpty && mapController != null ? +// BreadCrumb.builder( +// itemCount: indexController.perfectures.length, +// builder: (index){ +// return +// BreadCrumbItem( +// content: PerfectureWidget(indexController: indexController, mapController: mapController!) //Text('Item$index') +// ); +// } +// ): +// const Text("Empty") +// ); +// } +// } \ No newline at end of file diff --git a/lib/widgets/cat_widget.dart b/lib/widgets/cat_widget.dart index b96a1ed..b242c3d 100644 --- a/lib/widgets/cat_widget.dart +++ b/lib/widgets/cat_widget.dart @@ -1,50 +1,50 @@ -import 'package:flutter/material.dart'; -import 'package:rogapp/pages/index/index_controller.dart'; -import 'package:rogapp/services/location_service.dart'; +// import 'package:flutter/material.dart'; +// import 'package:rogapp/pages/index/index_controller.dart'; +// import 'package:rogapp/services/location_service.dart'; -class CatWidget extends StatefulWidget { - CatWidget({ Key? key, required this.indexController, }) : super(key: key); +// class CatWidget extends StatefulWidget { +// CatWidget({ Key? key, required this.indexController, }) : super(key: key); - IndexController indexController; +// IndexController indexController; - @override - State createState() => _CatWidgetState(); -} +// @override +// State createState() => _CatWidgetState(); +// } -class _CatWidgetState extends State { - String defaultValue = "---"; +// class _CatWidgetState extends State { +// String defaultValue = "---"; - @override - Widget build(BuildContext context) { - return - PopupMenuButton( - onSelected: (value) { - widget.indexController.currentCat.clear(); - widget.indexController.currentCat.add(value.toString()); - widget.indexController.refreshLocationForCat(); - setState(() { - print(value); - //widget.indexController.is_loading.value = true; - defaultValue = value.toString(); - }); - }, - itemBuilder: (BuildContext context){ - List itms = []; - for(dynamic d in widget.indexController.cats[0]){ - PopupMenuItem itm = PopupMenuItem(child: Text(d['category'].toString()), value: d['category'].toString()); - itms.add(itm); - } - return itms; - } +// @override +// Widget build(BuildContext context) { +// return +// PopupMenuButton( +// onSelected: (value) { +// widget.indexController.currentCat.clear(); +// widget.indexController.currentCat.add(value.toString()); +// widget.indexController.refreshLocationForCat(); +// setState(() { +// print(value); +// //widget.indexController.is_loading.value = true; +// defaultValue = value.toString(); +// }); +// }, +// itemBuilder: (BuildContext context){ +// List itms = []; +// for(dynamic d in widget.indexController.cats[0]){ +// PopupMenuItem itm = PopupMenuItem(child: Text(d['category'].toString()), value: d['category'].toString()); +// itms.add(itm); +// } +// return itms; +// } - ); - } -} +// ); +// } +// } -// widget.indexController.cats.map((e) => -// PopupMenuItem( -// value: defaultValue, -// child: Text(e[0]['category'].toString()), -// ) -// ).toList(), \ No newline at end of file +// // widget.indexController.cats.map((e) => +// // PopupMenuItem( +// // value: defaultValue, +// // child: Text(e[0]['category'].toString()), +// // ) +// // ).toList(), \ No newline at end of file diff --git a/lib/widgets/collapsed_widget.dart b/lib/widgets/collapsed_widget.dart new file mode 100644 index 0000000..c1ff322 --- /dev/null +++ b/lib/widgets/collapsed_widget.dart @@ -0,0 +1,31 @@ + +import 'package:flutter/material.dart'; +import 'package:latlong2/latlong.dart'; + +class CollapsedWidget extends StatelessWidget { + + void Function()? addIncident; + + CollapsedWidget({ this.addIncident, Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 4.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + IconButton( + onPressed: addIncident, + icon: Icon(Icons.add_circle_outline_rounded, size: 30,)), + ], + ), + ) + ], + ), + ); + } +} \ No newline at end of file diff --git a/lib/widgets/destination_widget.dart b/lib/widgets/destination_widget.dart index 056594c..9973fca 100644 --- a/lib/widgets/destination_widget.dart +++ b/lib/widgets/destination_widget.dart @@ -1,219 +1,219 @@ -import 'dart:ffi'; +// import 'dart:ffi'; -import 'package:flutter/material.dart'; -import 'package:geojson/geojson.dart'; -import 'package:get/get.dart'; -import 'package:rogapp/model/destination.dart'; -import 'package:rogapp/pages/destination/destination_controller.dart'; -import 'package:rogapp/pages/index/index_controller.dart'; -import 'package:rogapp/widgets/bottom_sheet_new.dart'; -import 'package:rogapp/widgets/bottom_sheet_widget.dart'; -import 'package:timeline_tile/timeline_tile.dart'; +// import 'package:flutter/material.dart'; +// import 'package:geojson/geojson.dart'; +// import 'package:get/get.dart'; +// import 'package:rogapp/model/destination.dart'; +// import 'package:rogapp/pages/destination/destination_controller.dart'; +// import 'package:rogapp/pages/index/index_controller.dart'; +// import 'package:rogapp/widgets/bottom_sheet_new.dart'; +// import 'package:rogapp/widgets/bottom_sheet_widget.dart'; +// import 'package:timeline_tile/timeline_tile.dart'; -class DestinationWidget extends StatelessWidget { - DestinationWidget({ Key? key }) : super(key: key); +// class DestinationWidget extends StatelessWidget { +// DestinationWidget({ Key? key }) : super(key: key); - final DestinationController destinationController = Get.find(); +// final DestinationController destinationController = Get.find(); - final IndexController indexController = Get.find(); +// final IndexController indexController = Get.find(); - final List _items = List.generate(50, (int index) => index); +// final List _items = List.generate(50, (int index) => index); - Image getImage(int index){ - if(destinationController.destinations[index].photos== null || destinationController.destinations[index].photos == ""){ - return Image(image: AssetImage('assets/images/empty_image.png')); - } - else{ - print("------- image is ${destinationController.destinations[index].photos!}------"); - return Image(image: NetworkImage( - destinationController.destinations[index].photos!), - errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { - return Image.asset("assets/images/empty_image.png"); - }, - ); - } - } +// Image getImage(int index){ +// if(destinationController.destinations[index].photos== null || destinationController.destinations[index].photos == ""){ +// return Image(image: AssetImage('assets/images/empty_image.png')); +// } +// else{ +// print("------- image is ${destinationController.destinations[index].photos!}------"); +// return Image(image: NetworkImage( +// destinationController.destinations[index].photos!), +// errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { +// return Image.asset("assets/images/empty_image.png"); +// }, +// ); +// } +// } - bool getSelection(int index){ - bool ret = false; - destinationController.destination_index_data.forEach((element) { - if(index == element["index"]){ - if(element["selected"] == true){ - ret = true; - return; - } - } - }); - return ret; - } +// bool getSelection(int index){ +// bool ret = false; +// destinationController.destination_index_data.forEach((element) { +// if(index == element["index"]){ +// if(element["selected"] == true){ +// ret = true; +// return; +// } +// } +// }); +// return ret; +// } - void doDelete() { - destinationController.currentSelectedDestinations.forEach((element) { - destinationController.deleteDestination(element); - }); - // destinationController.destination_index_data.forEach((element) { - // //print(element["index"]); - // destinationController.deleteDestination(element["index"]); - // }); - // destinationController.destination_index_data.clear(); - } +// void doDelete() { +// destinationController.currentSelectedDestinations.forEach((element) { +// destinationController.deleteDestination(element); +// }); +// // destinationController.destination_index_data.forEach((element) { +// // //print(element["index"]); +// // destinationController.deleteDestination(element["index"]); +// // }); +// // destinationController.destination_index_data.clear(); +// } - void moveUp() { - destinationController.destination_index_data.forEach((element) { - //print(element["index"]); - //int action_id = destinationController.destinations[element["index"]]["id"] as int; - //destinationController.makeOrder(action_id, (element["index"] as int) - 1, "up"); - }); - } +// void moveUp() { +// destinationController.destination_index_data.forEach((element) { +// //print(element["index"]); +// //int action_id = destinationController.destinations[element["index"]]["id"] as int; +// //destinationController.makeOrder(action_id, (element["index"] as int) - 1, "up"); +// }); +// } - void moveDown() { - destinationController.destination_index_data.forEach((element) { - //print(element["index"]); - //int action_id = destinationController.destinations[element["index"]]["id"] as int; - //destinationController.makeOrder(action_id, (element["index"] as int) + 1, "up"); - }); - } +// void moveDown() { +// destinationController.destination_index_data.forEach((element) { +// //print(element["index"]); +// //int action_id = destinationController.destinations[element["index"]]["id"] as int; +// //destinationController.makeOrder(action_id, (element["index"] as int) + 1, "up"); +// }); +// } - void interChange() { - // int first_index = -1; - // destinationController.destination_index_data.forEach((element) { - // //print(element["index"]); - // int action_id = destinationController.destinations[element["index"]]["id"] as int; - // destinationController.makeOrder(action_id, (element["index"] as int) + 1, "up"); +// void interChange() { +// // int first_index = -1; +// // destinationController.destination_index_data.forEach((element) { +// // //print(element["index"]); +// // int action_id = destinationController.destinations[element["index"]]["id"] as int; +// // destinationController.makeOrder(action_id, (element["index"] as int) + 1, "up"); - // }); - } +// // }); +// } - @override - Widget build(BuildContext context) { +// @override +// Widget build(BuildContext context) { - print("------ destination widget------ ${destinationController.destinationCount.value} ----------"); +// print("------ destination widget------ ${destinationController.destinationCount.value} ----------"); - return - Obx(() => - Stack( - children: [ - Padding( - padding: const EdgeInsets.only(top:45.0), - child: ListView.builder( - itemCount: destinationController.destinationCount.value, +// return +// Obx(() => +// Stack( +// children: [ +// Padding( +// padding: const EdgeInsets.only(top:45.0), +// child: ListView.builder( +// itemCount: destinationController.destinationCount.value, - itemBuilder: (BuildContext context, int index) { - return - TimelineTile( - alignment: TimelineAlign.manual, - lineXY: 0.2, - isFirst: index == 0 ? true : false, - indicatorStyle: IndicatorStyle( - color: index == 0 ? (Colors.red) : (Colors.grey[400])! - ), - key: Key(index.toString()), - endChild: Card( - child: Container( - constraints: const BoxConstraints( - minHeight: 80, - ), - child: ListTile( - onTap: () async { - { - Destination? fs = destinationController.destinations[index]; - print("----fsf-----${fs}"); - if(fs != null){ +// itemBuilder: (BuildContext context, int index) { +// return +// TimelineTile( +// alignment: TimelineAlign.manual, +// lineXY: 0.2, +// isFirst: index == 0 ? true : false, +// indicatorStyle: IndicatorStyle( +// color: index == 0 ? (Colors.red) : (Colors.grey[400])! +// ), +// key: Key(index.toString()), +// endChild: Card( +// child: Container( +// constraints: const BoxConstraints( +// minHeight: 80, +// ), +// child: ListTile( +// onTap: () async { +// { +// Destination? fs = destinationController.destinations[index]; +// print("----fsf-----${fs}"); +// if(fs != null){ - if(indexController.currentDestinationFeature.length > 0) { - indexController.currentDestinationFeature.clear(); - } - indexController.currentDestinationFeature.add(fs); - //indexController.getAction(); +// if(indexController.currentDestinationFeature.length > 0) { +// indexController.currentDestinationFeature.clear(); +// } +// indexController.currentDestinationFeature.add(fs); +// //indexController.getAction(); - showModalBottomSheet(context: context, isScrollControlled: true, - //builder:((context) => BottomSheetWidget()) - builder:((context) => BottomSheetNew()) - ); - } - }; - }, - onLongPress: (){ +// showModalBottomSheet(context: context, isScrollControlled: true, +// //builder:((context) => BottomSheetWidget()) +// builder:((context) => BottomSheetNew()) +// ); +// } +// }; +// }, +// onLongPress: (){ - Destination? match_element = null; - destinationController.currentSelectedDestinations.forEach((element) { - if(element.location_id == destinationController.destinations[index].location_id){ - match_element = element; - return; - } - }); +// Destination? match_element = null; +// destinationController.currentSelectedDestinations.forEach((element) { +// if(element.location_id == destinationController.destinations[index].location_id){ +// match_element = element; +// return; +// } +// }); - if(match_element != null){ - destinationController.currentSelectedDestinations.remove(destinationController.destinations[index]); - } +// if(match_element != null){ +// destinationController.currentSelectedDestinations.remove(destinationController.destinations[index]); +// } - destinationController.currentSelectedDestinations.add(destinationController.destinations[index]); +// destinationController.currentSelectedDestinations.add(destinationController.destinations[index]); - destinationController.PopulateDestinations(); +// destinationController.PopulateDestinations(); - }, - selectedTileColor: Colors.amberAccent, - selected:destinationController.destinations[index].selected!, - leading: getImage(index), - title: Text(destinationController.destinations[index].name!), - subtitle: Text(destinationController.destinations[index].category!), - ), - ), - ), - startChild: - destinationController.matrix["rows"][0]["elements"] != null ? - Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - //Text(destinationController.matrix["rows"][0]["elements"][index]["distance"]["text"].toString()), - //Text(destinationController.matrix["rows"][0]["elements"][index]["duration"]["text"].toString()) - ], - ): - Container() - , - ); +// }, +// selectedTileColor: Colors.amberAccent, +// selected:destinationController.destinations[index].selected!, +// leading: getImage(index), +// title: Text(destinationController.destinations[index].name!), +// subtitle: Text(destinationController.destinations[index].category!), +// ), +// ), +// ), +// startChild: +// destinationController.matrix["rows"][0]["elements"] != null ? +// Column( +// mainAxisAlignment: MainAxisAlignment.spaceEvenly, +// children: [ +// //Text(destinationController.matrix["rows"][0]["elements"][index]["distance"]["text"].toString()), +// //Text(destinationController.matrix["rows"][0]["elements"][index]["duration"]["text"].toString()) +// ], +// ): +// Container() +// , +// ); - } - ), - ), - Container( - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.3), - spreadRadius: 5, - blurRadius: 3, - offset: Offset(0, 7), // changes position of shadow - ), - ], - ), - height: 44.0, - width: MediaQuery.of(context).size.width, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - IconButton( - icon:Icon(Icons.cancel), - //onPressed: (){doDelete();}, - onPressed: destinationController.currentSelectedDestinations.length > 0 ? doDelete : null, - ), - IconButton( - icon:Icon(Icons.move_up), - onPressed: destinationController.destination_index_data.length > 0 ? moveUp : null, - ), - IconButton( - icon:Icon(Icons.move_down), - onPressed: destinationController.destination_index_data.length > 0 ? moveDown : null, - ), - IconButton( - icon:Icon(Icons.sync), - onPressed: destinationController.destination_index_data.length == 2 ? interChange : null, - ), - ], - ), - ) - ], - ) - ); - } -} \ No newline at end of file +// } +// ), +// ), +// Container( +// decoration: BoxDecoration( +// boxShadow: [ +// BoxShadow( +// color: Colors.grey.withOpacity(0.3), +// spreadRadius: 5, +// blurRadius: 3, +// offset: Offset(0, 7), // changes position of shadow +// ), +// ], +// ), +// height: 44.0, +// width: MediaQuery.of(context).size.width, +// child: Row( +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// IconButton( +// icon:Icon(Icons.cancel), +// //onPressed: (){doDelete();}, +// onPressed: destinationController.currentSelectedDestinations.length > 0 ? doDelete : null, +// ), +// IconButton( +// icon:Icon(Icons.move_up), +// onPressed: destinationController.destination_index_data.length > 0 ? moveUp : null, +// ), +// IconButton( +// icon:Icon(Icons.move_down), +// onPressed: destinationController.destination_index_data.length > 0 ? moveDown : null, +// ), +// IconButton( +// icon:Icon(Icons.sync), +// onPressed: destinationController.destination_index_data.length == 2 ? interChange : null, +// ), +// ], +// ), +// ) +// ], +// ) +// ); +// } +// } \ No newline at end of file diff --git a/lib/widgets/fake_search.dart b/lib/widgets/fake_search.dart index 6c42961..d84c399 100644 --- a/lib/widgets/fake_search.dart +++ b/lib/widgets/fake_search.dart @@ -1,45 +1,45 @@ -import 'package:flutter/material.dart'; -import 'package:rogapp/pages/search/search_page.dart'; +// import 'package:flutter/material.dart'; +// import 'package:rogapp/pages/search/search_page.dart'; -class FakeSearch extends StatelessWidget { - const FakeSearch({ - Key? key, - }) : super(key: key); +// class FakeSearch extends StatelessWidget { +// const FakeSearch({ +// Key? key, +// }) : super(key: key); - @override - Widget build(BuildContext context) { - return InkWell( - onTap: (){ - Navigator.push(context, MaterialPageRoute(builder: (context) => SearchPage())); - }, - child: Container( - height: 35, - decoration: BoxDecoration( - border: Border.all(color:Colors.blue, width: 1.4), - borderRadius: BorderRadius.circular(25) - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const Padding( - padding: EdgeInsets.symmetric(horizontal: 8.0), - child: Icon(Icons.search, color: Colors.grey,), - ), - const Text("What are you looking for", style: TextStyle(fontSize: 16, color: Colors.grey),), - Container( - height: 32, - width: 75, - decoration: BoxDecoration( - color: Colors.blue, - borderRadius: BorderRadius.circular(25), +// @override +// Widget build(BuildContext context) { +// return InkWell( +// onTap: (){ +// Navigator.push(context, MaterialPageRoute(builder: (context) => SearchPage())); +// }, +// child: Container( +// height: 35, +// decoration: BoxDecoration( +// border: Border.all(color:Colors.blue, width: 1.4), +// borderRadius: BorderRadius.circular(25) +// ), +// child: Row( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: [ +// const Padding( +// padding: EdgeInsets.symmetric(horizontal: 8.0), +// child: Icon(Icons.search, color: Colors.grey,), +// ), +// const Text("What are you looking for", style: TextStyle(fontSize: 16, color: Colors.grey),), +// Container( +// height: 32, +// width: 75, +// decoration: BoxDecoration( +// color: Colors.blue, +// borderRadius: BorderRadius.circular(25), - ), - child: const Center(child: Text("Search", style: TextStyle(fontSize: 16, color: Colors.white),)), - ) +// ), +// child: const Center(child: Text("Search", style: TextStyle(fontSize: 16, color: Colors.white),)), +// ) - ], - ), - ), - ); - } -} \ No newline at end of file +// ], +// ), +// ), +// ); +// } +// } \ No newline at end of file diff --git a/lib/widgets/list_widget.dart b/lib/widgets/list_widget.dart index 1451f52..d2a166b 100644 --- a/lib/widgets/list_widget.dart +++ b/lib/widgets/list_widget.dart @@ -1,63 +1,63 @@ -import 'package:flutter/material.dart'; -import 'package:geojson/geojson.dart'; -import 'package:get/get.dart'; -import 'package:rogapp/pages/index/index_controller.dart'; -import 'package:rogapp/widgets/bottom_sheet_new.dart'; -import 'package:rogapp/widgets/bottom_sheet_widget.dart'; +// import 'package:flutter/material.dart'; +// import 'package:geojson/geojson.dart'; +// import 'package:get/get.dart'; +// import 'package:rogapp/pages/index/index_controller.dart'; +// import 'package:rogapp/widgets/bottom_sheet_new.dart'; +// import 'package:rogapp/widgets/bottom_sheet_widget.dart'; -class ListWidget extends StatelessWidget { - ListWidget({ Key? key }) : super(key: key); +// class ListWidget extends StatelessWidget { +// ListWidget({ Key? key }) : super(key: key); - final IndexController indexController = Get.find(); +// final IndexController indexController = Get.find(); - Image getImage(int index){ - if(indexController.locations[0].collection[index].properties!["photos"] == null || indexController.locations[0].collection[index].properties!["photos"] == ""){ - return Image(image: AssetImage('assets/images/empty_image.png')); - } - else{ - return Image( - image: NetworkImage(indexController.locations[0].collection[index].properties!["photos"]), - errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { - return Image.asset("assets/images/empty_image.png"); - }, - ); - } - } +// Image getImage(int index){ +// if(indexController.locations[0].collection[index].properties!["photos"] == null || indexController.locations[0].collection[index].properties!["photos"] == ""){ +// return Image(image: AssetImage('assets/images/empty_image.png')); +// } +// else{ +// return Image( +// image: NetworkImage(indexController.locations[0].collection[index].properties!["photos"]), +// errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { +// return Image.asset("assets/images/empty_image.png"); +// }, +// ); +// } +// } - void changeCurrentFeature(GeoJsonFeature fs){ - if(indexController.currentFeature.length > 0){ - indexController.currentFeature.clear(); - } - indexController.currentFeature.add(fs); - } +// void changeCurrentFeature(GeoJsonFeature fs){ +// if(indexController.currentFeature.length > 0){ +// indexController.currentFeature.clear(); +// } +// indexController.currentFeature.add(fs); +// } - @override - Widget build(BuildContext context) { - return Obx(() => - indexController.locations.length > 0 ? - ListView.builder( - itemCount: indexController.locations[0].collection.length, - shrinkWrap: true, - itemBuilder: (_, index){ - return Card( - child: ListTile( - onTap: (){ - GeoJsonFeature gf = indexController.locations[0].collection[index]; - changeCurrentFeature(gf); - showModalBottomSheet( - isScrollControlled: true, - context: context, - //builder: (context) => BottomSheetWidget(), - builder:((context) => BottomSheetNew()) - ); - }, - leading: getImage(index), - title: indexController.locations[0].collection[index].properties!['location_name'] != null ? Text(indexController.locations[0].collection[index].properties!['location_name'].toString()) : Text(""), - subtitle: indexController.locations[0].collection[index].properties!['category'] != null ? Text(indexController.locations[0].collection[index].properties!['category']) : Text(""), - ), - ); - }, - ) : Container(width: 0, height: 0,), - ); - } -} \ No newline at end of file +// @override +// Widget build(BuildContext context) { +// return Obx(() => +// indexController.locations.length > 0 ? +// ListView.builder( +// itemCount: indexController.locations[0].collection.length, +// shrinkWrap: true, +// itemBuilder: (_, index){ +// return Card( +// child: ListTile( +// onTap: (){ +// GeoJsonFeature gf = indexController.locations[0].collection[index]; +// changeCurrentFeature(gf); +// showModalBottomSheet( +// isScrollControlled: true, +// context: context, +// //builder: (context) => BottomSheetWidget(), +// builder:((context) => BottomSheetNew()) +// ); +// }, +// leading: getImage(index), +// title: indexController.locations[0].collection[index].properties!['location_name'] != null ? Text(indexController.locations[0].collection[index].properties!['location_name'].toString()) : Text(""), +// subtitle: indexController.locations[0].collection[index].properties!['category'] != null ? Text(indexController.locations[0].collection[index].properties!['category']) : Text(""), +// ), +// ); +// }, +// ) : Container(width: 0, height: 0,), +// ); +// } +// } \ No newline at end of file diff --git a/lib/widgets/map_widget.dart b/lib/widgets/map_widget.dart index 9bdda49..a902127 100644 --- a/lib/widgets/map_widget.dart +++ b/lib/widgets/map_widget.dart @@ -1,150 +1,150 @@ -import 'dart:async'; -import 'package:flutter/material.dart'; -import 'package:flutter_map/plugin_api.dart'; -import 'package:flutter_map_location_marker/flutter_map_location_marker.dart'; -import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart';2 -import 'package:get/get.dart'; -import 'package:get/get_state_manager/get_state_manager.dart'; -import 'package:latlong2/latlong.dart'; -import 'package:rogapp/pages/index/index_controller.dart'; -import 'package:rogapp/widgets/base_layer_widget.dart'; -import 'package:rogapp/widgets/bottom_sheet_new.dart'; -import 'package:rogapp/widgets/bottom_sheet_widget.dart'; +// import 'dart:async'; +// import 'package:flutter/material.dart'; +// import 'package:flutter_map/plugin_api.dart'; +// import 'package:flutter_map_location_marker/flutter_map_location_marker.dart'; +// import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart';2 +// import 'package:get/get.dart'; +// import 'package:get/get_state_manager/get_state_manager.dart'; +// import 'package:latlong2/latlong.dart'; +// import 'package:rogapp/pages/index/index_controller.dart'; +// import 'package:rogapp/widgets/base_layer_widget.dart'; +// import 'package:rogapp/widgets/bottom_sheet_new.dart'; +// import 'package:rogapp/widgets/bottom_sheet_widget.dart'; -class MapWidget extends StatelessWidget { +// class MapWidget extends StatelessWidget { - final IndexController indexController = Get.find(); +// final IndexController indexController = Get.find(); - MapWidget({ Key? key}) : super(key: key); +// MapWidget({ Key? key}) : super(key: key); - StreamSubscription? subscription; +// StreamSubscription? subscription; - @override - Widget build(BuildContext context) { +// @override +// Widget build(BuildContext context) { - print("---------- rog mode is ${indexController.rog_mode.value.toString()}----------"); +// print("---------- rog mode is ${indexController.rog_mode.value.toString()}----------"); - final PopupController _popupController = PopupController(); - return Stack( - children: [ - Obx(() => - indexController.is_loading == true ? Padding( - padding: const EdgeInsets.only(top: 60.0), - child: CircularProgressIndicator(), - ): - FlutterMap( - //mapController: mapController, - options: MapOptions( - onMapCreated: (c){ - indexController.mapController = c; +// final PopupController _popupController = PopupController(); +// return Stack( +// children: [ +// Obx(() => +// indexController.is_loading == true ? Padding( +// padding: const EdgeInsets.only(top: 60.0), +// child: CircularProgressIndicator(), +// ): +// FlutterMap( +// //mapController: mapController, +// options: MapOptions( +// onMapCreated: (c){ +// indexController.mapController = c; - indexController.mapController!.onReady.then((_) { - indexController.is_mapController_loaded.value = true; - subscription = indexController.mapController!.mapEventStream.listen((MapEvent mapEvent) { - if (mapEvent is MapEventMoveStart) { - //print(DateTime.now().toString() + ' [MapEventMoveStart] START'); - // do something - } - if (mapEvent is MapEventMoveEnd) { - //print(DateTime.now().toString() + ' [MapEventMoveStart] END'); - indexController.loadLocationsBound(); - } - }); - }); +// indexController.mapController!.onReady.then((_) { +// indexController.is_mapController_loaded.value = true; +// subscription = indexController.mapController!.mapEventStream.listen((MapEvent mapEvent) { +// if (mapEvent is MapEventMoveStart) { +// //print(DateTime.now().toString() + ' [MapEventMoveStart] START'); +// // do something +// } +// if (mapEvent is MapEventMoveEnd) { +// //print(DateTime.now().toString() + ' [MapEventMoveStart] END'); +// indexController.loadLocationsBound(); +// } +// }); +// }); - }, - //center: LatLng(37.15319600454702, 139.58765950528198), - bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]), - zoom: 1, - maxZoom: 24, - interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag, - plugins: [ - MarkerClusterPlugin(), - ], +// }, +// //center: LatLng(37.15319600454702, 139.58765950528198), +// bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]), +// zoom: 1, +// maxZoom: 24, +// interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag, +// plugins: [ +// MarkerClusterPlugin(), +// ], - onPositionChanged: (MapPosition pos, isvalue){ - }, - onTap: (_, __) => - _popupController - .hideAllPopups(), // Hide popup when the map is tapped. - ), - children: [ - BaseLayer(), - LocationMarkerLayerWidget(), +// onPositionChanged: (MapPosition pos, isvalue){ +// }, +// onTap: (_, __) => +// _popupController +// .hideAllPopups(), // Hide popup when the map is tapped. +// ), +// children: [ +// BaseLayer(), +// LocationMarkerLayerWidget(), - indexController.locations.length > 0 ? - MarkerClusterLayerWidget( - options: MarkerClusterLayerOptions( - spiderfyCircleRadius: 0, - spiderfySpiralDistanceMultiplier: 2, - circleSpiralSwitchover: 12, - maxClusterRadius: 0, - rotate: true, - onMarkerTap: (marker){ - GeoJsonFeature? fs = indexController.getFeatureForLatLong(marker.point.latitude, marker.point.longitude); - //print("------- fs ${fs}------"); - if(fs != null){ - indexController.currentFeature.clear(); - indexController.currentFeature.add(fs); - //print("----- fs is ${fs.properties!['photos']}"); - indexController.getAction(); +// indexController.locations.length > 0 ? +// MarkerClusterLayerWidget( +// options: MarkerClusterLayerOptions( +// spiderfyCircleRadius: 0, +// spiderfySpiralDistanceMultiplier: 2, +// circleSpiralSwitchover: 12, +// maxClusterRadius: 0, +// rotate: true, +// onMarkerTap: (marker){ +// GeoJsonFeature? fs = indexController.getFeatureForLatLong(marker.point.latitude, marker.point.longitude); +// //print("------- fs ${fs}------"); +// if(fs != null){ +// indexController.currentFeature.clear(); +// indexController.currentFeature.add(fs); +// //print("----- fs is ${fs.properties!['photos']}"); +// indexController.getAction(); - showModalBottomSheet( - context: context, - isScrollControlled: true, - isDismissible: true, - builder:((context) => BottomSheetNew()) - //builder:((context) => BottomSheetWidget()) - ); - } +// showModalBottomSheet( +// context: context, +// isScrollControlled: true, +// isDismissible: true, +// builder:((context) => BottomSheetNew()) +// //builder:((context) => BottomSheetWidget()) +// ); +// } - }, +// }, - size: Size(40, 40), - anchor: AnchorPos.align(AnchorAlign.center), - fitBoundsOptions: const FitBoundsOptions( - padding: EdgeInsets.all(50), - maxZoom: 265, - ), - markers:indexController.locations[0].collection.map((i) { - print("i si ${i.properties!['location_id']}"); - GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint; - print("lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}"); - return Marker( - anchorPos: AnchorPos.align(AnchorAlign.center), - height: 22.0, - width: 22.0, - point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude), - builder: (ctx) => Icon(Icons.pin_drop), - // builder: (ctx) => i.properties!["category"] != null ? - // ImageIcon( - // AssetImage("assets/images/${i.properties!["category"]}.png"), - // color: Color(0xFF3A5A98), - // size:12.0, - // ) - // : Icon(Icons.pin_drop), +// size: Size(40, 40), +// anchor: AnchorPos.align(AnchorAlign.center), +// fitBoundsOptions: const FitBoundsOptions( +// padding: EdgeInsets.all(50), +// maxZoom: 265, +// ), +// markers:indexController.locations[0].collection.map((i) { +// print("i si ${i.properties!['location_id']}"); +// GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint; +// print("lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}"); +// return Marker( +// anchorPos: AnchorPos.align(AnchorAlign.center), +// height: 22.0, +// width: 22.0, +// point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude), +// builder: (ctx) => Icon(Icons.pin_drop), +// // builder: (ctx) => i.properties!["category"] != null ? +// // ImageIcon( +// // AssetImage("assets/images/${i.properties!["category"]}.png"), +// // color: Color(0xFF3A5A98), +// // size:12.0, +// // ) +// // : Icon(Icons.pin_drop), - ); - }).toList(), - builder: (context, markers) { - return Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20.0), - color: Colors.blue), - child: Center( - child: Text( - markers.length.toString(), - style: TextStyle(color: Colors.white), - ), - ), - ); - }, - ), - ): Container(height:0,width: 0), - ], - ) - ) - ], - ); - } -} \ No newline at end of file +// ); +// }).toList(), +// builder: (context, markers) { +// return Container( +// decoration: BoxDecoration( +// borderRadius: BorderRadius.circular(20.0), +// color: Colors.blue), +// child: Center( +// child: Text( +// markers.length.toString(), +// style: TextStyle(color: Colors.white), +// ), +// ), +// ); +// }, +// ), +// ): Container(height:0,width: 0), +// ], +// ) +// ) +// ], +// ); +// } +// } \ No newline at end of file diff --git a/lib/widgets/perfecture_widget.dart b/lib/widgets/perfecture_widget.dart index 543824f..ceea448 100644 --- a/lib/widgets/perfecture_widget.dart +++ b/lib/widgets/perfecture_widget.dart @@ -1,265 +1,44 @@ -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'; +// 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 { +// class PerfectureWidget extends StatefulWidget { - IndexController indexController; - MapController mapController; - - - PerfectureWidget({Key? key, required this.indexController, required this.mapController}) : super(key: key){ - //indexController.zoomtoMainPerf("9", mapController); - } - - @override - State createState() => _PerfectureWidgetState(); -} - -class _PerfectureWidgetState extends State { - - @override - void initState() { - super.initState(); - } - - - bool isNumeric(String s) { - if (s == null) { - return false; - } - return double.tryParse(s) != null; - } - - - List> getDropdownItems() { - List> dropDownItems = []; - - for (Map currency in widget.indexController.perfectures[0]) { - //print(currency["id"].toString()); - var newDropdown = DropdownMenuItem( - child: Text(currency["adm1_ja"].toString()), - value: currency["id"].toString(), - ); - - dropDownItems.add(newDropdown); - } - return dropDownItems; - } - - List> getSubDropdownItems() { - List> dropDownItems = []; - - if(widget.indexController.subPerfs.isNotEmpty){ - - for (Map currency in widget.indexController.subPerfs[0]) { - var newDropdown = DropdownMenuItem( - child: Text(currency["adm2_ja"].toString()), - value: currency["id"].toString(), - ); - - dropDownItems.add(newDropdown); - } - } - return dropDownItems; - } - - List> getCustomArea(){ - List> dropDownItems = []; - if(widget.indexController.areas.isNotEmpty){ - - for (Map currency in widget.indexController.areas[0]) { - var newDropdown = DropdownMenuItem( - child: Text(currency["area_nm"].toString()), - value: currency["id"].toString(), - ); - - dropDownItems.add(newDropdown); - } - - } - - if(widget.indexController.customAreas.isNotEmpty){ - - for (Map currency in widget.indexController.customAreas[0]) { - var newDropdown = DropdownMenuItem( - child: Text(currency["event_name"].toString()), - value: currency["event_name"].toString(), - ); - - dropDownItems.add(newDropdown); - } - - } - - 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) { - - return Obx(() => - Row( - children: [ - DropdownButton( - value: widget.indexController.dropdownValue, - icon: const Icon(Icons.arrow_downward), - elevation: 16, - style: const TextStyle(color: Colors.deepPurple), - underline: Container( - height: 2, - color: Colors.deepPurpleAccent, - ), - onChanged: (String? newValue) { - //setState(() { - if(newValue != null){ - widget.indexController.is_loading.value = true; - widget.indexController.dropdownValue = newValue; - widget.indexController.populateForPerf(newValue, widget.mapController); - } - //}); - }, - items: getDropdownItems() - ), - - // Gifu areas - widget.indexController.areas.isNotEmpty ? - DropdownButton( - value: widget.indexController.areaDropdownValue, - 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) { - if (isNumeric(newValue!)){ - widget.indexController.is_custom_area_selected.value = false; - } - else{ - widget.indexController.loadCustomLocation(newValue); - widget.indexController.is_custom_area_selected.value = true; - widget.indexController.subPerfs.clear(); - widget.indexController.cats.clear(); - } - setState(() { - widget.indexController.locations.clear(); - if(newValue != null){ - widget.indexController.is_loading.value = true; - widget.indexController.areaDropdownValue = newValue; - widget.indexController.populateSubPerForArea(newValue, widget.mapController); - } - }); - }, - items: getCustomArea(), - ): const Text(""), - - widget.indexController.subPerfs.isNotEmpty ? - DropdownButton( - value: widget.indexController.subDropdownValue, - 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; - widget.indexController.loadCatForCity(newValue); - } - }); - }, - items: - getSubDropdownItems() - ) : - const Text(""), - //CatWidget(indexController: widget.indexController,), - widget.indexController.cats.length > 0 ? - 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.cateogory = newValue; - widget.indexController.currentCat.clear(); - widget.indexController.currentCat.add(newValue); - widget.indexController.populateForSubPerf(widget.indexController.subDropdownValue, widget.mapController); - //widget.indexController.loadLocationforSubPerf(newValue, widget.mapController); - //widget.indexController.subDropdownValue = newValue; - } - }); - }, - items: - getCategory(), - ) - : - Container(), - - ], - ), - ); - } -} - - - -// class PerfectureWidget extends StatefulWidget { - -// HomeController homeController; +// IndexController indexController; // MapController mapController; -// PerfectureWidget({required this.homeController, required this.mapController}); + +// PerfectureWidget({Key? key, required this.indexController, required this.mapController}) : super(key: key){ +// //indexController.zoomtoMainPerf("9", mapController); +// } // @override // State createState() => _PerfectureWidgetState(); // } // class _PerfectureWidgetState extends State { -// String dropdownValue = "9"; + +// @override +// void initState() { +// super.initState(); +// } + + +// bool isNumeric(String s) { +// if (s == null) { +// return false; +// } +// return double.tryParse(s) != null; +// } + // List> getDropdownItems() { // List> dropDownItems = []; -// for (Map currency in widget.homeController.perfectures[0]) { +// for (Map currency in widget.indexController.perfectures[0]) { // //print(currency["id"].toString()); // var newDropdown = DropdownMenuItem( // child: Text(currency["adm1_ja"].toString()), @@ -274,9 +53,9 @@ class _PerfectureWidgetState extends State { // List> getSubDropdownItems() { // List> dropDownItems = []; -// if(widget.homeController.subPerfs.length > 0){ +// if(widget.indexController.subPerfs.isNotEmpty){ -// for (Map currency in widget.homeController.subPerfs[0]) { +// for (Map currency in widget.indexController.subPerfs[0]) { // var newDropdown = DropdownMenuItem( // child: Text(currency["adm2_ja"].toString()), // value: currency["id"].toString(), @@ -288,13 +67,55 @@ class _PerfectureWidgetState extends State { // return dropDownItems; // } -// @override -// void initState() { -// super.initState(); -// widget.homeController.loadSubPerfFor("9"); -// widget.homeController.zoomtoMainPerf("9", widget.mapController); +// List> getCustomArea(){ +// List> dropDownItems = []; +// if(widget.indexController.areas.isNotEmpty){ + +// for (Map currency in widget.indexController.areas[0]) { +// var newDropdown = DropdownMenuItem( +// child: Text(currency["area_nm"].toString()), +// value: currency["id"].toString(), +// ); + +// dropDownItems.add(newDropdown); +// } + +// } + +// if(widget.indexController.customAreas.isNotEmpty){ + +// for (Map currency in widget.indexController.customAreas[0]) { +// var newDropdown = DropdownMenuItem( +// child: Text(currency["event_name"].toString()), +// value: currency["event_name"].toString(), +// ); + +// dropDownItems.add(newDropdown); +// } + +// } + +// 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) { @@ -302,7 +123,7 @@ class _PerfectureWidgetState extends State { // Row( // children: [ // DropdownButton( -// value: dropdownValue, +// value: widget.indexController.dropdownValue, // icon: const Icon(Icons.arrow_downward), // elevation: 16, // style: const TextStyle(color: Colors.deepPurple), @@ -313,45 +134,105 @@ class _PerfectureWidgetState extends State { // onChanged: (String? newValue) { // //setState(() { // if(newValue != null){ -// dropdownValue = newValue; -// widget.homeController.loadLocationforPerf(newValue, widget.mapController); -// widget.homeController.loadSubPerfFor(newValue); -// //SubDropdownValue = widget.homeController.getSubInitialVal(); -// //widget.mapController.fitBounds(widget.homeController.currentBound[0]); -// widget.homeController.zoomtoMainPerf(newValue, widget.mapController); +// widget.indexController.is_loading.value = true; +// widget.indexController.dropdownValue = newValue; +// widget.indexController.populateForPerf(newValue, widget.mapController); // } // //}); // }, // items: getDropdownItems() // ), -// widget.homeController.subPerfs.length > 0 ? - +// // Gifu areas +// widget.indexController.areas.isNotEmpty ? // DropdownButton( -// value: widget.homeController.SubDropdownValue, +// value: widget.indexController.areaDropdownValue, +// 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) { +// if (isNumeric(newValue!)){ +// widget.indexController.is_custom_area_selected.value = false; +// } +// else{ +// widget.indexController.loadCustomLocation(newValue); +// widget.indexController.is_custom_area_selected.value = true; +// widget.indexController.subPerfs.clear(); +// widget.indexController.cats.clear(); +// } +// setState(() { +// widget.indexController.locations.clear(); +// if(newValue != null){ +// widget.indexController.is_loading.value = true; +// widget.indexController.areaDropdownValue = newValue; +// widget.indexController.populateSubPerForArea(newValue, widget.mapController); +// } +// }); +// }, +// items: getCustomArea(), +// ): const Text(""), + +// widget.indexController.subPerfs.isNotEmpty ? +// DropdownButton( +// value: widget.indexController.subDropdownValue, // icon: const Icon(Icons.arrow_downward), // elevation: 16, // style: const TextStyle(color: Colors.deepPurple), -// hint: Container( -// child: Text("select"), -// ), +// hint: const Text("select"), // underline: Container( // height: 2, // color: Colors.deepPurpleAccent, // ), // onChanged: (String? newValue) { -// //setState(() { +// setState(() { // if(newValue != null){ -// widget.homeController.loadLocationforSubPerf(newValue, widget.mapController); -// widget.homeController.SubDropdownValue = newValue; -// widget.homeController.zoomtoSubPerf(newValue, widget.mapController); +// //widget.indexController.is_loading.value = true; +// //widget.indexController.populateForSubPerf(newValue, widget.mapController); +// //widget.indexController.loadLocationforSubPerf(newValue, widget.mapController); +// widget.indexController.subDropdownValue = newValue; +// widget.indexController.loadCatForCity(newValue); // } -// //}); +// }); // }, // items: // getSubDropdownItems() // ) : -// Text("") +// const Text(""), +// //CatWidget(indexController: widget.indexController,), +// widget.indexController.cats.length > 0 ? +// 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.cateogory = newValue; +// widget.indexController.currentCat.clear(); +// widget.indexController.currentCat.add(newValue); +// widget.indexController.populateForSubPerf(widget.indexController.subDropdownValue, widget.mapController); +// //widget.indexController.loadLocationforSubPerf(newValue, widget.mapController); +// //widget.indexController.subDropdownValue = newValue; +// } +// }); +// }, +// items: +// getCategory(), +// ) +// : +// Container(), // ], // ), @@ -359,3 +240,122 @@ class _PerfectureWidgetState extends State { // } // } + + +// // class PerfectureWidget extends StatefulWidget { + +// // HomeController homeController; +// // MapController mapController; + +// // PerfectureWidget({required this.homeController, required this.mapController}); + +// // @override +// // State createState() => _PerfectureWidgetState(); +// // } + +// // class _PerfectureWidgetState extends State { +// // String dropdownValue = "9"; + +// // List> getDropdownItems() { +// // List> dropDownItems = []; + +// // for (Map currency in widget.homeController.perfectures[0]) { +// // //print(currency["id"].toString()); +// // var newDropdown = DropdownMenuItem( +// // child: Text(currency["adm1_ja"].toString()), +// // value: currency["id"].toString(), +// // ); + +// // dropDownItems.add(newDropdown); +// // } +// // return dropDownItems; +// // } + +// // List> getSubDropdownItems() { +// // List> dropDownItems = []; + +// // if(widget.homeController.subPerfs.length > 0){ + +// // for (Map currency in widget.homeController.subPerfs[0]) { +// // var newDropdown = DropdownMenuItem( +// // child: Text(currency["adm2_ja"].toString()), +// // value: currency["id"].toString(), +// // ); + +// // dropDownItems.add(newDropdown); +// // } +// // } +// // return dropDownItems; +// // } + +// // @override +// // void initState() { +// // super.initState(); +// // widget.homeController.loadSubPerfFor("9"); +// // widget.homeController.zoomtoMainPerf("9", widget.mapController); +// // } + +// // @override +// // Widget build(BuildContext context) { + +// // return Obx(() => +// // Row( +// // children: [ +// // DropdownButton( +// // value: dropdownValue, +// // icon: const Icon(Icons.arrow_downward), +// // elevation: 16, +// // style: const TextStyle(color: Colors.deepPurple), +// // underline: Container( +// // height: 2, +// // color: Colors.deepPurpleAccent, +// // ), +// // onChanged: (String? newValue) { +// // //setState(() { +// // if(newValue != null){ +// // dropdownValue = newValue; +// // widget.homeController.loadLocationforPerf(newValue, widget.mapController); +// // widget.homeController.loadSubPerfFor(newValue); +// // //SubDropdownValue = widget.homeController.getSubInitialVal(); +// // //widget.mapController.fitBounds(widget.homeController.currentBound[0]); +// // widget.homeController.zoomtoMainPerf(newValue, widget.mapController); +// // } +// // //}); +// // }, +// // items: getDropdownItems() +// // ), + +// // widget.homeController.subPerfs.length > 0 ? + +// // DropdownButton( +// // value: widget.homeController.SubDropdownValue, +// // icon: const Icon(Icons.arrow_downward), +// // elevation: 16, +// // style: const TextStyle(color: Colors.deepPurple), +// // hint: Container( +// // child: Text("select"), +// // ), +// // underline: Container( +// // height: 2, +// // color: Colors.deepPurpleAccent, +// // ), +// // onChanged: (String? newValue) { +// // //setState(() { +// // if(newValue != null){ +// // widget.homeController.loadLocationforSubPerf(newValue, widget.mapController); +// // widget.homeController.SubDropdownValue = newValue; +// // widget.homeController.zoomtoSubPerf(newValue, widget.mapController); +// // } +// // //}); +// // }, +// // items: +// // getSubDropdownItems() +// // ) : +// // Text("") + +// // ], +// // ), +// // ); +// // } +// // } + diff --git a/pubspec.lock b/pubspec.lock index de78a21..0d27953 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -14,7 +14,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.2" + version: "2.9.0" boolean_selector: dependency: transitive description: @@ -28,21 +28,14 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.2.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: "direct main" description: @@ -77,7 +70,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.3.1" ffi: dependency: transitive description: @@ -145,35 +138,35 @@ packages: name: flutter_lints url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.0.1" flutter_map: dependency: "direct main" description: name: flutter_map url: "https://pub.dartlang.org" source: hosted - version: "1.1.1" + version: "3.0.0" flutter_map_location_marker: dependency: "direct main" description: name: flutter_map_location_marker url: "https://pub.dartlang.org" source: hosted - version: "4.1.0" + version: "5.0.0+1" flutter_map_marker_cluster: dependency: "direct main" description: name: flutter_map_marker_cluster url: "https://pub.dartlang.org" source: hosted - version: "0.5.0" + version: "1.0.1" flutter_map_marker_popup: dependency: transitive description: name: flutter_map_marker_popup url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" + version: "4.0.0" flutter_plugin_android_lifecycle: dependency: transitive description: @@ -218,14 +211,14 @@ packages: name: geolocator url: "https://pub.dartlang.org" source: hosted - version: "8.2.1" + version: "9.0.2" geolocator_android: dependency: transitive description: name: geolocator_android url: "https://pub.dartlang.org" source: hosted - version: "3.2.1" + version: "4.1.4" geolocator_apple: dependency: transitive description: @@ -372,7 +365,7 @@ packages: name: lints url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "2.0.1" lists: dependency: transitive description: @@ -386,28 +379,28 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.11" + version: "0.12.12" material_color_utilities: dependency: transitive description: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.4" + version: "0.1.5" material_design_icons_flutter: dependency: "direct main" description: name: material_design_icons_flutter url: "https://pub.dartlang.org" source: hosted - version: "5.0.6595" + version: "6.0.7096" meta: dependency: "direct main" description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" mgrs_dart: dependency: transitive description: @@ -415,13 +408,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.0" + nested: + dependency: transitive + description: + name: nested + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" path_provider: dependency: "direct main" description: @@ -484,14 +484,35 @@ packages: name: permission_handler url: "https://pub.dartlang.org" source: hosted - version: "8.3.0" + version: "10.2.0" + permission_handler_android: + dependency: transitive + description: + name: permission_handler_android + url: "https://pub.dartlang.org" + source: hosted + version: "10.2.0" + permission_handler_apple: + dependency: transitive + description: + name: permission_handler_apple + url: "https://pub.dartlang.org" + source: hosted + version: "9.0.7" permission_handler_platform_interface: dependency: transitive description: name: permission_handler_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "3.7.0" + version: "3.9.0" + permission_handler_windows: + dependency: transitive + description: + name: permission_handler_windows + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2" platform: dependency: transitive description: @@ -540,7 +561,14 @@ packages: name: proj4dart url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" + provider: + dependency: transitive + description: + name: provider + url: "https://pub.dartlang.org" + source: hosted + version: "6.0.4" quiver: dependency: transitive description: @@ -553,13 +581,20 @@ packages: description: flutter source: sdk version: "0.0.99" + sliding_up_panel: + dependency: "direct main" + description: + name: sliding_up_panel + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0+1" source_span: dependency: transitive description: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.2" + version: "1.9.0" sqflite: dependency: "direct main" description: @@ -601,7 +636,7 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" synchronized: dependency: transitive description: @@ -615,14 +650,14 @@ packages: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.9" + version: "0.4.12" timeline_tile: dependency: "direct main" description: @@ -743,5 +778,5 @@ packages: source: hosted version: "0.2.0+1" sdks: - dart: ">=2.17.0 <3.0.0" - flutter: ">=3.0.0" + dart: ">=2.17.5 <3.0.0" + flutter: ">=3.3.0" diff --git a/pubspec.yaml b/pubspec.yaml index 473aa64..344443a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -36,9 +36,9 @@ dependencies: cupertino_icons: ^1.0.2 sqflite: ^2.0.1 get: ^4.6.5 - flutter_map: any - geolocator: ^8.0.1 - permission_handler: ^8.3.0 + flutter_map: ^3.0.0 + geolocator: ^9.0.1 + permission_handler: ^10.0.0 google_api_availability: ^3.0.1 tuple: ^2.0.0 latlong2: ^0.8.1 @@ -53,7 +53,7 @@ dependencies: path_provider: ^2.0.8 flutter_map_location_marker: any flutter_map_marker_cluster: any - material_design_icons_flutter: ^5.0.6595 + material_design_icons_flutter: ^6.0.7096 google_fonts: any image_picker: ^0.8.4+4 geojson_vi: ^2.0.7 @@ -66,6 +66,8 @@ dependencies: flutter_polyline_points: ^1.0.0 google_maps_webservice: ^0.0.19 flutter_typeahead: ^4.0.0 + sliding_up_panel: ^2.0.0+1 + dev_dependencies: @@ -77,7 +79,7 @@ dev_dependencies: # activated in the `analysis_options.yaml` file located at the root of your # package. See that file for information about deactivating specific lint # rules and activating additional ones. - flutter_lints: ^1.0.0 + flutter_lints: ^2.0.1 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 94586cc..ce843bc 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -7,11 +7,14 @@ #include "generated_plugin_registrant.h" #include +#include #include void RegisterPlugins(flutter::PluginRegistry* registry) { GeolocatorWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("GeolocatorWindows")); + PermissionHandlerWindowsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); UrlLauncherWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("UrlLauncherWindows")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index f0bcafd..b3ea692 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -4,6 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST geolocator_windows + permission_handler_windows url_launcher_windows )