From f64ac1ccfd42e917b4cd157aff6a012ac5431cb5 Mon Sep 17 00:00:00 2001 From: Mohamed Nouffer Date: Tue, 12 Sep 2023 16:00:58 +0530 Subject: [PATCH] fixed history --- lib/model/destination.dart | 10 +++++++--- lib/pages/destination/destination_controller.dart | 3 ++- lib/pages/history/history_page.dart | 13 ++++++++++--- lib/utils/database_helper.dart | 3 ++- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/lib/model/destination.dart b/lib/model/destination.dart index 7730066..86a295f 100644 --- a/lib/model/destination.dart +++ b/lib/model/destination.dart @@ -23,6 +23,7 @@ class Destination { double? checkin_point; double? buy_point; int? hidden_location; + String? checkin_image; Destination({ this.name, @@ -46,7 +47,8 @@ class Destination { this.cp, this.checkin_point, this.buy_point, - this.hidden_location + this.hidden_location, + this.checkin_image }); factory Destination.fromMap(Map json) { @@ -76,7 +78,8 @@ class Destination { cp: json['cp'], checkin_point: json['checkin_point'], buy_point: json['buy_point'], - hidden_location: json['hidden_location'] + hidden_location: json['hidden_location'], + checkin_image: json['checkin_image'] ); } @@ -105,7 +108,8 @@ class Destination { 'cp' : cp, 'checkin_point' : checkin_point, 'buy_point' : buy_point, - 'hidden_location' : hidden_location + 'hidden_location' : hidden_location, + 'checkin_image': checkin_image }; } diff --git a/lib/pages/destination/destination_controller.dart b/lib/pages/destination/destination_controller.dart index 537c6f5..e14d476 100644 --- a/lib/pages/destination/destination_controller.dart +++ b/lib/pages/destination/destination_controller.dart @@ -442,7 +442,7 @@ class DestinationController extends GetxController { try { print("--- 000 ---- $skip_gps----"); - await Future.delayed(const Duration(milliseconds: 1500)); + await Future.delayed(const Duration(milliseconds: 3500)); final la = current_lat; final ln = current_lon; for (GeoJsonFeature fs in indexController.locations[0].collection) { @@ -541,6 +541,7 @@ class DestinationController extends GetxController { if (ddd.isEmpty) { destination.checkedin = true; + destination.checkin_image = imageurl; await db.insertDestination(destination); } diff --git a/lib/pages/history/history_page.dart b/lib/pages/history/history_page.dart index accc3de..1dc5f77 100644 --- a/lib/pages/history/history_page.dart +++ b/lib/pages/history/history_page.dart @@ -41,17 +41,24 @@ class _HistoryPageState extends State { print("----- history -----"); return Container( width: MediaQuery.of(context).size.width, - height: 150, + height: MediaQuery.of(context).size.height, child: ListView.builder( itemCount: dests.length, itemBuilder: (ctx, index) { + print("--- photo ${dests[index].checkin_image!} ----"); 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!))) + leading: dests[index].checkin_image != null + ? Container(width: 100, height: 100, child: Image.file(File(dests[index].checkin_image!))) : Container(), + trailing: ElevatedButton( + child: Text(dests[index].cp.toString()), + style: ElevatedButton.styleFrom(shape: CircleBorder()), + onPressed: () { + + },), ); })); } else { diff --git a/lib/utils/database_helper.dart b/lib/utils/database_helper.dart index 68a4446..482cae5 100644 --- a/lib/utils/database_helper.dart +++ b/lib/utils/database_helper.dart @@ -48,7 +48,8 @@ class DatabaseHelper{ cp REAL, checkin_point REAL, buy_point REAL, - hidden_location INTEGER + hidden_location INTEGER, + checkin_image TEXT ) ''');