12/12/2
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/controller/home/payment/captain_wallet_controller.dart';
|
||||
import 'package:ride/views/home/my_wallet/walet_captain.dart';
|
||||
|
||||
import '../../../../constant/style.dart';
|
||||
import '../../../../views/widgets/elevated_btn.dart';
|
||||
@@ -15,40 +17,61 @@ class ConnectWidget extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final OrderRequestController orderRequestController =
|
||||
Get.put(OrderRequestController());
|
||||
CaptainWalletController captainWalletController =
|
||||
Get.put(CaptainWalletController());
|
||||
|
||||
captainWalletController.getCaptainWalletFromBuyPoints();
|
||||
return Center(
|
||||
child: GetBuilder<HomeCaptainController>(
|
||||
builder: (homeCaptainController) =>
|
||||
int.parse(orderRequestController.countRefuse) > 3
|
||||
? CupertinoButton(
|
||||
child: Text('You are Stopped'.tr),
|
||||
onPressed: () {
|
||||
Get.defaultDialog(
|
||||
// backgroundColor: CupertinoColors.destructiveRed,
|
||||
barrierDismissible: false,
|
||||
title: 'You Are Stopped For this Day !'.tr,
|
||||
content: Text(
|
||||
'You Refused 3 Rides this Day that is the reason \nSee you Tomorrow!'
|
||||
builder: (homeCaptainController) => int.parse(
|
||||
orderRequestController.countRefuse) >
|
||||
3 ||
|
||||
double.parse(captainWalletController.totalPoints) < -100
|
||||
? CupertinoButton(
|
||||
onPressed: () {
|
||||
Get.defaultDialog(
|
||||
// backgroundColor: CupertinoColors.destructiveRed,
|
||||
barrierDismissible: false,
|
||||
title: double.parse(captainWalletController.totalPoints) <
|
||||
-100
|
||||
? 'You dont have Points'
|
||||
: 'You Are Stopped For this Day !'.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
content: Text(
|
||||
double.parse(captainWalletController.totalPoints) < -100
|
||||
? 'You will be charge your Account'.tr
|
||||
: 'You Refused 3 Rides this Day that is the reason \nSee you Tomorrow!'
|
||||
.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok , See you Tomorrow'.tr,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
Get.back();
|
||||
}));
|
||||
},
|
||||
color: CupertinoColors.destructiveRed,
|
||||
)
|
||||
: CupertinoButton(
|
||||
child: Text(homeCaptainController.isActive
|
||||
? 'Connected'.tr
|
||||
: 'Not Connected'.tr),
|
||||
onPressed: homeCaptainController.onButtonSelected,
|
||||
color: homeCaptainController.isActive
|
||||
? CupertinoColors.activeGreen
|
||||
: CupertinoColors.inactiveGray,
|
||||
),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
confirm:
|
||||
double.parse(captainWalletController.totalPoints) <
|
||||
-100
|
||||
? MyElevatedButton(
|
||||
title: 'Charge your Account'.tr,
|
||||
onPressed: () {
|
||||
homeCaptainController
|
||||
.goToWalletFromConnect();
|
||||
})
|
||||
: MyElevatedButton(
|
||||
title: 'Ok , See you Tomorrow'.tr,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
Get.back();
|
||||
}));
|
||||
},
|
||||
color: CupertinoColors.destructiveRed,
|
||||
child: Text('You are Stopped'.tr),
|
||||
)
|
||||
: CupertinoButton(
|
||||
onPressed: homeCaptainController.onButtonSelected,
|
||||
color: homeCaptainController.isActive
|
||||
? CupertinoColors.activeGreen
|
||||
: CupertinoColors.inactiveGray,
|
||||
child: Text(homeCaptainController.isActive
|
||||
? 'Connected'.tr
|
||||
: 'Not Connected'.tr),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user