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();
bool isBookmarked = false; // Track bookmark state
String? bookmarkId; // Stores the ID of the bookmark record in PocketBase
late final Locale locale;
@override
void initState() {
@ -79,7 +80,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
print(' bgColor $bgColor');
// fetchChartData(widget.dataSets);
checkIfBookmarked();
final locale = ref.read(localeProvider);
locale = ref.read(localeProvider)?? const Locale('en');
fetchChartData(widget.dataSets, locale?.languageCode ?? 'en').then((_) {
if (_tabsData.isNotEmpty) {
// Call onTabSelected for the first tab
@ -525,9 +526,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
backgroundColor: Colors.transparent,
elevation: 0,
),
child: const Text(
'Skip',
style: TextStyle(
child: Text(
AppLocalizations.of(context)!.skip,
style: const TextStyle(
color: Colors.white,
fontSize: 14,
),
@ -538,22 +539,22 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
border: Border.all(
color: Colors.white, width: 2.0),
color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0),
),
child: IconButton(
iconSize: 20,
icon: const Icon(Icons.arrow_back,
color: Colors.white),
onPressed: () {
ref
.read(chartsTourProvider.notifier)
.state = true;
ref
.read(
previousHomeTourProvider.notifier)
.state = false;
tutorialCoachMark.finish();
if (locale.languageCode == 'ar') {
tutorialCoachMark.next();
} else {
ref.read(chartsTourProvider.notifier).state = true;
ref.read(previousHomeTourProvider.notifier).state = false;
tutorialCoachMark.finish();
}
},
),
),
@ -561,16 +562,22 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFF7DAFBC),
color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
border: Border.all(
color: Color(0xFF7DAFBC), width: 1.5),
color:locale.languageCode=='ar' ? Colors.white: Color(0xFF7DAFBC), width: 1),
),
child: IconButton(
iconSize: 20,
icon: const Icon(Icons.arrow_forward,
color: Colors.white),
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(
identify: 'BookMarkKey',
keyTarget: bookMarkKey,
@ -721,7 +627,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
text: AppLocalizations.of(context)!.bookMark,
alignment: ContentAlign.bottom,
gap: 53,
space: 50,
space: screenWidth*0.22,
),
TargetContent(
align: ContentAlign.bottom,
@ -763,9 +669,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
backgroundColor: Colors.transparent,
elevation: 0,
),
child: const Text(
'Skip',
style: TextStyle(
child: Text(
AppLocalizations.of(context)!.skip,
style: const TextStyle(
color: Colors.white,
fontSize: 14,
),
@ -776,15 +682,22 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
border: Border.all(
color: Colors.white, width: 2.0),
color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0),
),
child: IconButton(
iconSize: 20,
icon: const Icon(Icons.arrow_back,
color: Colors.white),
color: Colors.white,),
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(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFF7DAFBC),
color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
border: Border.all(
color: Color(0xFF7DAFBC), width: 1),
color:locale.languageCode=='ar' ? Colors.white: Color(0xFF7DAFBC), width: 1),
),
child: IconButton(
iconSize: 20,
icon: const Icon(Icons.arrow_forward,
color: Colors.white),
color: Colors.white,),
onPressed: () {
ref
.read(chartsTourProvider.notifier)
.state = true;
ref
.read(scaffoldTourProvider.notifier)
.state = false;
tutorialCoachMark.finish();
if (locale.languageCode == 'ar') {
tutorialCoachMark.previous();
} else {
ref.read(chartsTourProvider.notifier).state = true;
ref.read(scaffoldTourProvider.notifier).state = false;
tutorialCoachMark.finish();
}
},
),
),
@ -827,25 +741,13 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
align: ContentAlign.right,
child: Container(
width: screenWidth / 4,
height: screenHeight,
height: screenHeight*0.2,
child: Stack(
children: [
Image.asset(
'assets/app_tour/leftDown.png',
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: [
createTargetContent(
text: AppLocalizations.of(context)!.bookMark,
space: 50,
space:screenWidth*0.22,
alignment: ContentAlign.bottom,
gap: 23,
gap: 53,
),
TargetContent(
align: ContentAlign.bottom,
@ -912,9 +814,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
backgroundColor: Colors.transparent,
elevation: 0,
),
child: const Text(
'Skip',
style: TextStyle(
child: Text(
AppLocalizations.of(context)!.skip,
style: const TextStyle(
color: Colors.white,
fontSize: 14,
),
@ -925,15 +827,22 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
border: Border.all(
color: Colors.white, width: 2.0),
color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0,),
),
child: IconButton(
iconSize: 20,
icon: const Icon(Icons.arrow_back,
color: Colors.white),
color: Colors.white,),
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(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFF7DAFBC),
color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
border: Border.all(
color: Color(0xFF7DAFBC), width: 1.5),
color:locale.languageCode=='ar' ? Colors.white : Color(0xFF7DAFBC), width: 2.0,),
),
child: IconButton(
iconSize: 20,
icon: const Icon(Icons.arrow_forward,
color: Colors.white),
onPressed: () {
ref
.read(chartsTourProvider.notifier)
.state = true;
ref
.read(scaffoldTourProvider.notifier)
.state = false;
tutorialCoachMark.finish();
if (locale.languageCode == 'ar') {
tutorialCoachMark.next();
} else {
ref.read(chartsTourProvider.notifier).state = true;
ref.read(scaffoldTourProvider.notifier).state = false;
tutorialCoachMark.finish();
}
},
),
),
@ -972,29 +881,17 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
),
),
TargetContent(
padding: EdgeInsets.only(left: 0, top: 10),
padding: EdgeInsets.only(left: 0, top: 0),
align: ContentAlign.right,
child: Container(
child: SizedBox(
width: screenWidth / 4,
height: screenHeight,
height:screenHeight*0.2,
child: Stack(
children: [
Image.asset(
'assets/app_tour/leftDown.png',
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,
space: 0,
alignment: ContentAlign.top,
gap: 50,
gap: 55,
),
TargetContent(
align: ContentAlign.bottom,
@ -1054,9 +951,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
backgroundColor: Colors.transparent,
elevation: 0,
),
child: const Text(
'Skip',
style: TextStyle(
child: Text(
AppLocalizations.of(context)!.skip,
style: const TextStyle(
color: Colors.white,
fontSize: 14,
),
@ -1067,23 +964,23 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
border: Border.all(
color: Colors.white, width: 2.0),
color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0,),
),
child: IconButton(
iconSize: 20,
icon: const Icon(Icons.arrow_back,
color: Colors.white),
color: Colors.white,),
onPressed: () {
ref
.read(previousChartsTourProvider
.notifier)
.state = true;
ref
.read(
previousHomeTourProvider.notifier)
.state = false;
tutorialCoachMark.finish();
if (locale.languageCode == 'ar') {
tutorialCoachMark.previous();
} else {
ref.read(previousChartsTourProvider.notifier).state = true;
ref.read(previousHomeTourProvider.notifier).state = false;
tutorialCoachMark.finish();
}
},
),
),
@ -1091,16 +988,22 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFF7DAFBC),
color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
border: Border.all(
color: Color(0xFF7DAFBC), width: 1.5),
color:locale.languageCode=='ar' ? Colors.white: Color(0xFF7DAFBC), width: 1),
),
child: IconButton(
iconSize: 20,
icon: const Icon(Icons.arrow_forward,
color: Colors.white),
color: Colors.white,),
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 List<TargetFocus> homeTargets;
late List<TargetFocus> previousHomeTargets;
late final Locale locale;
void handleSkip() {
tutorialCoachMark.skip();
@ -298,6 +299,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
//Method to Start App Tour
void _showHomeTour() {
print('Home tour Arabic Started');
final homeTour = ref.watch(homeTourProvider);
final previousHomeTour = ref.watch(previousHomeTourProvider);
@ -305,6 +307,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
if (!homeTour) {
// Show Home Tour
_initTarget();
print('Home tour Target Intialized');
tutorialCoachMark = TutorialCoachMark(
paddingFocus: 0,
useSafeArea: true,
@ -345,7 +348,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
keyTarget: cardTopicKey,
shape: ShapeLightFocus.RRect,
radius: 8,
paddingFocus: 16,
paddingFocus: 10,
contents: [
createTargetContent(
text: AppLocalizations.of(context)!.home_topic,
@ -396,9 +399,9 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
backgroundColor: Colors.transparent,
elevation: 0,
),
child: const Text(
'Skip',
style: TextStyle(
child: Text(
AppLocalizations.of(context)!.skip,
style: const TextStyle(
color: Colors.white,
fontSize: 14,
),
@ -418,7 +421,8 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
child: IconButton(
padding: EdgeInsets.zero,
iconSize: 20,
icon: const Icon(Icons.arrow_forward,
icon:Icon(
locale.languageCode == 'ar' ?Icons.arrow_back : Icons.arrow_forward,
color: Colors.white),
onPressed: () {
tutorialCoachMark.next();
@ -436,9 +440,13 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
),
),
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,
child: Container(
child: SizedBox(
width: 200,
height: 77,
child: Stack(
@ -458,7 +466,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
keyTarget: cardsKey,
shape: ShapeLightFocus.RRect,
radius: 7,
paddingFocus: 6,
paddingFocus: 2,
// targetPosition:TargetPosition(),
contents: [
createTargetContent(
@ -507,9 +515,9 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
backgroundColor: Colors.transparent,
elevation: 0,
),
child: const Text(
'Skip',
style: TextStyle(
child: Text(
AppLocalizations.of(context)!.skip,
style: const TextStyle(
color: Colors.white,
fontSize: 14,
),
@ -520,15 +528,16 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
border: Border.all(
color: Colors.white, width: 2.0),
color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0),
),
child: IconButton(
iconSize: 20,
icon: const Icon(Icons.arrow_back,
color: Colors.white),
icon: Icon(Icons.arrow_back,
color: Colors.white,),
onPressed: () {
tutorialCoachMark.previous();
locale.languageCode=='ar' ?tutorialCoachMark.next() : tutorialCoachMark.previous();
},
),
),
@ -536,16 +545,16 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFF7DAFBC),
color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
border: Border.all(
color: Color(0xFF7DAFBC), width: 1),
color:locale.languageCode=='ar' ? Colors.white: Color(0xFF7DAFBC), width: 1),
),
child: IconButton(
iconSize: 20,
icon: const Icon(Icons.arrow_forward,
icon:Icon(Icons.arrow_forward,
color: Colors.white),
onPressed: () {
tutorialCoachMark.next();
locale.languageCode=='ar' ?tutorialCoachMark.previous() : tutorialCoachMark.next();
},
),
),
@ -561,7 +570,9 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
),
),
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,
child: Container(
width: 200,
@ -622,8 +633,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
align: ContentAlign.bottom,
child: SizedBox(
width: double.infinity,
height: MediaQuery.of(context).size.height *
0.5, // Set an appropriate height for the Stack
height: MediaQuery.of(context).size.height * 0.5,
child: Stack(
children: [
Positioned(
@ -660,9 +670,9 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
backgroundColor: Colors.transparent,
elevation: 0,
),
child: const Text(
'Skip',
style: TextStyle(
child: Text(
AppLocalizations.of(context)!.skip,
style: const TextStyle(
color: Colors.white,
fontSize: 14,
),
@ -675,14 +685,24 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
border: Border.all(
color: Colors.white, width: 2.0),
color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0,),
),
child: IconButton(
icon: const Icon(Icons.arrow_back,
color: Colors.white),
iconSize: 20,
icon: Icon(Icons.arrow_back,
color: Colors.white,),
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(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFF7DAFBC),
color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
border: Border.all(
color: Color(0xFF7DAFBC),
width: 1.5),
color:locale.languageCode=='ar' ? Colors.white: Color(0xFF7DAFBC), width: 1,),
),
child: IconButton(
iconSize: 20,
icon: const Icon(Icons.arrow_forward,
color: Colors.white),
onPressed: () {
ref
.read(previousHomeTourProvider
.notifier)
.state = true;
ref
.read(chartsTourProvider.notifier)
.state = false;
context.go(
'/chartScreen/hotels?bgColor=0xFF90B0D5&mainTopic=ECONOMY&title=Hotel+Establishments');
tutorialCoachMark.finish();
if (locale.languageCode == 'ar') {
tutorialCoachMark.next();
} else {
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');
}
},
),
),
@ -727,7 +745,9 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
),
),
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,
child: Container(
width: 200,
@ -788,8 +808,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
children: [
ElevatedButton(
onPressed: () {
tutorialCoachMark.skip();
debugPrint('Skip clicked');
handleSkip();
},
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
@ -799,9 +818,9 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
backgroundColor: Colors.transparent,
elevation: 0,
),
child: const Text(
'Skip',
style: TextStyle(
child: Text(
AppLocalizations.of(context)!.skip,
style: const TextStyle(
color: Colors.white,
fontSize: 14,
),
@ -819,8 +838,8 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
),
child: IconButton(
iconSize: 20,
icon: const Icon(Icons.arrow_forward,
color: Colors.white),
icon: Icon(locale.languageCode == 'ar' ?Icons.arrow_back : Icons.arrow_forward ,
color: Colors.white,),
onPressed: () {
tutorialCoachMark.previous();
},
@ -838,7 +857,8 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
),
),
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,
child: Container(
width: 200,
@ -861,7 +881,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
@override
void initState() {
super.initState();
final locale = ref.read(localeProvider);
locale = ref.read(localeProvider) ?? const Locale('en');
fetchData(locale?.languageCode ?? 'en');
// _fetchUserData();
_loadLoginCount();

View File

@ -80,11 +80,13 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
bool isLoggedOut = false;
final FlutterSecureStorage _secureStorage = const FlutterSecureStorage();
static final _repo = getIt.call<TAuthRepo>();
late final Locale locale;
@override
void initState() {
super.initState();
_checkUserId();
locale = ref.read(localeProvider)?? const Locale('en');
WidgetsBinding.instance.addPostFrameCallback((_) {
_startAppbarTour();
});
@ -199,23 +201,24 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
border: Border.all(
color: Colors.white, width: 2.0),
color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0),
),
child: IconButton(
icon: const Icon(Icons.arrow_back,
color: Colors.white),
color: Colors.white,),
onPressed: () {
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');
if (locale.languageCode == 'ar') {
tutorialCoachMark.next();
} else {
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',);
}
},
),
),
@ -223,15 +226,23 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFF7DAFBC),
color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
border: Border.all(
color: Color(0xFF7DAFBC), width: 1.5),
color:locale.languageCode=='ar' ? Colors.white: Color(0xFF7DAFBC), width: 1),
),
child: IconButton(
icon: const Icon(Icons.arrow_forward,
color: Colors.white),
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,
alignment: ContentAlign.bottom,
gap: 55,
space: 0,
space:locale.languageCode=='ar' ? 20: 20,
),
TargetContent(
align: ContentAlign.bottom,
@ -315,14 +326,15 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
border: Border.all(
color: Colors.white, width: 2.0),
color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0,),
),
child: IconButton(
icon: const Icon(Icons.arrow_back,
color: Colors.white),
color: Colors.white,),
onPressed: () {
tutorialCoachMark.previous();
locale.languageCode=='ar' ?tutorialCoachMark.next() : tutorialCoachMark.previous();
},
),
),
@ -330,15 +342,15 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFF7DAFBC),
color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
border: Border.all(
color: Color(0xFF7DAFBC), width: 1),
color:locale.languageCode=='ar' ? Colors.white: Color(0xFF7DAFBC), width: 1),
),
child: IconButton(
icon: const Icon(Icons.arrow_forward,
color: Colors.white),
color: Colors.white,),
onPressed: () {
tutorialCoachMark.next();
locale.languageCode=='ar' ?tutorialCoachMark.previous() : tutorialCoachMark.next();
},
),
),
@ -354,15 +366,17 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
),
),
TargetContent(
padding: EdgeInsets.only(right: screenWidth * 0.7, top: 30),
align: ContentAlign.right,
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: locale.languageCode=='ar' ? ContentAlign.left : ContentAlign.right,
child: Container(
width: 200,
height: screenHeight / 4,
child: Stack(
children: [
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,
),
// Positioned(
@ -437,7 +451,7 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
elevation: 0,
),
child: Text(
// 'Skip',
AppLocalizations.of(context)!.skip,
style: TextStyle(
color: Colors.white,
@ -454,8 +468,8 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
color: Colors.white, width: 2.0),
),
child: IconButton(
icon: const Icon(Icons.arrow_back,
color: Colors.white),
icon: Icon(locale.languageCode=='ar' ? Icons.arrow_forward: Icons.arrow_back,
color: Colors.white,),
onPressed: () {
tutorialCoachMark.previous();
},
@ -465,25 +479,12 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
ElevatedButton(
onPressed: () {
debugPrint('Got it clicked');
ref
.read(chartsTourProvider.notifier)
.state = true;
ref
.read(
previousChartsTourProvider.notifier)
.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;
ref.read(chartsTourProvider.notifier).state = true;
ref.read(previousChartsTourProvider.notifier).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();
},
style: ElevatedButton.styleFrom(
@ -514,30 +515,22 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
),
),
TargetContent(
padding:
EdgeInsets.only(left: screenWidth * 0.7, top: toggleHeight),
align: ContentAlign.left,
padding: EdgeInsets.only(left: locale.languageCode=='ar' ? 0: screenWidth * 0.7,
top: toggleHeight,
right: locale.languageCode=='ar' ? screenWidth * 0.7 : 0,
),
align : locale.languageCode=='ar' ? ContentAlign.right :ContentAlign.left,
child: Container(
width: 200,
height: screenHeight / 4,
child: Stack(
children: [
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,
),
// 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,
// ),
// ),
// ),
)
],
),
),