This commit is contained in:
Hamza Aleghwairyeen
2024-04-24 01:56:38 +03:00
parent 037fa65a55
commit c78f49e968
2 changed files with 101 additions and 106 deletions

View File

@@ -669,8 +669,9 @@ class DriverTipWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GetBuilder<MapPassengerController>(builder: (controller) {
return Column( return Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
// Text( // Text(
// '${'Your fee is '.tr}${Get.find<MapPassengerController>().totalPassenger.toStringAsFixed(2)}'), // '${'Your fee is '.tr}${Get.find<MapPassengerController>().totalPassenger.toStringAsFixed(2)}'),
@@ -687,7 +688,7 @@ class DriverTipWidget extends StatelessWidget {
Toast.show( Toast.show(
context, context,
'${'Tip is '.tr}${(Get.find<MapPassengerController>().totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}', '${'Tip is '.tr}${(controller.totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}',
AppColor.blueColor); AppColor.blueColor);
}, },
child: Container( child: Container(
@@ -705,7 +706,7 @@ class DriverTipWidget extends StatelessWidget {
box.write(BoxName.tipPercentage, '0.10'); box.write(BoxName.tipPercentage, '0.10');
Toast.show( Toast.show(
context, context,
'${'Tip is'.tr} ${(Get.find<MapPassengerController>().totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}', '${'Tip is'.tr} ${(controller.totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}',
AppColor.blueColor); AppColor.blueColor);
}, },
child: Container( child: Container(
@@ -723,7 +724,7 @@ class DriverTipWidget extends StatelessWidget {
box.write(BoxName.tipPercentage, '0.15'); box.write(BoxName.tipPercentage, '0.15');
Toast.show( Toast.show(
context, context,
'${'Tip is'.tr} ${(Get.find<MapPassengerController>().totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}', '${'Tip is'.tr} ${(controller.totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}',
AppColor.blueColor); AppColor.blueColor);
}, },
child: Container( child: Container(
@@ -741,7 +742,7 @@ class DriverTipWidget extends StatelessWidget {
box.write(BoxName.tipPercentage, '0.20'); box.write(BoxName.tipPercentage, '0.20');
Toast.show( Toast.show(
context, context,
'${'Tip is'.tr} ${(Get.find<MapPassengerController>().totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}', '${'Tip is'.tr} ${(controller.totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}',
AppColor.blueColor); AppColor.blueColor);
}, },
child: Container( child: Container(
@@ -755,8 +756,32 @@ class DriverTipWidget extends StatelessWidget {
), ),
), ),
], ],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
MyElevatedButton(
kolor: AppColor.redColor,
title: 'No i want'.tr,
onPressed: () {
box.write(BoxName.tipPercentage, '0');
}),
Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(6),
child: Text(
(controller.totalPassenger *
double.parse(box.read(BoxName.tipPercentage)))
.toString(),
style: AppStyle.title,
),
),
),
],
) )
], ],
); );
});
} }
} }

View File

@@ -115,36 +115,6 @@ class RateDriverFromPassenger extends StatelessWidget {
true) true)
? const DriverTipWidget() ? const DriverTipWidget()
: const SizedBox(), : const SizedBox(),
GetBuilder<MapPassengerController>(
builder: (mapPassengerController) {
return Row(
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: [
MyElevatedButton(
kolor: AppColor.redColor,
title: 'No i want'.tr,
onPressed: () {
box.write(
BoxName.tipPercentage, '0');
}),
Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(6),
child: Text(
(mapPassengerController
.totalPassenger *
double.parse(box.read(
BoxName.tipPercentage)))
.toString(),
style: AppStyle.title,
),
),
),
],
);
})
], ],
), ),
)), )),