259 lines
12 KiB
Dart
259 lines
12 KiB
Dart
import 'package:sefer_driver/controller/home/captin/map_driver_controller.dart';
|
|
import 'package:sefer_driver/views/widgets/my_textField.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:sefer_driver/constant/colors.dart';
|
|
import 'package:sefer_driver/views/widgets/elevated_btn.dart';
|
|
import 'package:sefer_driver/views/widgets/my_scafold.dart';
|
|
|
|
import '../../constant/style.dart';
|
|
import '../../controller/rate/rate_conroller.dart';
|
|
|
|
class RatePassenger extends StatelessWidget {
|
|
final RateController controller = Get.put(RateController());
|
|
|
|
RatePassenger({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MyScafolld(
|
|
title: 'Rate Passenger'.tr,
|
|
body: [
|
|
GetBuilder<RateController>(builder: (controller) {
|
|
return Positioned(
|
|
top: 40,
|
|
left: Get.width * .1,
|
|
right: Get.width * .1,
|
|
child: Container(
|
|
decoration: AppStyle.boxDecoration,
|
|
child: Column(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.all(4),
|
|
child: Container(
|
|
height: Get.height * .25,
|
|
decoration: AppStyle.boxDecoration1,
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Text(
|
|
'${'Total price from '.tr}${Get.find<MapDriverController>().passengerName}',
|
|
style: AppStyle.title,
|
|
),
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
border: Border.all(
|
|
width: 2,
|
|
color: AppColor.redColor,
|
|
)),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(4),
|
|
child: Text(
|
|
(double.parse(controller.price.toString()) -
|
|
double.parse(controller.price
|
|
.toString()) *
|
|
.12)
|
|
.toStringAsFixed(2),
|
|
style: AppStyle.number.copyWith(
|
|
color: AppColor.redColor,
|
|
textBaseline: TextBaseline.ideographic,
|
|
decoration: TextDecoration.lineThrough,
|
|
decorationColor: AppColor.redColor),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(
|
|
height: 10,
|
|
),
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
border: Border.all(
|
|
width: 2,
|
|
color: AppColor.greenColor,
|
|
)),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(4),
|
|
child: Text(
|
|
Get.find<MapDriverController>()
|
|
.paymentAmount,
|
|
style: AppStyle.number,
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(
|
|
height: 10,
|
|
),
|
|
Text(
|
|
'Exclusive offers and discounts always with the Sefer app'
|
|
.tr,
|
|
textAlign: TextAlign.center,
|
|
style: AppStyle.title
|
|
.copyWith(color: AppColor.redColor),
|
|
)
|
|
],
|
|
)),
|
|
),
|
|
controller.walletChecked != 'true'
|
|
? controller.ispassengerWantWalletFromDriver
|
|
? Container(
|
|
decoration: AppStyle.boxDecoration1,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Column(
|
|
children: [
|
|
Text(
|
|
"How much Passenger pay?".tr,
|
|
style: AppStyle.title,
|
|
),
|
|
Form(
|
|
key: controller.formKey,
|
|
child: MyTextForm(
|
|
controller:
|
|
controller.passengerPayAmount,
|
|
label: "passenger amount to me".tr,
|
|
hint: "passenger amount to me".tr,
|
|
type: const TextInputType
|
|
.numberWithOptions(decimal: true),
|
|
),
|
|
),
|
|
MyElevatedButton(
|
|
title: "Press here".tr,
|
|
onPressed: () {
|
|
controller.addPassengerWallet();
|
|
},
|
|
)
|
|
],
|
|
),
|
|
),
|
|
)
|
|
: Container(
|
|
width: Get.width * .73,
|
|
decoration: AppStyle.boxDecoration1,
|
|
child: Column(
|
|
children: [
|
|
Text(
|
|
"Would the passenger like to settle the remaining fare using their wallet?"
|
|
.tr,
|
|
style: AppStyle.title,
|
|
textAlign: TextAlign.center,
|
|
),
|
|
MyElevatedButton(
|
|
title: "Press here".tr,
|
|
onPressed: () {
|
|
controller.passengerWantPay();
|
|
},
|
|
)
|
|
],
|
|
),
|
|
)
|
|
: const SizedBox(),
|
|
const SizedBox(
|
|
height: 20,
|
|
),
|
|
Center(
|
|
child: RatingBar.builder(
|
|
initialRating: 0,
|
|
itemCount: 5,
|
|
itemSize: 50,
|
|
itemPadding: const EdgeInsets.symmetric(horizontal: 2),
|
|
itemBuilder: (context, index) {
|
|
switch (index) {
|
|
case 0:
|
|
return const Icon(
|
|
Icons.sentiment_very_dissatisfied,
|
|
color: Colors.red,
|
|
);
|
|
case 1:
|
|
return const Icon(
|
|
Icons.sentiment_dissatisfied,
|
|
color: Colors.redAccent,
|
|
);
|
|
case 2:
|
|
return const Icon(
|
|
Icons.sentiment_neutral,
|
|
color: Colors.amber,
|
|
);
|
|
case 3:
|
|
return const Icon(
|
|
Icons.sentiment_satisfied,
|
|
color: Colors.lightGreen,
|
|
);
|
|
case 4:
|
|
return const Icon(
|
|
Icons.sentiment_very_satisfied,
|
|
color: Colors.green,
|
|
);
|
|
default:
|
|
return const Icon(
|
|
Icons.sentiment_neutral,
|
|
color: Colors.amber,
|
|
);
|
|
} //
|
|
},
|
|
onRatingUpdate: (rating) {
|
|
controller.selectRateItem(rating);
|
|
},
|
|
),
|
|
),
|
|
const SizedBox(
|
|
height: 20,
|
|
),
|
|
SizedBox(
|
|
width: Get.width * .75,
|
|
child: TextFormField(
|
|
maxLines: 4,
|
|
minLines: 1,
|
|
keyboardType: TextInputType.multiline,
|
|
controller: controller.comment,
|
|
decoration: InputDecoration(
|
|
labelText: 'Enter your Note'.tr,
|
|
hintText: 'Type something...',
|
|
prefixIcon: const Icon(
|
|
Icons.rate_review), // Add an icon as a prefix
|
|
suffixIcon: IconButton(
|
|
icon: const Icon(
|
|
Icons.clear,
|
|
color: AppColor.redColor,
|
|
), // Add an icon as a suffix
|
|
onPressed: () {
|
|
controller.comment.clear();
|
|
},
|
|
),
|
|
border:
|
|
const OutlineInputBorder(), // Add a border around the input field
|
|
enabledBorder: const OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color:
|
|
Colors.blue), // Customize the border color
|
|
),
|
|
focusedBorder: const OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: Colors
|
|
.green), // Customize the border color when focused
|
|
),
|
|
errorBorder: const OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: Colors
|
|
.red), // Customize the border color when there's an error
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(
|
|
height: 20,
|
|
),
|
|
MyElevatedButton(
|
|
title: 'Submit rating'.tr,
|
|
onPressed: () => controller.addRateToPassenger())
|
|
],
|
|
),
|
|
));
|
|
}),
|
|
],
|
|
isleading: false,
|
|
);
|
|
}
|
|
}
|