From 7b33468e3f9151ad351e75e6384cb832b5c8b71d Mon Sep 17 00:00:00 2001 From: Mohamed Nouffer Date: Wed, 6 Sep 2023 15:25:12 +0530 Subject: [PATCH] update manual start --- lib/pages/history/history_page.dart | 35 ++++++++++++++++++---------- lib/widgets/bottom_sheet_new.dart | 36 ++++++++++++++++++++++++----- 2 files changed, 53 insertions(+), 18 deletions(-) diff --git a/lib/pages/history/history_page.dart b/lib/pages/history/history_page.dart index 11e6781..1971eb9 100644 --- a/lib/pages/history/history_page.dart +++ b/lib/pages/history/history_page.dart @@ -38,22 +38,33 @@ class _HistoryPageState extends State { } else if (snapshot.hasData) { final dests = snapshot.data; if (dests!.length > 0) { - return Center( - child: ListView.builder(itemBuilder:(ctx, index){ - return ListTile( - title: Text(dests[index].name?? ""), - subtitle: Text(dests[index].address ?? ""), - leading: dests[0].photos != null ? Image.file(File(dests[0].photos!)) : Container(), - ); - }), - ); + print("----- history -----"); + return Container( + width: MediaQuery.of(context).size.width, + height: 150, + child: Expanded( + child: ListView.builder( + itemCount: dests.length, + itemBuilder: (ctx, index) { + return ListTile( + title: Text(dests[index].name ?? ""), + subtitle: + Text(dests[index].address ?? ""), + leading: dests[0].photos != null + ? Container(width: 100, height: 100, child: Image.file(File(dests[0].photos!))) + : Container(), + ); + }), + )); } else { return Center(child: Text("No checkin yet")); } } - } - else if(snapshot.connectionState == ConnectionState.waiting){ - return Center(child: CircularProgressIndicator(),); + } else if (snapshot.connectionState == + ConnectionState.waiting) { + return Center( + child: CircularProgressIndicator(), + ); } return Container(); }), diff --git a/lib/widgets/bottom_sheet_new.dart b/lib/widgets/bottom_sheet_new.dart index b020288..4404bc5 100644 --- a/lib/widgets/bottom_sheet_new.dart +++ b/lib/widgets/bottom_sheet_new.dart @@ -509,7 +509,8 @@ class BottomSheetNew extends GetView { as GeoJsonFeature; Position position = await Geolocator.getCurrentPosition( - desiredAccuracy: LocationAccuracy.lowest, + desiredAccuracy: + LocationAccuracy.bestForNavigation, forceAndroidLocationManager: true); print("------- position -------- $position"); Destination ds = Destination( @@ -531,17 +532,40 @@ class BottomSheetNew extends GetView { color: Theme.of(context).colorScheme.onPrimary), )), - SizedBox(width: 10,), + SizedBox( + width: 10, + ), ElevatedButton( style: ElevatedButton.styleFrom( backgroundColor: Theme.of(context).colorScheme.secondary), onPressed: () async { - destinationController.CallforCheckin( + final Destination dd = destinationController.festuretoDestination( - indexController.currentFeature[0])); + indexController.currentFeature[0]); + if (dd.cp == -1) { + destinationController.is_in_rog.value = true; + destinationController.addToRogaining( + destinationController.current_lat, + destinationController.current_lon, + indexController.currentDestinationFeature[0] + .location_id!); + ExternalService() + .StartRogaining() + .then((value) => Get.back()); + } else { + destinationController.CallforCheckin(dd); + } }, - child: Text("チェックイン", + child: Text( + destinationController + .festuretoDestination( + indexController + .currentFeature[0]) + .cp == + -1 + ? "ロゲ開始" + : "チェックイン", style: TextStyle( color: Theme.of(context) .colorScheme @@ -979,4 +1003,4 @@ class BottomSheetNew extends GetView { ], ); } -} \ No newline at end of file +}