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
var result = jsonDecode(result0);
MyDialogContent().getDialog(
'Face Detection Result'.tr,
Text(
result['similar'].toString() == 'true'
? 'similar'.tr
: 'not similar'.tr,
style: AppStyle.title,
), () {
Get.back();
});
'Face Detection Result'.tr,
Text(
result['similar'].toString() == 'true'
? 'similar'.tr
: 'not similar'.tr,
style: AppStyle.title,
),
() {
Get.back();
},
);
update();
} else if (message.notification!.title! == 'Hi ,I will go now') {

View File

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

View File

@@ -10,73 +10,140 @@ import '../../constant/box_name.dart';
import '../../main.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
with SingleGetTickerProviderMixin {
late AnimationController animationController;
late Animation<double> zoomInAnimation;
late Animation<double> zoomOutAnimation;
with GetTickerProviderStateMixin {
late AnimationController _animationController;
late Animation<double> animation;
final progress = 0.0.obs;
Timer? _progressTimer;
String packageInfo = '';
Future<void> checkForUpdate() async {
final packageInfo = await PackageInfo.fromPlatform();
final currentVersion = packageInfo.buildNumber;
final version1 = packageInfo.version;
print('currentVersion is : $currentVersion');
// Fetch the latest version from your server
Future<void> _getPackageInfo() async {
final info = await PackageInfo.fromPlatform();
packageInfo = info.version;
box.write(BoxName.packagInfo, packageInfo);
update();
}
@override
void onInit() {
super.onInit();
checkForUpdate();
animationController = AnimationController(
_getPackageInfo();
_animationController = AnimationController(
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(
CurvedAnimation(
parent: animationController,
curve: Curves.easeInOut,
),
);
animation =
CurvedAnimation(parent: _animationController, curve: Curves.easeOut);
zoomOutAnimation = Tween<double>(begin: 1.5, end: 1.0).animate(
CurvedAnimation(
parent: animationController,
curve: Curves.easeInOut,
),
);
animationController.repeat(reverse: true);
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 {
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 {
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());
// 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
void onClose() {
animationController.dispose();
_progressTimer?.cancel();
_animationController.dispose();
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":
"يمكنك تغيير الدولة للحصول على جميع الميزات",
"Slide to End Trip": "‏اسحب لإنهاء الرحلة",
"App Preferences": "تفضيلات التطبيق",
"App Preferences": "تفضيلات التطبيق", "For Egypt": "للمصريين",
"Non Egypt": "لغير المصريين",
"Google Map App": "تطبيق خرائط جوجل",
"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/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:flutter/cupertino.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/widgets/elevated_btn.dart';
import '../home/payment/captain_wallet_controller.dart';
// import '../home/captin/home_captain_controller.dart';
class RateController extends GetxController {
@@ -43,9 +39,8 @@ class RateController extends GetxController {
Future addPassengerWallet() async {
if (formKey.currentState!.validate()) {
var priceOfTrip =
double.parse(price.toString());
// double.parse(Get.find<MapDriverController>().paymentAmount);
var priceOfTrip = double.parse(price.toString());
// double.parse(Get.find<MapDriverController>().paymentAmount);
double remainingFee = double.parse(passengerPayAmount.text) - priceOfTrip;
if (remainingFee > 0) {
var paymentToken2 = await Get.find<MapDriverController>()

View File

@@ -17,69 +17,109 @@ class SplashScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
// Get.put(LocationBackgroundController());
return Scaffold(
backgroundColor:
AppColor.secondaryColor, // Set your desired background color
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
GetBuilder<SplashScreenController>(
builder: (_) {
return AnimatedBuilder(
animation: splashScreenController.animationController,
builder: (BuildContext context, Widget? child) {
return Transform.scale(
scale:
splashScreenController.animationController.value < 0.5
? splashScreenController.zoomInAnimation.value
: splashScreenController.zoomOutAnimation.value,
child: Image.asset(
'assets/images/logo.gif',
width: Get.width * .5,
body: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
AppColor.primaryColor,
// AppColor.primaryColor,
AppColor.secondaryColor,
AppColor.secondaryColor,
],
),
),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
GetBuilder<SplashScreenController>(
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),
const SizedBox(
height: 20,
),
AnimatedTextKit(animatedTexts: [
TypewriterAnimatedText(
'Powered By ${AppInformation.appName}',
textStyle:
AppStyle.title.copyWith(color: AppColor.primaryColor),
speed: const Duration(milliseconds: 200),
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),
],
),
),
], isRepeatingAnimation: true),
const SizedBox(
height: 100,
),
],
],
),
),
),
bottomNavigationBar: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
box.read(BoxName.packagInfo) ?? '1.4.54',
style: AppStyle.subtitle,
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(),
Row(
children: [
controller.isEgypt
? MyElevatedButton(
title: 'For Egypt'.tr,
onPressed: () {
controller.changeNationality();
})
: MyElevatedButton(
title: 'Non Egypt'.tr,
onPressed: () {
controller.changeNationality();
}),
MyElevatedButton(
kolor: controller.isEgypt
? AppColor.greenColor
: AppColor.redColor,
title: controller.isEgypt
? 'For Egypt'.tr
: 'Non Egypt'.tr,
onPressed: () {
controller.changeNationality();
})
],
)
],

View File

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

View File

@@ -477,51 +477,56 @@ class HomeCaptain extends StatelessWidget {
const SizedBox(
height: 5,
),
box.read(BoxName.rideStatus) == 'Applied' ||
box.read(BoxName.rideStatus) == 'Begin'
? Positioned(
bottom: Get.height * .2,
right: 6,
child: AnimatedContainer(
duration: const Duration(microseconds: 200),
width: homeCaptainController.widthMapTypeAndTraffic,
decoration: BoxDecoration(
border: Border.all(color: AppColor.blueColor),
color: AppColor.secondaryColor,
borderRadius: BorderRadius.circular(15)),
child: GestureDetector(
onLongPress: () {
box.write(BoxName.rideStatus, 'delete');
homeCaptainController.update();
},
child: IconButton(
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()
};
GetBuilder<HomeCaptainController>(
builder: (homeCaptainController) {
return box.read(BoxName.rideStatus) == 'Applied' ||
box.read(BoxName.rideStatus) == 'Begin'
? Positioned(
bottom: Get.height * .2,
right: 6,
child: AnimatedContainer(
duration: const Duration(microseconds: 200),
width: homeCaptainController.widthMapTypeAndTraffic,
decoration: BoxDecoration(
border: Border.all(color: AppColor.blueColor),
color: AppColor.secondaryColor,
borderRadius: BorderRadius.circular(15)),
child: GestureDetector(
onLongPress: () {
box.write(BoxName.rideStatus, 'delete');
homeCaptainController.update();
},
icon: const Icon(
Icons.rice_bowl,
size: 29,
color: AppColor.blueColor,
child: IconButton(
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(
Icons.rice_bowl,
size: 29,
color: AppColor.blueColor,
),
),
),
),
),
)
: const SizedBox()
)
: const SizedBox();
})
],
),
),