102 lines
3.5 KiB
Dart
102 lines
3.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:Tripz/constant/colors.dart';
|
|
import 'package:Tripz/constant/style.dart';
|
|
import 'package:Tripz/controller/home/map_passenger_controller.dart';
|
|
import '../../widgets/elevated_btn.dart';
|
|
|
|
void showCancelRideBottomSheet() {
|
|
Get.bottomSheet(
|
|
cancelRidePage(),
|
|
backgroundColor: Colors.transparent,
|
|
isScrollControlled: true,
|
|
);
|
|
}
|
|
|
|
GetBuilder<MapPassengerController> cancelRidePage() {
|
|
Get.put(MapPassengerController());
|
|
|
|
final List<String> reasons = [
|
|
"I don't need a ride anymore".tr,
|
|
"I was just trying the application".tr,
|
|
"No driver accepted my request".tr,
|
|
"I added the wrong pick-up/drop-off location".tr,
|
|
"I don't have a reason".tr,
|
|
"Other".tr,
|
|
];
|
|
|
|
return GetBuilder<MapPassengerController>(
|
|
builder: (controller) => controller.isCancelRidePageShown
|
|
? Container(
|
|
height: Get.height * 0.6,
|
|
padding: const EdgeInsets.all(20),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black.withOpacity(0.2),
|
|
offset: const Offset(0, 8),
|
|
blurRadius: 16,
|
|
),
|
|
],
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
'Can we know why you want to cancel Ride ?'.tr,
|
|
style: AppStyle.title
|
|
.copyWith(fontSize: 18, fontWeight: FontWeight.bold),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
const SizedBox(height: 20),
|
|
Expanded(
|
|
child: ListView.separated(
|
|
itemCount: reasons.length,
|
|
separatorBuilder: (context, index) => const Divider(),
|
|
itemBuilder: (context, index) {
|
|
return ListTile(
|
|
title: Text(
|
|
reasons[index],
|
|
style: AppStyle.title.copyWith(fontSize: 16),
|
|
),
|
|
leading: Radio(
|
|
value: index,
|
|
groupValue: controller.selectedReason,
|
|
onChanged: (int? value) {
|
|
controller.selectReason(value!, reasons[index]);
|
|
},
|
|
activeColor: AppColor.primaryColor,
|
|
),
|
|
onTap: () {
|
|
controller.selectReason(index, reasons[index]);
|
|
},
|
|
);
|
|
},
|
|
),
|
|
),
|
|
const SizedBox(height: 20),
|
|
MyElevatedButton(
|
|
title: 'Cancel Ride'.tr,
|
|
onPressed: () {
|
|
if (controller.selectedReason == -1) {
|
|
Get.snackbar(
|
|
'You Should be select reason.'.tr,
|
|
'',
|
|
snackPosition: SnackPosition.BOTTOM,
|
|
backgroundColor: AppColor.redColor,
|
|
colorText: Colors.white,
|
|
);
|
|
} else {
|
|
controller.cancelRide();
|
|
}
|
|
},
|
|
),
|
|
],
|
|
),
|
|
)
|
|
: const SizedBox(),
|
|
);
|
|
}
|