app tour alignment and message translation

This commit is contained in:
Kalonkarthik 2025-03-20 18:17:32 +05:30
parent 7564a66d8c
commit 285dee15fc
12 changed files with 76 additions and 39 deletions

View File

@ -94,12 +94,13 @@
"status": "الحالة", "status": "الحالة",
"denied": "مرفوض", "denied": "مرفوض",
"pending": " قيد الانتظار", "pending": " قيد الانتظار",
"approve_msg": "هل أنت متأكد أنك ترغب في تغيير الحالة إلى \"{newStatus}\"؟", "approve_msg": "هل أنت متأكد أنك ترغب في تغيير الحالة إلى",
"yes": "نعم", "yes": "نعم",
"no": "لا", "no": "لا",
"no_result_found": "لم يتم العثور على نتائج", "no_result_found": "لم يتم العثور على نتائج",
"search": "يبحث", "search": "يبحث",
"approved": "تمت الموافقة", "approved": "تمت الموافقة",
"status_success": "تم تحديث الحالة بنجاح",
"profile_updated_successfully": "تم تحديث الملف الشخصي بنجاح", "profile_updated_successfully": "تم تحديث الملف الشخصي بنجاح",
"create_new_password": "إنشاء كلمة مرور جديدة", "create_new_password": "إنشاء كلمة مرور جديدة",

View File

@ -92,12 +92,12 @@
"denied": "Denied", "denied": "Denied",
"pending": "Pending", "pending": "Pending",
"approved": "Approved", "approved": "Approved",
"approve_msg": "Are you sure you want to change the status to {newStatus}?", "approve_msg": "Are you sure you want to change the status to ",
"yes": "Yes", "yes": "Yes",
"no": "No", "no": "No",
"no_result_found": "No results found", "no_result_found": "No results found",
"search": "Search", "search": "Search",
"status_success": "Status updated successfully",
"profile_updated_successfully": "Profile updated successfully", "profile_updated_successfully": "Profile updated successfully",
"create_new_password": "Create New Password", "create_new_password": "Create New Password",

View File

@ -210,7 +210,7 @@ class _CreateNewPwState extends ConsumerState<CreateNewPw> {
}); });
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text('Failed to update password: $e'), content: Text(context.translate('Failed to update password: $e','فشل في تحديث كلمة المرور')),
backgroundColor: Colors.red, backgroundColor: Colors.red,
), ),
); );

View File

@ -158,7 +158,7 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
}); });
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text('Failed to update password: $e'), content: Text(context.translate('Failed to update password: $e','فشل في تحديث كلمة المرور')),
backgroundColor: Colors.red, backgroundColor: Colors.red,
), ),
); );

View File

