2026-04-06 redesign splash screen and drawer menu
This commit is contained in:
@@ -42,6 +42,20 @@
|
|||||||
"https://tiles.intaleqapp.com/places_egypt/{z}/{x}/{y}"
|
"https://tiles.intaleqapp.com/places_egypt/{z}/{x}/{y}"
|
||||||
],
|
],
|
||||||
"maxzoom": 14
|
"maxzoom": 14
|
||||||
|
},
|
||||||
|
"places_syria": {
|
||||||
|
"type": "vector",
|
||||||
|
"tiles": [
|
||||||
|
"https://tiles.intaleqapp.com/places_syria/{z}/{x}/{y}"
|
||||||
|
],
|
||||||
|
"maxzoom": 14
|
||||||
|
},
|
||||||
|
"places_jordan": {
|
||||||
|
"type": "vector",
|
||||||
|
"tiles": [
|
||||||
|
"https://tiles.intaleqapp.com/places_jordan/{z}/{x}/{y}"
|
||||||
|
],
|
||||||
|
"maxzoom": 14
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"layers": [
|
"layers": [
|
||||||
@@ -1796,6 +1810,104 @@
|
|||||||
"text-halo-color": "rgba(255, 255, 255, 0.9)",
|
"text-halo-color": "rgba(255, 255, 255, 0.9)",
|
||||||
"text-halo-width": 2
|
"text-halo-width": 2
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "places-syria-labels",
|
||||||
|
"type": "symbol",
|
||||||
|
"source": "places_syria",
|
||||||
|
"source-layer": "places_syria",
|
||||||
|
"minzoom": 10,
|
||||||
|
"layout": {
|
||||||
|
"text-field": [
|
||||||
|
"coalesce",
|
||||||
|
[
|
||||||
|
"get",
|
||||||
|
"name_ar"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"get",
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"text-font": [
|
||||||
|
"Noto Sans Bold"
|
||||||
|
],
|
||||||
|
"text-size": [
|
||||||
|
"interpolate",
|
||||||
|
[
|
||||||
|
"linear"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"zoom"
|
||||||
|
],
|
||||||
|
12,
|
||||||
|
9,
|
||||||
|
16,
|
||||||
|
13
|
||||||
|
],
|
||||||
|
"text-offset": [
|
||||||
|
0,
|
||||||
|
1.5
|
||||||
|
],
|
||||||
|
"text-anchor": "top",
|
||||||
|
"text-padding": 8,
|
||||||
|
"text-allow-overlap": false
|
||||||
|
},
|
||||||
|
"paint": {
|
||||||
|
"text-color": "#2D3748",
|
||||||
|
"text-halo-color": "rgba(255, 255, 255, 0.9)",
|
||||||
|
"text-halo-width": 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "places-jordan-labels",
|
||||||
|
"type": "symbol",
|
||||||
|
"source": "places_jordan",
|
||||||
|
"source-layer": "places_jordan",
|
||||||
|
"minzoom": 10,
|
||||||
|
"layout": {
|
||||||
|
"text-field": [
|
||||||
|
"coalesce",
|
||||||
|
[
|
||||||
|
"get",
|
||||||
|
"name_ar"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"get",
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"text-font": [
|
||||||
|
"Noto Sans Bold"
|
||||||
|
],
|
||||||
|
"text-size": [
|
||||||
|
"interpolate",
|
||||||
|
[
|
||||||
|
"linear"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"zoom"
|
||||||
|
],
|
||||||
|
12,
|
||||||
|
9,
|
||||||
|
16,
|
||||||
|
13
|
||||||
|
],
|
||||||
|
"text-offset": [
|
||||||
|
0,
|
||||||
|
1.5
|
||||||
|
],
|
||||||
|
"text-anchor": "top",
|
||||||
|
"text-padding": 8,
|
||||||
|
"text-allow-overlap": false
|
||||||
|
},
|
||||||
|
"paint": {
|
||||||
|
"text-color": "#2D3748",
|
||||||
|
"text-halo-color": "rgba(255, 255, 255, 0.9)",
|
||||||
|
"text-halo-width": 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,7 @@ import '../functions/encrypt_decrypt.dart';
|
|||||||
|
|
||||||
class SplashScreenController extends GetxController
|
class SplashScreenController extends GetxController
|
||||||
with GetTickerProviderStateMixin {
|
with GetTickerProviderStateMixin {
|
||||||
|
// ─── انيميشن الـ splash الأصلي ───────────────────────────────────────────
|
||||||
late AnimationController _animationController;
|
late AnimationController _animationController;
|
||||||
late Animation<double> titleFadeAnimation,
|
late Animation<double> titleFadeAnimation,
|
||||||
titleScaleAnimation,
|
titleScaleAnimation,
|
||||||
@@ -25,38 +26,67 @@ class SplashScreenController extends GetxController
|
|||||||
footerFadeAnimation;
|
footerFadeAnimation;
|
||||||
late Animation<Offset> taglineSlideAnimation;
|
late Animation<Offset> taglineSlideAnimation;
|
||||||
|
|
||||||
|
// ─── انيميشن الحلقات المدارية ────────────────────────────────────────────
|
||||||
|
late AnimationController _orbitController;
|
||||||
|
late Animation<double> orbitAnimation;
|
||||||
|
|
||||||
|
// ─── انيميشن التوهج المتنفّس ─────────────────────────────────────────────
|
||||||
|
late AnimationController _glowController;
|
||||||
|
late Animation<double> glowAnimation;
|
||||||
|
|
||||||
final progress = 0.0.obs;
|
final progress = 0.0.obs;
|
||||||
Timer? _progressTimer;
|
Timer? _progressTimer;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
|
||||||
|
// ── الكنترولر الرئيسي للـ splash ─────────────────────────────────────
|
||||||
_animationController = AnimationController(
|
_animationController = AnimationController(
|
||||||
vsync: this, duration: const Duration(milliseconds: 2000));
|
vsync: this, duration: const Duration(milliseconds: 2000));
|
||||||
|
|
||||||
// Animation definitions
|
|
||||||
titleFadeAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
|
titleFadeAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
|
||||||
CurvedAnimation(
|
CurvedAnimation(
|
||||||
parent: _animationController,
|
parent: _animationController,
|
||||||
curve: const Interval(0.0, 0.5, curve: Curves.easeOut)));
|
curve: const Interval(0.0, 0.5, curve: Curves.easeOut)));
|
||||||
|
|
||||||
titleScaleAnimation = Tween<double>(begin: 0.8, end: 1.0).animate(
|
titleScaleAnimation = Tween<double>(begin: 0.8, end: 1.0).animate(
|
||||||
CurvedAnimation(
|
CurvedAnimation(
|
||||||
parent: _animationController,
|
parent: _animationController,
|
||||||
curve: const Interval(0.0, 0.5, curve: Curves.easeOut)));
|
curve: const Interval(0.0, 0.5, curve: Curves.easeOut)));
|
||||||
|
|
||||||
taglineFadeAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
|
taglineFadeAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
|
||||||
CurvedAnimation(
|
CurvedAnimation(
|
||||||
parent: _animationController,
|
parent: _animationController,
|
||||||
curve: const Interval(0.3, 0.8, curve: Curves.easeOut)));
|
curve: const Interval(0.3, 0.8, curve: Curves.easeOut)));
|
||||||
|
|
||||||
taglineSlideAnimation =
|
taglineSlideAnimation =
|
||||||
Tween<Offset>(begin: const Offset(0, 0.5), end: Offset.zero).animate(
|
Tween<Offset>(begin: const Offset(0, 0.5), end: Offset.zero).animate(
|
||||||
CurvedAnimation(
|
CurvedAnimation(
|
||||||
parent: _animationController,
|
parent: _animationController,
|
||||||
curve: const Interval(0.3, 0.8, curve: Curves.easeOut)));
|
curve: const Interval(0.3, 0.8, curve: Curves.easeOut)));
|
||||||
|
|
||||||
footerFadeAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
|
footerFadeAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
|
||||||
CurvedAnimation(
|
CurvedAnimation(
|
||||||
parent: _animationController,
|
parent: _animationController,
|
||||||
curve: const Interval(0.5, 1.0, curve: Curves.easeOut)));
|
curve: const Interval(0.5, 1.0, curve: Curves.easeOut)));
|
||||||
|
|
||||||
|
// ── كنترولر الدوران المداري — دورة كاملة كل 7 ثوانٍ ─────────────────
|
||||||
|
_orbitController =
|
||||||
|
AnimationController(vsync: this, duration: const Duration(seconds: 7))
|
||||||
|
..repeat();
|
||||||
|
|
||||||
|
orbitAnimation =
|
||||||
|
Tween<double>(begin: 0.0, end: 1.0).animate(_orbitController);
|
||||||
|
|
||||||
|
// ── كنترولر التوهج المتنفّس — نبضة كل ثانيتين ───────────────────────
|
||||||
|
_glowController = AnimationController(
|
||||||
|
vsync: this, duration: const Duration(milliseconds: 2000))
|
||||||
|
..repeat(reverse: true);
|
||||||
|
|
||||||
|
glowAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
|
||||||
|
CurvedAnimation(parent: _glowController, curve: Curves.easeInOut));
|
||||||
|
|
||||||
_animationController.forward();
|
_animationController.forward();
|
||||||
_initializeApp();
|
_initializeApp();
|
||||||
}
|
}
|
||||||
@@ -191,6 +221,8 @@ class SplashScreenController extends GetxController
|
|||||||
void onClose() {
|
void onClose() {
|
||||||
_progressTimer?.cancel();
|
_progressTimer?.cancel();
|
||||||
_animationController.dispose();
|
_animationController.dispose();
|
||||||
|
_orbitController.dispose();
|
||||||
|
_glowController.dispose();
|
||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class Log {
|
|||||||
Log._();
|
Log._();
|
||||||
|
|
||||||
static void print(String value, {StackTrace? stackTrace}) {
|
static void print(String value, {StackTrace? stackTrace}) {
|
||||||
developer.log(value, name: 'LOG', stackTrace: stackTrace);
|
// developer.log(value, name: 'LOG', stackTrace: stackTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object? inspect(Object? object) {
|
static Object? inspect(Object? object) {
|
||||||
|
|||||||
@@ -1,167 +1,469 @@
|
|||||||
|
import 'dart:math';
|
||||||
import 'package:animated_text_kit/animated_text_kit.dart';
|
import 'package:animated_text_kit/animated_text_kit.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:Intaleq/constant/colors.dart';
|
|
||||||
import 'package:Intaleq/constant/style.dart';
|
import 'package:Intaleq/constant/style.dart';
|
||||||
import 'package:Intaleq/constant/box_name.dart';
|
import 'package:Intaleq/constant/box_name.dart';
|
||||||
import 'package:Intaleq/main.dart';
|
import 'package:Intaleq/main.dart';
|
||||||
|
|
||||||
import 'controller/home/splash_screen_controlle.dart';
|
import 'controller/home/splash_screen_controlle.dart';
|
||||||
|
|
||||||
// شاشة بداية بتصميم جديد وحركات وألوان محسّنة
|
|
||||||
class SplashScreen extends StatelessWidget {
|
class SplashScreen extends StatelessWidget {
|
||||||
const SplashScreen({super.key});
|
const SplashScreen({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// تهيئة الكنترولر
|
|
||||||
final SplashScreenController controller = Get.put(SplashScreenController());
|
final SplashScreenController controller = Get.put(SplashScreenController());
|
||||||
|
final size = MediaQuery.of(context).size;
|
||||||
|
|
||||||
// تعريف الألوان المستخدمة في حركة اسم التطبيق
|
// ألوان الـ colorize — سيان كهربائي → أبيض → ذهبي عنبري
|
||||||
const colorizeColors = [
|
const colorizeColors = [
|
||||||
|
Color(0xFF00D4FF),
|
||||||
Colors.white,
|
Colors.white,
|
||||||
Color(0xFF89D4CF), // لون تركواز فاتح
|
Color(0xFFFFB700),
|
||||||
Color(0xFF734AE8), // لون بنفسجي مشرق
|
Color(0xFF00D4FF),
|
||||||
Colors.white,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
body: Container(
|
backgroundColor: const Color(0xFF060B18),
|
||||||
// --- تحسين الألوان ---
|
body: Stack(
|
||||||
// تم استخدام تدرج لوني جديد أكثر حيوية وعصرية
|
children: [
|
||||||
decoration: const BoxDecoration(
|
// ── طبقة الشبكة الهندسية ──────────────────────────────────
|
||||||
gradient: LinearGradient(
|
Positioned.fill(
|
||||||
begin: Alignment.topLeft,
|
child: CustomPaint(painter: _GridPainter()),
|
||||||
end: Alignment.bottomRight,
|
|
||||||
colors: [
|
|
||||||
Color(0xFF2E3192), // أزرق داكن
|
|
||||||
Color(0xFF1BFFFF), // سماوي ساطع
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
// دوائر زخرفية لإضافة عمق للتصميم
|
|
||||||
_buildDecorativeCircles(),
|
|
||||||
|
|
||||||
// المحتوى الرئيسي مع الحركات المتتالية
|
// ── توهج سماوي — أعلى اليمين ─────────────────────────────
|
||||||
Center(
|
Positioned(
|
||||||
child: Column(
|
top: -size.height * 0.18,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
right: -size.width * 0.25,
|
||||||
children: [
|
child: Container(
|
||||||
// --- حركة اسم التطبيق ---
|
width: size.width * 0.85,
|
||||||
// تم إلغاء الشعار واستبداله بحركة نصية ملونة لكلمة "Intaleq"
|
height: size.width * 0.85,
|
||||||
FadeTransition(
|
decoration: BoxDecoration(
|
||||||
opacity: controller.titleFadeAnimation,
|
shape: BoxShape.circle,
|
||||||
child: ScaleTransition(
|
gradient: RadialGradient(colors: [
|
||||||
scale: controller.titleScaleAnimation,
|
const Color(0xFF00D4FF).withOpacity(0.11),
|
||||||
child: AnimatedTextKit(
|
Colors.transparent,
|
||||||
animatedTexts: [
|
]),
|
||||||
ColorizeAnimatedText(
|
|
||||||
'Intaleq',
|
|
||||||
textStyle: AppStyle.headTitle.copyWith(
|
|
||||||
fontSize: 65.0, // تكبير حجم الخط
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
shadows: [
|
|
||||||
const Shadow(
|
|
||||||
blurRadius: 15.0,
|
|
||||||
color: Colors.black38,
|
|
||||||
offset: Offset(0, 3.0),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
colors: colorizeColors,
|
|
||||||
speed: const Duration(milliseconds: 300),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
isRepeatingAnimation: false,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 18),
|
|
||||||
|
|
||||||
// --- حركة الشعار النصي ---
|
|
||||||
FadeTransition(
|
|
||||||
opacity: controller.taglineFadeAnimation,
|
|
||||||
child: SlideTransition(
|
|
||||||
position: controller.taglineSlideAnimation,
|
|
||||||
child: Text(
|
|
||||||
'Your Journey Begins Here'.tr,
|
|
||||||
style: AppStyle.title.copyWith(
|
|
||||||
color: AppColor.writeColor.withOpacity(0.9),
|
|
||||||
fontSize: 18,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
|
||||||
// قسم سفلي لشريط التقدم ومعلومات الإصدار
|
// ── توهج أزرق غامق — أسفل اليسار ────────────────────────
|
||||||
Align(
|
Positioned(
|
||||||
alignment: Alignment.bottomCenter,
|
bottom: -size.height * 0.12,
|
||||||
child: FadeTransition(
|
left: -size.width * 0.22,
|
||||||
opacity: controller.footerFadeAnimation,
|
child: Container(
|
||||||
child: Padding(
|
width: size.width * 0.75,
|
||||||
padding: const EdgeInsets.only(
|
height: size.width * 0.75,
|
||||||
bottom: 40.0, left: 40, right: 40),
|
decoration: BoxDecoration(
|
||||||
child: Column(
|
shape: BoxShape.circle,
|
||||||
mainAxisSize: MainAxisSize.min,
|
gradient: RadialGradient(colors: [
|
||||||
children: [
|
const Color(0xFF0052FF).withOpacity(0.09),
|
||||||
ClipRRect(
|
Colors.transparent,
|
||||||
borderRadius: BorderRadius.circular(10),
|
]),
|
||||||
child: Obx(() => LinearProgressIndicator(
|
),
|
||||||
value: controller.progress.value,
|
),
|
||||||
backgroundColor:
|
),
|
||||||
AppColor.writeColor.withOpacity(0.2),
|
|
||||||
valueColor: const AlwaysStoppedAnimation<Color>(
|
// ── المحتوى الرئيسي ───────────────────────────────────────
|
||||||
AppColor.writeColor),
|
Center(
|
||||||
minHeight: 5,
|
child: Column(
|
||||||
)),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
// ── حلقات مدارية + اسم التطبيق ───────────────────
|
||||||
|
FadeTransition(
|
||||||
|
opacity: controller.titleFadeAnimation,
|
||||||
|
child: ScaleTransition(
|
||||||
|
scale: controller.titleScaleAnimation,
|
||||||
|
child: SizedBox(
|
||||||
|
width: 220,
|
||||||
|
height: 220,
|
||||||
|
child: Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
// الحلقة الخارجية — تدور ببطء
|
||||||
|
AnimatedBuilder(
|
||||||
|
animation: controller.orbitAnimation,
|
||||||
|
builder: (_, __) => Transform.rotate(
|
||||||
|
angle: controller.orbitAnimation.value * 2 * pi,
|
||||||
|
child: CustomPaint(
|
||||||
|
painter: _OrbitalRingPainter(
|
||||||
|
radius: 100,
|
||||||
|
dotColor: const Color(0xFF00D4FF),
|
||||||
|
lineOpacity: 0.22,
|
||||||
|
dotSize: 5.5,
|
||||||
|
),
|
||||||
|
size: const Size(220, 220),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// الحلقة الداخلية — تدور عكسياً
|
||||||
|
AnimatedBuilder(
|
||||||
|
animation: controller.orbitAnimation,
|
||||||
|
builder: (_, __) => Transform.rotate(
|
||||||
|
angle: -controller.orbitAnimation.value *
|
||||||
|
2 *
|
||||||
|
pi *
|
||||||
|
0.65,
|
||||||
|
child: CustomPaint(
|
||||||
|
painter: _OrbitalRingPainter(
|
||||||
|
radius: 73,
|
||||||
|
dotColor: const Color(0xFFFFB700),
|
||||||
|
lineOpacity: 0.14,
|
||||||
|
dotSize: 4,
|
||||||
|
dashCount: 20,
|
||||||
|
),
|
||||||
|
size: const Size(220, 220),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// النقطة المركزية المضيئة
|
||||||
|
AnimatedBuilder(
|
||||||
|
animation: controller.glowAnimation,
|
||||||
|
builder: (_, __) => Container(
|
||||||
|
width: 8,
|
||||||
|
height: 8,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: const Color(0xFF00D4FF),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: const Color(0xFF00D4FF)
|
||||||
|
.withOpacity(0.25 +
|
||||||
|
controller.glowAnimation.value *
|
||||||
|
0.35),
|
||||||
|
blurRadius: 20 +
|
||||||
|
controller.glowAnimation.value * 20,
|
||||||
|
spreadRadius: 4,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// ── اسم "Intaleq" مع توهج متنفّس ─────────
|
||||||
|
AnimatedBuilder(
|
||||||
|
animation: controller.glowAnimation,
|
||||||
|
builder: (_, child) => Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: const Color(0xFF00D4FF)
|
||||||
|
.withOpacity(0.08 +
|
||||||
|
controller.glowAnimation.value *
|
||||||
|
0.10),
|
||||||
|
blurRadius: 40 +
|
||||||
|
controller.glowAnimation.value * 25,
|
||||||
|
spreadRadius: 0,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
child: AnimatedTextKit(
|
||||||
|
animatedTexts: [
|
||||||
|
ColorizeAnimatedText(
|
||||||
|
'Intaleq',
|
||||||
|
textStyle: const TextStyle(
|
||||||
|
fontSize: 38,
|
||||||
|
fontWeight: FontWeight.w800,
|
||||||
|
letterSpacing: 3,
|
||||||
|
height: 1,
|
||||||
|
),
|
||||||
|
colors: colorizeColors,
|
||||||
|
speed: const Duration(milliseconds: 380),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
isRepeatingAnimation: false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
),
|
||||||
Text(
|
|
||||||
'Version: ${box.read(BoxName.packagInfo) ?? '1.0.0'}',
|
|
||||||
style: AppStyle.subtitle.copyWith(
|
|
||||||
color: AppColor.writeColor.withOpacity(0.7),
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
const SizedBox(height: 28),
|
||||||
|
|
||||||
|
// ── شريحة "AI-Powered" + الشعار النصي ───────────────
|
||||||
|
FadeTransition(
|
||||||
|
opacity: controller.taglineFadeAnimation,
|
||||||
|
child: SlideTransition(
|
||||||
|
position: controller.taglineSlideAnimation,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
// شريحة الذكاء الاصطناعي
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 14, vertical: 5),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(
|
||||||
|
color:
|
||||||
|
const Color(0xFF00D4FF).withOpacity(0.35),
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
color: const Color(0xFF00D4FF).withOpacity(0.06),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
// نقطة نبضية
|
||||||
|
AnimatedBuilder(
|
||||||
|
animation: controller.glowAnimation,
|
||||||
|
builder: (_, __) => Container(
|
||||||
|
width: 6,
|
||||||
|
height: 6,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: const Color(0xFF00D4FF)
|
||||||
|
.withOpacity(0.5 +
|
||||||
|
controller.glowAnimation.value *
|
||||||
|
0.5),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: const Color(0xFF00D4FF)
|
||||||
|
.withOpacity(controller
|
||||||
|
.glowAnimation.value *
|
||||||
|
0.6),
|
||||||
|
blurRadius: 6,
|
||||||
|
spreadRadius: 1,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
'AI-Powered Mobility',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 11,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: const Color(0xFF00D4FF)
|
||||||
|
.withOpacity(0.85),
|
||||||
|
letterSpacing: 1.4,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
// الشعار النصي
|
||||||
|
Text(
|
||||||
|
'Your Journey Begins Here'.tr,
|
||||||
|
style: AppStyle.title.copyWith(
|
||||||
|
color: const Color(0xFF7A8FA8),
|
||||||
|
fontSize: 14,
|
||||||
|
letterSpacing: 0.6,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// ── القسم السفلي: شريط التقدم + الإصدار ─────────────────
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: FadeTransition(
|
||||||
|
opacity: controller.footerFadeAnimation,
|
||||||
|
child: Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(bottom: 44, left: 36, right: 36),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
// شريط تقدم رفيع مضيء
|
||||||
|
Obx(() => _GlowProgressBar(
|
||||||
|
value: controller.progress.value,
|
||||||
|
)),
|
||||||
|
const SizedBox(height: 18),
|
||||||
|
// معلومات الإصدار
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'INTALEQ',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 9.5,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
color: Colors.white.withOpacity(0.18),
|
||||||
|
letterSpacing: 3.5,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'v${box.read(BoxName.packagInfo) ?? '1.0.0'}',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 9.5,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Colors.white.withOpacity(0.18),
|
||||||
|
letterSpacing: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// بناء دوائر زخرفية لتحسين الخلفية
|
// ── شريط التقدم المضيء ─────────────────────────────────────────────────────
|
||||||
Widget _buildDecorativeCircles() {
|
class _GlowProgressBar extends StatelessWidget {
|
||||||
|
final double value;
|
||||||
|
const _GlowProgressBar({required this.value});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
Positioned(
|
// المسار
|
||||||
top: -80,
|
Container(
|
||||||
left: -100,
|
height: 2,
|
||||||
child: CircleAvatar(
|
decoration: BoxDecoration(
|
||||||
radius: 120,
|
color: Colors.white.withOpacity(0.07),
|
||||||
backgroundColor: Colors.white.withOpacity(0.05),
|
borderRadius: BorderRadius.circular(2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
// الملء المضيء
|
||||||
bottom: -120,
|
FractionallySizedBox(
|
||||||
right: -150,
|
widthFactor: value.clamp(0.0, 1.0),
|
||||||
child: CircleAvatar(
|
child: Container(
|
||||||
radius: 180,
|
height: 2,
|
||||||
backgroundColor: Colors.white.withOpacity(0.07),
|
decoration: BoxDecoration(
|
||||||
|
gradient: const LinearGradient(colors: [
|
||||||
|
Color(0xFF0052FF),
|
||||||
|
Color(0xFF00D4FF),
|
||||||
|
]),
|
||||||
|
borderRadius: BorderRadius.circular(2),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: const Color(0xFF00D4FF).withOpacity(0.55),
|
||||||
|
blurRadius: 8,
|
||||||
|
spreadRadius: 1,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── رسّام الشبكة الهندسية ─────────────────────────────────────────────────
|
||||||
|
class _GridPainter extends CustomPainter {
|
||||||
|
@override
|
||||||
|
void paint(Canvas canvas, Size size) {
|
||||||
|
final linePaint = Paint()
|
||||||
|
..color = const Color(0xFF00D4FF).withOpacity(0.04)
|
||||||
|
..strokeWidth = 0.5;
|
||||||
|
|
||||||
|
const spacing = 36.0;
|
||||||
|
|
||||||
|
for (double y = 0; y < size.height; y += spacing) {
|
||||||
|
canvas.drawLine(Offset(0, y), Offset(size.width, y), linePaint);
|
||||||
|
}
|
||||||
|
for (double x = 0; x < size.width; x += spacing) {
|
||||||
|
canvas.drawLine(Offset(x, 0), Offset(x, size.height), linePaint);
|
||||||
|
}
|
||||||
|
|
||||||
|
// نقاط التقاطع
|
||||||
|
final dotPaint = Paint()
|
||||||
|
..color = const Color(0xFF00D4FF).withOpacity(0.07)
|
||||||
|
..style = PaintingStyle.fill;
|
||||||
|
|
||||||
|
for (double y = 0; y < size.height; y += spacing) {
|
||||||
|
for (double x = 0; x < size.width; x += spacing) {
|
||||||
|
canvas.drawCircle(Offset(x, y), 0.9, dotPaint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool shouldRepaint(_GridPainter old) => false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── رسّام الحلقة المدارية ─────────────────────────────────────────────────
|
||||||
|
class _OrbitalRingPainter extends CustomPainter {
|
||||||
|
final double radius;
|
||||||
|
final Color dotColor;
|
||||||
|
final double lineOpacity;
|
||||||
|
final double dotSize;
|
||||||
|
final int dashCount;
|
||||||
|
|
||||||
|
const _OrbitalRingPainter({
|
||||||
|
this.radius = 95,
|
||||||
|
this.dotColor = const Color(0xFF00D4FF),
|
||||||
|
this.lineOpacity = 0.25,
|
||||||
|
this.dotSize = 5.5,
|
||||||
|
this.dashCount = 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
void paint(Canvas canvas, Size size) {
|
||||||
|
final center = Offset(size.width / 2, size.height / 2);
|
||||||
|
|
||||||
|
if (dashCount > 0) {
|
||||||
|
// حلقة متقطعة (dashed)
|
||||||
|
final dashPaint = Paint()
|
||||||
|
..color = const Color(0xFF00D4FF).withOpacity(lineOpacity)
|
||||||
|
..strokeWidth = 1
|
||||||
|
..style = PaintingStyle.stroke
|
||||||
|
..strokeCap = StrokeCap.round;
|
||||||
|
|
||||||
|
const dashAngle = 2 * pi / 40;
|
||||||
|
final gapRatio = 0.45;
|
||||||
|
|
||||||
|
for (int i = 0; i < dashCount; i++) {
|
||||||
|
final startAngle = i * (2 * pi / dashCount);
|
||||||
|
final sweepAngle = (2 * pi / dashCount) * (1 - gapRatio);
|
||||||
|
canvas.drawArc(
|
||||||
|
Rect.fromCircle(center: center, radius: radius),
|
||||||
|
startAngle,
|
||||||
|
sweepAngle,
|
||||||
|
false,
|
||||||
|
dashPaint,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// حلقة متصلة
|
||||||
|
final ringPaint = Paint()
|
||||||
|
..color = const Color(0xFF00D4FF).withOpacity(lineOpacity)
|
||||||
|
..strokeWidth = 1
|
||||||
|
..style = PaintingStyle.stroke;
|
||||||
|
canvas.drawCircle(center, radius, ringPaint);
|
||||||
|
}
|
||||||
|
|
||||||
|
// النقطة البراقة — دائماً في القمة (before rotation)
|
||||||
|
final dotPos = Offset(center.dx, center.dy - radius);
|
||||||
|
|
||||||
|
// توهج خلف النقطة
|
||||||
|
final glowPaint = Paint()
|
||||||
|
..color = dotColor.withOpacity(0.35)
|
||||||
|
..maskFilter = const MaskFilter.blur(BlurStyle.normal, 9);
|
||||||
|
canvas.drawCircle(dotPos, dotSize + 2, glowPaint);
|
||||||
|
|
||||||
|
// النقطة نفسها
|
||||||
|
final dotPaint = Paint()
|
||||||
|
..color = dotColor
|
||||||
|
..style = PaintingStyle.fill;
|
||||||
|
canvas.drawCircle(dotPos, dotSize, dotPaint);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool shouldRepaint(_OrbitalRingPainter old) => false;
|
||||||
|
}
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ class MapPagePassenger extends StatelessWidget {
|
|||||||
CashConfirmPageShown(),
|
CashConfirmPageShown(),
|
||||||
const PaymentMethodPage(),
|
const PaymentMethodPage(),
|
||||||
const SearchingCaptainWindow(),
|
const SearchingCaptainWindow(),
|
||||||
|
AttributionMap(),
|
||||||
// timerForCancelTripFromPassenger(),
|
// timerForCancelTripFromPassenger(),
|
||||||
// const DriverTimeArrivePassengerPage(),
|
// const DriverTimeArrivePassengerPage(),
|
||||||
// const TimerToPassengerFromDriver(),
|
// const TimerToPassengerFromDriver(),
|
||||||
@@ -81,6 +82,35 @@ class MapPagePassenger extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AttributionMap extends StatelessWidget {
|
||||||
|
const AttributionMap({
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Positioned(
|
||||||
|
left: 4,
|
||||||
|
bottom: 20,
|
||||||
|
child: RotatedBox(
|
||||||
|
quarterTurns: 0, // يخلي النص عمودي (من تحت لفوق)
|
||||||
|
child: Opacity(
|
||||||
|
opacity: 0.7,
|
||||||
|
child: Text(
|
||||||
|
"Intaleq Maps",
|
||||||
|
// "Intaleq Maps • © OpenStreetMap contributors",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 10,
|
||||||
|
color: Colors.grey[700],
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class CancelRidePageShow extends StatelessWidget {
|
class CancelRidePageShow extends StatelessWidget {
|
||||||
const CancelRidePageShow({
|
const CancelRidePageShow({
|
||||||
super.key,
|
super.key,
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ class GoogleMapPassengerWidget extends StatelessWidget {
|
|||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
child: MapLibreMap(
|
child: MapLibreMap(
|
||||||
|
attributionButtonPosition: AttributionButtonPosition.bottomLeft,
|
||||||
|
attributionButtonMargins: null,
|
||||||
onMapCreated: controller.onMapCreated,
|
onMapCreated: controller.onMapCreated,
|
||||||
onStyleLoadedCallback: () => controller.onStyleLoaded(),
|
onStyleLoadedCallback: () => controller.onStyleLoaded(),
|
||||||
styleString: "assets/style.json",
|
styleString: "assets/style.json",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import 'dart:ui'; // مهم لإضافة تأثير الضبابية
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:Intaleq/constant/box_name.dart';
|
import 'package:Intaleq/constant/box_name.dart';
|
||||||
import 'package:Intaleq/main.dart';
|
import 'package:Intaleq/main.dart';
|
||||||
@@ -22,7 +22,15 @@ import '../HomePage/share_app_page.dart';
|
|||||||
import '../setting_page.dart';
|
import '../setting_page.dart';
|
||||||
import '../profile/passenger_profile_page.dart';
|
import '../profile/passenger_profile_page.dart';
|
||||||
|
|
||||||
// --- الويدجت الرئيسية بالتصميم الجديد ---
|
// ─── ألوان النظام ───────────────────────────────────────────────────────────
|
||||||
|
const _kBg = Color(0xFF060B18);
|
||||||
|
const _kBgSurface = Color(0xFF0D1525);
|
||||||
|
const _kCyan = Color(0xFF00D4FF);
|
||||||
|
const _kAmber = Color(0xFFFFB700);
|
||||||
|
const _kBorder = Color(0x1A00D4FF);
|
||||||
|
const _kText = Colors.white;
|
||||||
|
const _kTextMuted = Color(0xFF7A8FA8);
|
||||||
|
|
||||||
class MapMenuWidget extends StatelessWidget {
|
class MapMenuWidget extends StatelessWidget {
|
||||||
const MapMenuWidget({super.key});
|
const MapMenuWidget({super.key});
|
||||||
|
|
||||||
@@ -33,51 +41,58 @@ class MapMenuWidget extends StatelessWidget {
|
|||||||
return GetBuilder<MapPassengerController>(
|
return GetBuilder<MapPassengerController>(
|
||||||
builder: (controller) => Stack(
|
builder: (controller) => Stack(
|
||||||
children: [
|
children: [
|
||||||
// --- خلفية معتمة عند فتح القائمة ---
|
// ── تعتيم الخلفية ───────────────────────────────────────────────
|
||||||
if (controller.widthMenu > 0)
|
if (controller.widthMenu > 0)
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: controller.getDrawerMenu,
|
onTap: controller.getDrawerMenu,
|
||||||
child: Container(
|
child: Container(color: Colors.black.withOpacity(0.55)),
|
||||||
color: Colors.black.withOpacity(0.4),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
// --- القائمة الجانبية المنزلقة ---
|
|
||||||
_buildSideMenu(controller),
|
_buildSideMenu(controller),
|
||||||
|
|
||||||
// --- زر القائمة العائم ---
|
|
||||||
_buildMenuButton(controller),
|
_buildMenuButton(controller),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- ويدجت لبناء زر القائمة ---
|
// ── زر القائمة العائم ────────────────────────────────────────────────────
|
||||||
Widget _buildMenuButton(MapPassengerController controller) {
|
Widget _buildMenuButton(MapPassengerController controller) {
|
||||||
return Positioned(
|
return Positioned(
|
||||||
top: 45,
|
top: 45,
|
||||||
left: 16,
|
left: 16,
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: InkWell(
|
child: GestureDetector(
|
||||||
onTap: controller.getDrawerMenu,
|
onTap: controller.getDrawerMenu,
|
||||||
borderRadius: BorderRadius.circular(50),
|
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(50),
|
borderRadius: BorderRadius.circular(16),
|
||||||
child: BackdropFilter(
|
child: BackdropFilter(
|
||||||
filter: ImageFilter.blur(sigmaX: 5.0, sigmaY: 5.0),
|
filter: ImageFilter.blur(sigmaX: 12, sigmaY: 12),
|
||||||
child: AnimatedContainer(
|
child: AnimatedContainer(
|
||||||
duration: const Duration(milliseconds: 300),
|
duration: const Duration(milliseconds: 300),
|
||||||
padding: const EdgeInsets.all(12),
|
curve: Curves.easeOut,
|
||||||
|
width: 48,
|
||||||
|
height: 48,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppColor.secondaryColor.withOpacity(0.8),
|
color: _kBg.withOpacity(0.88),
|
||||||
shape: BoxShape.circle,
|
borderRadius: BorderRadius.circular(16),
|
||||||
border:
|
border: Border.all(color: _kCyan.withOpacity(0.25), width: 1),
|
||||||
Border.all(color: AppColor.writeColor.withOpacity(0.2)),
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: _kCyan.withOpacity(0.12),
|
||||||
|
blurRadius: 16,
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
child: Icon(
|
child: AnimatedSwitcher(
|
||||||
controller.widthMenu > 0 ? Icons.close : Icons.menu,
|
duration: const Duration(milliseconds: 200),
|
||||||
color: AppColor.writeColor,
|
child: Icon(
|
||||||
size: 26,
|
controller.widthMenu > 0
|
||||||
|
? Icons.close_rounded
|
||||||
|
: Icons.menu_rounded,
|
||||||
|
key: ValueKey(controller.widthMenu > 0),
|
||||||
|
color: _kCyan,
|
||||||
|
size: 22,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -87,109 +102,125 @@ class MapMenuWidget extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- ويدجت لبناء القائمة الجانبية ---
|
// ── القائمة الجانبية ─────────────────────────────────────────────────────
|
||||||
Widget _buildSideMenu(MapPassengerController controller) {
|
Widget _buildSideMenu(MapPassengerController controller) {
|
||||||
return AnimatedPositioned(
|
return AnimatedPositioned(
|
||||||
duration: const Duration(milliseconds: 400),
|
duration: const Duration(milliseconds: 420),
|
||||||
curve: Curves.fastOutSlowIn,
|
curve: Curves.fastOutSlowIn,
|
||||||
top: 0,
|
top: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
left: controller.widthMenu > 0 ? 0 : -Get.width,
|
left: controller.widthMenu > 0 ? 0 : -Get.width,
|
||||||
child: ClipRRect(
|
child: ClipRect(
|
||||||
child: BackdropFilter(
|
child: BackdropFilter(
|
||||||
filter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
|
filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20),
|
||||||
child: Container(
|
child: Container(
|
||||||
width: Get.width * 0.8,
|
width: Get.width * 0.8,
|
||||||
constraints: const BoxConstraints(maxWidth: 320),
|
constraints: const BoxConstraints(maxWidth: 320),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppColor.secondaryColor.withOpacity(0.95),
|
color: _kBg.withOpacity(0.97),
|
||||||
|
border: Border(
|
||||||
|
right: BorderSide(color: _kCyan.withOpacity(0.12), width: 1),
|
||||||
|
),
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black.withOpacity(0.2),
|
color: Colors.black.withOpacity(0.5),
|
||||||
blurRadius: 20,
|
blurRadius: 32,
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: SafeArea(
|
child: Stack(
|
||||||
child: Column(
|
children: [
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
// شبكة خلفية
|
||||||
children: [
|
Positioned.fill(
|
||||||
_buildMenuHeader(),
|
child: CustomPaint(painter: _MenuGridPainter())),
|
||||||
_buildQuickActionButtons(),
|
|
||||||
const Divider(
|
// المحتوى
|
||||||
color: Colors.white24,
|
SafeArea(
|
||||||
indent: 16,
|
child: Column(
|
||||||
endIndent: 16,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
height: 24),
|
children: [
|
||||||
Expanded(
|
_buildMenuHeader(),
|
||||||
child: ListView(
|
_buildQuickActionButtons(),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
_buildDivider(),
|
||||||
children: [
|
Expanded(
|
||||||
MenuListItem(
|
child: ListView(
|
||||||
title: 'My Balance'.tr,
|
padding: const EdgeInsets.symmetric(
|
||||||
icon: Icons.account_balance_wallet_outlined,
|
horizontal: 12, vertical: 4),
|
||||||
onTap: () => Get.to(() => const PassengerWallet())),
|
children: [
|
||||||
MenuListItem(
|
MenuListItem(
|
||||||
title: 'Order History'.tr,
|
title: 'My Balance'.tr,
|
||||||
icon: Icons.history_rounded,
|
icon: Icons.account_balance_wallet_outlined,
|
||||||
onTap: () => Get.to(() => const OrderHistory())),
|
onTap: () =>
|
||||||
MenuListItem(
|
Get.to(() => const PassengerWallet()),
|
||||||
title: 'Promos'.tr,
|
),
|
||||||
icon: Icons.local_offer_outlined,
|
MenuListItem(
|
||||||
onTap: () =>
|
title: 'Order History'.tr,
|
||||||
Get.to(() => const PromosPassengerPage())),
|
icon: Icons.history_rounded,
|
||||||
MenuListItem(
|
onTap: () => Get.to(() => const OrderHistory()),
|
||||||
title: 'Contact Us'.tr,
|
),
|
||||||
icon: Icons.contact_support_outlined,
|
MenuListItem(
|
||||||
onTap: () => Get.to(() => ContactUsPage())),
|
title: 'Promos'.tr,
|
||||||
MenuListItem(
|
icon: Icons.local_offer_outlined,
|
||||||
title: 'Complaint'.tr,
|
onTap: () =>
|
||||||
icon: Icons.flag_outlined,
|
Get.to(() => const PromosPassengerPage()),
|
||||||
onTap: () => Get.to(() => ComplaintPage())),
|
),
|
||||||
MenuListItem(
|
MenuListItem(
|
||||||
title: 'Driver'.tr,
|
title: 'Contact Us'.tr,
|
||||||
icon: Ionicons.car_sport_outline,
|
icon: Icons.contact_support_outlined,
|
||||||
onTap: () => _launchDriverAppUrl()),
|
onTap: () => Get.to(() => ContactUsPage()),
|
||||||
MenuListItem(
|
),
|
||||||
title: 'Share App'.tr,
|
MenuListItem(
|
||||||
icon: Icons.share_outlined,
|
title: 'Complaint'.tr,
|
||||||
onTap: () => Get.to(() => ShareAppPage())),
|
icon: Icons.flag_outlined,
|
||||||
MenuListItem(
|
onTap: () => Get.to(() => ComplaintPage()),
|
||||||
title: 'Privacy Policy'.tr,
|
),
|
||||||
icon: Icons.shield_outlined,
|
MenuListItem(
|
||||||
onTap: () => launchUrl(Uri.parse(
|
title: 'Driver'.tr,
|
||||||
'${AppLink.server}/privacy_policy.php')),
|
icon: Ionicons.car_sport_outline,
|
||||||
|
onTap: () => _launchDriverAppUrl(),
|
||||||
|
),
|
||||||
|
MenuListItem(
|
||||||
|
title: 'Share App'.tr,
|
||||||
|
icon: Icons.share_outlined,
|
||||||
|
onTap: () => Get.to(() => ShareAppPage()),
|
||||||
|
),
|
||||||
|
MenuListItem(
|
||||||
|
title: 'Privacy Policy'.tr,
|
||||||
|
icon: Icons.shield_outlined,
|
||||||
|
onTap: () => launchUrl(
|
||||||
|
Uri.parse(
|
||||||
|
'${AppLink.server}/privacy_policy.php'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
_buildDivider(),
|
||||||
),
|
// زر الخروج
|
||||||
const Divider(
|
Padding(
|
||||||
color: Colors.white24,
|
padding: const EdgeInsets.fromLTRB(12, 4, 12, 12),
|
||||||
indent: 16,
|
child: MenuListItem(
|
||||||
endIndent: 16,
|
title: 'Logout'.tr,
|
||||||
height: 1),
|
icon: Icons.logout_rounded,
|
||||||
Padding(
|
isDestructive: true,
|
||||||
padding: const EdgeInsets.all(8.0),
|
onTap: () {
|
||||||
child: MenuListItem(
|
Get.defaultDialog(
|
||||||
title: 'Logout'.tr,
|
title: "Logout".tr,
|
||||||
icon: Icons.logout_rounded,
|
middleText: "Are you sure you want to logout?".tr,
|
||||||
onTap: () {
|
textConfirm: "Logout".tr,
|
||||||
Get.defaultDialog(
|
textCancel: "Cancel".tr,
|
||||||
title: "Logout".tr,
|
onConfirm: () {
|
||||||
middleText: "Are you sure you want to logout?".tr,
|
// controller.logout();
|
||||||
textConfirm: "Logout".tr,
|
Get.back();
|
||||||
textCancel: "Cancel".tr,
|
},
|
||||||
onConfirm: () {
|
);
|
||||||
// controller.logout();
|
|
||||||
Get.back();
|
|
||||||
},
|
},
|
||||||
);
|
),
|
||||||
},
|
),
|
||||||
color: Colors.red.shade300,
|
],
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -197,33 +228,96 @@ class MapMenuWidget extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- ويدجت رأس القائمة ---
|
// ── رأس القائمة ──────────────────────────────────────────────────────────
|
||||||
Widget _buildMenuHeader() {
|
Widget _buildMenuHeader() {
|
||||||
return Padding(
|
return Container(
|
||||||
padding: const EdgeInsets.fromLTRB(20, 30, 20, 16),
|
margin: const EdgeInsets.fromLTRB(16, 24, 16, 16),
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: _kBgSurface,
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
border: Border.all(color: _kCyan.withOpacity(0.15), width: 1),
|
||||||
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
const CircleAvatar(
|
// أفاتار المستخدم
|
||||||
radius: 30,
|
Stack(
|
||||||
backgroundColor: AppColor.primaryColor,
|
children: [
|
||||||
child: Icon(Icons.person, color: AppColor.writeColor, size: 35),
|
Container(
|
||||||
|
width: 56,
|
||||||
|
height: 56,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.topLeft,
|
||||||
|
end: Alignment.bottomRight,
|
||||||
|
colors: [
|
||||||
|
_kCyan.withOpacity(0.2),
|
||||||
|
_kAmber.withOpacity(0.12),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
border:
|
||||||
|
Border.all(color: _kCyan.withOpacity(0.35), width: 1.5),
|
||||||
|
),
|
||||||
|
child:
|
||||||
|
const Icon(Icons.person_rounded, color: _kCyan, size: 28),
|
||||||
|
),
|
||||||
|
// نقطة الحضور
|
||||||
|
Positioned(
|
||||||
|
bottom: 1,
|
||||||
|
right: 1,
|
||||||
|
child: Container(
|
||||||
|
width: 12,
|
||||||
|
height: 12,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color(0xFF00E676),
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
border: Border.all(color: _kBg, width: 2),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: const Color(0xFF00E676).withOpacity(0.5),
|
||||||
|
blurRadius: 6,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 14),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
box.read(BoxName.name) ?? 'Guest',
|
box.read(BoxName.name) ?? 'Guest',
|
||||||
style: AppStyle.headTitle.copyWith(fontSize: 20),
|
style: const TextStyle(
|
||||||
|
color: _kText,
|
||||||
|
fontSize: 17,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
letterSpacing: 0.3,
|
||||||
|
),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 5),
|
||||||
Text(
|
Row(
|
||||||
"Intaleq Passenger".tr,
|
children: [
|
||||||
style: AppStyle.title.copyWith(
|
Container(
|
||||||
color: AppColor.writeColor.withOpacity(0.7),
|
width: 5,
|
||||||
fontSize: 14),
|
height: 5,
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: _kCyan, shape: BoxShape.circle),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
Text(
|
||||||
|
"Intaleq Passenger".tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: _kTextMuted,
|
||||||
|
fontSize: 12,
|
||||||
|
letterSpacing: 0.4,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -233,47 +327,44 @@ class MapMenuWidget extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- ويدجت الأزرار السريعة ---
|
// ── أزرار الإجراءات السريعة ───────────────────────────────────────────────
|
||||||
Widget _buildQuickActionButtons() {
|
Widget _buildQuickActionButtons() {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
children: [
|
children: [
|
||||||
_buildSmallActionButton(
|
_QuickBtn(
|
||||||
icon: Icons.person_outline_rounded,
|
icon: Icons.person_outline_rounded,
|
||||||
label: 'Profile'.tr,
|
label: 'Profile'.tr,
|
||||||
onTap: () => Get.to(() => PassengerProfilePage())),
|
onTap: () => Get.to(() => PassengerProfilePage()),
|
||||||
_buildSmallActionButton(
|
),
|
||||||
icon: Icons.notifications_none_rounded,
|
const SizedBox(width: 8),
|
||||||
label: 'Alerts'.tr,
|
_QuickBtn(
|
||||||
onTap: () => Get.to(() => const NotificationPage())),
|
icon: Icons.notifications_none_rounded,
|
||||||
_buildSmallActionButton(
|
label: 'Alerts'.tr,
|
||||||
icon: Icons.settings_outlined,
|
onTap: () => Get.to(() => const NotificationPage()),
|
||||||
label: 'Settings'.tr,
|
),
|
||||||
onTap: () => Get.to(() => const SettingPage())),
|
const SizedBox(width: 8),
|
||||||
|
_QuickBtn(
|
||||||
|
icon: Icons.settings_outlined,
|
||||||
|
label: 'Settings'.tr,
|
||||||
|
onTap: () => Get.to(() => const SettingPage()),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildSmallActionButton(
|
Widget _buildDivider() {
|
||||||
{required IconData icon,
|
return Container(
|
||||||
required String label,
|
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
required VoidCallback onTap}) {
|
height: 1,
|
||||||
return InkWell(
|
decoration: BoxDecoration(
|
||||||
onTap: onTap,
|
gradient: LinearGradient(
|
||||||
borderRadius: BorderRadius.circular(12),
|
colors: [
|
||||||
child: Padding(
|
Colors.transparent,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 12.0),
|
_kCyan.withOpacity(0.15),
|
||||||
child: Column(
|
Colors.transparent,
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Icon(icon, color: AppColor.writeColor.withOpacity(0.9), size: 24),
|
|
||||||
const SizedBox(height: 6),
|
|
||||||
Text(label,
|
|
||||||
style: AppStyle.subtitle.copyWith(
|
|
||||||
fontSize: 12, color: AppColor.writeColor.withOpacity(0.9))),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -304,7 +395,52 @@ class MapMenuWidget extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- ويدجت عناصر القائمة بتصميم محسن ---
|
// ── زر الإجراء السريع ────────────────────────────────────────────────────────
|
||||||
|
class _QuickBtn extends StatelessWidget {
|
||||||
|
final IconData icon;
|
||||||
|
final String label;
|
||||||
|
final VoidCallback onTap;
|
||||||
|
|
||||||
|
const _QuickBtn({
|
||||||
|
required this.icon,
|
||||||
|
required this.label,
|
||||||
|
required this.onTap,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Expanded(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: onTap,
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: _kBgSurface,
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
border: Border.all(color: _kCyan.withOpacity(0.12), width: 1),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Icon(icon, color: _kCyan, size: 22),
|
||||||
|
const SizedBox(height: 6),
|
||||||
|
Text(
|
||||||
|
label,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: _kTextMuted,
|
||||||
|
fontSize: 11,
|
||||||
|
letterSpacing: 0.4,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── عنصر القائمة ─────────────────────────────────────────────────────────────
|
||||||
class MenuListItem extends StatelessWidget {
|
class MenuListItem extends StatelessWidget {
|
||||||
const MenuListItem({
|
const MenuListItem({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -312,33 +448,87 @@ class MenuListItem extends StatelessWidget {
|
|||||||
required this.onTap,
|
required this.onTap,
|
||||||
required this.icon,
|
required this.icon,
|
||||||
this.color,
|
this.color,
|
||||||
|
this.isDestructive = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
final IconData icon;
|
final IconData icon;
|
||||||
final VoidCallback onTap;
|
final VoidCallback onTap;
|
||||||
final Color? color;
|
final Color? color;
|
||||||
|
final bool isDestructive;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ListTile(
|
final iconColor = isDestructive
|
||||||
onTap: onTap,
|
? const Color(0xFFFF5252)
|
||||||
leading: Icon(
|
: (color ?? _kCyan.withOpacity(0.80));
|
||||||
icon,
|
final textColor =
|
||||||
size: 26,
|
isDestructive ? const Color(0xFFFF5252) : (color ?? _kText);
|
||||||
color: color ?? AppColor.writeColor.withOpacity(0.8),
|
|
||||||
),
|
return Material(
|
||||||
title: Text(
|
color: Colors.transparent,
|
||||||
title.tr,
|
child: InkWell(
|
||||||
style: AppStyle.title.copyWith(
|
onTap: onTap,
|
||||||
fontSize: 16,
|
borderRadius: BorderRadius.circular(12),
|
||||||
color: color ?? AppColor.writeColor,
|
splashColor: _kCyan.withOpacity(0.07),
|
||||||
|
highlightColor: _kCyan.withOpacity(0.04),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
// أيقونة بخلفية دقيقة
|
||||||
|
Container(
|
||||||
|
width: 36,
|
||||||
|
height: 36,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: isDestructive
|
||||||
|
? const Color(0xFFFF5252).withOpacity(0.08)
|
||||||
|
: _kCyan.withOpacity(0.07),
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
child: Icon(icon, size: 19, color: iconColor),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 14),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
title.tr,
|
||||||
|
style: TextStyle(
|
||||||
|
color: textColor,
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
letterSpacing: 0.2,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Icon(
|
||||||
|
Icons.chevron_right_rounded,
|
||||||
|
color: _kTextMuted.withOpacity(0.4),
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
splashColor: AppColor.primaryColor.withOpacity(0.2),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── رسّام الشبكة ──────────────────────────────────────────────────────────────
|
||||||
|
class _MenuGridPainter extends CustomPainter {
|
||||||
|
@override
|
||||||
|
void paint(Canvas canvas, Size size) {
|
||||||
|
final paint = Paint()
|
||||||
|
..color = const Color(0xFF00D4FF).withOpacity(0.025)
|
||||||
|
..strokeWidth = 0.5;
|
||||||
|
const spacing = 36.0;
|
||||||
|
for (double y = 0; y < size.height; y += spacing) {
|
||||||
|
canvas.drawLine(Offset(0, y), Offset(size.width, y), paint);
|
||||||
|
}
|
||||||
|
for (double x = 0; x < size.width; x += spacing) {
|
||||||
|
canvas.drawLine(Offset(x, 0), Offset(x, size.height), paint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool shouldRepaint(_MenuGridPainter old) => false;
|
||||||
|
}
|
||||||
|
|||||||
@@ -34,6 +34,12 @@ class NavigationController extends GetxController {
|
|||||||
/// Minimum metres the device must move between general location ticks.
|
/// Minimum metres the device must move between general location ticks.
|
||||||
static const double _minMoveToProcess = 2.0;
|
static const double _minMoveToProcess = 2.0;
|
||||||
|
|
||||||
|
/// Metres off-route before the auto-recalculate countdown starts.
|
||||||
|
static const double _offRouteThresholdM = 25.0;
|
||||||
|
|
||||||
|
/// Seconds the user must remain off-route before auto-recalculate fires.
|
||||||
|
static const int _offRouteTriggerSeconds = 6;
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// ── Map state ─────────────────────────────────────────────────────────────
|
// ── Map state ─────────────────────────────────────────────────────────────
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
@@ -46,6 +52,11 @@ class NavigationController extends GetxController {
|
|||||||
|
|
||||||
LatLng? myLocation;
|
LatLng? myLocation;
|
||||||
double heading = 0.0;
|
double heading = 0.0;
|
||||||
|
|
||||||
|
/// Smoothed heading used for the car icon and camera bearing.
|
||||||
|
/// Updated every tick via angle-aware lerp to eliminate snap/jitter.
|
||||||
|
double _smoothedHeading = 0.0;
|
||||||
|
|
||||||
double currentSpeed = 0.0; // km/h
|
double currentSpeed = 0.0; // km/h
|
||||||
double totalDistance = 0.0; // metres accumulated this session
|
double totalDistance = 0.0; // metres accumulated this session
|
||||||
|
|
||||||
@@ -85,6 +96,19 @@ class NavigationController extends GetxController {
|
|||||||
// Camera
|
// Camera
|
||||||
bool isNavigating = false;
|
bool isNavigating = false;
|
||||||
bool _cameraLockedToUser = true;
|
bool _cameraLockedToUser = true;
|
||||||
|
bool _mapReady = false; // true only after layout has settled
|
||||||
|
|
||||||
|
// ==========================================================================
|
||||||
|
// ── Off-route auto-recalculate ────────────────────────────────────────────
|
||||||
|
// ==========================================================================
|
||||||
|
|
||||||
|
/// Wall-clock time when the user first went more than [_offRouteThresholdM]
|
||||||
|
/// metres away from the nearest route point. Null means on-route.
|
||||||
|
DateTime? _offRouteStartTime;
|
||||||
|
|
||||||
|
/// True while an auto-recalculate triggered from off-route detection is in
|
||||||
|
/// progress — prevents a second trigger from firing.
|
||||||
|
bool _autoRecalcInProgress = false;
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// ── Batch location tracking ───────────────────────────────────────────────
|
// ── Batch location tracking ───────────────────────────────────────────────
|
||||||
@@ -167,14 +191,22 @@ class NavigationController extends GetxController {
|
|||||||
isStyleLoaded = true;
|
isStyleLoaded = true;
|
||||||
await _loadCustomIcons();
|
await _loadCustomIcons();
|
||||||
|
|
||||||
if (myLocation != null) {
|
// Wait one full frame for the native MapLibre view to finish layout.
|
||||||
animateCameraToPosition(myLocation!);
|
// Without this, ANY animateCamera call throws std::domain_error on iOS
|
||||||
_updateCarMarker();
|
// because the view still has zero pixel dimensions at this point.
|
||||||
}
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
|
await Future.delayed(const Duration(milliseconds: 300));
|
||||||
if (_fullRouteCoordinates.isNotEmpty) {
|
if (!_mapReady) {
|
||||||
_updatePolylinesSets([], _fullRouteCoordinates);
|
_mapReady = true;
|
||||||
}
|
if (myLocation != null) {
|
||||||
|
animateCameraToPosition(myLocation!);
|
||||||
|
_updateCarMarker();
|
||||||
|
}
|
||||||
|
if (_fullRouteCoordinates.isNotEmpty) {
|
||||||
|
_updatePolylinesSets([], _fullRouteCoordinates);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> onMapLongPressed(Point<double> point, LatLng tappedPoint) async {
|
Future<void> onMapLongPressed(Point<double> point, LatLng tappedPoint) async {
|
||||||
@@ -217,6 +249,7 @@ class NavigationController extends GetxController {
|
|||||||
final position = await Geolocator.getCurrentPosition(
|
final position = await Geolocator.getCurrentPosition(
|
||||||
desiredAccuracy: LocationAccuracy.high);
|
desiredAccuracy: LocationAccuracy.high);
|
||||||
myLocation = LatLng(position.latitude, position.longitude);
|
myLocation = LatLng(position.latitude, position.longitude);
|
||||||
|
_smoothedHeading = position.heading; // seed so first lerp is instant
|
||||||
update();
|
update();
|
||||||
if (isStyleLoaded) animateCameraToPosition(myLocation!);
|
if (isStyleLoaded) animateCameraToPosition(myLocation!);
|
||||||
_startLocationTimer();
|
_startLocationTimer();
|
||||||
@@ -264,6 +297,13 @@ class NavigationController extends GetxController {
|
|||||||
myLocation = newLoc;
|
myLocation = newLoc;
|
||||||
_lastProcessedLocation = newLoc;
|
_lastProcessedLocation = newLoc;
|
||||||
heading = position.heading;
|
heading = position.heading;
|
||||||
|
|
||||||
|
// ── Smooth the heading with an angle-aware exponential lerp ──────────
|
||||||
|
// Factor 0.25 means ~75 % of the old angle is kept each tick, giving a
|
||||||
|
// ~4-tick (≈4 s) settling time — smooth enough to look fluid on screen
|
||||||
|
// while still reacting quickly to real turns.
|
||||||
|
_smoothedHeading = _lerpAngle(_smoothedHeading, heading, 0.25);
|
||||||
|
|
||||||
currentSpeed = position.speed * 3.6;
|
currentSpeed = position.speed * 3.6;
|
||||||
|
|
||||||
if (isStyleLoaded) _updateCarMarker();
|
if (isStyleLoaded) _updateCarMarker();
|
||||||
@@ -271,17 +311,86 @@ class NavigationController extends GetxController {
|
|||||||
if (_fullRouteCoordinates.isNotEmpty) {
|
if (_fullRouteCoordinates.isNotEmpty) {
|
||||||
if (_cameraLockedToUser) {
|
if (_cameraLockedToUser) {
|
||||||
animateCameraToPosition(myLocation!,
|
animateCameraToPosition(myLocation!,
|
||||||
bearing: heading, zoom: _targetZoom, tilt: _targetTilt);
|
bearing: _smoothedHeading, zoom: _targetZoom, tilt: _targetTilt);
|
||||||
}
|
}
|
||||||
_updateTraveledPolylineSmart(myLocation!);
|
_updateTraveledPolylineSmart(myLocation!);
|
||||||
_checkNavigationStep(myLocation!);
|
_checkNavigationStep(myLocation!);
|
||||||
_recomputeETA();
|
_recomputeETA();
|
||||||
|
|
||||||
|
// ── Off-route auto-recalculate ─────────────────────────────────────
|
||||||
|
_checkOffRoute(myLocation!);
|
||||||
}
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ==========================================================================
|
||||||
|
// ── Heading utilities ─────────────────────────────────────────────────────
|
||||||
|
// ==========================================================================
|
||||||
|
|
||||||
|
/// Lerps from [from] to [to] by factor [t], correctly handling the 0/360
|
||||||
|
/// wrap-around so we never spin the wrong way (e.g. 350° → 10° goes +20°,
|
||||||
|
/// not −340°).
|
||||||
|
double _lerpAngle(double from, double to, double t) {
|
||||||
|
final double diff = ((to - from + 540.0) % 360.0) - 180.0;
|
||||||
|
return (from + diff * t + 360.0) % 360.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==========================================================================
|
||||||
|
// ── Off-route detection ───────────────────────────────────────────────────
|
||||||
|
// ==========================================================================
|
||||||
|
|
||||||
|
/// Called every tick while navigating. Measures the distance from [pos] to
|
||||||
|
/// the nearest upcoming route coordinate. If the driver stays more than
|
||||||
|
/// [_offRouteThresholdM] metres away for at least [_offRouteTriggerSeconds]
|
||||||
|
/// seconds, an automatic route recalculation is triggered.
|
||||||
|
void _checkOffRoute(LatLng pos) {
|
||||||
|
if (_autoRecalcInProgress || isLoading) return;
|
||||||
|
if (_fullRouteCoordinates.isEmpty) return;
|
||||||
|
|
||||||
|
// Search a window ahead of the last tracked index for the nearest point.
|
||||||
|
const int searchWindow = 80;
|
||||||
|
final int start = _lastTraveledIndexInFullRoute;
|
||||||
|
final int end = min(start + searchWindow, _fullRouteCoordinates.length);
|
||||||
|
|
||||||
|
double minDist = double.infinity;
|
||||||
|
for (int i = start; i < end; i++) {
|
||||||
|
final d = Geolocator.distanceBetween(
|
||||||
|
pos.latitude,
|
||||||
|
pos.longitude,
|
||||||
|
_fullRouteCoordinates[i].latitude,
|
||||||
|
_fullRouteCoordinates[i].longitude,
|
||||||
|
);
|
||||||
|
if (d < minDist) minDist = d;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (minDist > _offRouteThresholdM) {
|
||||||
|
// Driver is off the route.
|
||||||
|
if (_offRouteStartTime == null) {
|
||||||
|
_offRouteStartTime = DateTime.now();
|
||||||
|
Log.print('⚠️ Off-route detected (${minDist.toStringAsFixed(0)} m). '
|
||||||
|
'Countdown started.');
|
||||||
|
} else {
|
||||||
|
final elapsed =
|
||||||
|
DateTime.now().difference(_offRouteStartTime!).inSeconds;
|
||||||
|
if (elapsed >= _offRouteTriggerSeconds) {
|
||||||
|
Log.print('🔄 Auto-recalculate triggered after ${elapsed}s '
|
||||||
|
'off-route (${minDist.toStringAsFixed(0)} m).');
|
||||||
|
_offRouteStartTime = null;
|
||||||
|
_autoRecalcInProgress = true;
|
||||||
|
recalculateRoute().then((_) => _autoRecalcInProgress = false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Back on (or close enough to) the route — reset the clock.
|
||||||
|
if (_offRouteStartTime != null) {
|
||||||
|
Log.print('✅ Back on route — off-route timer reset.');
|
||||||
|
}
|
||||||
|
_offRouteStartTime = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// ── Batch tracking: record every 3 s, upload every 2 min ─────────────────
|
// ── Batch tracking: record every 3 s, upload every 2 min ─────────────────
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
@@ -389,12 +498,15 @@ class NavigationController extends GetxController {
|
|||||||
geometry: myLocation,
|
geometry: myLocation,
|
||||||
iconImage: 'car_icon',
|
iconImage: 'car_icon',
|
||||||
iconSize: 1.0,
|
iconSize: 1.0,
|
||||||
iconRotate: heading,
|
iconRotate: _smoothedHeading, // ← use smoothed heading
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
mapController!.updateSymbol(
|
mapController!.updateSymbol(
|
||||||
carSymbol!,
|
carSymbol!,
|
||||||
SymbolOptions(geometry: myLocation, iconRotate: heading),
|
SymbolOptions(
|
||||||
|
geometry: myLocation,
|
||||||
|
iconRotate: _smoothedHeading, // ← use smoothed heading
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -405,7 +517,10 @@ class NavigationController extends GetxController {
|
|||||||
|
|
||||||
void animateCameraToPosition(LatLng position,
|
void animateCameraToPosition(LatLng position,
|
||||||
{double? zoom, double bearing = 0.0, double tilt = 0.0}) {
|
{double? zoom, double bearing = 0.0, double tilt = 0.0}) {
|
||||||
mapController?.animateCamera(
|
// Guard: skip if the native view is not ready yet
|
||||||
|
if (!_mapReady || mapController == null) return;
|
||||||
|
|
||||||
|
mapController!.animateCamera(
|
||||||
CameraUpdate.newCameraPosition(
|
CameraUpdate.newCameraPosition(
|
||||||
CameraPosition(
|
CameraPosition(
|
||||||
target: position,
|
target: position,
|
||||||
@@ -426,7 +541,9 @@ class NavigationController extends GetxController {
|
|||||||
_cameraLockedToUser = true;
|
_cameraLockedToUser = true;
|
||||||
if (myLocation != null) {
|
if (myLocation != null) {
|
||||||
animateCameraToPosition(myLocation!,
|
animateCameraToPosition(myLocation!,
|
||||||
bearing: heading, zoom: _targetZoom, tilt: _targetTilt);
|
bearing: _smoothedHeading, // ← use smoothed heading
|
||||||
|
zoom: _targetZoom,
|
||||||
|
tilt: _targetTilt);
|
||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@@ -561,6 +678,9 @@ class NavigationController extends GetxController {
|
|||||||
isNavigating = true;
|
isNavigating = true;
|
||||||
_cameraLockedToUser = true;
|
_cameraLockedToUser = true;
|
||||||
|
|
||||||
|
// Reset off-route state after a successful recalculation
|
||||||
|
_offRouteStartTime = null;
|
||||||
|
|
||||||
if (routeSteps.isNotEmpty) {
|
if (routeSteps.isNotEmpty) {
|
||||||
currentInstruction = routeSteps[0]['instruction_text'];
|
currentInstruction = routeSteps[0]['instruction_text'];
|
||||||
nextInstruction = routeSteps.length > 1
|
nextInstruction = routeSteps.length > 1
|
||||||
@@ -569,10 +689,20 @@ class NavigationController extends GetxController {
|
|||||||
Get.find<TextToSpeechController>().speakText(currentInstruction);
|
Get.find<TextToSpeechController>().speakText(currentInstruction);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_fullRouteCoordinates.isNotEmpty) {
|
if (_fullRouteCoordinates.length >= 2) {
|
||||||
final bounds = _boundsFromLatLngList(_fullRouteCoordinates);
|
final bounds = _boundsFromLatLngList(_fullRouteCoordinates);
|
||||||
mapController?.animateCamera(CameraUpdate.newLatLngBounds(bounds,
|
|
||||||
bottom: 220, top: 150, left: 50, right: 50));
|
final latDiff =
|
||||||
|
(bounds.northeast.latitude - bounds.southwest.latitude).abs();
|
||||||
|
final lngDiff =
|
||||||
|
(bounds.northeast.longitude - bounds.southwest.longitude).abs();
|
||||||
|
|
||||||
|
if (latDiff > 0.0001 || lngDiff > 0.0001) {
|
||||||
|
mapController?.animateCamera(CameraUpdate.newLatLngBounds(bounds,
|
||||||
|
bottom: 220, top: 150, left: 50, right: 50));
|
||||||
|
} else {
|
||||||
|
animateCameraToPosition(_fullRouteCoordinates.first, zoom: 15.0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
@@ -638,6 +768,10 @@ class NavigationController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> clearRoute({bool isNewRoute = false}) async {
|
Future<void> clearRoute({bool isNewRoute = false}) async {
|
||||||
|
// Reset off-route state whenever the route is cleared
|
||||||
|
_offRouteStartTime = null;
|
||||||
|
_autoRecalcInProgress = false;
|
||||||
|
|
||||||
if (!isNewRoute) {
|
if (!isNewRoute) {
|
||||||
if (destinationSymbol != null && mapController != null) {
|
if (destinationSymbol != null && mapController != null) {
|
||||||
await mapController!.removeSymbol(destinationSymbol!);
|
await mapController!.removeSymbol(destinationSymbol!);
|
||||||
|
|||||||
Reference in New Issue
Block a user