From c78f49e968a39ffb43307a8cd4d38d291420eb0c Mon Sep 17 00:00:00 2001 From: Hamza Aleghwairyeen Date: Wed, 24 Apr 2024 01:56:38 +0300 Subject: [PATCH] 4/23/6 --- lib/controller/firebase/firbase_messge.dart | 177 +++++++++++--------- lib/views/Rate/rate_captain.dart | 30 ---- 2 files changed, 101 insertions(+), 106 deletions(-) diff --git a/lib/controller/firebase/firbase_messge.dart b/lib/controller/firebase/firbase_messge.dart index 95be155..75266e9 100644 --- a/lib/controller/firebase/firbase_messge.dart +++ b/lib/controller/firebase/firbase_messge.dart @@ -669,94 +669,119 @@ class DriverTipWidget extends StatelessWidget { @override Widget build(BuildContext context) { - return Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - // Text( - // '${'Your fee is '.tr}${Get.find().totalPassenger.toStringAsFixed(2)}'), - Text( - 'Do you want to pay Tips for this Driver'.tr, - textAlign: TextAlign.center, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - InkWell( - onTap: () { - box.write(BoxName.tipPercentage, '0.05'); + return GetBuilder(builder: (controller) { + return Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + // Text( + // '${'Your fee is '.tr}${Get.find().totalPassenger.toStringAsFixed(2)}'), + Text( + 'Do you want to pay Tips for this Driver'.tr, + textAlign: TextAlign.center, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + InkWell( + onTap: () { + box.write(BoxName.tipPercentage, '0.05'); - Toast.show( - context, - '${'Tip is '.tr}${(Get.find().totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}', - AppColor.blueColor); - }, - child: Container( - decoration: BoxDecoration(border: Border.all()), - child: const Padding( - padding: EdgeInsets.all(4), - child: Center( - child: Text('5%'), + Toast.show( + context, + '${'Tip is '.tr}${(controller.totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}', + AppColor.blueColor); + }, + child: Container( + decoration: BoxDecoration(border: Border.all()), + child: const Padding( + padding: EdgeInsets.all(4), + child: Center( + child: Text('5%'), + ), ), ), ), - ), - InkWell( - onTap: () { - box.write(BoxName.tipPercentage, '0.10'); - Toast.show( - context, - '${'Tip is'.tr} ${(Get.find().totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}', - AppColor.blueColor); - }, - child: Container( - decoration: BoxDecoration(border: Border.all()), - child: const Center( - child: Padding( - padding: EdgeInsets.all(5), - child: Text('10%'), + InkWell( + onTap: () { + box.write(BoxName.tipPercentage, '0.10'); + Toast.show( + context, + '${'Tip is'.tr} ${(controller.totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}', + AppColor.blueColor); + }, + child: Container( + decoration: BoxDecoration(border: Border.all()), + child: const Center( + child: Padding( + padding: EdgeInsets.all(5), + child: Text('10%'), + ), ), ), ), - ), - InkWell( - onTap: () { - box.write(BoxName.tipPercentage, '0.15'); - Toast.show( - context, - '${'Tip is'.tr} ${(Get.find().totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}', - AppColor.blueColor); - }, - child: Container( - decoration: BoxDecoration(border: Border.all()), - child: const Center( - child: Padding( - padding: EdgeInsets.all(5), - child: Text('15%'), + InkWell( + onTap: () { + box.write(BoxName.tipPercentage, '0.15'); + Toast.show( + context, + '${'Tip is'.tr} ${(controller.totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}', + AppColor.blueColor); + }, + child: Container( + decoration: BoxDecoration(border: Border.all()), + child: const Center( + child: Padding( + padding: EdgeInsets.all(5), + child: Text('15%'), + ), ), ), ), - ), - InkWell( - onTap: () { - box.write(BoxName.tipPercentage, '0.20'); - Toast.show( - context, - '${'Tip is'.tr} ${(Get.find().totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}', - AppColor.blueColor); - }, - child: Container( - decoration: BoxDecoration(border: Border.all()), - child: const Center( - child: Padding( - padding: EdgeInsets.all(5), - child: Text('20%'), + InkWell( + onTap: () { + box.write(BoxName.tipPercentage, '0.20'); + Toast.show( + context, + '${'Tip is'.tr} ${(controller.totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}', + AppColor.blueColor); + }, + child: Container( + decoration: BoxDecoration(border: Border.all()), + child: const Center( + child: Padding( + padding: EdgeInsets.all(5), + child: Text('20%'), + ), ), ), ), - ), - ], - ) - ], - ); + ], + ), + 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, + ), + ), + ), + ], + ) + ], + ); + }); } } diff --git a/lib/views/Rate/rate_captain.dart b/lib/views/Rate/rate_captain.dart index 423b0f0..aae1db2 100644 --- a/lib/views/Rate/rate_captain.dart +++ b/lib/views/Rate/rate_captain.dart @@ -115,36 +115,6 @@ class RateDriverFromPassenger extends StatelessWidget { true) ? const DriverTipWidget() : const SizedBox(), - GetBuilder( - 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, - ), - ), - ), - ], - ); - }) ], ), )),