import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:SEFER/constant/colors.dart'; import 'package:SEFER/constant/style.dart'; import 'package:SEFER/controller/home/map_passenger_controller.dart'; import '../../widgets/elevated_btn.dart'; GetBuilder cancelRidePage() { Get.put(MapPassengerController()); final List 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( builder: (controller) => controller.isCancelRidePageShown ? Positioned( left: 20, top: Get.height * 0.15, right: 20, bottom: Get.height * 0.15, child: Container( 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(), ); }