11/1/6
This commit is contained in:
@@ -16,6 +16,7 @@ class HomeCaptainController extends GetxController {
|
||||
Timer? activeTimer;
|
||||
Map data = {};
|
||||
String totalMoneyToday = '0';
|
||||
String totalMoneyInSEFER = '0';
|
||||
String totalDurationToday = '0';
|
||||
Timer? timer;
|
||||
// Inject the LocationController class
|
||||
@@ -89,7 +90,8 @@ class HomeCaptainController extends GetxController {
|
||||
link: AppLink.getDriverpaymentToday,
|
||||
payload: {'driverID': box.read(BoxName.driverID).toString()});
|
||||
data = jsonDecode(res);
|
||||
totalMoneyToday = data['message'][0]['total_amount'];
|
||||
totalMoneyToday = data['message'][0]['todayAmount'];
|
||||
totalMoneyInSEFER = data['message'][0]['total_amount'];
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
@@ -199,6 +199,7 @@ class MapPassengerController extends GetxController {
|
||||
int seconds = remainingTimeTimerRideBegin % 60;
|
||||
stringRemainingTimeRideBegin =
|
||||
'$minutes:${seconds.toString().padLeft(2, '0')}';
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -207,6 +208,10 @@ class MapPassengerController extends GetxController {
|
||||
update();
|
||||
print('rideTimerBegin: $rideTimerBegin');
|
||||
print('isRideFinished: $isRideFinished');
|
||||
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||
'passenger_id': box.read(BoxName.passengerID).toString(),
|
||||
'balance': ((-1) * totalPassenger).toString()
|
||||
});
|
||||
Get.to(() => RateCaptainFromPassenger(), arguments: {
|
||||
'driverId': driverId.toString(),
|
||||
'rideId': rideId.toString(),
|
||||
|
||||
65
lib/controller/home/splash_screen_controlle.dart
Normal file
65
lib/controller/home/splash_screen_controlle.dart
Normal file
@@ -0,0 +1,65 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/views/auth/login_page.dart';
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../main.dart';
|
||||
import '../../onbording_page.dart';
|
||||
import '../../views/auth/captin/login_captin.dart';
|
||||
import '../../views/home/Captin/home_captin.dart';
|
||||
import '../../views/home/map_page.dart';
|
||||
|
||||
class SplashScreenController extends GetxController
|
||||
with SingleGetTickerProviderMixin {
|
||||
late AnimationController animationController;
|
||||
late Animation<double> zoomInAnimation;
|
||||
late Animation<double> zoomOutAnimation;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
animationController = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(seconds: 7),
|
||||
);
|
||||
|
||||
zoomInAnimation = Tween<double>(begin: 1.0, end: 1.5).animate(
|
||||
CurvedAnimation(
|
||||
parent: animationController,
|
||||
curve: Curves.easeInOut,
|
||||
),
|
||||
);
|
||||
|
||||
zoomOutAnimation = Tween<double>(begin: 1.5, end: 1.0).animate(
|
||||
CurvedAnimation(
|
||||
parent: animationController,
|
||||
curve: Curves.easeInOut,
|
||||
),
|
||||
);
|
||||
|
||||
animationController.repeat(reverse: true);
|
||||
startTimer();
|
||||
}
|
||||
|
||||
void startTimer() {
|
||||
Timer(const Duration(seconds: 7), () {
|
||||
box.read(BoxName.onBoarding) == null
|
||||
? Get.off(() => OnBoardingPage())
|
||||
: box.read(BoxName.email) != null
|
||||
? Get.off(() => const MapPage())
|
||||
: box.read(BoxName.emailDriver) == null
|
||||
? Get.off(() => LoginPage())
|
||||
: box.read(BoxName.emailDriver) != null
|
||||
? Get.off(() => const HomeCaptain())
|
||||
: Get.off(() => LoginCaptin());
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
animationController.dispose();
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user