fix bottomsheel
This commit is contained in:
@ -152,6 +152,9 @@ class DestinationController extends GetxController {
|
|||||||
if (is_photo_shoot.value == true) {
|
if (is_photo_shoot.value == true) {
|
||||||
photos.clear();
|
photos.clear();
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
|
constraints: BoxConstraints.loose(Size(
|
||||||
|
Get.width,
|
||||||
|
Get.height * 0.75)),
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
builder: ((context) => CameraPage())).whenComplete(() {
|
builder: ((context) => CameraPage())).whenComplete(() {
|
||||||
@ -174,6 +177,9 @@ class DestinationController extends GetxController {
|
|||||||
is_in_checkin.value = true;
|
is_in_checkin.value = true;
|
||||||
is_at_start.value = true;
|
is_at_start.value = true;
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
|
constraints: BoxConstraints.loose(Size(
|
||||||
|
Get.width,
|
||||||
|
Get.height * 0.75)),
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
builder: ((context) => BottomSheetNew())).whenComplete(() {
|
builder: ((context) => BottomSheetNew())).whenComplete(() {
|
||||||
@ -187,6 +193,9 @@ class DestinationController extends GetxController {
|
|||||||
chekcs = 2;
|
chekcs = 2;
|
||||||
is_in_checkin.value = true;
|
is_in_checkin.value = true;
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
|
constraints: BoxConstraints.loose(Size(
|
||||||
|
Get.width,
|
||||||
|
Get.height * 0.75)),
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
builder: ((context) => BottomSheetNew())).whenComplete(() {
|
builder: ((context) => BottomSheetNew())).whenComplete(() {
|
||||||
@ -223,6 +232,9 @@ class DestinationController extends GetxController {
|
|||||||
is_in_checkin.value = true;
|
is_in_checkin.value = true;
|
||||||
photos.clear();
|
photos.clear();
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
|
constraints: BoxConstraints.loose(Size(
|
||||||
|
Get.width,
|
||||||
|
Get.height * 0.75)),
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
builder: ((context) => CameraPage(
|
builder: ((context) => CameraPage(
|
||||||
@ -273,6 +285,9 @@ class DestinationController extends GetxController {
|
|||||||
is_at_goal.value = true;
|
is_at_goal.value = true;
|
||||||
photos.clear();
|
photos.clear();
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
|
constraints: BoxConstraints.loose(Size(
|
||||||
|
Get.width,
|
||||||
|
Get.height * 0.75)),
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
builder: ((context) => CameraPage(
|
builder: ((context) => CameraPage(
|
||||||
@ -290,6 +305,9 @@ class DestinationController extends GetxController {
|
|||||||
chekcs = 6;
|
chekcs = 6;
|
||||||
is_at_start.value = true;
|
is_at_start.value = true;
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
|
constraints: BoxConstraints.loose(Size(
|
||||||
|
Get.width,
|
||||||
|
Get.height * 0.75)),
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
builder: ((context) => BottomSheetNew())).whenComplete(() {
|
builder: ((context) => BottomSheetNew())).whenComplete(() {
|
||||||
@ -395,6 +413,9 @@ class DestinationController extends GetxController {
|
|||||||
is_in_checkin.value = true;
|
is_in_checkin.value = true;
|
||||||
photos.clear();
|
photos.clear();
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
|
constraints: BoxConstraints.loose(Size(
|
||||||
|
Get.width,
|
||||||
|
Get.height * 0.75)),
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
builder: ((context) => CameraPage(
|
builder: ((context) => CameraPage(
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -15,13 +14,13 @@ import 'package:rogapp/utils/text_util.dart';
|
|||||||
import 'package:rogapp/widgets/base_layer_widget.dart';
|
import 'package:rogapp/widgets/base_layer_widget.dart';
|
||||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||||
|
|
||||||
|
|
||||||
class DestinationMapPage extends StatelessWidget {
|
class DestinationMapPage extends StatelessWidget {
|
||||||
DestinationMapPage({Key? key}) : super(key: key);
|
DestinationMapPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
final DestinationController destinationController = Get.find<DestinationController>();
|
final DestinationController destinationController =
|
||||||
|
Get.find<DestinationController>();
|
||||||
StreamSubscription? subscription;
|
StreamSubscription? subscription;
|
||||||
final PopupController _popupLayerController = PopupController();
|
final PopupController _popupLayerController = PopupController();
|
||||||
|
|
||||||
@ -45,7 +44,6 @@ class DestinationMapPage extends StatelessWidget {
|
|||||||
point: LatLng(d.lat!, d.lon!),
|
point: LatLng(d.lat!, d.lon!),
|
||||||
anchorPos: AnchorPos.align(AnchorAlign.center),
|
anchorPos: AnchorPos.align(AnchorAlign.center),
|
||||||
builder: (cts) {
|
builder: (cts) {
|
||||||
|
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
print("-- Destination is --- ${d.name} ------");
|
print("-- Destination is --- ${d.name} ------");
|
||||||
@ -55,9 +53,12 @@ class DestinationMapPage extends StatelessWidget {
|
|||||||
indexController.currentDestinationFeature.add(d);
|
indexController.currentDestinationFeature.add(d);
|
||||||
//indexController.getAction();
|
//indexController.getAction();
|
||||||
|
|
||||||
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
|
showModalBottomSheet(
|
||||||
builder:((context) => BottomSheetNew())
|
context: Get.context!,
|
||||||
).whenComplete((){
|
isScrollControlled: true,
|
||||||
|
constraints: BoxConstraints.loose(
|
||||||
|
Size(Get.width, Get.height * 0.75)),
|
||||||
|
builder: ((context) => BottomSheetNew())).whenComplete(() {
|
||||||
print("---- set skip gps to false -----");
|
print("---- set skip gps to false -----");
|
||||||
destinationController.skip_gps = false;
|
destinationController.skip_gps = false;
|
||||||
});
|
});
|
||||||
@ -73,7 +74,8 @@ class DestinationMapPage extends StatelessWidget {
|
|||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
width: d.checkin_radious != null ? d.checkin_radious! : 1,
|
width:
|
||||||
|
d.checkin_radious != null ? d.checkin_radious! : 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Center(
|
child: Center(
|
||||||
@ -83,11 +85,18 @@ class DestinationMapPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container( color: Colors.yellow, child: Text(TextUtils.getDisplayText(d), style: const TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, overflow: TextOverflow.visible),)),
|
Container(
|
||||||
|
color: Colors.yellow,
|
||||||
|
child: Text(
|
||||||
|
TextUtils.getDisplayText(d),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 15.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
overflow: TextOverflow.visible),
|
||||||
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
pts.add(m);
|
pts.add(m);
|
||||||
@ -97,8 +106,7 @@ class DestinationMapPage extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Obx((() =>
|
return Obx((() => Stack(
|
||||||
Stack(
|
|
||||||
children: [
|
children: [
|
||||||
// indexController.is_rog_mapcontroller_loaded.value == false ?
|
// indexController.is_rog_mapcontroller_loaded.value == false ?
|
||||||
// Center(child: CircularProgressIndicator())
|
// Center(child: CircularProgressIndicator())
|
||||||
@ -110,12 +118,10 @@ class DestinationMapPage extends StatelessWidget {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 0.0),
|
padding: const EdgeInsets.only(top: 0.0),
|
||||||
//child: TravelMap(),
|
//child: TravelMap(),
|
||||||
child:
|
child: TravelMap(),
|
||||||
TravelMap(),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FlutterMap TravelMap() {
|
FlutterMap TravelMap() {
|
||||||
@ -124,9 +130,9 @@ class DestinationMapPage extends StatelessWidget {
|
|||||||
options: MapOptions(
|
options: MapOptions(
|
||||||
onMapReady: () {
|
onMapReady: () {
|
||||||
indexController.is_rog_mapcontroller_loaded.value = true;
|
indexController.is_rog_mapcontroller_loaded.value = true;
|
||||||
subscription = indexController.rogMapController.mapEventStream.listen((MapEvent mapEvent) {
|
subscription = indexController.rogMapController.mapEventStream
|
||||||
if (mapEvent is MapEventMoveStart) {
|
.listen((MapEvent mapEvent) {
|
||||||
}
|
if (mapEvent is MapEventMoveStart) {}
|
||||||
if (mapEvent is MapEventMoveEnd) {
|
if (mapEvent is MapEventMoveEnd) {
|
||||||
//destinationController.is_gps_selected.value = true;
|
//destinationController.is_gps_selected.value = true;
|
||||||
//indexController.mapController!.move(c.center, c.zoom);
|
//indexController.mapController!.move(c.center, c.zoom);
|
||||||
@ -139,34 +145,33 @@ class DestinationMapPage extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
bounds: indexController.currentBound.isNotEmpty ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
|
bounds: indexController.currentBound.isNotEmpty
|
||||||
|
? indexController.currentBound[0]
|
||||||
|
: LatLngBounds.fromPoints([
|
||||||
|
LatLng(35.03999881162295, 136.40587119778962),
|
||||||
|
LatLng(36.642756778706904, 137.95226720406063)
|
||||||
|
]),
|
||||||
zoom: 1,
|
zoom: 1,
|
||||||
maxZoom: 42,
|
maxZoom: 42,
|
||||||
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
const BaseLayer(),
|
const BaseLayer(),
|
||||||
Obx(() =>
|
Obx(
|
||||||
indexController.routePointLenght > 0 ?
|
() => indexController.routePointLenght > 0
|
||||||
PolylineLayer(
|
? PolylineLayer(
|
||||||
polylines: [
|
polylines: [
|
||||||
Polyline(
|
Polyline(
|
||||||
points: getPoints()!,
|
points: getPoints()!,
|
||||||
strokeWidth: 6.0,
|
strokeWidth: 6.0,
|
||||||
color: Colors.indigo
|
color: Colors.indigo),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
: Container(),
|
||||||
:
|
|
||||||
Container(),
|
|
||||||
),
|
),
|
||||||
CurrentLocationLayer(),
|
CurrentLocationLayer(),
|
||||||
MarkerLayer(
|
MarkerLayer(markers: getMarkers()!),
|
||||||
markers: getMarkers()!
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,13 +13,15 @@ class SearchPage extends StatelessWidget {
|
|||||||
IndexController indexController = Get.find<IndexController>();
|
IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
Image getImage(int index) {
|
Image getImage(int index) {
|
||||||
if(searchController.searchResults[index].properties!["photos"] == null || searchController.searchResults[index].properties!["photos"] == ""){
|
if (searchController.searchResults[index].properties!["photos"] == null ||
|
||||||
|
searchController.searchResults[index].properties!["photos"] == "") {
|
||||||
return const Image(image: AssetImage('assets/images/empty_image.png'));
|
return const Image(image: AssetImage('assets/images/empty_image.png'));
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return Image(
|
return Image(
|
||||||
image: NetworkImage(searchController.searchResults[index].properties!["photos"]),
|
image: NetworkImage(
|
||||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
searchController.searchResults[index].properties!["photos"]),
|
||||||
|
errorBuilder:
|
||||||
|
(BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||||
return Image.asset("assets/images/empty_image.png");
|
return Image.asset("assets/images/empty_image.png");
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -36,11 +38,12 @@ class SearchPage extends StatelessWidget {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.arrow_back_ios_new, color: Colors.black,)
|
icon: const Icon(
|
||||||
),
|
Icons.arrow_back_ios_new,
|
||||||
|
color: Colors.black,
|
||||||
|
)),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
//title: const CupertinoSearchTextField(),
|
//title: const CupertinoSearchTextField(),
|
||||||
|
|
||||||
),
|
),
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
child: TypeAheadField(
|
child: TypeAheadField(
|
||||||
@ -63,13 +66,18 @@ class SearchPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
suggestionsCallback: (pattern) async {
|
suggestionsCallback: (pattern) async {
|
||||||
return searchController.searchResults.where((GeoJsonFeature element) => element.properties!["location_name"].toString().contains(pattern));
|
return searchController.searchResults.where(
|
||||||
|
(GeoJsonFeature element) => element.properties!["location_name"]
|
||||||
|
.toString()
|
||||||
|
.contains(pattern));
|
||||||
//return await
|
//return await
|
||||||
},
|
},
|
||||||
itemBuilder: (context, GeoJsonFeature suggestion) {
|
itemBuilder: (context, GeoJsonFeature suggestion) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(suggestion.properties!["location_name"]),
|
title: Text(suggestion.properties!["location_name"]),
|
||||||
subtitle: suggestion.properties!["category"] != null ? Text(suggestion.properties!["category"]) : const Text(""),
|
subtitle: suggestion.properties!["category"] != null
|
||||||
|
? Text(suggestion.properties!["category"])
|
||||||
|
: const Text(""),
|
||||||
//leading: getImage(index),
|
//leading: getImage(index),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -78,11 +86,12 @@ class SearchPage extends StatelessWidget {
|
|||||||
indexController.currentFeature.add(suggestion);
|
indexController.currentFeature.add(suggestion);
|
||||||
Get.back();
|
Get.back();
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
|
constraints:
|
||||||
|
BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
context: context,
|
context: context,
|
||||||
//builder: (context) => BottomSheetWidget(),
|
//builder: (context) => BottomSheetWidget(),
|
||||||
builder:((context) => BottomSheetNew())
|
builder: ((context) => BottomSheetNew()));
|
||||||
);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -991,15 +991,19 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: MediaQuery.of(context).size.width - 160,
|
width: MediaQuery.of(context).size.width - (MediaQuery.of(context).size.width * 0.28),
|
||||||
|
child: Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
text,
|
text,
|
||||||
|
textDirection: TextDirection.ltr,
|
||||||
|
textAlign: TextAlign.justify,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: isurl ? Colors.blue : Colors.black,
|
color: isurl ? Colors.blue : Colors.black,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,38 +11,42 @@ import 'package:timeline_tile/timeline_tile.dart';
|
|||||||
class DestinationWidget extends StatelessWidget {
|
class DestinationWidget extends StatelessWidget {
|
||||||
DestinationWidget({Key? key}) : super(key: key);
|
DestinationWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
final DestinationController destinationController = Get.find<DestinationController>();
|
final DestinationController destinationController =
|
||||||
|
Get.find<DestinationController>();
|
||||||
|
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
final List<int> _items = List<int>.generate(50, (int index) => index);
|
final List<int> _items = List<int>.generate(50, (int index) => index);
|
||||||
|
|
||||||
Image getImage(int index) {
|
Image getImage(int index) {
|
||||||
if(destinationController.destinations[index].photos== null || destinationController.destinations[index].photos == ""){
|
if (destinationController.destinations[index].photos == null ||
|
||||||
|
destinationController.destinations[index].photos == "") {
|
||||||
return const Image(image: AssetImage('assets/images/empty_image.png'));
|
return const Image(image: AssetImage('assets/images/empty_image.png'));
|
||||||
}
|
} else {
|
||||||
else{
|
print(
|
||||||
print("------- image is ${destinationController.destinations[index].photos!}------");
|
"------- image is ${destinationController.destinations[index].photos!}------");
|
||||||
String _photo = destinationController.destinations[index].photos!;
|
String _photo = destinationController.destinations[index].photos!;
|
||||||
if (_photo.contains('http')) {
|
if (_photo.contains('http')) {
|
||||||
return Image(image: NetworkImage(
|
return Image(
|
||||||
destinationController.destinations[index].photos!),
|
image:
|
||||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
NetworkImage(destinationController.destinations[index].photos!),
|
||||||
|
errorBuilder:
|
||||||
|
(BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||||
return Image.asset("assets/images/empty_image.png");
|
return Image.asset("assets/images/empty_image.png");
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
String serverUrl = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
//print("==== photo is ${server_url + '/media/compressed/' + destinationController.destinations[index].photos!} ===");
|
//print("==== photo is ${server_url + '/media/compressed/' + destinationController.destinations[index].photos!} ===");
|
||||||
return Image(image: NetworkImage(
|
return Image(
|
||||||
'$serverUrl/media/compressed/' + destinationController.destinations[index].photos!),
|
image: NetworkImage('$serverUrl/media/compressed/' +
|
||||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
destinationController.destinations[index].photos!),
|
||||||
|
errorBuilder:
|
||||||
|
(BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||||
return Image.asset("assets/images/empty_image.png");
|
return Image.asset("assets/images/empty_image.png");
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,15 +118,14 @@ class DestinationWidget extends StatelessWidget {
|
|||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
radius: 10,
|
radius: 10,
|
||||||
content: const Column(
|
content: const Column(
|
||||||
children: [
|
children: [],
|
||||||
],
|
|
||||||
),
|
),
|
||||||
onConfirm: () {
|
onConfirm: () {
|
||||||
destinationController.deleteAllDestinations();
|
destinationController.deleteAllDestinations();
|
||||||
Get.back();
|
Get.back();
|
||||||
Get.snackbar("deleted".tr, "all_destinations_are_deleted_successfully".tr);
|
Get.snackbar(
|
||||||
}
|
"deleted".tr, "all_destinations_are_deleted_successfully".tr);
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void interChange() {
|
void interChange() {
|
||||||
@ -142,26 +145,27 @@ class DestinationWidget extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
print(
|
||||||
|
"------ destination widget------ ${destinationController.destinationCount.value} ----------");
|
||||||
|
|
||||||
print("------ destination widget------ ${destinationController.destinationCount.value} ----------");
|
return Obx(() => Stack(
|
||||||
|
|
||||||
return
|
|
||||||
Obx(() =>
|
|
||||||
Stack(
|
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 45.0),
|
padding: const EdgeInsets.only(top: 45.0),
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: destinationController.destinationCount.value,
|
itemCount: destinationController.destinationCount.value,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
return
|
return TimelineTile(
|
||||||
TimelineTile(
|
|
||||||
alignment: TimelineAlign.manual,
|
alignment: TimelineAlign.manual,
|
||||||
lineXY: 0.2,
|
lineXY: 0.2,
|
||||||
isFirst: index == 0 ? true : false,
|
isFirst: index == 0 ? true : false,
|
||||||
indicatorStyle: IndicatorStyle(
|
indicatorStyle: IndicatorStyle(
|
||||||
indicator: CircleAvatar(
|
indicator: CircleAvatar(
|
||||||
child: Text(destinationController.destinations[index].list_order.toString(), style: const TextStyle(color: Colors.white),),
|
child: Text(
|
||||||
|
destinationController.destinations[index].list_order
|
||||||
|
.toString(),
|
||||||
|
style: const TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
backgroundColor: Colors.red,
|
backgroundColor: Colors.red,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -174,47 +178,72 @@ class DestinationWidget extends StatelessWidget {
|
|||||||
child: ListTile(
|
child: ListTile(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
{
|
{
|
||||||
Destination? fs = destinationController.destinations[index];
|
Destination? fs =
|
||||||
|
destinationController.destinations[index];
|
||||||
print("----fsf-----$index");
|
print("----fsf-----$index");
|
||||||
if(indexController.currentDestinationFeature.isNotEmpty) {
|
if (indexController
|
||||||
indexController.currentDestinationFeature.clear();
|
.currentDestinationFeature.isNotEmpty) {
|
||||||
|
indexController.currentDestinationFeature
|
||||||
|
.clear();
|
||||||
}
|
}
|
||||||
indexController.currentDestinationFeature.add(fs);
|
indexController.currentDestinationFeature
|
||||||
print("--- ndexController.currentDestinationFeature ----- ${ indexController.currentDestinationFeature[0].name} ----");
|
.add(fs);
|
||||||
|
print(
|
||||||
|
"--- ndexController.currentDestinationFeature ----- ${indexController.currentDestinationFeature[0].name} ----");
|
||||||
//indexController.getAction();
|
//indexController.getAction();
|
||||||
|
|
||||||
showModalBottomSheet(context: context, isScrollControlled: true,
|
showModalBottomSheet(
|
||||||
|
constraints: BoxConstraints.loose(
|
||||||
|
Size(Get.width, Get.height * 0.75)),
|
||||||
|
context: context,
|
||||||
|
isScrollControlled: true,
|
||||||
//builder:((context) => BottomSheetWidget())
|
//builder:((context) => BottomSheetWidget())
|
||||||
builder:((context) => BottomSheetNew())
|
builder: ((context) => BottomSheetNew()));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLongPress: () {
|
onLongPress: () {
|
||||||
destinationController.toggleSelection(destinationController.destinations[index]);
|
destinationController.toggleSelection(
|
||||||
|
destinationController.destinations[index]);
|
||||||
},
|
},
|
||||||
selectedTileColor: Colors.amberAccent,
|
selectedTileColor: Colors.amberAccent,
|
||||||
selected:destinationController.destinations[index].selected!,
|
selected: destinationController
|
||||||
|
.destinations[index].selected!,
|
||||||
leading: getImage(index),
|
leading: getImage(index),
|
||||||
title: Text(destinationController.destinations[index].name!),
|
title: Text(destinationController
|
||||||
subtitle: Text(destinationController.destinations[index].category!),
|
.destinations[index].name!),
|
||||||
|
subtitle: Text(destinationController
|
||||||
|
.destinations[index].category!),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
startChild:
|
startChild: index > 0 &&
|
||||||
index > 0 && destinationController.matrix["routes"][0]["legs"] != null ?
|
destinationController.matrix["routes"][0]
|
||||||
Column(
|
["legs"] !=
|
||||||
|
null
|
||||||
|
? Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: [
|
children: [
|
||||||
Text(destinationController.matrix["routes"][0]["legs"][index -1]["distance"] != null ? destinationController.matrix["routes"][0]["legs"][index-1]["distance"]["text"].toString(): ''),
|
Text(destinationController.matrix["routes"][0]
|
||||||
Text(destinationController.matrix["routes"][0]["legs"][index -1]["duration"] != null ? destinationController.matrix["routes"][0]["legs"][index-1]["duration"]["text"].toString() : '')
|
["legs"][index - 1]["distance"] !=
|
||||||
|
null
|
||||||
|
? destinationController.matrix["routes"][0]
|
||||||
|
["legs"][index - 1]["distance"]
|
||||||
|
["text"]
|
||||||
|
.toString()
|
||||||
|
: ''),
|
||||||
|
Text(destinationController.matrix["routes"][0]
|
||||||
|
["legs"][index - 1]["duration"] !=
|
||||||
|
null
|
||||||
|
? destinationController.matrix["routes"][0]
|
||||||
|
["legs"][index - 1]["duration"]
|
||||||
|
["text"]
|
||||||
|
.toString()
|
||||||
|
: '')
|
||||||
],
|
],
|
||||||
):
|
)
|
||||||
Container()
|
: Container(),
|
||||||
,
|
|
||||||
);
|
);
|
||||||
|
}),
|
||||||
}
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -240,15 +269,24 @@ class DestinationWidget extends StatelessWidget {
|
|||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.cancel),
|
icon: const Icon(Icons.cancel),
|
||||||
//onPressed: (){doDelete();},
|
//onPressed: (){doDelete();},
|
||||||
onPressed: destinationController.currentSelectedDestinations.isNotEmpty ? doDelete : null,
|
onPressed: destinationController
|
||||||
|
.currentSelectedDestinations.isNotEmpty
|
||||||
|
? doDelete
|
||||||
|
: null,
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.move_up),
|
icon: const Icon(Icons.move_up),
|
||||||
onPressed: destinationController.currentSelectedDestinations.isNotEmpty ? moveUp : null,
|
onPressed: destinationController
|
||||||
|
.currentSelectedDestinations.isNotEmpty
|
||||||
|
? moveUp
|
||||||
|
: null,
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.move_down),
|
icon: const Icon(Icons.move_down),
|
||||||
onPressed: destinationController.currentSelectedDestinations.isNotEmpty ? moveDown : null,
|
onPressed: destinationController
|
||||||
|
.currentSelectedDestinations.isNotEmpty
|
||||||
|
? moveDown
|
||||||
|
: null,
|
||||||
),
|
),
|
||||||
// IconButton(
|
// IconButton(
|
||||||
// icon:Icon(Icons.sync),
|
// icon:Icon(Icons.sync),
|
||||||
@ -258,7 +296,6 @@ class DestinationWidget extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
)
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -18,22 +18,25 @@ class ListWidget extends StatefulWidget {
|
|||||||
class _ListWidgetState extends State<ListWidget> {
|
class _ListWidgetState extends State<ListWidget> {
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
final DestinationController destinationController = Get.find<DestinationController>();
|
final DestinationController destinationController =
|
||||||
|
Get.find<DestinationController>();
|
||||||
|
|
||||||
Image getImage(int index) {
|
Image getImage(int index) {
|
||||||
if(indexController.locations[0].collection[index].properties!["photos"] == null || indexController.locations[0].collection[index].properties!["photos"] == ""){
|
if (indexController.locations[0].collection[index].properties!["photos"] ==
|
||||||
|
null ||
|
||||||
|
indexController.locations[0].collection[index].properties!["photos"] ==
|
||||||
|
"") {
|
||||||
return const Image(image: AssetImage('assets/images/empty_image.png'));
|
return const Image(image: AssetImage('assets/images/empty_image.png'));
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
print("==== photo index is $index ===");
|
print("==== photo index is $index ===");
|
||||||
String serverUrl = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
GeoJsonFeature<dynamic> gf = indexController.locations[0].collection[index];
|
GeoJsonFeature<dynamic> gf =
|
||||||
|
indexController.locations[0].collection[index];
|
||||||
String _photo = gf.properties!["photos"];
|
String _photo = gf.properties!["photos"];
|
||||||
return Image(
|
return Image(
|
||||||
image: NetworkImage(
|
image: NetworkImage('$serverUrl/media/compressed/' + _photo),
|
||||||
'$serverUrl/media/compressed/' + _photo
|
errorBuilder:
|
||||||
),
|
(BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
|
||||||
return Image.asset("assets/images/empty_image.png");
|
return Image.asset("assets/images/empty_image.png");
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -65,9 +68,11 @@ class _ListWidgetState extends State<ListWidget> {
|
|||||||
|
|
||||||
Future<String> matrixDistance(int i) async {
|
Future<String> matrixDistance(int i) async {
|
||||||
// Create two destinations directly from indexController.locations[0].collection
|
// Create two destinations directly from indexController.locations[0].collection
|
||||||
Destination desCurr = Destination(lat: indexController.current_lat, lon: indexController.current_lon);
|
Destination desCurr = Destination(
|
||||||
|
lat: indexController.current_lat, lon: indexController.current_lon);
|
||||||
//Destination dest1 = createDestination(indexController.locations[0].collection[0]);
|
//Destination dest1 = createDestination(indexController.locations[0].collection[0]);
|
||||||
Destination dest2 = createDestination(indexController.locations[0].collection[i]);
|
Destination dest2 =
|
||||||
|
createDestination(indexController.locations[0].collection[i]);
|
||||||
|
|
||||||
// Get the distance between these two destinations
|
// Get the distance between these two destinations
|
||||||
final res = await MatrixService.getDestinations([desCurr, dest2]);
|
final res = await MatrixService.getDestinations([desCurr, dest2]);
|
||||||
@ -81,15 +86,14 @@ class _ListWidgetState extends State<ListWidget> {
|
|||||||
indexController.locations[0].collection.sort((a, b) =>
|
indexController.locations[0].collection.sort((a, b) =>
|
||||||
(a.properties!['cp'] as Comparable)
|
(a.properties!['cp'] as Comparable)
|
||||||
.compareTo(b.properties!['cp'] as Comparable));
|
.compareTo(b.properties!['cp'] as Comparable));
|
||||||
setState(() {
|
setState(() {});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Obx(() =>
|
return Obx(
|
||||||
indexController.locations.isNotEmpty ?
|
() => indexController.locations.isNotEmpty
|
||||||
RefreshIndicator(
|
? RefreshIndicator(
|
||||||
onRefresh: _pullRefresh,
|
onRefresh: _pullRefresh,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: indexController.locations[0].collection.length,
|
itemCount: indexController.locations[0].collection.length,
|
||||||
@ -97,7 +101,9 @@ class _ListWidgetState extends State<ListWidget> {
|
|||||||
itemBuilder: (_, index) {
|
itemBuilder: (_, index) {
|
||||||
bool _is_found = false;
|
bool _is_found = false;
|
||||||
for (Destination d in destinationController.destinations) {
|
for (Destination d in destinationController.destinations) {
|
||||||
if(indexController.locations[0].collection[index].properties!['location_id'] == d.location_id){
|
if (indexController.locations[0].collection[index]
|
||||||
|
.properties!['location_id'] ==
|
||||||
|
d.location_id) {
|
||||||
_is_found = true;
|
_is_found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -105,49 +111,78 @@ class _ListWidgetState extends State<ListWidget> {
|
|||||||
return Card(
|
return Card(
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
selected: _is_found,
|
selected: _is_found,
|
||||||
|
|
||||||
selectedTileColor: Colors.yellow.shade200,
|
selectedTileColor: Colors.yellow.shade200,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
GeoJsonFeature gf = indexController.locations[0].collection[index];
|
GeoJsonFeature gf =
|
||||||
|
indexController.locations[0].collection[index];
|
||||||
changeCurrentFeature(gf);
|
changeCurrentFeature(gf);
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
|
constraints: BoxConstraints.loose(
|
||||||
|
Size(Get.width, Get.height * 0.75)),
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
context: context,
|
context: context,
|
||||||
//builder: (context) => BottomSheetWidget(),
|
//builder: (context) => BottomSheetWidget(),
|
||||||
builder:((context) => BottomSheetNew())
|
builder: ((context) => BottomSheetNew()));
|
||||||
);
|
|
||||||
},
|
},
|
||||||
leading: getImage(index),
|
leading: getImage(index),
|
||||||
title: indexController.locations[0].collection[index].properties!['location_name'] != null ? Text(indexController.locations[0].collection[index].properties!['location_name'].toString()) : const Text(""),
|
title: indexController.locations[0].collection[index]
|
||||||
subtitle: indexController.locations[0].collection[index].properties!['category'] != null ? Text(indexController.locations[0].collection[index].properties!['category']) : const Text(""),
|
.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(
|
trailing: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
indexController.locations[0].collection[index].properties!['sub_loc_id'] != null ? Text(indexController.locations[0].collection[index].properties!['sub_loc_id']) : const Text(""),
|
indexController.locations[0].collection[index]
|
||||||
|
.properties!['sub_loc_id'] !=
|
||||||
|
null
|
||||||
|
? Text(indexController
|
||||||
|
.locations[0]
|
||||||
|
.collection[index]
|
||||||
|
.properties!['sub_loc_id'])
|
||||||
|
: const Text(""),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 100,
|
width: 100,
|
||||||
child: FutureBuilder<String>(
|
child: FutureBuilder<String>(
|
||||||
future: matrixDistance(index),
|
future: matrixDistance(index),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if(snapshot.connectionState == ConnectionState.waiting){
|
if (snapshot.connectionState ==
|
||||||
return const Center(child: CircularProgressIndicator(),);
|
ConnectionState.waiting) {
|
||||||
|
return const Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (snapshot.hasError) {
|
if (snapshot.hasError) {
|
||||||
return const Text("-");
|
return const Text("-");
|
||||||
}
|
} else {
|
||||||
else{
|
return Text(
|
||||||
return Text(snapshot.data ?? '', style: const TextStyle(color: Colors.red, fontWeight: FontWeight.bold),);
|
snapshot.data ?? '',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.red,
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
)
|
)),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
) : const SizedBox(width: 0, height: 0,),
|
)
|
||||||
|
: const SizedBox(
|
||||||
|
width: 0,
|
||||||
|
height: 0,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -14,9 +14,9 @@ import 'package:rogapp/widgets/base_layer_widget.dart';
|
|||||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||||
|
|
||||||
class MapWidget extends StatelessWidget {
|
class MapWidget extends StatelessWidget {
|
||||||
|
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
final DestinationController destinationController = Get.find<DestinationController>();
|
final DestinationController destinationController =
|
||||||
|
Get.find<DestinationController>();
|
||||||
|
|
||||||
MapWidget({Key? key}) : super(key: key);
|
MapWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@ -31,7 +31,9 @@ class MapWidget extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
GeoJsonFeature? fs = indexController.getFeatureForLatLong(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude);
|
GeoJsonFeature? fs = indexController.getFeatureForLatLong(
|
||||||
|
p.geoSerie!.geoPoints[0].latitude,
|
||||||
|
p.geoSerie!.geoPoints[0].longitude);
|
||||||
print("------- fs $fs------");
|
print("------- fs $fs------");
|
||||||
if (fs != null) {
|
if (fs != null) {
|
||||||
indexController.currentFeature.clear();
|
indexController.currentFeature.clear();
|
||||||
@ -40,6 +42,8 @@ class MapWidget extends StatelessWidget {
|
|||||||
indexController.getAction();
|
indexController.getAction();
|
||||||
|
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
|
constraints:
|
||||||
|
BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
|
||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
isDismissible: true,
|
isDismissible: true,
|
||||||
@ -49,10 +53,6 @@ class MapWidget extends StatelessWidget {
|
|||||||
destinationController.skip_gps = false;
|
destinationController.skip_gps = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 32,
|
height: 32,
|
||||||
@ -61,27 +61,42 @@ class MapWidget extends StatelessWidget {
|
|||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: i.properties!['buy_point'] > 0 ? Colors.blue : Colors.red,
|
color: i.properties!['buy_point'] > 0
|
||||||
|
? Colors.blue
|
||||||
|
: Colors.red,
|
||||||
width: 3,
|
width: 3,
|
||||||
style: BorderStyle.solid
|
style: BorderStyle.solid)),
|
||||||
)
|
|
||||||
),
|
|
||||||
child: Stack(
|
child: Stack(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
children: [
|
children: [
|
||||||
const Icon(Icons.circle,size: 6.0,),
|
const Icon(
|
||||||
i.properties!['cp'] == -1 ?
|
Icons.circle,
|
||||||
Transform.rotate(
|
size: 6.0,
|
||||||
|
),
|
||||||
|
i.properties!['cp'] == -1
|
||||||
|
? Transform.rotate(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
origin: Offset.fromDirection(1, 26),
|
origin: Offset.fromDirection(1, 26),
|
||||||
angle: 270 * pi / 180,
|
angle: 270 * pi / 180,
|
||||||
child: const Icon(Icons.play_arrow_outlined, color: Colors.red, size: 70,)):
|
child: const Icon(
|
||||||
Container(color: Colors.transparent,),
|
Icons.play_arrow_outlined,
|
||||||
|
color: Colors.red,
|
||||||
|
size: 70,
|
||||||
|
))
|
||||||
|
: Container(
|
||||||
|
color: Colors.transparent,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)),
|
||||||
),
|
),
|
||||||
),
|
Container(
|
||||||
Container(color: Colors.white, child: Text(TextUtils.getDisplayTextFeture(i), style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color:Colors.red,))),
|
color: Colors.white,
|
||||||
|
child: Text(TextUtils.getDisplayTextFeture(i),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.red,
|
||||||
|
))),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -98,91 +113,94 @@ class MapWidget extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
print(
|
||||||
print("---------- rog mode is ${indexController.rog_mode.value.toString()}----------");
|
"---------- rog mode is ${indexController.rog_mode.value.toString()}----------");
|
||||||
|
|
||||||
final PopupController _popupController = PopupController();
|
final PopupController _popupController = PopupController();
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
Obx(() =>
|
Obx(() => indexController.is_loading == true
|
||||||
indexController.is_loading == true ? const Padding(
|
? const Padding(
|
||||||
padding: EdgeInsets.only(top: 60.0),
|
padding: EdgeInsets.only(top: 60.0),
|
||||||
child: CircularProgressIndicator(),
|
child: CircularProgressIndicator(),
|
||||||
):
|
)
|
||||||
FlutterMap(
|
: FlutterMap(
|
||||||
mapController: indexController.mapController,
|
mapController: indexController.mapController,
|
||||||
options: MapOptions(
|
options: MapOptions(
|
||||||
maxZoom: 18.4,
|
maxZoom: 18.4,
|
||||||
onMapReady: () {
|
onMapReady: () {
|
||||||
indexController.is_mapController_loaded.value = true;
|
indexController.is_mapController_loaded.value = true;
|
||||||
subscription = indexController.mapController.mapEventStream.listen((MapEvent mapEvent) {
|
subscription = indexController.mapController.mapEventStream
|
||||||
|
.listen((MapEvent mapEvent) {
|
||||||
if (mapEvent is MapEventMoveStart) {
|
if (mapEvent is MapEventMoveStart) {
|
||||||
//print(DateTime.now().toString() + ' [MapEventMoveStart] START');
|
//print(DateTime.now().toString() + ' [MapEventMoveStart] START');
|
||||||
// do something
|
// do something
|
||||||
}
|
}
|
||||||
if (mapEvent is MapEventMoveEnd && indexController.currentUser.isEmpty) {
|
if (mapEvent is MapEventMoveEnd &&
|
||||||
|
indexController.currentUser.isEmpty) {
|
||||||
//print(DateTime.now().toString() + ' [MapEventMoveStart] END');
|
//print(DateTime.now().toString() + ' [MapEventMoveStart] END');
|
||||||
indexController.loadLocationsBound();
|
indexController.loadLocationsBound();
|
||||||
//indexController.rogMapController!.move(c.center, c.zoom);
|
//indexController.rogMapController!.move(c.center, c.zoom);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
//center: LatLng(37.15319600454702, 139.58765950528198),
|
//center: LatLng(37.15319600454702, 139.58765950528198),
|
||||||
bounds: indexController.currentBound.isNotEmpty ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
|
bounds: indexController.currentBound.isNotEmpty
|
||||||
|
? indexController.currentBound[0]
|
||||||
|
: LatLngBounds.fromPoints([
|
||||||
|
LatLng(35.03999881162295, 136.40587119778962),
|
||||||
|
LatLng(36.642756778706904, 137.95226720406063)
|
||||||
|
]),
|
||||||
zoom: 1,
|
zoom: 1,
|
||||||
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
interactiveFlags:
|
||||||
|
InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
||||||
|
|
||||||
onPositionChanged: (MapPosition pos, isvalue){
|
onPositionChanged: (MapPosition pos, isvalue) {},
|
||||||
|
onTap: (_, __) => _popupController
|
||||||
},
|
|
||||||
onTap: (_, __) =>
|
|
||||||
_popupController
|
|
||||||
.hideAllPopups(), // Hide popup when the map is tapped.
|
.hideAllPopups(), // Hide popup when the map is tapped.
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
const BaseLayer(),
|
const BaseLayer(),
|
||||||
Obx(() =>
|
Obx(
|
||||||
indexController.routePointLenght > 0 ?
|
() => indexController.routePointLenght > 0
|
||||||
PolylineLayer(
|
? PolylineLayer(
|
||||||
polylines: [
|
polylines: [
|
||||||
Polyline(
|
Polyline(
|
||||||
points: getPoints()!,
|
points: getPoints()!,
|
||||||
strokeWidth: 6.0,
|
strokeWidth: 6.0,
|
||||||
color: Colors.indigo
|
color: Colors.indigo),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
: Container(),
|
||||||
:
|
|
||||||
Container(),
|
|
||||||
),
|
),
|
||||||
CurrentLocationLayer(),
|
CurrentLocationLayer(),
|
||||||
indexController.locations.isNotEmpty && indexController.locations[0].collection.isNotEmpty ?
|
indexController.locations.isNotEmpty &&
|
||||||
MarkerLayer(
|
indexController.locations[0].collection.isNotEmpty
|
||||||
markers:indexController.locations[0].collection.map((i) {
|
? MarkerLayer(
|
||||||
|
markers:
|
||||||
|
indexController.locations[0].collection.map((i) {
|
||||||
print("i si ${i.properties!['location_id']}");
|
print("i si ${i.properties!['location_id']}");
|
||||||
|
|
||||||
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
||||||
GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
|
GeoJsonMultiPoint p =
|
||||||
print("lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}");
|
i.geometry as GeoJsonMultiPoint;
|
||||||
|
print(
|
||||||
|
"lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}");
|
||||||
return Marker(
|
return Marker(
|
||||||
anchorPos: AnchorPos.exactly(Anchor(108.0, 18.0)),
|
anchorPos: AnchorPos.exactly(Anchor(108.0, 18.0)),
|
||||||
height: 32.0,
|
height: 32.0,
|
||||||
width: 120.0,
|
width: 120.0,
|
||||||
point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude),
|
point: LatLng(p.geoSerie!.geoPoints[0].latitude,
|
||||||
|
p.geoSerie!.geoPoints[0].longitude),
|
||||||
builder: (ctx) {
|
builder: (ctx) {
|
||||||
return getMarkerShape(i, context);
|
return getMarkerShape(i, context);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
)
|
)
|
||||||
:
|
: const Center(child: CircularProgressIndicator()),
|
||||||
const Center(child: CircularProgressIndicator())
|
|
||||||
,
|
|
||||||
],
|
],
|
||||||
)
|
))
|
||||||
)
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user