@ -99,6 +99,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
late final Locale locale; late final Locale locale;
late String mainTopic; late String mainTopic;
late UserService _userService; late UserService _userService;
late double tourCard;
@override @override
void initState() { void initState() {
@ -447,6 +448,29 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
// // ); // // );
// } // }
///Calculate card Width
Future<double?> _getWidget() async {
await Future.delayed(Duration(milliseconds: 50)); // Ensures widget is built
final RenderBox? box = cardKey.currentContext?.findRenderObject() as RenderBox?;
if (box != null) {
final Offset position = box.localToGlobal(Offset.zero);
final Size size = box.size;
double bottomY = position.dy + size.height; // Y position + height
// final double screenWidth = MediaQuery.of(context).size.width;
// final double screenHeight = MediaQuery.of(context).size.height;
// print("screenWidth: ${screenWidth}");
// print("screenHeight: ${screenHeight}");
// print("Widget Position: ${position.dx}, ${position.dy}");
// print("Widget Size: ${size.width} x ${size.height}");
// print("Bottom Y Position: $bottomY");
return bottomY;
}
return null;
}
void handleSkip() { void handleSkip() {
tutorialCoachMark.skip(); tutorialCoachMark.skip();
debugPrint('Skip clicked'); debugPrint('Skip clicked');
@ -459,8 +483,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
context.go('/myhomepage'); context.go('/myhomepage');
} }
void _kpiTutorialCoachMark() { Future<void> _kpiTutorialCoachMark() async {
debugPrint('Not Initialized and Started'); debugPrint('Not Initialized and Started');
tourCard = (await _getWidget())!;
// _calculateMarkPosition(); // _calculateMarkPosition();
_initmarriageTargets(); _initmarriageTargets();
debugPrint('Initialized and Started'); debugPrint('Initialized and Started');
@ -510,6 +535,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
void _initmarriageTargets() { void _initmarriageTargets() {
final double screenWidth = MediaQuery.of(context).size.width; final double screenWidth = MediaQuery.of(context).size.width;
final double screenHeight = MediaQuery.of(context).size.height; final double screenHeight = MediaQuery.of(context).size.height;
// print('remaintarget $remainHeight');
// print ('at intint target : ${screenHeight-remainHeight}');
final double arrowPosition= screenHeight-tourCard;
marriageTargets = [ marriageTargets = [
TargetFocus( TargetFocus(
enableTargetTab: false, enableTargetTab: false,
@ -529,11 +557,11 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
align: ContentAlign.bottom, align: ContentAlign.bottom,
child: SizedBox( child: SizedBox(
width: double.infinity, width: double.infinity,
height: MediaQuery.of(context).size.height * 0.3, height: arrowPosition,
child: Stack( child: Stack(
children: [ children: [
Positioned( Positioned(
bottom: 55, bottom: arrowPosition*0.41,
left: 16, left: 16,
right: 16, right: 16,
child: Column( child: Column(
@ -693,11 +721,11 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
align: ContentAlign.bottom, align: ContentAlign.bottom,
child: SizedBox( child: SizedBox(
width: double.infinity, width: double.infinity,
height: MediaQuery.of(context).size.height * 0.60, height: MediaQuery.of(context).size.height * 0.65,
child: Stack( child: Stack(
children: [ children: [
Positioned( Positioned(
bottom: 55, bottom: 25,
left: 16, left: 16,
right: 16, right: 16,
child: Column( child: Column(
@ -841,6 +869,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
void _initpreviousTargets() { void _initpreviousTargets() {
final double screenWidth = MediaQuery.of(context).size.width; final double screenWidth = MediaQuery.of(context).size.width;
final double screenHeight = MediaQuery.of(context).size.height; final double screenHeight = MediaQuery.of(context).size.height;
// print('remaintarget $remainHeight');
// print ('at intint target : ${screenHeight-remainHeight}');
final double arrowPosition= screenHeight-tourCard;
previousMarriageTargets = [ previousMarriageTargets = [
TargetFocus( TargetFocus(
enableTargetTab: false, enableTargetTab: false,
@ -860,11 +891,11 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
align: ContentAlign.bottom, align: ContentAlign.bottom,
child: SizedBox( child: SizedBox(
width: double.infinity, width: double.infinity,
height: MediaQuery.of(context).size.height * 0.60, height: MediaQuery.of(context).size.height * 0.65,
child: Stack( child: Stack(
children: [ children: [
Positioned( Positioned(
bottom: 35, bottom: 25,
left: 16, left: 16,
right: 16, right: 16,
child: Column( child: Column(
@ -1020,11 +1051,11 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
align: ContentAlign.bottom, align: ContentAlign.bottom,
child: SizedBox( child: SizedBox(
width: double.infinity, width: double.infinity,
height: MediaQuery.of(context).size.height * 0.30, height: arrowPosition,
child: Stack( child: Stack(
children: [ children: [
Positioned( Positioned(
bottom: 55, bottom: arrowPosition*0.41,
left: 16, left: 16,
right: 16, right: 16,
child: Column( child: Column(

View File

@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:internet_connection_checker/internet_connection_checker.dart'; import 'package:internet_connection_checker/internet_connection_checker.dart';
import 'package:uae_stat/config/connectivity_provider.dart'; import 'package:uae_stat/config/connectivity_provider.dart';
import 'package:uae_stat/domain/use_cases/language.dart';
class InternetCheckScreen extends ConsumerWidget { class InternetCheckScreen extends ConsumerWidget {
const InternetCheckScreen({super.key}); const InternetCheckScreen({super.key});
@ -14,7 +15,7 @@ class InternetCheckScreen extends ConsumerWidget {
// Show a SnackBar when internet is back // Show a SnackBar when internet is back
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text("Internet is back!"), content: Text(context.translate('Internet is back!','عاد الاتصال بالإنترنت!')),
backgroundColor: Colors.green, backgroundColor: Colors.green,
), ),
); );
@ -42,22 +43,22 @@ class InternetCheckScreen extends ConsumerWidget {
children: [ children: [
Image.asset('assets/logos/no-internet.png', width: 150), Image.asset('assets/logos/no-internet.png', width: 150),
SizedBox(height: myHeight / 40), SizedBox(height: myHeight / 40),
Text("No Internet Connection", Text(context.translate('No Internet Connection','لا يوجد اتصال بالإنترنت'),
style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold)), style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),),
Text("Please check your Wi-Fi or Mobile Data", Text(context.translate('Please check your Wi-Fi or Mobile Data','يرجى التحقق من شبكة Wi-Fi أو بيانات الهاتف المحمول'),
style: TextStyle(fontSize: 15, fontWeight: FontWeight.w500)), style: TextStyle(fontSize: 15, fontWeight: FontWeight.w500),),
Text("connection and try again", Text(context.translate('connection and try again','واتصالك ثم حاول مرة أخرى'),
style: TextStyle(fontSize: 15, fontWeight: FontWeight.w500)), style: TextStyle(fontSize: 15, fontWeight: FontWeight.w500),),
SizedBox(height: myHeight / 40), SizedBox(height: myHeight / 40),
ElevatedButton( ElevatedButton(
onPressed: () async { onPressed: () async {
bool hasInternet = bool hasInternet =
await InternetConnectionChecker.instance.hasConnection; await InternetConnectionChecker.instance.hasConnection;
if (hasInternet) { if (hasInternet) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text("Internet is back!"), content: Text(context.translate('Internet is back!','عاد الاتصال بالإنترنت!')),
backgroundColor: Colors.green, backgroundColor: Colors.green,
), ),
); );
@ -73,7 +74,7 @@ class InternetCheckScreen extends ConsumerWidget {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: content:
Text("No internet connection. Please try again."), Text(context.translate('No internet connection. Please try again.','لا يوجد اتصال بالإنترنت. يرجى المحاولة مرة أخرى.')),
backgroundColor: Colors.red, backgroundColor: Colors.red,
), ),
); );
@ -88,8 +89,8 @@ class InternetCheckScreen extends ConsumerWidget {
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Text("Retry", Text( context.translate('Retry','إعادة المحاولة'),
style: TextStyle(fontSize: 16, color: Colors.white)), style: TextStyle(fontSize: 16, color: Colors.white),),
SizedBox(width: 8), SizedBox(width: 8),
Icon(Icons.refresh, size: 16, color: Colors.white), Icon(Icons.refresh, size: 16, color: Colors.white),
], ],

View File

@ -378,7 +378,7 @@ class _ProfileScreenState extends ConsumerState<ProfileScreen> {
context.go('/welcomePage'); context.go('/welcomePage');
} catch (error) { } catch (error) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("Failed to update profile: $error"))); SnackBar(content: Text(context.translate("Failed to update profile: $error",'$error فشل في تحديث الملف الشخصي: '))),);
} }
} }
} }

View File

@ -466,7 +466,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
child: Stack( child: Stack(
children: [ children: [
Positioned( Positioned(
bottom: 20, bottom: 10,
left: 16, left: 16,
right: 16, right: 16,
child: Column( child: Column(
@ -943,7 +943,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
child: Stack( child: Stack(
children: [ children: [
Positioned( Positioned(
bottom: 20, bottom: 10,
left: 16, left: 16,
right: 16, right: 16,
child: Column( child: Column(

View File

@ -217,7 +217,9 @@ class _BookMarkState extends ConsumerState<BookMark> {
} catch (e) { } catch (e) {
SnackBar( SnackBar(
content: Text( content: Text(
context.translate(
'Unable to remove from bookmarks. Please try again', 'Unable to remove from bookmarks. Please try again',
'تعذر الإزالة من الإشارات المرجعية. يرجى المحاولة مرة أخرى.',),
style: style:
TextStyle(color: Color(0xFFEB5F24), fontWeight: FontWeight.w600), TextStyle(color: Color(0xFFEB5F24), fontWeight: FontWeight.w600),
), ),
@ -495,7 +497,8 @@ class _BookMarkState extends ConsumerState<BookMark> {
size: 100, color: Colors.grey[400]), size: 100, color: Colors.grey[400]),
SizedBox(height: 16), SizedBox(height: 16),
Text( Text(
'No Bookmark is added', context.translate('No BookMark Added',
'لم يتم إضافة أي علامة مرجعية'),
style: TextStyle( style: TextStyle(
fontSize: 16, color: Colors.grey), fontSize: 16, color: Colors.grey),
), ),

View File

@ -275,7 +275,7 @@ class _EditProfileState extends ConsumerState<EditProfile> {
}); });
} else { } else {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Please select a JPG, JPEG, or PNG file.')), SnackBar(content: Text(context.translate('Please select a JPG, JPEG, or PNG file.','يرجى تحديد ملف بصيغة JPG أو JPEG أو PNG.'))),
); );
} }
} }

View File

@ -7,6 +7,7 @@ import 'package:pocketbase/pocketbase.dart';
import 'package:uae_stat/config/api_config.dart'; import 'package:uae_stat/config/api_config.dart';
import 'package:uae_stat/config/connectivity_provider.dart'; import 'package:uae_stat/config/connectivity_provider.dart';
import 'package:uae_stat/config/toggle_lang_service.dart'; import 'package:uae_stat/config/toggle_lang_service.dart';
import 'package:uae_stat/domain/use_cases/language.dart';
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/misc_icon_asset_path.dart'; import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/misc_icon_asset_path.dart';
import 'package:uae_stat/presentation/components/indicators/locale_provider.dart'; import 'package:uae_stat/presentation/components/indicators/locale_provider.dart';
@ -151,7 +152,7 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
isLoading = false; isLoading = false;
}); });
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Status updated successfully!')), SnackBar(content: Text(AppLocalizations.of(context)!.status_success),),
); );
} catch (e) { } catch (e) {
setState(() { setState(() {
@ -159,7 +160,7 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
}); });
Navigator.of(context).pop(); Navigator.of(context).pop();
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Error updating status: $e')), SnackBar(content: Text(context.translate('Error updating status: $e','$e خطأ في تحديث الحالة: '))),
); );
} }
} }
@ -191,7 +192,7 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
), ),
Text.rich( Text.rich(
TextSpan( TextSpan(
text: 'Are you sure you want to change the status to ', text: AppLocalizations.of(context)!.approve_msg,
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
color: Color(0xFF898C81), color: Color(0xFF898C81),
@ -443,7 +444,7 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
SizedBox(height: 15), SizedBox(height: 15),
// Space between icon and text // Space between icon and text
Text( Text(
"No results found", AppLocalizations.of(context)!.no_result_found,
style: TextStyle( style: TextStyle(
fontSize: 24, fontSize: 24,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -454,7 +455,7 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
SizedBox(height: 12), // Space between texts SizedBox(height: 12), // Space between texts
FittedBox( FittedBox(
child: Text( child: Text(
"We couldn't find anything matching your search.", context.translate("We couldn't find anything matching your search.",'لم نعثر على أي شيء يطابق بحثك.'),
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
color: Color(0xFF898C81)), color: Color(0xFF898C81)),
@ -532,7 +533,7 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
(index) => DataCell( (index) => DataCell(
index == 0 index == 0
? Text( ? Text(
'No results found', AppLocalizations.of(context)!.no_result_found,
style: TextStyle( style: TextStyle(
fontStyle: FontStyle fontStyle: FontStyle
.italic), .italic),

View File

@ -309,7 +309,7 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
child: Stack( child: Stack(
children: [ children: [
Positioned( Positioned(
bottom: 25, bottom: 40,
left: 16, left: 16,
right: 16, right: 16,
child: Column( child: Column(
@ -473,7 +473,7 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
child: Stack( child: Stack(
children: [ children: [
Positioned( Positioned(
bottom: 25, bottom: 37,
left: 16, left: 16,
right: 16, right: 16,
child: Column( child: Column(