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": "الحالة",
"denied": "مرفوض",
"pending": " قيد الانتظار",
"approve_msg": "هل أنت متأكد أنك ترغب في تغيير الحالة إلى \"{newStatus}\"؟",
"approve_msg": "هل أنت متأكد أنك ترغب في تغيير الحالة إلى",
"yes": "نعم",
"no": "لا",
"no_result_found": "لم يتم العثور على نتائج",
"search": "يبحث",
"approved": "تمت الموافقة",
"status_success": "تم تحديث الحالة بنجاح",
"profile_updated_successfully": "تم تحديث الملف الشخصي بنجاح",
"create_new_password": "إنشاء كلمة مرور جديدة",

View File

@ -92,12 +92,12 @@
"denied": "Denied",
"pending": "Pending",
"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",
"no": "No",
"no_result_found": "No results found",
"search": "Search",
"status_success": "Status updated successfully",
"profile_updated_successfully": "Profile updated successfully",
"create_new_password": "Create New Password",

View File

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

View File

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

View File

@ -99,6 +99,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
late final Locale locale;
late String mainTopic;
late UserService _userService;
late double tourCard;
@override
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() {
tutorialCoachMark.skip();
debugPrint('Skip clicked');
@ -459,8 +483,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
context.go('/myhomepage');
}
void _kpiTutorialCoachMark() {
Future<void> _kpiTutorialCoachMark() async {
debugPrint('Not Initialized and Started');
tourCard = (await _getWidget())!;
// _calculateMarkPosition();
_initmarriageTargets();
debugPrint('Initialized and Started');
@ -510,6 +535,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
void _initmarriageTargets() {
final double screenWidth = MediaQuery.of(context).size.width;
final double screenHeight = MediaQuery.of(context).size.height;
// print('remaintarget $remainHeight');
// print ('at intint target : ${screenHeight-remainHeight}');
final double arrowPosition= screenHeight-tourCard;
marriageTargets = [
TargetFocus(
enableTargetTab: false,
@ -529,11 +557,11 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
align: ContentAlign.bottom,
child: SizedBox(
width: double.infinity,
height: MediaQuery.of(context).size.height * 0.3,
height: arrowPosition,
child: Stack(
children: [
Positioned(
bottom: 55,
bottom: arrowPosition*0.41,
left: 16,
right: 16,
child: Column(
@ -693,11 +721,11 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
align: ContentAlign.bottom,
child: SizedBox(
width: double.infinity,
height: MediaQuery.of(context).size.height * 0.60,
height: MediaQuery.of(context).size.height * 0.65,
child: Stack(
children: [
Positioned(
bottom: 55,
bottom: 25,
left: 16,
right: 16,
child: Column(
@ -841,6 +869,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
void _initpreviousTargets() {
final double screenWidth = MediaQuery.of(context).size.width;
final double screenHeight = MediaQuery.of(context).size.height;
// print('remaintarget $remainHeight');
// print ('at intint target : ${screenHeight-remainHeight}');
final double arrowPosition= screenHeight-tourCard;
previousMarriageTargets = [
TargetFocus(
enableTargetTab: false,
@ -860,11 +891,11 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
align: ContentAlign.bottom,
child: SizedBox(
width: double.infinity,
height: MediaQuery.of(context).size.height * 0.60,
height: MediaQuery.of(context).size.height * 0.65,
child: Stack(
children: [
Positioned(
bottom: 35,
bottom: 25,
left: 16,
right: 16,
child: Column(
@ -1020,11 +1051,11 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
align: ContentAlign.bottom,
child: SizedBox(
width: double.infinity,
height: MediaQuery.of(context).size.height * 0.30,
height: arrowPosition,
child: Stack(
children: [
Positioned(
bottom: 55,
bottom: arrowPosition*0.41,
left: 16,
right: 16,
child: Column(

View File

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

View File

@ -378,7 +378,7 @@ class _ProfileScreenState extends ConsumerState<ProfileScreen> {
context.go('/welcomePage');
} catch (error) {
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(
children: [
Positioned(
bottom: 20,
bottom: 10,
left: 16,
right: 16,
child: Column(
@ -943,7 +943,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
child: Stack(
children: [
Positioned(
bottom: 20,
bottom: 10,
left: 16,
right: 16,
child: Column(

View File

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

View File

@ -275,7 +275,7 @@ class _EditProfileState extends ConsumerState<EditProfile> {
});
} else {
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/connectivity_provider.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/presentation/components/indicators/locale_provider.dart';
@ -151,7 +152,7 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
isLoading = false;
});
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Status updated successfully!')),
SnackBar(content: Text(AppLocalizations.of(context)!.status_success),),
);
} catch (e) {
setState(() {
@ -159,7 +160,7 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
});
Navigator.of(context).pop();
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(
TextSpan(
text: 'Are you sure you want to change the status to ',
text: AppLocalizations.of(context)!.approve_msg,
style: TextStyle(
fontSize: 18,
color: Color(0xFF898C81),
@ -443,7 +444,7 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
SizedBox(height: 15),
// Space between icon and text
Text(
"No results found",
AppLocalizations.of(context)!.no_result_found,
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
@ -454,7 +455,7 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
SizedBox(height: 12), // Space between texts
FittedBox(
child: Text(
"We couldn't find anything matching your search.",
context.translate("We couldn't find anything matching your search.",'لم نعثر على أي شيء يطابق بحثك.'),
style: TextStyle(
fontSize: 18,
color: Color(0xFF898C81)),
@ -532,7 +533,7 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
(index) => DataCell(
index == 0
? Text(
'No results found',
AppLocalizations.of(context)!.no_result_found,
style: TextStyle(
fontStyle: FontStyle
.italic),

View File

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