25-5-10/1

This commit is contained in:
Hamza-Ayed
2025-05-11 00:03:19 +03:00
parent 801f26eb18
commit bdf380b925
21 changed files with 1117 additions and 144 deletions

View File

@@ -1,28 +1,12 @@
import 'dart:io';
import 'package:Tripz/constant/links.dart';
import 'package:Tripz/controller/auth/login_controller.dart';
import 'package:Tripz/controller/functions/crud.dart';
import 'package:Tripz/controller/functions/sms_controller.dart';
import 'package:Tripz/views/widgets/error_snakbar.dart';
import 'package:flutter/services.dart';
import 'package:Tripz/constant/box_name.dart';
import 'package:Tripz/main.dart';
import 'package:flutter/material.dart';
import 'package:flutter_font_icons/flutter_font_icons.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:jwt_decoder/jwt_decoder.dart';
import 'package:secure_string_operations/secure_string_operations.dart';
import '../../../constant/char_map.dart';
import '../../../constant/colors.dart';
import '../../../constant/info.dart';
import '../../../controller/functions/encrypt_decrypt.dart';
import '../../../controller/functions/tts.dart';
import '../../../controller/home/map_passenger_controller.dart';
import '../../../controller/home/vip_waitting_page.dart';
import '../../../controller/payment/paymob/paymob_response.dart';
import '../../../print.dart';
GetBuilder<MapPassengerController> leftMainMenuIcons() {
Get.put(TextToSpeechController());
@@ -70,7 +54,7 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
onPressed: () => Get.to(() => VipWaittingPage()),
tooltip: 'VIP Waiting Page', // More descriptive tooltip
),
const SizedBox(width: 8),
// const SizedBox(width: 8),
_buildIconButtonWithAnimation(
controller: controller,
icon: Octicons.screen_full,
@@ -96,35 +80,7 @@ class TestPage extends StatelessWidget {
appBar: AppBar(),
body: Center(
child: TextButton(
onPressed: () async {
// bool isTokenExpired = JwtDecoder.isExpired(X
// .r(X.r(X.r(box.read(BoxName.jwt), cn), cC), cs)
// .toString()
// .split(AppInformation.addd)[0]);
// if (isTokenExpired) {
// Log.print(
// 'isTokenExpired loginUsingCredentials: ${isTokenExpired}');
// await LoginController().getJWT();
// }
// var res = await CRUD().get(
// link: 'https://server.sefer.click/sefer.click/sefer/test.php',
// payload: {
// 'email': box.read(BoxName.email).toString(),
// 'id': box.read(BoxName.passengerID).toString(),
// "platform": Platform.isAndroid ? 'android' : 'ios',
// "appName": AppInformation.appName,
// });
// Log.print('res: ${res}');
// var s = EncryptionHelper.instance.encryptData('Female');
Log.print('s: ${box.read(BoxName.hmac)}');
},
// uDG41L0K5vrem0eh87ZAf9leTrDUW0+twVRHQIQtxOWn4L6J5seU9x1tnRUUbGBb
// uDG41L0K5vrem0eh87ZAf9leTrDUW0+twVRHQIQtxOU=
onPressed: () async {},
child: Text(
"Text Button",
),

View File

@@ -1,123 +1,547 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'dart:ui';
import '../../constant/colors.dart';
class SnackbarConfig {
static const duration = Duration(seconds: 3);
static const animationDuration = Duration(milliseconds: 300);
static const margin = EdgeInsets.symmetric(horizontal: 16, vertical: 10);
static const borderRadius = 12.0;
static const elevation = 6.0;
static const duration = Duration(seconds: 4);
static const animationDuration = Duration(milliseconds: 400);
static const margin = EdgeInsets.symmetric(horizontal: 16, vertical: 12);
static const borderRadius = 16.0;
static const elevation = 0.0; // تقليل الارتفاع لأننا سنستخدم تأثيرات زجاجية
static final BoxShadow shadow = BoxShadow(
color: Colors.black.withOpacity(0.1),
blurRadius: 10,
offset: const Offset(0, 2),
// تأثير زجاجي
static const double blurStrength = 15.0;
static const double opacity = 0.85;
// حدود شفافة
static final Border glassBorder = Border.all(
color: Colors.white.withOpacity(0.25),
width: 1.5,
);
// ظل أكثر نعومة وانتشار
static final List<BoxShadow> shadows = [
BoxShadow(
color: Colors.black.withOpacity(0.15),
blurRadius: 12,
spreadRadius: 1,
offset: const Offset(0, 4),
),
BoxShadow(
color: Colors.black.withOpacity(0.08),
blurRadius: 20,
spreadRadius: 0,
offset: const Offset(0, 2),
),
];
}
// تطبيق تأثير زجاجي باستخدام Container مخصص
class GlassSnackbar extends StatelessWidget {
final Color baseColor;
final Widget child;
const GlassSnackbar({
required this.baseColor,
required this.child,
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return ClipRRect(
borderRadius: BorderRadius.circular(SnackbarConfig.borderRadius),
child: BackdropFilter(
filter: ImageFilter.blur(
sigmaX: SnackbarConfig.blurStrength,
sigmaY: SnackbarConfig.blurStrength,
),
child: Container(
decoration: BoxDecoration(
color: baseColor.withOpacity(SnackbarConfig.opacity),
borderRadius: BorderRadius.circular(SnackbarConfig.borderRadius),
border: SnackbarConfig.glassBorder,
boxShadow: SnackbarConfig.shadows,
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
baseColor.withOpacity(SnackbarConfig.opacity + 0.05),
baseColor.withOpacity(SnackbarConfig.opacity - 0.05),
],
),
),
child: child,
),
),
);
}
}
SnackbarController mySnackeBarError(String message) {
// Trigger error haptic feedback
// تأثير اهتزاز للأخطاء
HapticFeedback.mediumImpact();
final Color errorBaseColor = AppColor.redColor;
return Get.snackbar(
'Error'.tr,
message,
backgroundColor: AppColor.redColor.withOpacity(0.95),
colorText: AppColor.secondaryColor,
icon: const Icon(
Icons.error_outline_rounded,
color: AppColor.secondaryColor,
size: 28,
),
shouldIconPulse: true,
'',
'',
snackPosition: SnackPosition.TOP,
margin: SnackbarConfig.margin,
borderRadius: SnackbarConfig.borderRadius,
duration: SnackbarConfig.duration,
animationDuration: SnackbarConfig.animationDuration,
forwardAnimationCurve: Curves.easeOutCirc,
reverseAnimationCurve: Curves.easeInCirc,
boxShadows: [SnackbarConfig.shadow],
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
titleText: Text(
'Error'.tr,
style: const TextStyle(
fontWeight: FontWeight.w700,
color: Colors.white,
fontSize: 16,
letterSpacing: 0.2,
borderRadius: SnackbarConfig.borderRadius,
backgroundColor: Colors.transparent, // شفاف لأننا سنستخدم حاوية مخصصة
barBlur: 0, // إيقاف تشويش الخلفية الافتراضي لأننا سنستخدم BlurFilter
overlayBlur: 1.5,
overlayColor: Colors.black12,
userInputForm: Form(
child: GlassSnackbar(
baseColor: errorBaseColor,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 14),
child: Row(
children: [
// أيقونة متحركة
TweenAnimationBuilder<double>(
tween: Tween(begin: 0.0, end: 1.0),
duration: const Duration(milliseconds: 500),
curve: Curves.elasticOut,
builder: (context, value, child) {
return Transform.scale(
scale: value,
child: child,
);
},
child: Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.25),
shape: BoxShape.circle,
),
child: const Icon(
Icons.error_rounded,
color: Colors.white,
size: 26,
),
),
),
const SizedBox(width: 16),
// محتوى النص
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
'Error'.tr,
style: const TextStyle(
fontWeight: FontWeight.w700,
color: Colors.white,
fontSize: 16,
letterSpacing: 0.3,
shadows: [
Shadow(
color: Colors.black26,
offset: Offset(0, 1),
blurRadius: 2,
),
],
),
),
const SizedBox(height: 4),
Text(
message,
style: const TextStyle(
color: Colors.white,
fontSize: 14,
height: 1.3,
fontWeight: FontWeight.w400,
),
),
],
),
),
// زر الإغلاق
InkWell(
onTap: () {
HapticFeedback.lightImpact();
Get.closeCurrentSnackbar();
},
child: Container(
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.2),
shape: BoxShape.circle,
),
child: const Icon(
Icons.close_rounded,
color: Colors.white,
size: 18,
),
),
),
],
),
),
),
),
messageText: Text(
message,
style: TextStyle(
color: Colors.white.withOpacity(0.95),
fontSize: 14,
height: 1.3,
),
),
onTap: (_) {
HapticFeedback.lightImpact();
Get.closeCurrentSnackbar();
},
isDismissible: true,
dismissDirection: DismissDirection.horizontal,
overlayBlur: 0.8,
overlayColor: Colors.black12,
forwardAnimationCurve: Curves.easeOutBack,
reverseAnimationCurve: Curves.easeInCubic,
);
}
SnackbarController mySnackbarSuccess(String message) {
// Trigger success haptic feedback
// تأثير اهتزاز للنجاح
HapticFeedback.lightImpact();
final Color successBaseColor = AppColor.greenColor;
return Get.snackbar(
'Success'.tr,
message,
backgroundColor: AppColor.greenColor.withOpacity(0.95),
colorText: AppColor.secondaryColor,
icon: const Icon(
Icons.check_circle_outline_rounded,
color: AppColor.secondaryColor,
size: 28,
),
shouldIconPulse: true,
'',
'',
snackPosition: SnackPosition.TOP,
margin: SnackbarConfig.margin,
borderRadius: SnackbarConfig.borderRadius,
duration: SnackbarConfig.duration,
animationDuration: SnackbarConfig.animationDuration,
forwardAnimationCurve: Curves.easeOutCirc,
reverseAnimationCurve: Curves.easeInCirc,
boxShadows: [SnackbarConfig.shadow],
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
titleText: Text(
'Success'.tr,
style: const TextStyle(
fontWeight: FontWeight.w700,
color: Colors.white,
fontSize: 16,
letterSpacing: 0.2,
borderRadius: SnackbarConfig.borderRadius,
backgroundColor: Colors.transparent, // شفاف لأننا سنستخدم حاوية مخصصة
barBlur: 0, // إيقاف تشويش الخلفية الافتراضي لأننا سنستخدم BlurFilter
overlayBlur: 1.5,
overlayColor: Colors.black12,
userInputForm: Form(
child: GlassSnackbar(
baseColor: successBaseColor,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 14),
child: Row(
children: [
// أيقونة متحركة
TweenAnimationBuilder<double>(
tween: Tween(begin: 0.0, end: 1.0),
duration: const Duration(milliseconds: 600),
curve: Curves.elasticOut,
builder: (context, value, child) {
return Transform.scale(
scale: value,
child: child,
);
},
child: Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.25),
shape: BoxShape.circle,
),
child: const Icon(
Icons.check_circle_rounded,
color: Colors.white,
size: 26,
),
),
),
const SizedBox(width: 16),
// محتوى النص
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
'Success'.tr,
style: const TextStyle(
fontWeight: FontWeight.w700,
color: Colors.white,
fontSize: 16,
letterSpacing: 0.3,
shadows: [
Shadow(
color: Colors.black26,
offset: Offset(0, 1),
blurRadius: 2,
),
],
),
),
const SizedBox(height: 4),
Text(
message,
style: const TextStyle(
color: Colors.white,
fontSize: 14,
height: 1.3,
fontWeight: FontWeight.w400,
),
),
],
),
),
// زر الإغلاق
InkWell(
onTap: () {
HapticFeedback.lightImpact();
Get.closeCurrentSnackbar();
},
child: Container(
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.2),
shape: BoxShape.circle,
),
child: const Icon(
Icons.close_rounded,
color: Colors.white,
size: 18,
),
),
),
],
),
),
),
),
messageText: Text(
message,
style: TextStyle(
color: Colors.white.withOpacity(0.95),
fontSize: 14,
height: 1.3,
),
),
onTap: (_) {
HapticFeedback.lightImpact();
Get.closeCurrentSnackbar();
},
isDismissible: true,
dismissDirection: DismissDirection.horizontal,
overlayBlur: 0.8,
overlayColor: Colors.black12,
forwardAnimationCurve: Curves.easeOutBack,
reverseAnimationCurve: Curves.easeInCubic,
);
}
// إضافة: دالة للمعلومات والتنبيهات
SnackbarController mySnackbarInfo(String message) {
// تأثير اهتزاز خفيف
HapticFeedback.selectionClick();
final Color infoBaseColor = Colors.blue;
return Get.snackbar(
'',
'',
snackPosition: SnackPosition.TOP,
margin: SnackbarConfig.margin,
duration: SnackbarConfig.duration,
animationDuration: SnackbarConfig.animationDuration,
borderRadius: SnackbarConfig.borderRadius,
backgroundColor: Colors.transparent, // شفاف لأننا سنستخدم حاوية مخصصة
barBlur: 0, // إيقاف تشويش الخلفية الافتراضي لأننا سنستخدم BlurFilter
overlayBlur: 1.5,
overlayColor: Colors.black12,
userInputForm: Form(
child: GlassSnackbar(
baseColor: infoBaseColor,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 14),
child: Row(
children: [
// أيقونة متحركة
TweenAnimationBuilder<double>(
tween: Tween(begin: 0.0, end: 1.0),
duration: const Duration(milliseconds: 500),
curve: Curves.elasticOut,
builder: (context, value, child) {
return Transform.scale(
scale: value,
child: child,
);
},
child: Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.25),
shape: BoxShape.circle,
),
child: const Icon(
Icons.info_rounded,
color: Colors.white,
size: 26,
),
),
),
const SizedBox(width: 16),
// محتوى النص
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
'Info'.tr,
style: const TextStyle(
fontWeight: FontWeight.w700,
color: Colors.white,
fontSize: 16,
letterSpacing: 0.3,
shadows: [
Shadow(
color: Colors.black26,
offset: Offset(0, 1),
blurRadius: 2,
),
],
),
),
const SizedBox(height: 4),
Text(
message,
style: const TextStyle(
color: Colors.white,
fontSize: 14,
height: 1.3,
fontWeight: FontWeight.w400,
),
),
],
),
),
// زر الإغلاق
InkWell(
onTap: () {
HapticFeedback.lightImpact();
Get.closeCurrentSnackbar();
},
child: Container(
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.2),
shape: BoxShape.circle,
),
child: const Icon(
Icons.close_rounded,
color: Colors.white,
size: 18,
),
),
),
],
),
),
),
),
isDismissible: true,
dismissDirection: DismissDirection.horizontal,
forwardAnimationCurve: Curves.easeOutBack,
reverseAnimationCurve: Curves.easeInCubic,
);
}
// إضافة: دالة للتحذيرات
SnackbarController mySnackbarWarning(String message) {
// تأثير اهتزاز متوسط
HapticFeedback.mediumImpact();
final Color warningBaseColor = Colors.orange;
return Get.snackbar(
'',
'',
snackPosition: SnackPosition.TOP,
margin: SnackbarConfig.margin,
duration: SnackbarConfig.duration,
animationDuration: SnackbarConfig.animationDuration,
borderRadius: SnackbarConfig.borderRadius,
backgroundColor: Colors.transparent, // شفاف لأننا سنستخدم حاوية مخصصة
barBlur: 0, // إيقاف تشويش الخلفية الافتراضي لأننا سنستخدم BlurFilter
overlayBlur: 1.5,
overlayColor: Colors.black12,
userInputForm: Form(
child: GlassSnackbar(
baseColor: warningBaseColor,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 14),
child: Row(
children: [
// أيقونة متحركة
TweenAnimationBuilder<double>(
tween: Tween(begin: 0.0, end: 1.0),
duration: const Duration(milliseconds: 500),
curve: Curves.elasticOut,
builder: (context, value, child) {
return Transform.scale(
scale: value,
child: child,
);
},
child: Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.25),
shape: BoxShape.circle,
),
child: const Icon(
Icons.warning_rounded,
color: Colors.white,
size: 26,
),
),
),
const SizedBox(width: 16),
// محتوى النص
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
'Warning'.tr,
style: const TextStyle(
fontWeight: FontWeight.w700,
color: Colors.white,
fontSize: 16,
letterSpacing: 0.3,
shadows: [
Shadow(
color: Colors.black26,
offset: Offset(0, 1),
blurRadius: 2,
),
],
),
),
const SizedBox(height: 4),
Text(
message,
style: const TextStyle(
color: Colors.white,
fontSize: 14,
height: 1.3,
fontWeight: FontWeight.w400,
),
),
],
),
),
// زر الإغلاق
InkWell(
onTap: () {
HapticFeedback.lightImpact();
Get.closeCurrentSnackbar();
},
child: Container(
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.2),
shape: BoxShape.circle,
),
child: const Icon(
Icons.close_rounded,
color: Colors.white,
size: 18,
),
),
),
],
),
),
),
),
isDismissible: true,
dismissDirection: DismissDirection.horizontal,
forwardAnimationCurve: Curves.easeOutBack,
reverseAnimationCurve: Curves.easeInCubic,
);
}