Merge branch 'dev' of github.com:VinistanSS/FCSC into dev

This commit is contained in:
venbaittech 2025-02-18 18:26:38 +05:30
commit 3cc3a9bcbd
3 changed files with 231 additions and 315 deletions

View File

@ -71,6 +71,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
final GlobalKey cardKey = GlobalKey(); final GlobalKey cardKey = GlobalKey();
bool isBookmarked = false; // Track bookmark state bool isBookmarked = false; // Track bookmark state
String? bookmarkId; // Stores the ID of the bookmark record in PocketBase String? bookmarkId; // Stores the ID of the bookmark record in PocketBase
late final Locale locale;
@override @override
void initState() { void initState() {
@ -79,7 +80,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
print(' bgColor $bgColor'); print(' bgColor $bgColor');
// fetchChartData(widget.dataSets); // fetchChartData(widget.dataSets);
checkIfBookmarked(); checkIfBookmarked();
final locale = ref.read(localeProvider); locale = ref.read(localeProvider)?? const Locale('en');
fetchChartData(widget.dataSets, locale?.languageCode ?? 'en').then((_) { fetchChartData(widget.dataSets, locale?.languageCode ?? 'en').then((_) {
if (_tabsData.isNotEmpty) { if (_tabsData.isNotEmpty) {
// Call onTabSelected for the first tab // Call onTabSelected for the first tab
@ -525,9 +526,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
elevation: 0, elevation: 0,
), ),
child: const Text( child: Text(
'Skip', AppLocalizations.of(context)!.skip,
style: TextStyle( style: const TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 14, fontSize: 14,
), ),
@ -538,22 +539,22 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
border: Border.all( border: Border.all(
color: Colors.white, width: 2.0), color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0),
), ),
child: IconButton( child: IconButton(
iconSize: 20, iconSize: 20,
icon: const Icon(Icons.arrow_back, icon: const Icon(Icons.arrow_back,
color: Colors.white), color: Colors.white),
onPressed: () { onPressed: () {
ref if (locale.languageCode == 'ar') {
.read(chartsTourProvider.notifier) tutorialCoachMark.next();
.state = true; } else {
ref ref.read(chartsTourProvider.notifier).state = true;
.read( ref.read(previousHomeTourProvider.notifier).state = false;
previousHomeTourProvider.notifier) tutorialCoachMark.finish();
.state = false; }
tutorialCoachMark.finish();
}, },
), ),
), ),
@ -561,16 +562,22 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Color(0xFF7DAFBC), color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
border: Border.all( border: Border.all(
color: Color(0xFF7DAFBC), width: 1.5), color:locale.languageCode=='ar' ? Colors.white: Color(0xFF7DAFBC), width: 1),
), ),
child: IconButton( child: IconButton(
iconSize: 20, iconSize: 20,
icon: const Icon(Icons.arrow_forward, icon: const Icon(Icons.arrow_forward,
color: Colors.white), color: Colors.white),
onPressed: () { onPressed: () {
tutorialCoachMark.next(); if (locale.languageCode == 'ar') {
ref.read(chartsTourProvider.notifier).state = true;
ref.read(previousHomeTourProvider.notifier).state = false;
tutorialCoachMark.finish();
} else {
tutorialCoachMark.next();
}
}, },
), ),
), ),
@ -609,107 +616,6 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
), ),
], ],
), ),
// TargetFocus(
// identify: 'chartKey',
// keyTarget: chartKey,
// shape: ShapeLightFocus.RRect,
// paddingFocus: 0,
// contents: [
// createTargetContent(
// text: AppLocalizations.of(context)!.kpiCards,
// alignment: ContentAlign.top,
// gap:0,
// space: 0,
// ),
// TargetContent(
// align: ContentAlign.bottom,
// child: SizedBox(
// width: double.infinity,
// height: MediaQuery.of(context).size.height *
// 0.30, // Set an appropriate height for the Stack
// child: Stack(
// children: [
// Positioned(
// bottom: 25,
// left: 16,
// right: 16,
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// ElevatedButton(
// onPressed: () => handleSkip(),
// style: ElevatedButton.styleFrom(
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(12),
// ),
// side: const BorderSide(color: Colors.white),
// backgroundColor: Colors.transparent,
// elevation: 0,
// ),
// child: const Text(
// 'Skip',
// style: TextStyle(
// color: Colors.white,
// fontSize: 14,
// ),
// ),
// ),
// Column(
// children: [
// Text(
// '5/7',
// style: const TextStyle(
// color: Colors.white,
// fontSize: 14,
// ),
// ),
// const SizedBox(height: 3),
// Row(
// children: [
// Container(
// decoration: BoxDecoration(
// shape: BoxShape.circle,
// border: Border.all(
// color: Colors.white, width: 2.0),
// ),
// child: IconButton(
// icon: const Icon(Icons.arrow_back,
// color: Colors.white),
// onPressed: () {
// scrollToTargetThenShowTutorial(bookMarkKey);
// tutorialCoachMark.next();
// },
// ),
// ),
// const SizedBox(width: 10),
// Container(
// decoration: BoxDecoration(
// shape: BoxShape.circle,
// color: Color(0xFF7DAFBC),
// border: Border.all(
// color: Color(0xFF7DAFBC), width: 1.5),
// ),
// child: IconButton(
// icon: const Icon(Icons.arrow_forward,
// color: Colors.white),
// onPressed: () {
// tutorialCoachMark.next();
// },
// ),
// ),
// ],
// ),
// ],
// ),
// ],
// ),
// ),
// ],
// ),
// ),
// ),
// ],
// ),
TargetFocus( TargetFocus(
identify: 'BookMarkKey', identify: 'BookMarkKey',
keyTarget: bookMarkKey, keyTarget: bookMarkKey,
@ -721,7 +627,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
text: AppLocalizations.of(context)!.bookMark, text: AppLocalizations.of(context)!.bookMark,
alignment: ContentAlign.bottom, alignment: ContentAlign.bottom,
gap: 53, gap: 53,
space: 50, space: screenWidth*0.22,
), ),
TargetContent( TargetContent(
align: ContentAlign.bottom, align: ContentAlign.bottom,
@ -763,9 +669,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
elevation: 0, elevation: 0,
), ),
child: const Text( child: Text(
'Skip', AppLocalizations.of(context)!.skip,
style: TextStyle( style: const TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 14, fontSize: 14,
), ),
@ -776,15 +682,22 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
border: Border.all( border: Border.all(
color: Colors.white, width: 2.0), color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0),
), ),
child: IconButton( child: IconButton(
iconSize: 20, iconSize: 20,
icon: const Icon(Icons.arrow_back, icon: const Icon(Icons.arrow_back,
color: Colors.white), color: Colors.white,),
onPressed: () { onPressed: () {
tutorialCoachMark.previous(); if (locale.languageCode == 'ar') {
ref.read(chartsTourProvider.notifier).state = true;
ref.read(scaffoldTourProvider.notifier).state = false;
tutorialCoachMark.finish();
} else {
tutorialCoachMark.previous();
}
}, },
), ),
), ),
@ -792,22 +705,23 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Color(0xFF7DAFBC), color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
border: Border.all( border: Border.all(
color: Color(0xFF7DAFBC), width: 1), color:locale.languageCode=='ar' ? Colors.white: Color(0xFF7DAFBC), width: 1),
), ),
child: IconButton( child: IconButton(
iconSize: 20, iconSize: 20,
icon: const Icon(Icons.arrow_forward, icon: const Icon(Icons.arrow_forward,
color: Colors.white), color: Colors.white,),
onPressed: () { onPressed: () {
ref if (locale.languageCode == 'ar') {
.read(chartsTourProvider.notifier) tutorialCoachMark.previous();
.state = true; } else {
ref ref.read(chartsTourProvider.notifier).state = true;
.read(scaffoldTourProvider.notifier) ref.read(scaffoldTourProvider.notifier).state = false;
.state = false; tutorialCoachMark.finish();
tutorialCoachMark.finish(); }
}, },
), ),
), ),
@ -827,25 +741,13 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
align: ContentAlign.right, align: ContentAlign.right,
child: Container( child: Container(
width: screenWidth / 4, width: screenWidth / 4,
height: screenHeight, height: screenHeight*0.2,
child: Stack( child: Stack(
children: [ children: [
Image.asset( Image.asset(
'assets/app_tour/leftDown.png', 'assets/app_tour/leftDown.png',
fit: BoxFit.contain, fit: BoxFit.contain,
), ),
// Positioned(
// top: 0,
// left: MediaQuery.of(context).size.width* 0.5,
// child: SizedBox(
// width: 50,
// height: 100,
// child: Image.asset(
// 'assets/app_tour/bookmark2.png',
// fit: BoxFit.contain,
// ),
// ),
// ),
], ],
), ),
), ),
@ -868,9 +770,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
contents: [ contents: [
createTargetContent( createTargetContent(
text: AppLocalizations.of(context)!.bookMark, text: AppLocalizations.of(context)!.bookMark,
space: 50, space:screenWidth*0.22,
alignment: ContentAlign.bottom, alignment: ContentAlign.bottom,
gap: 23, gap: 53,
), ),
TargetContent( TargetContent(
align: ContentAlign.bottom, align: ContentAlign.bottom,
@ -912,9 +814,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
elevation: 0, elevation: 0,
), ),
child: const Text( child: Text(
'Skip', AppLocalizations.of(context)!.skip,
style: TextStyle( style: const TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 14, fontSize: 14,
), ),
@ -925,15 +827,22 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
border: Border.all( border: Border.all(
color: Colors.white, width: 2.0), color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0,),
), ),
child: IconButton( child: IconButton(
iconSize: 20, iconSize: 20,
icon: const Icon(Icons.arrow_back, icon: const Icon(Icons.arrow_back,
color: Colors.white), color: Colors.white,),
onPressed: () { onPressed: () {
tutorialCoachMark.next(); if (locale.languageCode == 'ar') {
ref.read(chartsTourProvider.notifier).state = true;
ref.read(scaffoldTourProvider.notifier).state = false;
tutorialCoachMark.finish();
} else {
tutorialCoachMark.next();
}
}, },
), ),
), ),
@ -941,22 +850,22 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Color(0xFF7DAFBC), color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
border: Border.all( border: Border.all(
color: Color(0xFF7DAFBC), width: 1.5), color:locale.languageCode=='ar' ? Colors.white : Color(0xFF7DAFBC), width: 2.0,),
), ),
child: IconButton( child: IconButton(
iconSize: 20, iconSize: 20,
icon: const Icon(Icons.arrow_forward, icon: const Icon(Icons.arrow_forward,
color: Colors.white), color: Colors.white),
onPressed: () { onPressed: () {
ref if (locale.languageCode == 'ar') {
.read(chartsTourProvider.notifier) tutorialCoachMark.next();
.state = true; } else {
ref ref.read(chartsTourProvider.notifier).state = true;
.read(scaffoldTourProvider.notifier) ref.read(scaffoldTourProvider.notifier).state = false;
.state = false; tutorialCoachMark.finish();
tutorialCoachMark.finish(); }
}, },
), ),
), ),
@ -972,29 +881,17 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
), ),
), ),
TargetContent( TargetContent(
padding: EdgeInsets.only(left: 0, top: 10), padding: EdgeInsets.only(left: 0, top: 0),
align: ContentAlign.right, align: ContentAlign.right,
child: Container( child: SizedBox(
width: screenWidth / 4, width: screenWidth / 4,
height: screenHeight, height:screenHeight*0.2,
child: Stack( child: Stack(
children: [ children: [
Image.asset( Image.asset(
'assets/app_tour/leftDown.png', 'assets/app_tour/leftDown.png',
fit: BoxFit.contain, fit: BoxFit.contain,
), ),
// Positioned(
// top: 0,
// left: MediaQuery.of(context).size.width* 0.5,
// child: SizedBox(
// width: 50,
// height: 100,
// child: Image.asset(
// 'assets/app_tour/bookmark2.png',
// fit: BoxFit.contain,
// ),
// ),
// ),
], ],
), ),
), ),
@ -1012,7 +909,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
text: AppLocalizations.of(context)!.kpiCards, text: AppLocalizations.of(context)!.kpiCards,
space: 0, space: 0,
alignment: ContentAlign.top, alignment: ContentAlign.top,
gap: 50, gap: 55,
), ),
TargetContent( TargetContent(
align: ContentAlign.bottom, align: ContentAlign.bottom,
@ -1054,9 +951,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
elevation: 0, elevation: 0,
), ),
child: const Text( child: Text(
'Skip', AppLocalizations.of(context)!.skip,
style: TextStyle( style: const TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 14, fontSize: 14,
), ),
@ -1067,23 +964,23 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
border: Border.all( border: Border.all(
color: Colors.white, width: 2.0), color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0,),
), ),
child: IconButton( child: IconButton(
iconSize: 20, iconSize: 20,
icon: const Icon(Icons.arrow_back, icon: const Icon(Icons.arrow_back,
color: Colors.white), color: Colors.white,),
onPressed: () { onPressed: () {
ref if (locale.languageCode == 'ar') {
.read(previousChartsTourProvider tutorialCoachMark.previous();
.notifier) } else {
.state = true; ref.read(previousChartsTourProvider.notifier).state = true;
ref ref.read(previousHomeTourProvider.notifier).state = false;
.read( tutorialCoachMark.finish();
previousHomeTourProvider.notifier) }
.state = false;
tutorialCoachMark.finish();
}, },
), ),
), ),
@ -1091,16 +988,22 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Color(0xFF7DAFBC), color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
border: Border.all( border: Border.all(
color: Color(0xFF7DAFBC), width: 1.5), color:locale.languageCode=='ar' ? Colors.white: Color(0xFF7DAFBC), width: 1),
), ),
child: IconButton( child: IconButton(
iconSize: 20, iconSize: 20,
icon: const Icon(Icons.arrow_forward, icon: const Icon(Icons.arrow_forward,
color: Colors.white), color: Colors.white,),
onPressed: () { onPressed: () {
tutorialCoachMark.previous(); if (locale.languageCode == 'ar') {
ref.read(previousChartsTourProvider.notifier).state = true;
ref.read(previousHomeTourProvider.notifier).state = false;
tutorialCoachMark.finish();
} else {
tutorialCoachMark.previous();
}
}, },
), ),
), ),

