This commit is contained in:
Hamza-Ayed
2024-12-24 17:55:20 +03:00
parent 0fc3ce010b
commit 7751866428
9 changed files with 280 additions and 171 deletions

View File

@@ -201,9 +201,11 @@ class FirebaseMessagesController extends GetxController {
? 'similar'.tr ? 'similar'.tr
: 'not similar'.tr, : 'not similar'.tr,
style: AppStyle.title, style: AppStyle.title,
), () { ),
() {
Get.back(); Get.back();
}); },
);
update(); update();
} else if (message.notification!.title! == 'Hi ,I will go now') { } else if (message.notification!.title! == 'Hi ,I will go now') {

View File

@@ -306,7 +306,7 @@ class ImageController extends GetxController {
'POST', 'POST',
Uri.parse(link), Uri.parse(link),
); );
Log.print('request: ${request}');
var length = await file.length(); var length = await file.length();
var stream = http.ByteStream(file.openRead()); var stream = http.ByteStream(file.openRead());
var multipartFile = http.MultipartFile( var multipartFile = http.MultipartFile(

View File

@@ -10,57 +10,106 @@ import '../../constant/box_name.dart';
import '../../main.dart'; import '../../main.dart';
import '../../views/auth/captin/login_captin.dart'; import '../../views/auth/captin/login_captin.dart';
// class SplashScreenController extends GetxController
// with GetTickerProviderStateMixin {
// late AnimationController _animationController;
// late Animation<double> animation;
// String packageInfo = '';
// Future<void> _getPackageInfo() async {
// final info = await PackageInfo.fromPlatform();
// packageInfo = info.version;
// box.write(BoxName.packagInfo, packageInfo);
// update();
// }
// @override
// void onInit() {
// super.onInit();
// _getPackageInfo();
// _animationController = AnimationController(
// vsync: this,
// duration: const Duration(milliseconds: 1500), // Reduced duration
// )..forward();
// animation =
// CurvedAnimation(parent: _animationController, curve: Curves.easeOut);
// startTimer();
// }
// void startTimer() async {
// debugPrint('onBoarding: ${box.read(BoxName.onBoarding)}');
// debugPrint('emailDriver: ${box.read(BoxName.emailDriver)}');
// debugPrint('phoneDriver: ${box.read(BoxName.phoneDriver)}');
// debugPrint('phoneVerified: ${box.read(BoxName.phoneVerified)}');
// Timer(const Duration(seconds: 5), () async {
// // Reduced timer duration
// box.read(BoxName.onBoarding) == null
// ? Get.off(() => OnBoardingPage())
// : box.read(BoxName.emailDriver) != null &&
// box.read(BoxName.phoneDriver) != null &&
// box.read(BoxName.phoneVerified) == '1'
// ? await Get.put(LoginDriverController())
// .loginWithGoogleCredential(
// box.read(BoxName.driverID).toString(),
// box.read(BoxName.emailDriver))
// : Get.off(() => LoginCaptin());
// });
// }
// @override
// void onClose() {
// _animationController.dispose();
// super.onClose();
// }
// }
class SplashScreenController extends GetxController class SplashScreenController extends GetxController
with SingleGetTickerProviderMixin { with GetTickerProviderStateMixin {
late AnimationController animationController; late AnimationController _animationController;
late Animation<double> zoomInAnimation; late Animation<double> animation;
late Animation<double> zoomOutAnimation; final progress = 0.0.obs;
Timer? _progressTimer;
String packageInfo = ''; String packageInfo = '';
Future<void> checkForUpdate() async { Future<void> _getPackageInfo() async {
final packageInfo = await PackageInfo.fromPlatform(); final info = await PackageInfo.fromPlatform();
final currentVersion = packageInfo.buildNumber; packageInfo = info.version;
final version1 = packageInfo.version; box.write(BoxName.packagInfo, packageInfo);
print('currentVersion is : $currentVersion');
// Fetch the latest version from your server
update(); update();
} }
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
checkForUpdate(); _getPackageInfo();
animationController = AnimationController( _animationController = AnimationController(
vsync: this, vsync: this,
duration: const Duration(seconds: 4), duration: const Duration(milliseconds: 1500), // Reduced duration
); )..forward();
zoomInAnimation = Tween<double>(begin: 1.0, end: 1.5).animate( animation =
CurvedAnimation( CurvedAnimation(parent: _animationController, curve: Curves.easeOut);
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(); startTimer();
_startProgressTimer();
} }
void startTimer() async { void _startProgressTimer() {
debugPrint('onBoarding: ${box.read(BoxName.onBoarding)}'); const totalTime = 3000; // 5 seconds in milliseconds
debugPrint('emailDriver: ${box.read(BoxName.emailDriver)}'); const interval = 50; // Update every 50ms
debugPrint('phoneDriver: ${box.read(BoxName.phoneDriver)}'); int elapsed = 0;
debugPrint('phoneVerified: ${box.read(BoxName.phoneVerified)}');
Timer(const Duration(seconds: 5), () async { _progressTimer =
Timer.periodic(const Duration(milliseconds: interval), (timer) async {
elapsed += interval;
progress.value = (elapsed / totalTime).clamp(0.0, 1.0);
if (elapsed >= totalTime) {
timer.cancel();
box.read(BoxName.onBoarding) == null box.read(BoxName.onBoarding) == null
? Get.off(() => OnBoardingPage()) ? Get.off(() => OnBoardingPage())
: box.read(BoxName.emailDriver) != null && : box.read(BoxName.emailDriver) != null &&
@@ -71,12 +120,30 @@ class SplashScreenController extends GetxController
box.read(BoxName.driverID).toString(), box.read(BoxName.driverID).toString(),
box.read(BoxName.emailDriver)) box.read(BoxName.emailDriver))
: Get.off(() => LoginCaptin()); : Get.off(() => LoginCaptin());
}
});
}
void startTimer() async {
Timer(const Duration(seconds: 5), () async {
// box.read(BoxName.onBoarding) == null
// ? Get.off(() => OnBoardingPage())
// : box.read(BoxName.email) != null &&
// box.read(BoxName.phone) != null &&
// box.read(BoxName.isVerified) == '1'
// // ? Get.off(() => const MapPagePassenger())
// ? await Get.put(LoginController()).loginUsingCredentials(
// box.read(BoxName.passengerID).toString(),
// box.read(BoxName.email).toString(),
// )
// : Get.off(() => LoginPage());
}); });
} }
@override @override
void onClose() { void onClose() {
animationController.dispose(); _progressTimer?.cancel();
_animationController.dispose();
super.onClose(); super.onClose();
} }
} }

