This commit is contained in:
Hamza-Ayed
2024-01-08 23:46:03 +03:00
parent 7d9bd9f62a
commit 783ae1a0ac
5 changed files with 220 additions and 137 deletions

View File

@@ -28,7 +28,7 @@ GetBuilder<MapPassengerController> formSearchPlaces0() {
width: 2,
)),
suffixIcon: const Icon(Icons.search),
hintText: 'Search for waypoint'.tr,
hintText: controller.hintTextwayPoint0.tr,
hintStyle: AppStyle.title,
hintMaxLines: 1,
prefixIcon: IconButton(
@@ -86,9 +86,10 @@ GetBuilder<MapPassengerController> formSearchPlaces0() {
}
controller.convertHintTextPlaces0(index);
controller.currentLocationString = res['name'];
controller.currentLocationString0 = res['name'];
controller.wayPoint0 = [];
controller.wayPoint0Controller.clear();
Get.back();
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
@@ -182,7 +183,7 @@ GetBuilder<MapPassengerController> formSearchPlaces1() {
width: 2,
)),
suffixIcon: const Icon(Icons.search),
hintText: 'Search for waypoint'.tr,
hintText: controller.hintTextwayPoint1.tr,
hintStyle: AppStyle.title,
hintMaxLines: 1,
prefixIcon: IconButton(
@@ -240,9 +241,10 @@ GetBuilder<MapPassengerController> formSearchPlaces1() {
}
controller.convertHintTextPlaces1(index);
controller.currentLocationString = res['name'];
controller.wayPoint1 = [];
controller.wayPoint1Controller.clear();
controller.currentLocationString1 = res['name'];
// controller.wayPoint1 = [];
// controller.wayPoint1Controller.clear();
Get.back();
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
@@ -336,7 +338,7 @@ GetBuilder<MapPassengerController> formSearchPlaces2() {
width: 2,
)),
suffixIcon: const Icon(Icons.search),
hintText: 'Search for waypoint'.tr,
hintText: controller.hintTextwayPoint2.tr,
hintStyle: AppStyle.title,
hintMaxLines: 1,
prefixIcon: IconButton(
@@ -394,9 +396,10 @@ GetBuilder<MapPassengerController> formSearchPlaces2() {
}
controller.convertHintTextPlaces2(index);
controller.currentLocationString = res['name'];
controller.currentLocationString2 = res['name'];
controller.wayPoint2 = [];
controller.wayPoint2Controller.clear();
Get.back();
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
@@ -490,7 +493,7 @@ GetBuilder<MapPassengerController> formSearchPlaces3() {
width: 2,
)),
suffixIcon: const Icon(Icons.search),
hintText: 'Search for waypoint'.tr,
hintText: controller.hintTextwayPoint3.tr,
hintStyle: AppStyle.title,
hintMaxLines: 1,
prefixIcon: IconButton(
@@ -548,9 +551,10 @@ GetBuilder<MapPassengerController> formSearchPlaces3() {
}
controller.convertHintTextPlaces3(index);
controller.currentLocationString = res['name'];
controller.currentLocationString3 = res['name'];
controller.wayPoint3 = [];
controller.wayPoint3Controller.clear();
Get.back();
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
@@ -644,7 +648,7 @@ GetBuilder<MapPassengerController> formSearchPlaces4() {
width: 2,
)),
suffixIcon: const Icon(Icons.search),
hintText: 'Search for waypoint'.tr,
hintText: controller.hintTextwayPoint4.tr,
hintStyle: AppStyle.title,
hintMaxLines: 1,
prefixIcon: IconButton(
@@ -702,9 +706,10 @@ GetBuilder<MapPassengerController> formSearchPlaces4() {
}
controller.convertHintTextPlaces4(index);
controller.currentLocationString = res['name'];
controller.currentLocationString4 = res['name'];
controller.wayPoint4 = [];
controller.wayPoint4Controller.clear();
Get.back();
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),

View File

@@ -24,20 +24,9 @@ class MainBottomMenuMap extends StatelessWidget {
left: 5,
right: 5,
child: AnimatedContainer(
duration: const Duration(milliseconds: 400),
height: controller.mainBottomMenuMap,
decoration: const BoxDecoration(
boxShadow: [
BoxShadow(
color: AppColor.accentColor, offset: Offset(2, 2)),
BoxShadow(
color: AppColor.accentColor, offset: Offset(-2, -2))
],
color: AppColor.secondaryColor,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(15),
topRight: Radius.circular(15),
)),
duration: const Duration(milliseconds: 500),
height: controller.mainBottomMenuMapHeight,
decoration: AppStyle.boxDecoration,
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
@@ -272,7 +261,17 @@ class MainBottomMenuMap extends StatelessWidget {
controller.showBottomSheet1();
Get.back();
controller.showBottomSheet1();
})
}),
TextButton(
onPressed: () {
controller.changeMainBottomMenuMap();
controller.changeWayPointSheet();
},
child: Text(
"If you want add stop click here".tr,
style: AppStyle.title,
),
),
],
)
],

View File

