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

@@ -195,15 +195,17 @@ class FirebaseMessagesController extends GetxController {
// Handle the result here, e.g., show a dialog or update the UI // Handle the result here, e.g., show a dialog or update the UI
var result = jsonDecode(result0); var result = jsonDecode(result0);
MyDialogContent().getDialog( MyDialogContent().getDialog(
'Face Detection Result'.tr, 'Face Detection Result'.tr,
Text( Text(
result['similar'].toString() == 'true' result['similar'].toString() == 'true'
? '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,73 +10,140 @@ 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 _startProgressTimer() {
const totalTime = 3000; // 5 seconds in milliseconds
const interval = 50; // Update every 50ms
int elapsed = 0;
_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
? 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());
}
});
} }
void startTimer() async { 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 { Timer(const Duration(seconds: 5), () async {
box.read(BoxName.onBoarding) == null // box.read(BoxName.onBoarding) == null
? Get.off(() => OnBoardingPage()) // ? Get.off(() => OnBoardingPage())
: box.read(BoxName.emailDriver) != null && // : box.read(BoxName.email) != null &&
box.read(BoxName.phoneDriver) != null && // box.read(BoxName.phone) != null &&
box.read(BoxName.phoneVerified) == '1' // box.read(BoxName.isVerified) == '1'
? await Get.put(LoginDriverController()) // // ? Get.off(() => const MapPagePassenger())
.loginWithGoogleCredential( // ? await Get.put(LoginController()).loginUsingCredentials(
box.read(BoxName.driverID).toString(), // box.read(BoxName.passengerID).toString(),
box.read(BoxName.emailDriver)) // box.read(BoxName.email).toString(),
: Get.off(() => LoginCaptin()); // )
// : 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,9 +39,8 @@ 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) {
var paymentToken2 = await Get.find<MapDriverController>() var paymentToken2 = await Get.find<MapDriverController>()

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(
child: Column( begin: Alignment.topCenter,
mainAxisAlignment: MainAxisAlignment.center, end: Alignment.bottomCenter,
children: [ colors: [
GetBuilder<SplashScreenController>( AppColor.primaryColor,
builder: (_) { // AppColor.primaryColor,
return AnimatedBuilder( AppColor.secondaryColor,
animation: splashScreenController.animationController, AppColor.secondaryColor,
builder: (BuildContext context, Widget? child) { ],
return Transform.scale( ),
scale: ),
splashScreenController.animationController.value < 0.5 child: Center(
? splashScreenController.zoomInAnimation.value child: Column(
: splashScreenController.zoomOutAnimation.value, mainAxisAlignment: MainAxisAlignment.center,
child: Image.asset( children: [
'assets/images/logo.gif', GetBuilder<SplashScreenController>(
width: Get.width * .5, builder: (_) {
return ScaleTransition(
scale: splashScreenController.animation,
child: FadeTransition(
opacity: splashScreenController.animation,
child: Column(
children: [
DefaultTextStyle(
style: AppStyle.headTitle.copyWith(
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,
),
),
],
), ),
); ),
}, );
); },
},
),
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), Padding(
const SizedBox( padding:
height: 20, const EdgeInsets.symmetric(horizontal: 40, vertical: 20),
), child: Column(
AnimatedTextKit(animatedTexts: [ children: [
TypewriterAnimatedText( Obx(() => LinearProgressIndicator(
'Powered By ${AppInformation.appName}', value: splashScreenController.progress.value,
textStyle: backgroundColor: AppColor.writeColor.withOpacity(0.2),
AppStyle.title.copyWith(color: AppColor.primaryColor), valueColor: AlwaysStoppedAnimation<Color>(
speed: const Duration(milliseconds: 200), 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),
],
),
), ),
], isRepeatingAnimation: true), ],
const SizedBox( ),
height: 100,
),
],
), ),
), ),
bottomNavigationBar: Row( bottomNavigationBar: Padding(
mainAxisAlignment: MainAxisAlignment.center, padding: const EdgeInsets.only(bottom: 16.0),
children: [ child: Text(
Text( 'Version: ${box.read(BoxName.packagInfo) ?? '1.0.0'}',
box.read(BoxName.packagInfo) ?? '1.4.54', style: AppStyle.subtitle.copyWith(
style: AppStyle.subtitle, 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
onPressed: () { : AppColor.redColor,
controller.changeNationality(); title: controller.isEgypt
}) ? 'For Egypt'.tr
: MyElevatedButton( : 'Non Egypt'.tr,
title: 'Non Egypt'.tr, onPressed: () {
onPressed: () { controller.changeNationality();
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,51 +477,56 @@ class HomeCaptain extends StatelessWidget {
const SizedBox( const SizedBox(
height: 5, height: 5,
), ),
box.read(BoxName.rideStatus) == 'Applied' || GetBuilder<HomeCaptainController>(
box.read(BoxName.rideStatus) == 'Begin' builder: (homeCaptainController) {
? Positioned( return box.read(BoxName.rideStatus) == 'Applied' ||
bottom: Get.height * .2, box.read(BoxName.rideStatus) == 'Begin'
right: 6, ? Positioned(
child: AnimatedContainer( bottom: Get.height * .2,
duration: const Duration(microseconds: 200), right: 6,
width: homeCaptainController.widthMapTypeAndTraffic, child: AnimatedContainer(
decoration: BoxDecoration( duration: const Duration(microseconds: 200),
border: Border.all(color: AppColor.blueColor), width: homeCaptainController.widthMapTypeAndTraffic,
color: AppColor.secondaryColor, decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15)), border: Border.all(color: AppColor.blueColor),
child: GestureDetector( color: AppColor.secondaryColor,
onLongPress: () { borderRadius: BorderRadius.circular(15)),
box.write(BoxName.rideStatus, 'delete'); child: GestureDetector(
homeCaptainController.update(); onLongPress: () {
}, box.write(BoxName.rideStatus, 'delete');
child: IconButton( homeCaptainController.update();
onPressed: () {
box.read(BoxName.rideStatus) == 'Applied'
? {
Get.to(() => PassengerLocationMapPage(),
arguments: box
.read(BoxName.rideArguments)),
Get.put(MapDriverController())
.changeRideToBeginToPassenger()
}
: {
Get.to(() => PassengerLocationMapPage(),
arguments: box
.read(BoxName.rideArguments)),
Get.put(MapDriverController())
.startRideFromStartApp()
};
}, },
icon: const Icon( child: IconButton(
Icons.rice_bowl, onPressed: () {
size: 29, box.read(BoxName.rideStatus) == 'Applied'
color: AppColor.blueColor, ? {
Get.to(
() => PassengerLocationMapPage(),
arguments: box
.read(BoxName.rideArguments)),
Get.put(MapDriverController())
.changeRideToBeginToPassenger()
}
: {
Get.to(
() => PassengerLocationMapPage(),
arguments: box
.read(BoxName.rideArguments)),
Get.put(MapDriverController())
.startRideFromStartApp()
};
},
icon: const Icon(
Icons.rice_bowl,
size: 29,
color: AppColor.blueColor,
),
), ),
), ),
), ),
), )
) : const SizedBox();
: const SizedBox() })
], ],
), ),
), ),