diff --git a/lib/presentation/routes/drawer_routes/Drawer Items/bookmark.dart b/lib/presentation/routes/drawer_routes/Drawer Items/bookmark.dart index 34ab01c9..b8b6f5ec 100644 --- a/lib/presentation/routes/drawer_routes/Drawer Items/bookmark.dart +++ b/lib/presentation/routes/drawer_routes/Drawer Items/bookmark.dart @@ -378,75 +378,170 @@ class _BookMarkState extends ConsumerState { // print( 'filtered one :${filteredBookmarks['main_topic']} , Tabs : ${tabs[selectedTabIndex]["title"]}'); List> transformedList = groupedMap.values.toList(); // print('filtered $filteredBookmarks'); - return BaseScaffold( - title: Text( - AppLocalizations.of(context)!.bookmarks, - ), - body: isLoading - ? Container( - color: Color(0x98FFFCE5), // Semi-transparent background - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.symmetric( - horizontal: 40), // Left & Right space - child: LinearProgressIndicator( - minHeight: 5, // Adjust thickness - backgroundColor: - Colors.grey[100], // Optional: Background color - valueColor: AlwaysStoppedAnimation( - Color(0xFFAA8E83)), // Loader color + return PopScope( + canPop: false, + onPopInvokedWithResult: (didPop, result) { + if (didPop) return; + context.go('/myhomepage'); + }, + child: BaseScaffold( + title: Text( + AppLocalizations.of(context)!.bookmarks, + ), + body: isLoading + ? Container( + color: Color(0x98FFFCE5), // Semi-transparent background + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.symmetric( + horizontal: 40), // Left & Right space + child: LinearProgressIndicator( + minHeight: 5, // Adjust thickness + backgroundColor: + Colors.grey[100], // Optional: Background color + valueColor: AlwaysStoppedAnimation( + Color(0xFFAA8E83)), // Loader color + ), ), - ), - ], - ), - ) - : Column( - children: [ - TabBarHeader( - tabs: tabs, - selectedIndex: selectedTabIndex, - onTabSelected: (index) { - setState(() { - selectedTabIndex = index; - }); - }, + ], ), - Expanded( - child: selectedTabIndex == 0 - ? (bookmarks.isNotEmpty - ? SingleChildScrollView( - child: Column( - children: - List.generate(transformedList.length, (i) { - final mainTopic = transformedList[i]; - print('oustside1 $mainTopic'); - final list = - List.from(mainTopic['SubTopic'] ?? []); - print('oustside2 $list'); - return CustomExpandableTile( - index: i, - isExpanded: expandedIndex == i, - onTap: (int index) { - // 🔹 Expecting an index - setState(() { - expandedIndex = (expandedIndex == index) - ? null - : index; - }); - }, - title: - mainTopic['main_topic'] ?? 'No Topic', - childWidget: Container( - decoration: BoxDecoration( - color: Colors.white, - // borderRadius: BorderRadius.all(Radius.circular(20)) + ) + : Column( + children: [ + TabBarHeader( + tabs: tabs, + selectedIndex: selectedTabIndex, + onTabSelected: (index) { + setState(() { + selectedTabIndex = index; + }); + }, + ), + Expanded( + child: selectedTabIndex == 0 + ? (bookmarks.isNotEmpty + ? SingleChildScrollView( + child: Column( + children: + List.generate(transformedList.length, (i) { + final mainTopic = transformedList[i]; + print('oustside1 $mainTopic'); + final list = + List.from(mainTopic['SubTopic'] ?? []); + print('oustside2 $list'); + return CustomExpandableTile( + index: i, + isExpanded: expandedIndex == i, + onTap: (int index) { + // 🔹 Expecting an index + setState(() { + expandedIndex = (expandedIndex == index) + ? null + : index; + }); + }, + title: + mainTopic['main_topic'] ?? 'No Topic', + childWidget: Container( + decoration: BoxDecoration( + color: Colors.white, + // borderRadius: BorderRadius.all(Radius.circular(20)) + ), + padding: const EdgeInsets.all(16), + child: GridView.builder( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + gridDelegate: + const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 10.0, + mainAxisSpacing: 10.0, + mainAxisExtent: 100, + ), + itemCount: list.length, + itemBuilder: (context, index) { + return _buildBoxes( + mainTopic['SubTopic'][index], + context, + mainTopic['valueColor']); + }, + ), ), - padding: const EdgeInsets.all(16), + filteredBookmarks: + List.from(mainTopic['SubTopic'] ?? []), + titleBackgroundColor: + mainTopic['valueColor'], + // Ensure it's a new list + ); + }), + ), + ) + : Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.info_outline, + size: 100, color: Colors.grey[400]), + SizedBox(height: 16), + Text( + context.translate('No BookMark Added', + 'لم يتم إضافة أي علامة مرجعية'), + style: TextStyle( + fontSize: 16, color: Colors.grey), + ), + ], + ), + )) + : filteredBookmarks.isEmpty + ? Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.info_outline, + size: 100, color: Colors.grey[400]), + SizedBox(height: 16), + Text( + context.translate('No BookMark Added', + 'لم يتم إضافة أي علامة مرجعية'), + style: TextStyle( + fontSize: 16, color: Colors.grey), + ), + ], + ), + ) + : Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Container( + decoration: BoxDecoration( + color: tabs[selectedTabIndex]['color'], + borderRadius: BorderRadius.all( + Radius.circular(35))), + padding: const EdgeInsets.only( + left: 16, bottom: 5, top: 5, right: 10), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + tabs[selectedTabIndex]['title'], + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.w600, + fontSize: 20, + ), + ), + ], + ), + ), + SizedBox( + height: 20, + ), + Expanded( child: GridView.builder( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, @@ -454,108 +549,20 @@ class _BookMarkState extends ConsumerState { mainAxisSpacing: 10.0, mainAxisExtent: 100, ), - itemCount: list.length, + itemCount: filteredBookmarks.length, itemBuilder: (context, index) { - return _buildBoxes( - mainTopic['SubTopic'][index], - context, - mainTopic['valueColor']); + return _buildBox( + filteredBookmarks[index], context); }, ), ), - filteredBookmarks: - List.from(mainTopic['SubTopic'] ?? []), - titleBackgroundColor: - mainTopic['valueColor'], - // Ensure it's a new list - ); - }), + ], + ), ), - ) - : Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(Icons.info_outline, - size: 100, color: Colors.grey[400]), - SizedBox(height: 16), - Text( - context.translate('No BookMark Added', - 'لم يتم إضافة أي علامة مرجعية'), - style: TextStyle( - fontSize: 16, color: Colors.grey), - ), - ], - ), - )) - : filteredBookmarks.isEmpty - ? Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(Icons.info_outline, - size: 100, color: Colors.grey[400]), - SizedBox(height: 16), - Text( - context.translate('No BookMark Added', - 'لم يتم إضافة أي علامة مرجعية'), - style: TextStyle( - fontSize: 16, color: Colors.grey), - ), - ], - ), - ) - : Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - children: [ - Container( - decoration: BoxDecoration( - color: tabs[selectedTabIndex]['color'], - borderRadius: BorderRadius.all( - Radius.circular(35))), - padding: const EdgeInsets.only( - left: 16, bottom: 5, top: 5, right: 10), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - tabs[selectedTabIndex]['title'], - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.w600, - fontSize: 20, - ), - ), - ], - ), - ), - SizedBox( - height: 20, - ), - Expanded( - child: GridView.builder( - gridDelegate: - const SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 10.0, - mainAxisSpacing: 10.0, - mainAxisExtent: 100, - ), - itemCount: filteredBookmarks.length, - itemBuilder: (context, index) { - return _buildBox( - filteredBookmarks[index], context); - }, - ), - ), - ], - ), - ), - ), - ], - ), + ), + ], + ), + ), ); } diff --git a/lib/presentation/routes/drawer_routes/Drawer Items/contactUs.dart b/lib/presentation/routes/drawer_routes/Drawer Items/contactUs.dart index 607d4cde..cc9d72f2 100644 --- a/lib/presentation/routes/drawer_routes/Drawer Items/contactUs.dart +++ b/lib/presentation/routes/drawer_routes/Drawer Items/contactUs.dart @@ -41,147 +41,154 @@ class _ContactState extends ConsumerState { await _userService.updateLanguage(localeCode); }); - return BaseScaffold( - body: Container( - color: Colors.grey[200], - width: screenWidth, - padding: const EdgeInsets.all(16.0), - child: SingleChildScrollView( - child: Column( - children: [ - buildContactCard( - context, - title: 'DUBAI - EMIRATES TOWER -32ND FLOOR', - titleAr: 'دبي - أبراج الإمارات - الطابق 32', - details: [ - { - 'icon': EnquiryAssetIconPath.building, - 'text': 'Office : Dubai - Emirates Tower -32nd Floor', - 'textAr': 'المقر الرئيسي : دبي - أبراج الإمارات - الطابق 32' - }, - { - 'icon': EnquiryAssetIconPath.phone, - 'text': 'Tel : 00971 46080000', - 'textAr': 'الهاتف : 0097146080000' - }, - { - 'icon': EnquiryAssetIconPath.fax, - 'text': 'Fax : 0097143273535', - 'textAr': 'فاكس : 0097143273535' - }, - { - 'icon': EnquiryAssetIconPath.map, - 'text': 'P.O.Box : 127000 Dubai', - 'textAr': 'ص.ب: : 127000 دبي' - }, - { - 'icon': EnquiryAssetIconPath.at, - 'text': 'Email Address : info@fcsc.gov.ae', - 'textAr': 'البريد الإلكتروني : info@fcsc.gov.ae' - }, - { - 'icon': EnquiryAssetIconPath.map, - 'text': 'Latitude : 25.223926', - 'textAr': 'خط العرض : 25.223926' - }, - { - 'icon': EnquiryAssetIconPath.map, - 'text': 'Longitude : 55.350526', - 'textAr': 'خط الطول : 55.350526' - }, - ], - ), - const SizedBox(height: 10), - buildContactCard( - context, - title: 'MEDIA SECTION', - titleAr: 'قسم الاعلام', - details: [ - { - 'icon': EnquiryAssetIconPath.building, - 'text': 'Office : Media Section', - 'textAr': 'المقر الرئيسي : قسم الاعلام' - }, - { - 'icon': EnquiryAssetIconPath.phone, - 'text': 'Tel : 00971 46080000', - 'textAr': 'الهاتف : 0097146080000' - }, - { - 'icon': EnquiryAssetIconPath.fax, - 'text': 'Fax : 0097143273535', - 'textAr': 'فاكس : 0097143273535' - }, - { - 'icon': EnquiryAssetIconPath.map, - 'text': 'P.O.Box : 127000 Dubai', - 'textAr': 'ص.ب: : 127000 دبي' - }, - { - 'icon': EnquiryAssetIconPath.at, - 'text': 'Email Address : GCO@fcsc.gov.ae', - 'textAr': 'البريد الإلكتروني : GCO@fcsc.gov.ae' - }, - { - 'icon': EnquiryAssetIconPath.map, - 'text': 'Latitude : 25.223926', - 'textAr': 'خط العرض : 25.223926' - }, - { - 'icon': EnquiryAssetIconPath.map, - 'text': 'Longitude : 55.350526', - 'textAr': 'خط الطول : 55.350526' - }, - ], - ), - const SizedBox(height: 10), - buildContactCard( - context, - title: 'SGDS', - titleAr: 'أهداف التنمية المستدامة', - details: [ - { - 'icon': EnquiryAssetIconPath.building, - 'text': 'Office : SDGs', - 'textAr': 'المقر الرئيسي : أهداف التنمية المستدامة' - }, - { - 'icon': EnquiryAssetIconPath.phone, - 'text': 'Tel : 00971 46080000', - 'textAr': 'الهاتف : 0097146080000' - }, - { - 'icon': EnquiryAssetIconPath.fax, - 'text': 'Fax : 0097143273535', - 'textAr': 'فاكس : 0097143273535' - }, - { - 'icon': EnquiryAssetIconPath.map, - 'text': 'P.O.Box : 127000 Dubai', - 'textAr': 'ص.ب: : 127000 دبي' - }, - { - 'icon': EnquiryAssetIconPath.at, - 'text': 'Email Address : sdgs@fcsc.gov.ae', - 'textAr': 'البريد الإلكتروني : sdgs@fcsc.gov.ae' - }, - { - 'icon': EnquiryAssetIconPath.map, - 'text': 'Latitude : 25.223926', - 'textAr': 'خط العرض : 25.223926' - }, - { - 'icon': EnquiryAssetIconPath.map, - 'text': 'Longitude : 55.350526', - 'textAr': 'خط الطول : 55.350526' - }, - ], - ), - ], + return PopScope( + canPop: false, + onPopInvokedWithResult: (didPop, result) { + if (didPop) return; + context.go('/myhomepage'); + }, + child: BaseScaffold( + body: Container( + color: Colors.grey[200], + width: screenWidth, + padding: const EdgeInsets.all(16.0), + child: SingleChildScrollView( + child: Column( + children: [ + buildContactCard( + context, + title: 'DUBAI - EMIRATES TOWER -32ND FLOOR', + titleAr: 'دبي - أبراج الإمارات - الطابق 32', + details: [ + { + 'icon': EnquiryAssetIconPath.building, + 'text': 'Office : Dubai - Emirates Tower -32nd Floor', + 'textAr': 'المقر الرئيسي : دبي - أبراج الإمارات - الطابق 32' + }, + { + 'icon': EnquiryAssetIconPath.phone, + 'text': 'Tel : 00971 46080000', + 'textAr': 'الهاتف : 0097146080000' + }, + { + 'icon': EnquiryAssetIconPath.fax, + 'text': 'Fax : 0097143273535', + 'textAr': 'فاكس : 0097143273535' + }, + { + 'icon': EnquiryAssetIconPath.map, + 'text': 'P.O.Box : 127000 Dubai', + 'textAr': 'ص.ب: : 127000 دبي' + }, + { + 'icon': EnquiryAssetIconPath.at, + 'text': 'Email Address : info@fcsc.gov.ae', + 'textAr': 'البريد الإلكتروني : info@fcsc.gov.ae' + }, + { + 'icon': EnquiryAssetIconPath.map, + 'text': 'Latitude : 25.223926', + 'textAr': 'خط العرض : 25.223926' + }, + { + 'icon': EnquiryAssetIconPath.map, + 'text': 'Longitude : 55.350526', + 'textAr': 'خط الطول : 55.350526' + }, + ], + ), + const SizedBox(height: 10), + buildContactCard( + context, + title: 'MEDIA SECTION', + titleAr: 'قسم الاعلام', + details: [ + { + 'icon': EnquiryAssetIconPath.building, + 'text': 'Office : Media Section', + 'textAr': 'المقر الرئيسي : قسم الاعلام' + }, + { + 'icon': EnquiryAssetIconPath.phone, + 'text': 'Tel : 00971 46080000', + 'textAr': 'الهاتف : 0097146080000' + }, + { + 'icon': EnquiryAssetIconPath.fax, + 'text': 'Fax : 0097143273535', + 'textAr': 'فاكس : 0097143273535' + }, + { + 'icon': EnquiryAssetIconPath.map, + 'text': 'P.O.Box : 127000 Dubai', + 'textAr': 'ص.ب: : 127000 دبي' + }, + { + 'icon': EnquiryAssetIconPath.at, + 'text': 'Email Address : GCO@fcsc.gov.ae', + 'textAr': 'البريد الإلكتروني : GCO@fcsc.gov.ae' + }, + { + 'icon': EnquiryAssetIconPath.map, + 'text': 'Latitude : 25.223926', + 'textAr': 'خط العرض : 25.223926' + }, + { + 'icon': EnquiryAssetIconPath.map, + 'text': 'Longitude : 55.350526', + 'textAr': 'خط الطول : 55.350526' + }, + ], + ), + const SizedBox(height: 10), + buildContactCard( + context, + title: 'SGDS', + titleAr: 'أهداف التنمية المستدامة', + details: [ + { + 'icon': EnquiryAssetIconPath.building, + 'text': 'Office : SDGs', + 'textAr': 'المقر الرئيسي : أهداف التنمية المستدامة' + }, + { + 'icon': EnquiryAssetIconPath.phone, + 'text': 'Tel : 00971 46080000', + 'textAr': 'الهاتف : 0097146080000' + }, + { + 'icon': EnquiryAssetIconPath.fax, + 'text': 'Fax : 0097143273535', + 'textAr': 'فاكس : 0097143273535' + }, + { + 'icon': EnquiryAssetIconPath.map, + 'text': 'P.O.Box : 127000 Dubai', + 'textAr': 'ص.ب: : 127000 دبي' + }, + { + 'icon': EnquiryAssetIconPath.at, + 'text': 'Email Address : sdgs@fcsc.gov.ae', + 'textAr': 'البريد الإلكتروني : sdgs@fcsc.gov.ae' + }, + { + 'icon': EnquiryAssetIconPath.map, + 'text': 'Latitude : 25.223926', + 'textAr': 'خط العرض : 25.223926' + }, + { + 'icon': EnquiryAssetIconPath.map, + 'text': 'Longitude : 55.350526', + 'textAr': 'خط الطول : 55.350526' + }, + ], + ), + ], + ), ), ), + title: Text(context.translate('Contact Us', 'اتصل بنا')), ), - title: Text(context.translate('Contact Us', 'اتصل بنا')), ); } diff --git a/lib/presentation/routes/drawer_routes/Drawer Items/edit_profile.dart b/lib/presentation/routes/drawer_routes/Drawer Items/edit_profile.dart index a2cf4bf1..3dbdd5ea 100644 --- a/lib/presentation/routes/drawer_routes/Drawer Items/edit_profile.dart +++ b/lib/presentation/routes/drawer_routes/Drawer Items/edit_profile.dart @@ -4,6 +4,7 @@ import 'dart:io'; import 'package:external_repos/external_repos.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:go_router/go_router.dart'; @@ -404,9 +405,9 @@ class _EditProfileState extends ConsumerState { print('ShowConfirmationuser response - $response '); // Handle response if (response.statusCode == 200) { - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text( - AppLocalizations.of(context)!.profile_updated_successfully))); + // ScaffoldMessenger.of(context).showSnackBar(SnackBar( + // content: Text( + // AppLocalizations.of(context)!.profile_updated_successfully))); if (changedPreferredLanguage == 1) { print(_selectedLanguage); preferredLang = _selectedLanguage == 'English' ? 'en' : 'ar'; @@ -421,6 +422,12 @@ class _EditProfileState extends ConsumerState { isLoader = false; }); + SchedulerBinding.instance.addPostFrameCallback((_) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text(AppLocalizations.of(context)!.profile_updated_successfully)), + ); + }); + // print('ShowConfirmation userData - $userData '); context.go('/myhomepage'); } else { diff --git a/lib/presentation/routes/drawer_routes/custom_drawer_routes.dart b/lib/presentation/routes/drawer_routes/custom_drawer_routes.dart index 2b29eb5b..632b3fa0 100644 --- a/lib/presentation/routes/drawer_routes/custom_drawer_routes.dart +++ b/lib/presentation/routes/drawer_routes/custom_drawer_routes.dart @@ -990,7 +990,7 @@ class _BaseScaffoldState extends ConsumerState { ListTile( leading: Icon(Icons.mail_outlined), title: Text(context.translate('Contact Us', 'اتصل بنا'),), - onTap: () => context.push('/contact'), + onTap: () => context.go('/contact'), ), if (userId != 'guest') ListTile(