@@ -18,102 +18,146 @@ class PointsPageForRider extends StatelessWidget {
Widget build(BuildContext context) {
Get.put(WayPointController());
return GetBuilder<WayPointController>(builder: (wayPointController) {
return Container(
decoration: AppStyle.boxDecoration,
height: wayPointController.wayPointHeight,
child: ListView(
children: [
const AppBarPointsPageForRider(),
SizedBox(
height: 300,
child: ReorderableListView(
// The children of the list are the text fields
children:
wayPointController.wayPoints.asMap().entries.map((entry) {
final index = entry.key;
final wayPoint = entry.value;
return Padding(
key: ValueKey(index),
padding: const EdgeInsets.all(6),
child: ListTile(
leading: Container(
decoration: BoxDecoration(
color: AppColor.deepPurpleAccent,
border: Border.all(),
shape: BoxShape.rectangle),
child: Padding(
padding: const EdgeInsets.all(2),
child: Text(
index.toString(),
style: AppStyle.title,
),
)),
title: InkWell(
onTap: () {
// showAddLocationDialog(context);
Get.defaultDialog(
content: SizedBox(
width: Get.width,
height: 400,
child: mapPassengerController
.placeListResponse[index]),
);
},
child: Container(
decoration: BoxDecoration(
border: Border.all(),
color: AppColor.accentColor.withOpacity(.5)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
index == 0
? Text(
'Current Location',
style: AppStyle.title,
)
: Text(
'$wayPoint$index',
style: AppStyle.title,
),
const Icon(
Icons.reorder,
size: 20,
),
],
),
),
),
trailing: index > 0
? IconButton(
icon: const Icon(Icons.close),
onPressed: () {
wayPointController.removeTextField(index);
},
)
: IconButton(
icon: const Icon(
Icons.close,
color: AppColor.secondaryColor,
),
onPressed: () {},
)),
);
}).toList(),
// The callback when the user reorders the text fields
onReorder: (int oldIndex, int newIndex) {
wayPointController.reorderTextFields(oldIndex, newIndex);
return GetBuilder<MapPassengerController>(builder: (controller) {
return Positioned(
bottom: 2,
left: 2,
right: 2,
child: AnimatedContainer(
duration: const Duration(milliseconds: 800),
height: controller.wayPointSheetHeight,
decoration: AppStyle.boxDecoration,
child: ListView(
children: [
// const AppBarPointsPageForRider(),
IconButton(
onPressed: () {
mapPassengerController.changeWayPointSheet();
},
icon: const Icon(Icons.arrow_drop_down_circle_outlined),
),
),
ElevatedButton(
onPressed: () {
wayPointController.addWayPoints();
},
child: const Text('Add Text Field'),
),
],
SizedBox(
height: Get.height * .57,
child: GetBuilder<WayPointController>(
builder: (wayPointController) {
return ReorderableListView(
// The children of the list are the text fields
children: wayPointController.wayPoints
.asMap()
.entries
.map((entry) {
final index = entry.key;
final wayPoint = entry.value;
return Padding(
key: ValueKey(index),
padding: const EdgeInsets.all(6),
child: ListTile(
leading: Container(
decoration: BoxDecoration(
color: AppColor.deepPurpleAccent,
border: Border.all(),
shape: BoxShape.rectangle),
child: Padding(
padding: const EdgeInsets.all(2),
child: Text(
index.toString(),
style: AppStyle.title,
),
)),
title: InkWell(
onTap: () {
// showAddLocationDialog(context);
Get.defaultDialog(
content: SizedBox(
width: Get.width,
height: 400,
child: mapPassengerController
.placeListResponse[index]),
);
},
child: Container(
decoration: BoxDecoration(
border: Border.all(),
color:
AppColor.accentColor.withOpacity(.5)),
child: GetBuilder<MapPassengerController>(
builder: (mapPassengerController) {
return Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
index == 0
? Text(
mapPassengerController
.currentLocationString0,
style: AppStyle.title,
)
: index == 1
? Text(
mapPassengerController
.currentLocationString1,
style: AppStyle.title,
)
: index == 2
? Text(
mapPassengerController
.currentLocationString2,
style: AppStyle.title,
)
: index == 3
? Text(
mapPassengerController
.currentLocationString3,
style: AppStyle.title,
)
: Text(
mapPassengerController
.currentLocationString4,
style: AppStyle.title,
),
const Icon(
Icons.reorder,
size: 20,
),
],
);
}),
),
),
trailing: index > 0
? IconButton(
icon: const Icon(Icons.close),
onPressed: () {
wayPointController.removeTextField(index);
},
)
: IconButton(
icon: const Icon(
Icons.close,
color: AppColor.secondaryColor,
),
onPressed: () {},
)),
);
}).toList(),
// The callback when the user reorders the text fields
onReorder: (int oldIndex, int newIndex) {
wayPointController.reorderTextFields(oldIndex, newIndex);
},
);
}),
),
GetBuilder<WayPointController>(builder: (wayPointController) {
return ElevatedButton(
onPressed: () {
wayPointController.addWayPoints();
},
child: const Text('Add Text Field'),
);
}),
],
),
),
);
});