update to add resume app from sleep

This commit is contained in:
Mohamed Nouffer
2023-08-16 14:53:32 +05:30
parent 68bf3e9ab3
commit 2ab96cc3d0
51 changed files with 748 additions and 789 deletions

View File

@ -7,10 +7,9 @@ import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/services/maxtrix_service.dart';
import 'package:rogapp/utils/const.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart';
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
class ListWidget extends StatefulWidget {
ListWidget({ Key? key }) : super(key: key);
const ListWidget({ Key? key }) : super(key: key);
@override
State<ListWidget> createState() => _ListWidgetState();
@ -23,16 +22,16 @@ class _ListWidgetState extends State<ListWidget> {
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'));
return const Image(image: AssetImage('assets/images/empty_image.png'));
}
else{
print("==== photo index is ${index} ===");
String server_url = ConstValues.currentServer();
print("==== photo index is $index ===");
String serverUrl = ConstValues.currentServer();
GeoJsonFeature<dynamic> gf = indexController.locations[0].collection[index];
String _photo = gf!.properties!["photos"];
String _photo = gf.properties!["photos"];
return Image(
image: NetworkImage(
'${server_url}/media/compressed/' + _photo
'$serverUrl/media/compressed/' + _photo
),
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/empty_image.png");
@ -42,7 +41,7 @@ class _ListWidgetState extends State<ListWidget> {
}
void changeCurrentFeature(GeoJsonFeature fs){
if(indexController.currentFeature.length > 0){
if(indexController.currentFeature.isNotEmpty){
indexController.currentFeature.clear();
}
indexController.currentFeature.add(fs);
@ -89,7 +88,7 @@ class _ListWidgetState extends State<ListWidget> {
@override
Widget build(BuildContext context) {
return Obx(() =>
indexController.locations.length > 0 ?
indexController.locations.isNotEmpty ?
RefreshIndicator(
onRefresh: _pullRefresh,
child: ListView.builder(
@ -119,13 +118,13 @@ class _ListWidgetState extends State<ListWidget> {
);
},
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(""),
title: indexController.locations[0].collection[index].properties!['location_name'] != null ? Text(indexController.locations[0].collection[index].properties!['location_name'].toString()) : const Text(""),
subtitle: indexController.locations[0].collection[index].properties!['category'] != null ? Text(indexController.locations[0].collection[index].properties!['category']) : const Text(""),
trailing: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
indexController.locations[0].collection[index].properties!['sub_loc_id'] != null ? Text(indexController.locations[0].collection[index].properties!['sub_loc_id']) : Text(""),
Container(
indexController.locations[0].collection[index].properties!['sub_loc_id'] != null ? Text(indexController.locations[0].collection[index].properties!['sub_loc_id']) : const Text(""),
SizedBox(
width: 100,
child: FutureBuilder<String>(
future: matrixDistance(index),
@ -134,10 +133,10 @@ class _ListWidgetState extends State<ListWidget> {
return const Center(child: CircularProgressIndicator(),);
}
if(snapshot.hasError){
return Text("-");
return const Text("-");
}
else{
return Text(snapshot.data ?? '', style: TextStyle(color: Colors.red, fontWeight: FontWeight.bold),);
return Text(snapshot.data ?? '', style: const TextStyle(color: Colors.red, fontWeight: FontWeight.bold),);
}
},
),
@ -148,7 +147,7 @@ class _ListWidgetState extends State<ListWidget> {
);
},
),
) : Container(width: 0, height: 0,),
) : const SizedBox(width: 0, height: 0,),
);
}
}