fix bottomsheel

This commit is contained in:
Mohamed Nouffer
2023-09-06 21:36:11 +05:30
parent 36751f6ef7
commit 44a3fc21fb
7 changed files with 676 additions and 547 deletions

View File

@ -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(

View File

@ -1,4 +1,3 @@
import 'dart:async';
import 'package:flutter/material.dart';
@ -15,65 +14,68 @@ 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(){
print("##### --- route point ${indexController.routePoints.length}");
List<LatLng> pts = [];
for(PointLatLng p in indexController.routePoints){
LatLng l = LatLng(p.latitude, p.longitude);
pts.add(l);
}
return pts;
List<LatLng>? getPoints() {
print("##### --- route point ${indexController.routePoints.length}");
List<LatLng> pts = [];
for (PointLatLng p in indexController.routePoints) {
LatLng l = LatLng(p.latitude, p.longitude);
pts.add(l);
}
return pts;
}
List<Marker>? getMarkers() {
List<Marker> pts = [];
int index = -1;
for (int i = 0; i < destinationController.destinations.length; i++) {
Destination d = destinationController.destinations[i];
print("^^^^ $d ^^^^");
Marker m = Marker(
List<Marker>? getMarkers() {
List<Marker> pts = [];
int index = -1;
for (int i = 0; i < destinationController.destinations.length; i++) {
Destination d = destinationController.destinations[i];
print("^^^^ $d ^^^^");
Marker m = Marker(
point: LatLng(d.lat!, d.lon!),
anchorPos: AnchorPos.align(AnchorAlign.center),
builder:(cts){
builder: (cts) {
return InkWell(
onTap: (){
print("-- Destination is --- ${d.name} ------");
if(indexController.currentDestinationFeature.isNotEmpty) {
indexController.currentDestinationFeature.clear();
}
indexController.currentDestinationFeature.add(d);
//indexController.getAction();
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => BottomSheetNew())
).whenComplete((){
print("---- set skip gps to false -----");
destinationController.skip_gps = false;
});
onTap: () {
print("-- Destination is --- ${d.name} ------");
if (indexController.currentDestinationFeature.isNotEmpty) {
indexController.currentDestinationFeature.clear();
}
indexController.currentDestinationFeature.add(d);
//indexController.getAction();
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;
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width:20,
height:20,
decoration: BoxDecoration(
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,90 +85,93 @@ 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);
}
return pts;
});
pts.add(m);
}
return pts;
}
@override
Widget build(BuildContext context) {
return Obx((() =>
Stack(
children: [
// indexController.is_rog_mapcontroller_loaded.value == false ?
// Center(child: CircularProgressIndicator())
// :
// Padding(
// padding: const EdgeInsets.only(left:8.0),
// child: BreadCrumbWidget(mapController:indexController.rogMapController),
// ),
Padding(
padding: const EdgeInsets.only(top:0.0),
//child: TravelMap(),
child:
TravelMap(),
),
],
)
));
return Obx((() => Stack(
children: [
// indexController.is_rog_mapcontroller_loaded.value == false ?
// Center(child: CircularProgressIndicator())
// :
// Padding(
// padding: const EdgeInsets.only(left:8.0),
// child: BreadCrumbWidget(mapController:indexController.rogMapController),
// ),
Padding(
padding: const EdgeInsets.only(top: 0.0),
//child: TravelMap(),
child: TravelMap(),
),
],
)));
}
FlutterMap TravelMap() {
return FlutterMap(
mapController: indexController.rogMapController,
options: MapOptions(
onMapReady: (){
indexController.is_rog_mapcontroller_loaded.value = true;
subscription = indexController.rogMapController.mapEventStream.listen((MapEvent mapEvent) {
if (mapEvent is MapEventMoveStart) {
}
options: MapOptions(
onMapReady: () {
indexController.is_rog_mapcontroller_loaded.value = true;
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)]),
zoom: 1,
maxZoom: 42,
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
),
children: [
const BaseLayer(),
Obx(() =>
indexController.routePointLenght > 0 ?
PolylineLayer(
polylines: [
Polyline(
points: getPoints()!,
strokeWidth: 6.0,
color: Colors.indigo
),
],
)
:
Container(),
},
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,
),
CurrentLocationLayer(),
MarkerLayer(
markers: getMarkers()!
),
],
);
children: [
const BaseLayer(),
Obx(
() => indexController.routePointLenght > 0
? PolylineLayer(
polylines: [
Polyline(
points: getPoints()!,
strokeWidth: 6.0,
color: Colors.indigo),
],
)
: Container(),
),
CurrentLocationLayer(),
MarkerLayer(markers: getMarkers()!),
],
);
}
}

View File

@ -7,22 +7,24 @@ import 'package:rogapp/pages/search/search_controller.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart';
class SearchPage extends StatelessWidget {
SearchPage({Key? key}) : super(key: key);
SearchPage({Key? key}) : super(key: key);
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,60 +35,67 @@ class SearchPage extends StatelessWidget {
elevation: 0,
backgroundColor: Colors.white,
leading: IconButton(
onPressed:(){
Get.back();
},
icon: const Icon(Icons.arrow_back_ios_new, color: Colors.black,)
),
onPressed: () {
Get.back();
},
icon: const Icon(
Icons.arrow_back_ios_new,
color: Colors.black,
)),
centerTitle: true,
//title: const CupertinoSearchTextField(),
),
body: SingleChildScrollView(
child: TypeAheadField(
textFieldConfiguration: TextFieldConfiguration(
autofocus: true,
style: DefaultTextStyle.of(context).style.copyWith(
fontStyle: FontStyle.normal,
fontSize: 15.0,
),
decoration: InputDecoration(
border: const OutlineInputBorder(),
hintText: "検索",
prefixIcon: const Icon(Icons.search),
suffixIcon: IconButton(
icon: const Icon(Icons.clear),
onPressed: () {
// clear the text field
},
textFieldConfiguration: TextFieldConfiguration(
autofocus: true,
style: DefaultTextStyle.of(context).style.copyWith(
fontStyle: FontStyle.normal,
fontSize: 15.0,
),
decoration: InputDecoration(
border: const OutlineInputBorder(),
hintText: "検索",
prefixIcon: const Icon(Icons.search),
suffixIcon: IconButton(
icon: const Icon(Icons.clear),
onPressed: () {
// clear the text field
},
),
),
suggestionsCallback: (pattern) async{
return searchController.searchResults.where((GeoJsonFeature element) => element.properties!["location_name"].toString().contains(pattern));
//return await
},
itemBuilder: (context, GeoJsonFeature suggestion){
return ListTile(
title: Text(suggestion.properties!["location_name"]),
subtitle: suggestion.properties!["category"] != null ? Text(suggestion.properties!["category"]) : const Text(""),
//leading: getImage(index),
);
},
onSuggestionSelected: (GeoJsonFeature suggestion){
indexController.currentFeature.clear();
indexController.currentFeature.add(suggestion);
Get.back();
showModalBottomSheet(
isScrollControlled: true,
context: context,
//builder: (context) => BottomSheetWidget(),
builder:((context) => BottomSheetNew())
);
},
),
suggestionsCallback: (pattern) async {
return searchController.searchResults.where(
(GeoJsonFeature element) => element.properties!["location_name"]
.toString()
.contains(pattern));
//return await
},
itemBuilder: (context, GeoJsonFeature suggestion) {
return ListTile(
title: Text(suggestion.properties!["location_name"]),
subtitle: suggestion.properties!["category"] != null
? Text(suggestion.properties!["category"])
: const Text(""),
//leading: getImage(index),
);
},
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()));
},
),
),
// Obx(() =>
// Obx(() =>
// ListView.builder(
// itemCount: searchController.searchResults.length,
// itemBuilder: (context, index){
@ -111,4 +120,4 @@ class SearchPage extends StatelessWidget {
// )
);
}
}
}