optimized
This commit is contained in:
@ -28,13 +28,13 @@ class _ListWidgetState extends State<ListWidget> {
|
||||
"") {
|
||||
return const Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
} else {
|
||||
print("==== photo index is $index ===");
|
||||
//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('$serverUrl/media/compressed/' + _photo),
|
||||
image: NetworkImage('$serverUrl/media/compressed/$photo'),
|
||||
errorBuilder:
|
||||
(BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
return Image.asset("assets/images/empty_image.png");
|
||||
@ -57,19 +57,19 @@ class _ListWidgetState extends State<ListWidget> {
|
||||
|
||||
Destination createDestination(GeoJsonFeature feature) {
|
||||
final props = feature.properties;
|
||||
GeoJsonMultiPoint _pt = feature.geometry;
|
||||
GeoJsonMultiPoint pt = feature.geometry;
|
||||
|
||||
return Destination(
|
||||
cp: props!['cp'],
|
||||
lat: _pt.geoSerie!.geoPoints.first.latitude,
|
||||
lon: _pt.geoSerie!.geoPoints.first.longitude,
|
||||
lat: pt.geoSerie!.geoPoints.first.latitude,
|
||||
lon: pt.geoSerie!.geoPoints.first.longitude,
|
||||
);
|
||||
}
|
||||
|
||||
Future<String> matrixDistance(int i) async {
|
||||
// Create two destinations directly from indexController.locations[0].collection
|
||||
Destination desCurr = Destination(
|
||||
lat: indexController.current_lat, lon: indexController.current_lon);
|
||||
lat: indexController.currentLat, lon: indexController.currentLon);
|
||||
//Destination dest1 = createDestination(indexController.locations[0].collection[0]);
|
||||
Destination dest2 =
|
||||
createDestination(indexController.locations[0].collection[i]);
|
||||
@ -82,7 +82,7 @@ class _ListWidgetState extends State<ListWidget> {
|
||||
}
|
||||
|
||||
Future<void> _pullRefresh() async {
|
||||
print("pull to refesh");
|
||||
//print("pull to refesh");
|
||||
indexController.locations[0].collection.sort((a, b) =>
|
||||
(a.properties!['cp'] as Comparable)
|
||||
.compareTo(b.properties!['cp'] as Comparable));
|
||||
@ -99,23 +99,24 @@ class _ListWidgetState extends State<ListWidget> {
|
||||
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: () {
|
||||
GeoJsonFeature gf =
|
||||
indexController.locations[0].collection[index];
|
||||
Destination des = destinationController.festuretoDestination(gf);
|
||||
Destination des =
|
||||
destinationController.festuretoDestination(gf);
|
||||
changeCurrentFeature(gf);
|
||||
showModalBottomSheet(
|
||||
constraints: BoxConstraints.loose(
|
||||
@ -123,7 +124,9 @@ class _ListWidgetState extends State<ListWidget> {
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
//builder: (context) => BottomSheetWidget(),
|
||||
builder: ((context) => BottomSheetNew(destination: des,)));
|
||||
builder: ((context) => BottomSheetNew(
|
||||
destination: des,
|
||||
)));
|
||||
},
|
||||
leading: getImage(index),
|
||||
title: indexController.locations[0].collection[index]
|
||||
|
||||
Reference in New Issue
Block a user