fixed history

This commit is contained in:
Mohamed Nouffer
2023-09-12 16:00:58 +05:30
parent 48f4b833f6
commit f64ac1ccfd
4 changed files with 21 additions and 8 deletions

View File

@ -23,6 +23,7 @@ class Destination {
double? checkin_point; double? checkin_point;
double? buy_point; double? buy_point;
int? hidden_location; int? hidden_location;
String? checkin_image;
Destination({ Destination({
this.name, this.name,
@ -46,7 +47,8 @@ class Destination {
this.cp, this.cp,
this.checkin_point, this.checkin_point,
this.buy_point, this.buy_point,
this.hidden_location this.hidden_location,
this.checkin_image
}); });
factory Destination.fromMap(Map<String, dynamic> json) { factory Destination.fromMap(Map<String, dynamic> json) {
@ -76,7 +78,8 @@ class Destination {
cp: json['cp'], cp: json['cp'],
checkin_point: json['checkin_point'], checkin_point: json['checkin_point'],
buy_point: json['buy_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, 'cp' : cp,
'checkin_point' : checkin_point, 'checkin_point' : checkin_point,
'buy_point' : buy_point, 'buy_point' : buy_point,
'hidden_location' : hidden_location 'hidden_location' : hidden_location,
'checkin_image': checkin_image
}; };
} }

View File

@ -442,7 +442,7 @@ class DestinationController extends GetxController {
try { try {
print("--- 000 ---- $skip_gps----"); print("--- 000 ---- $skip_gps----");
await Future.delayed(const Duration(milliseconds: 1500)); await Future.delayed(const Duration(milliseconds: 3500));
final la = current_lat; final la = current_lat;
final ln = current_lon; final ln = current_lon;
for (GeoJsonFeature fs in indexController.locations[0].collection) { for (GeoJsonFeature fs in indexController.locations[0].collection) {
@ -541,6 +541,7 @@ class DestinationController extends GetxController {
if (ddd.isEmpty) { if (ddd.isEmpty) {
destination.checkedin = true; destination.checkedin = true;
destination.checkin_image = imageurl;
await db.insertDestination(destination); await db.insertDestination(destination);
} }

View File

@ -41,17 +41,24 @@ class _HistoryPageState extends State<HistoryPage> {
print("----- history -----"); print("----- history -----");
return Container( return Container(
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
height: 150, height: MediaQuery.of(context).size.height,
child: ListView.builder( child: ListView.builder(
itemCount: dests.length, itemCount: dests.length,
itemBuilder: (ctx, index) { itemBuilder: (ctx, index) {
print("--- photo ${dests[index].checkin_image!} ----");
return ListTile( return ListTile(
title: Text(dests[index].name ?? ""), title: Text(dests[index].name ?? ""),
subtitle: subtitle:
Text(dests[index].address ?? ""), Text(dests[index].address ?? ""),
leading: dests[0].photos != null leading: dests[index].checkin_image != null
? Container(width: 100, height: 100, child: Image.file(File(dests[0].photos!))) ? Container(width: 100, height: 100, child: Image.file(File(dests[index].checkin_image!)))
: Container(), : Container(),
trailing: ElevatedButton(
child: Text(dests[index].cp.toString()),
style: ElevatedButton.styleFrom(shape: CircleBorder()),
onPressed: () {
},),
); );
})); }));
} else { } else {

View File

@ -48,7 +48,8 @@ class DatabaseHelper{
cp REAL, cp REAL,
checkin_point REAL, checkin_point REAL,
buy_point REAL, buy_point REAL,
hidden_location INTEGER hidden_location INTEGER,
checkin_image TEXT
) )
'''); ''');