update to 3.13
This commit is contained in:
@ -6,7 +6,6 @@ import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.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 StatelessWidget {
|
||||
ListWidget({ Key? key }) : super(key: key);
|
||||
@ -16,16 +15,16 @@ class ListWidget extends StatelessWidget {
|
||||
|
||||
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");
|
||||
@ -35,7 +34,7 @@ class ListWidget extends StatelessWidget {
|
||||
}
|
||||
|
||||
void changeCurrentFeature(GeoJsonFeature fs){
|
||||
if(indexController.currentFeature.length > 0){
|
||||
if(indexController.currentFeature.isNotEmpty){
|
||||
indexController.currentFeature.clear();
|
||||
}
|
||||
indexController.currentFeature.add(fs);
|
||||
@ -44,21 +43,21 @@ class ListWidget extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Obx(() =>
|
||||
indexController.locations.length > 0 ?
|
||||
indexController.locations.isNotEmpty ?
|
||||
ListView.builder(
|
||||
itemCount: indexController.locations[0].collection.length,
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (_, index){
|
||||
bool _is_found = false;
|
||||
bool isFound = false;
|
||||
for(Destination d in destinationController.destinations){
|
||||
if(indexController.locations[0].collection[index].properties!['location_id'] == d.location_id){
|
||||
_is_found = true;
|
||||
isFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Card(
|
||||
child: ListTile(
|
||||
selected: _is_found,
|
||||
selected: isFound,
|
||||
|
||||
selectedTileColor: Colors.yellow.shade200,
|
||||
onTap: (){
|
||||
@ -72,13 +71,13 @@ class ListWidget extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
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(""),
|
||||
trailing: indexController.locations[0].collection[index].properties!['sub_loc_id'] != null ? Text(indexController.locations[0].collection[index].properties!['sub_loc_id']) : 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: indexController.locations[0].collection[index].properties!['sub_loc_id'] != null ? Text(indexController.locations[0].collection[index].properties!['sub_loc_id']) : const Text(""),
|
||||
),
|
||||
);
|
||||
},
|
||||
) : Container(width: 0, height: 0,),
|
||||
) : const SizedBox(width: 0, height: 0,),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user