View File

@@ -942,7 +942,8 @@ Store your money with us and receive it in your bank as a monthly salary.''':
"You can change the Country to get all features": "You can change the Country to get all features":
"يمكنك تغيير الدولة للحصول على جميع الميزات", "يمكنك تغيير الدولة للحصول على جميع الميزات",
"Slide to End Trip": "‏اسحب لإنهاء الرحلة", "Slide to End Trip": "‏اسحب لإنهاء الرحلة",
"App Preferences": "تفضيلات التطبيق", "App Preferences": "تفضيلات التطبيق", "For Egypt": "للمصريين",
"Non Egypt": "لغير المصريين",
"Google Map App": "تطبيق خرائط جوجل", "Google Map App": "تطبيق خرائط جوجل",
"If you want to make Google Map App run directly when you apply order": "If you want to make Google Map App run directly when you apply order":
"إذا كنت تريد تشغيل تطبيق خرائط جوجل مباشرة عند تطبيق الطلب", "إذا كنت تريد تشغيل تطبيق خرائط جوجل مباشرة عند تطبيق الطلب",

View File

@@ -1,7 +1,5 @@
import 'package:sefer_driver/constant/colors.dart';
import 'package:sefer_driver/controller/firebase/firbase_messge.dart'; import 'package:sefer_driver/controller/firebase/firbase_messge.dart';
import 'package:sefer_driver/controller/home/captin/map_driver_controller.dart'; import 'package:sefer_driver/controller/home/captin/map_driver_controller.dart';
import 'package:sefer_driver/controller/payment/payment_controller.dart';
import 'package:sefer_driver/views/widgets/error_snakbar.dart'; import 'package:sefer_driver/views/widgets/error_snakbar.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@@ -13,8 +11,6 @@ import 'package:sefer_driver/main.dart';
import 'package:sefer_driver/views/home/Captin/home_captain/home_captin.dart'; import 'package:sefer_driver/views/home/Captin/home_captain/home_captin.dart';
import 'package:sefer_driver/views/widgets/elevated_btn.dart'; import 'package:sefer_driver/views/widgets/elevated_btn.dart';
import '../home/payment/captain_wallet_controller.dart';
// import '../home/captin/home_captain_controller.dart'; // import '../home/captin/home_captain_controller.dart';
class RateController extends GetxController { class RateController extends GetxController {
@@ -43,8 +39,7 @@ class RateController extends GetxController {
Future addPassengerWallet() async { Future addPassengerWallet() async {
if (formKey.currentState!.validate()) { if (formKey.currentState!.validate()) {
var priceOfTrip = var priceOfTrip = double.parse(price.toString());
double.parse(price.toString());
// double.parse(Get.find<MapDriverController>().paymentAmount); // double.parse(Get.find<MapDriverController>().paymentAmount);
double remainingFee = double.parse(passengerPayAmount.text) - priceOfTrip; double remainingFee = double.parse(passengerPayAmount.text) - priceOfTrip;
if (remainingFee > 0) { if (remainingFee > 0) {

View File

@@ -17,69 +17,109 @@ class SplashScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// Get.put(LocationBackgroundController());
return Scaffold( return Scaffold(
backgroundColor: body: Container(
AppColor.secondaryColor, // Set your desired background color decoration: const BoxDecoration(
body: Center( gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
AppColor.primaryColor,
// AppColor.primaryColor,
AppColor.secondaryColor,
AppColor.secondaryColor,
],
),
),
child: Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
GetBuilder<SplashScreenController>( GetBuilder<SplashScreenController>(
builder: (_) { builder: (_) {
return AnimatedBuilder( return ScaleTransition(
animation: splashScreenController.animationController, scale: splashScreenController.animation,
builder: (BuildContext context, Widget? child) { child: FadeTransition(
return Transform.scale( opacity: splashScreenController.animation,
scale: child: Column(
splashScreenController.animationController.value < 0.5
? splashScreenController.zoomInAnimation.value
: splashScreenController.zoomOutAnimation.value,
child: Image.asset(
'assets/images/logo.gif',
width: Get.width * .5,
),
);
},
);
},
),
const SizedBox(
height: 30,
),
AnimatedTextKit(animatedTexts: [
TypewriterAnimatedText(
'Welcome to ${AppInformation.appName}',
textStyle:
AppStyle.headTitle2.copyWith(color: AppColor.writeColor),
speed: const Duration(milliseconds: 200),
),
], isRepeatingAnimation: true),
const SizedBox(
height: 20,
),
AnimatedTextKit(animatedTexts: [
TypewriterAnimatedText(
'Powered By ${AppInformation.appName}',
textStyle:
AppStyle.title.copyWith(color: AppColor.primaryColor),
speed: const Duration(milliseconds: 200),
),
], isRepeatingAnimation: true),
const SizedBox(
height: 100,
),
],
),
),
bottomNavigationBar: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text( DefaultTextStyle(
box.read(BoxName.packagInfo) ?? '1.4.54', style: AppStyle.headTitle.copyWith(
style: AppStyle.subtitle, color: AppColor.primaryColor,
fontSize: 48,
fontWeight: FontWeight.bold,
),
child: AnimatedTextKit(
animatedTexts: [
WavyAnimatedText(
AppInformation.appName,
speed: const Duration(milliseconds: 200),
), ),
], ],
isRepeatingAnimation: false,
onFinished: () {
// Trigger any additional animations here
},
),
),
const SizedBox(height: 20),
DefaultTextStyle(
style: AppStyle.title.copyWith(
color: AppColor.writeColor.withOpacity(0.8),
fontSize: 18,
),
child: AnimatedTextKit(
animatedTexts: [
TyperAnimatedText(
'Your Journey Begins Here'.tr,
speed: const Duration(milliseconds: 100),
),
],
isRepeatingAnimation: false,
),
),
],
),
),
);
},
),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 40, vertical: 20),
child: Column(
children: [
Obx(() => LinearProgressIndicator(
value: splashScreenController.progress.value,
backgroundColor: AppColor.writeColor.withOpacity(0.2),
valueColor: AlwaysStoppedAnimation<Color>(
AppColor.primaryColor),
minHeight: 3,
)),
const SizedBox(height: 16),
Text(
'Version: ${box.read(BoxName.packagInfo) ?? '1.0.0'}',
style: AppStyle.subtitle.copyWith(
color: AppColor.writeColor.withOpacity(0.6),
),
),
const SizedBox(height: 20),
],
),
),
],
),
),
),
bottomNavigationBar: Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: Text(
'Version: ${box.read(BoxName.packagInfo) ?? '1.0.0'}',
style: AppStyle.subtitle.copyWith(
color: AppColor.writeColor.withOpacity(0.6),
),
textAlign: TextAlign.center,
),
), ),
); );
} }

View File

@@ -81,17 +81,16 @@ class EgyptCardAI extends StatelessWidget {
: const SizedBox(), : const SizedBox(),
Row( Row(
children: [ children: [
controller.isEgypt MyElevatedButton(
? MyElevatedButton( kolor: controller.isEgypt
title: 'For Egypt'.tr, ? AppColor.greenColor
: AppColor.redColor,
title: controller.isEgypt
? 'For Egypt'.tr
: 'Non Egypt'.tr,
onPressed: () { onPressed: () {
controller.changeNationality(); controller.changeNationality();
}) })
: MyElevatedButton(
title: 'Non Egypt'.tr,
onPressed: () {
controller.changeNationality();
}),
], ],
) )
], ],

View File

@@ -497,7 +497,7 @@ class UserAccountHeader extends StatelessWidget {
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
onPressed: () { onPressed: () {
imageController.choosImagePicture( imageController.choosImagePicture(
AppLink.uploadImage1, 'portrait'); AppLink.uploadImagePortrate, 'portrait');
}, },
child: Container( child: Container(
padding: const EdgeInsets.all(6), padding: const EdgeInsets.all(6),

View File

@@ -477,7 +477,9 @@ class HomeCaptain extends StatelessWidget {
const SizedBox( const SizedBox(
height: 5, height: 5,
), ),
box.read(BoxName.rideStatus) == 'Applied' || GetBuilder<HomeCaptainController>(
builder: (homeCaptainController) {
return box.read(BoxName.rideStatus) == 'Applied' ||
box.read(BoxName.rideStatus) == 'Begin' box.read(BoxName.rideStatus) == 'Begin'
? Positioned( ? Positioned(
bottom: Get.height * .2, bottom: Get.height * .2,
@@ -498,14 +500,16 @@ class HomeCaptain extends StatelessWidget {
onPressed: () { onPressed: () {
box.read(BoxName.rideStatus) == 'Applied' box.read(BoxName.rideStatus) == 'Applied'
? { ? {
Get.to(() => PassengerLocationMapPage(), Get.to(
() => PassengerLocationMapPage(),
arguments: box arguments: box
.read(BoxName.rideArguments)), .read(BoxName.rideArguments)),
Get.put(MapDriverController()) Get.put(MapDriverController())
.changeRideToBeginToPassenger() .changeRideToBeginToPassenger()
} }
: { : {
Get.to(() => PassengerLocationMapPage(), Get.to(
() => PassengerLocationMapPage(),
arguments: box arguments: box
.read(BoxName.rideArguments)), .read(BoxName.rideArguments)),
Get.put(MapDriverController()) Get.put(MapDriverController())
@@ -521,7 +525,8 @@ class HomeCaptain extends StatelessWidget {
), ),
), ),
) )
: const SizedBox() : const SizedBox();
})
], ],
), ),
), ),