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