View File

@ -273,6 +273,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
late TutorialCoachMark tutorialCoachMark; late TutorialCoachMark tutorialCoachMark;
late List<TargetFocus> homeTargets; late List<TargetFocus> homeTargets;
late List<TargetFocus> previousHomeTargets; late List<TargetFocus> previousHomeTargets;
late final Locale locale;
void handleSkip() { void handleSkip() {
tutorialCoachMark.skip(); tutorialCoachMark.skip();
@ -298,6 +299,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
//Method to Start App Tour //Method to Start App Tour
void _showHomeTour() { void _showHomeTour() {
print('Home tour Arabic Started');
final homeTour = ref.watch(homeTourProvider); final homeTour = ref.watch(homeTourProvider);
final previousHomeTour = ref.watch(previousHomeTourProvider); final previousHomeTour = ref.watch(previousHomeTourProvider);
@ -305,6 +307,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
if (!homeTour) { if (!homeTour) {
// Show Home Tour // Show Home Tour
_initTarget(); _initTarget();
print('Home tour Target Intialized');
tutorialCoachMark = TutorialCoachMark( tutorialCoachMark = TutorialCoachMark(
paddingFocus: 0, paddingFocus: 0,
useSafeArea: true, useSafeArea: true,
@ -345,7 +348,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
keyTarget: cardTopicKey, keyTarget: cardTopicKey,
shape: ShapeLightFocus.RRect, shape: ShapeLightFocus.RRect,
radius: 8, radius: 8,
paddingFocus: 16, paddingFocus: 10,
contents: [ contents: [
createTargetContent( createTargetContent(
text: AppLocalizations.of(context)!.home_topic, text: AppLocalizations.of(context)!.home_topic,
@ -396,9 +399,9 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
elevation: 0, elevation: 0,
), ),
child: const Text( child: Text(
'Skip', AppLocalizations.of(context)!.skip,
style: TextStyle( style: const TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 14, fontSize: 14,
), ),
@ -418,7 +421,8 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
child: IconButton( child: IconButton(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
iconSize: 20, iconSize: 20,
icon: const Icon(Icons.arrow_forward, icon:Icon(
locale.languageCode == 'ar' ?Icons.arrow_back : Icons.arrow_forward,
color: Colors.white), color: Colors.white),
onPressed: () { onPressed: () {
tutorialCoachMark.next(); tutorialCoachMark.next();
@ -436,9 +440,13 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
), ),
), ),
TargetContent( TargetContent(
padding: EdgeInsets.only(left: screenWidth * 0.4, bottom: 0), padding: EdgeInsets.only(left:locale.languageCode == 'ar'
? 0
: screenWidth * 0.4, bottom: 0,right:locale.languageCode == 'ar'
? screenWidth * 0.4
: 0 ,),
align: ContentAlign.bottom, align: ContentAlign.bottom,
child: Container( child: SizedBox(
width: 200, width: 200,
height: 77, height: 77,
child: Stack( child: Stack(
@ -458,7 +466,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
keyTarget: cardsKey, keyTarget: cardsKey,
shape: ShapeLightFocus.RRect, shape: ShapeLightFocus.RRect,
radius: 7, radius: 7,
paddingFocus: 6, paddingFocus: 2,
// targetPosition:TargetPosition(), // targetPosition:TargetPosition(),
contents: [ contents: [
createTargetContent( createTargetContent(
@ -507,9 +515,9 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
elevation: 0, elevation: 0,
), ),
child: const Text( child: Text(
'Skip', AppLocalizations.of(context)!.skip,
style: TextStyle( style: const TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 14, fontSize: 14,
), ),
@ -520,15 +528,16 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
border: Border.all( border: Border.all(
color: Colors.white, width: 2.0), color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0),
), ),
child: IconButton( child: IconButton(
iconSize: 20, iconSize: 20,
icon: const Icon(Icons.arrow_back, icon: Icon(Icons.arrow_back,
color: Colors.white), color: Colors.white,),
onPressed: () { onPressed: () {
tutorialCoachMark.previous(); locale.languageCode=='ar' ?tutorialCoachMark.next() : tutorialCoachMark.previous();
}, },
), ),
), ),
@ -536,16 +545,16 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Color(0xFF7DAFBC), color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
border: Border.all( border: Border.all(
color: Color(0xFF7DAFBC), width: 1), color:locale.languageCode=='ar' ? Colors.white: Color(0xFF7DAFBC), width: 1),
), ),
child: IconButton( child: IconButton(
iconSize: 20, iconSize: 20,
icon: const Icon(Icons.arrow_forward, icon:Icon(Icons.arrow_forward,
color: Colors.white), color: Colors.white),
onPressed: () { onPressed: () {
tutorialCoachMark.next(); locale.languageCode=='ar' ?tutorialCoachMark.previous() : tutorialCoachMark.next();
}, },
), ),
), ),
@ -561,7 +570,9 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
), ),
), ),
TargetContent( TargetContent(
padding: EdgeInsets.only(left: screenWidth * 0.4, bottom: 0), padding: EdgeInsets.only(left:locale.languageCode == 'ar'
? 0: screenWidth * 0.4, bottom: 0, right: locale.languageCode == 'en'
? 0: screenWidth * 0.4, ),
align: ContentAlign.bottom, align: ContentAlign.bottom,
child: Container( child: Container(
width: 200, width: 200,
@ -622,8 +633,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
align: ContentAlign.bottom, align: ContentAlign.bottom,
child: SizedBox( child: SizedBox(
width: double.infinity, width: double.infinity,
height: MediaQuery.of(context).size.height * height: MediaQuery.of(context).size.height * 0.5,
0.5, // Set an appropriate height for the Stack
child: Stack( child: Stack(
children: [ children: [
Positioned( Positioned(
@ -660,9 +670,9 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
elevation: 0, elevation: 0,
), ),
child: const Text( child: Text(
'Skip', AppLocalizations.of(context)!.skip,
style: TextStyle( style: const TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 14, fontSize: 14,
), ),
@ -675,14 +685,24 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
border: Border.all( border: Border.all(
color: Colors.white, width: 2.0), color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0,),
), ),
child: IconButton( child: IconButton(
icon: const Icon(Icons.arrow_back, iconSize: 20,
color: Colors.white), icon: Icon(Icons.arrow_back,
color: Colors.white,),
onPressed: () { onPressed: () {
tutorialCoachMark.next(); if (locale.languageCode == 'ar') {
tutorialCoachMark.finish();
ref.read(previousHomeTourProvider.notifier).state = true;
ref.read(chartsTourProvider.notifier).state = false;
context.go(
'/chartScreen/hotels?bgColor=0xFF90B0D5&mainTopic=ECONOMY&title=Hotel+Establishments',);
} else {
tutorialCoachMark.next();
}
}, },
), ),
), ),
@ -690,26 +710,24 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Color(0xFF7DAFBC), color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
border: Border.all( border: Border.all(
color: Color(0xFF7DAFBC), color:locale.languageCode=='ar' ? Colors.white: Color(0xFF7DAFBC), width: 1,),
width: 1.5),
), ),
child: IconButton( child: IconButton(
iconSize: 20, iconSize: 20,
icon: const Icon(Icons.arrow_forward, icon: const Icon(Icons.arrow_forward,
color: Colors.white), color: Colors.white),
onPressed: () { onPressed: () {
ref if (locale.languageCode == 'ar') {
.read(previousHomeTourProvider tutorialCoachMark.next();
.notifier) } else {
.state = true; tutorialCoachMark.finish();
ref ref.read(previousHomeTourProvider.notifier).state = true;
.read(chartsTourProvider.notifier) ref.read(chartsTourProvider.notifier).state = false;
.state = false; context.go(
context.go( '/chartScreen/hotels?bgColor=0xFF90B0D5&mainTopic=ECONOMY&title=Hotel+Establishments');
'/chartScreen/hotels?bgColor=0xFF90B0D5&mainTopic=ECONOMY&title=Hotel+Establishments'); }
tutorialCoachMark.finish();
}, },
), ),
), ),
@ -727,7 +745,9 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
), ),
), ),
TargetContent( TargetContent(
padding: EdgeInsets.only(left: screenWidth * 0.4, bottom: 0), padding: EdgeInsets.only(left:locale.languageCode == 'ar'
? 0: screenWidth * 0.4, bottom: 0, right: locale.languageCode == 'en'
? 0: screenWidth * 0.4, ),
align: ContentAlign.bottom, align: ContentAlign.bottom,
child: Container( child: Container(
width: 200, width: 200,
@ -788,8 +808,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
children: [ children: [
ElevatedButton( ElevatedButton(
onPressed: () { onPressed: () {
tutorialCoachMark.skip(); handleSkip();
debugPrint('Skip clicked');
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
@ -799,9 +818,9 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
elevation: 0, elevation: 0,
), ),
child: const Text( child: Text(
'Skip', AppLocalizations.of(context)!.skip,
style: TextStyle( style: const TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 14, fontSize: 14,
), ),
@ -819,8 +838,8 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
), ),
child: IconButton( child: IconButton(
iconSize: 20, iconSize: 20,
icon: const Icon(Icons.arrow_forward, icon: Icon(locale.languageCode == 'ar' ?Icons.arrow_back : Icons.arrow_forward ,
color: Colors.white), color: Colors.white,),
onPressed: () { onPressed: () {
tutorialCoachMark.previous(); tutorialCoachMark.previous();
}, },
@ -838,7 +857,8 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
), ),
), ),
TargetContent( TargetContent(
padding: EdgeInsets.only(left: screenWidth * 0.4, bottom: 0), padding: EdgeInsets.only(left:locale.languageCode == 'ar' ? 0 : screenWidth * 0.4, bottom: 0,
right:locale.languageCode == 'ar' ? screenWidth * 0.4 : 0 ,),
align: ContentAlign.bottom, align: ContentAlign.bottom,
child: Container( child: Container(
width: 200, width: 200,
@ -861,7 +881,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
final locale = ref.read(localeProvider); locale = ref.read(localeProvider) ?? const Locale('en');
fetchData(locale?.languageCode ?? 'en'); fetchData(locale?.languageCode ?? 'en');
// _fetchUserData(); // _fetchUserData();
_loadLoginCount(); _loadLoginCount();

View File

@ -80,11 +80,13 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
bool isLoggedOut = false; bool isLoggedOut = false;
final FlutterSecureStorage _secureStorage = const FlutterSecureStorage(); final FlutterSecureStorage _secureStorage = const FlutterSecureStorage();
static final _repo = getIt.call<TAuthRepo>(); static final _repo = getIt.call<TAuthRepo>();
late final Locale locale;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_checkUserId(); _checkUserId();
locale = ref.read(localeProvider)?? const Locale('en');
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
_startAppbarTour(); _startAppbarTour();
}); });
@ -199,23 +201,24 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
border: Border.all( border: Border.all(
color: Colors.white, width: 2.0), color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0),
), ),
child: IconButton( child: IconButton(
icon: const Icon(Icons.arrow_back, icon: const Icon(Icons.arrow_back,
color: Colors.white), color: Colors.white,),
onPressed: () { onPressed: () {
tutorialCoachMark.finish(); if (locale.languageCode == 'ar') {
ref tutorialCoachMark.next();
.read(scaffoldTourProvider.notifier) } else {
.state = true; tutorialCoachMark.finish();
ref ref.read(scaffoldTourProvider.notifier).state = true;
.read(previousChartsTourProvider ref.read(previousChartsTourProvider.notifier).state = false;
.notifier) context.go(
.state = false; '/chartScreen/hotels?bgColor=0xFF90B0D5&mainTopic=ECONOMY&title=Hotel+Establishments',);
context.go( }
'/chartScreen/hotels?bgColor=0xFF90B0D5&mainTopic=ECONOMY&title=Hotel+Establishments');
}, },
), ),
), ),
@ -223,15 +226,23 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Color(0xFF7DAFBC), color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
border: Border.all( border: Border.all(
color: Color(0xFF7DAFBC), width: 1.5), color:locale.languageCode=='ar' ? Colors.white: Color(0xFF7DAFBC), width: 1),
), ),
child: IconButton( child: IconButton(
icon: const Icon(Icons.arrow_forward, icon: const Icon(Icons.arrow_forward,
color: Colors.white), color: Colors.white),
onPressed: () { onPressed: () {
tutorialCoachMark.next(); if (locale.languageCode == 'ar') {
tutorialCoachMark.finish();
ref.read(scaffoldTourProvider.notifier).state = true;
ref.read(previousChartsTourProvider.notifier).state = false;
context.go(
'/chartScreen/hotels?bgColor=0xFF90B0D5&mainTopic=ECONOMY&title=Hotel+Establishments',);
} else {
tutorialCoachMark.next();
}
}, },
), ),
), ),
@ -259,7 +270,7 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
text: AppLocalizations.of(context)!.mainMenu, text: AppLocalizations.of(context)!.mainMenu,
alignment: ContentAlign.bottom, alignment: ContentAlign.bottom,
gap: 55, gap: 55,
space: 0, space:locale.languageCode=='ar' ? 20: 20,
), ),
TargetContent( TargetContent(
align: ContentAlign.bottom, align: ContentAlign.bottom,
@ -315,14 +326,15 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
border: Border.all( border: Border.all(
color: Colors.white, width: 2.0), color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0,),
), ),
child: IconButton( child: IconButton(
icon: const Icon(Icons.arrow_back, icon: const Icon(Icons.arrow_back,
color: Colors.white), color: Colors.white,),
onPressed: () { onPressed: () {
tutorialCoachMark.previous(); locale.languageCode=='ar' ?tutorialCoachMark.next() : tutorialCoachMark.previous();
}, },
), ),
), ),
@ -330,15 +342,15 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Color(0xFF7DAFBC), color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
border: Border.all( border: Border.all(
color: Color(0xFF7DAFBC), width: 1), color:locale.languageCode=='ar' ? Colors.white: Color(0xFF7DAFBC), width: 1),
), ),
child: IconButton( child: IconButton(
icon: const Icon(Icons.arrow_forward, icon: const Icon(Icons.arrow_forward,
color: Colors.white), color: Colors.white,),
onPressed: () { onPressed: () {
tutorialCoachMark.next(); locale.languageCode=='ar' ?tutorialCoachMark.previous() : tutorialCoachMark.next();
}, },
), ),
), ),
@ -354,15 +366,17 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
), ),
), ),
TargetContent( TargetContent(
padding: EdgeInsets.only(right: screenWidth * 0.7, top: 30), padding: EdgeInsets.only(right:locale.languageCode=='ar' ? 0: screenWidth * 0.7, top: locale.languageCode=='ar' ?20 : 20, left: locale.languageCode=='ar' ? screenWidth * 0.7:0,),
align: ContentAlign.right, align: locale.languageCode=='ar' ? ContentAlign.left : ContentAlign.right,
child: Container( child: Container(
width: 200, width: 200,
height: screenHeight / 4, height: screenHeight / 4,
child: Stack( child: Stack(
children: [ children: [
Image.asset( Image.asset(
'assets/app_tour/leftDown.png', locale.languageCode == 'ar'
? 'assets/app_tour/down_right.png' // Arabic locale image
: 'assets/app_tour/leftDown.png', // Default image
fit: BoxFit.contain, fit: BoxFit.contain,
), ),
// Positioned( // Positioned(
@ -437,7 +451,7 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
elevation: 0, elevation: 0,
), ),
child: Text( child: Text(
// 'Skip',
AppLocalizations.of(context)!.skip, AppLocalizations.of(context)!.skip,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
@ -454,8 +468,8 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
color: Colors.white, width: 2.0), color: Colors.white, width: 2.0),
), ),
child: IconButton( child: IconButton(
icon: const Icon(Icons.arrow_back, icon: Icon(locale.languageCode=='ar' ? Icons.arrow_forward: Icons.arrow_back,
color: Colors.white), color: Colors.white,),
onPressed: () { onPressed: () {
tutorialCoachMark.previous(); tutorialCoachMark.previous();
}, },
@ -465,25 +479,12 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
ElevatedButton( ElevatedButton(
onPressed: () { onPressed: () {
debugPrint('Got it clicked'); debugPrint('Got it clicked');
ref ref.read(chartsTourProvider.notifier).state = true;
.read(chartsTourProvider.notifier) ref.read(previousChartsTourProvider.notifier).state = true;
.state = true; ref.read(homeTourProvider.notifier).state = true;
ref ref.read(previousHomeTourProvider.notifier).state = true;
.read( ref.read(scaffoldTourProvider.notifier).state = true;
previousChartsTourProvider.notifier) ref.read(previousScaffoldTourProvider.notifier).state = true;
.state = true;
ref.read(homeTourProvider.notifier).state =
true;
ref
.read(previousHomeTourProvider.notifier)
.state = true;
ref
.read(scaffoldTourProvider.notifier)
.state = true;
ref
.read(previousScaffoldTourProvider
.notifier)
.state = true;
tutorialCoachMark.finish(); tutorialCoachMark.finish();
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
@ -514,30 +515,22 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
), ),
), ),
TargetContent( TargetContent(
padding: padding: EdgeInsets.only(left: locale.languageCode=='ar' ? 0: screenWidth * 0.7,
EdgeInsets.only(left: screenWidth * 0.7, top: toggleHeight), top: toggleHeight,
align: ContentAlign.left, right: locale.languageCode=='ar' ? screenWidth * 0.7 : 0,
),
align : locale.languageCode=='ar' ? ContentAlign.right :ContentAlign.left,
child: Container( child: Container(
width: 200, width: 200,
height: screenHeight / 4, height: screenHeight / 4,
child: Stack( child: Stack(
children: [ children: [
Image.asset( Image.asset(
'assets/app_tour/down_right.png', locale.languageCode == 'ar'
? 'assets/app_tour/leftDown.png' // Arabic locale image
: 'assets/app_tour/down_right.png', // Default image
fit: BoxFit.contain, fit: BoxFit.contain,
), )
// Positioned(
// top: 0,
// left: MediaQuery.of(context).size.width* 0.5,
// child: SizedBox(
// width: 50,
// height: 100,
// child: Image.asset(
// 'assets/app_tour/bookmark2.png',
// fit: BoxFit.contain,
// ),
// ),
// ),
], ],
), ),
), ),