This commit is contained in:
venbaittech 2025-03-27 18:47:33 +05:30
commit 260e502d64
4 changed files with 326 additions and 307 deletions

View File

@ -378,75 +378,170 @@ class _BookMarkState extends ConsumerState<BookMark> {
// print( 'filtered one :${filteredBookmarks['main_topic']} , Tabs : ${tabs[selectedTabIndex]["title"]}'); // print( 'filtered one :${filteredBookmarks['main_topic']} , Tabs : ${tabs[selectedTabIndex]["title"]}');
List<Map<String, dynamic>> transformedList = groupedMap.values.toList(); List<Map<String, dynamic>> transformedList = groupedMap.values.toList();
// print('filtered $filteredBookmarks'); // print('filtered $filteredBookmarks');
return BaseScaffold( return PopScope(
title: Text( canPop: false,
AppLocalizations.of(context)!.bookmarks, onPopInvokedWithResult: (didPop, result) {
), if (didPop) return;
body: isLoading context.go('/myhomepage');
? Container( },
color: Color(0x98FFFCE5), // Semi-transparent background child: BaseScaffold(
child: Column( title: Text(
mainAxisAlignment: MainAxisAlignment.center, AppLocalizations.of(context)!.bookmarks,
children: [ ),
Container( body: isLoading
margin: EdgeInsets.symmetric( ? Container(
horizontal: 40), // Left & Right space color: Color(0x98FFFCE5), // Semi-transparent background
child: LinearProgressIndicator( child: Column(
minHeight: 5, // Adjust thickness mainAxisAlignment: MainAxisAlignment.center,
backgroundColor: children: [
Colors.grey[100], // Optional: Background color Container(
valueColor: AlwaysStoppedAnimation<Color>( margin: EdgeInsets.symmetric(
Color(0xFFAA8E83)), // Loader color horizontal: 40), // Left & Right space
child: LinearProgressIndicator(
minHeight: 5, // Adjust thickness
backgroundColor:
Colors.grey[100], // Optional: Background color
valueColor: AlwaysStoppedAnimation<Color>(
Color(0xFFAA8E83)), // Loader color
),
), ),
), ],
],
),
)
: Column(
children: [
TabBarHeader(
tabs: tabs,
selectedIndex: selectedTabIndex,
onTabSelected: (index) {
setState(() {
selectedTabIndex = index;
});
},
), ),
Expanded( )
child: selectedTabIndex == 0 : Column(
? (bookmarks.isNotEmpty children: [
? SingleChildScrollView( TabBarHeader(
child: Column( tabs: tabs,
children: selectedIndex: selectedTabIndex,
List.generate(transformedList.length, (i) { onTabSelected: (index) {
final mainTopic = transformedList[i]; setState(() {
print('oustside1 $mainTopic'); selectedTabIndex = index;
final list = });
List.from(mainTopic['SubTopic'] ?? []); },
print('oustside2 $list'); ),
return CustomExpandableTile( Expanded(
index: i, child: selectedTabIndex == 0
isExpanded: expandedIndex == i, ? (bookmarks.isNotEmpty
onTap: (int index) { ? SingleChildScrollView(
// 🔹 Expecting an index child: Column(
setState(() { children:
expandedIndex = (expandedIndex == index) List.generate(transformedList.length, (i) {
? null final mainTopic = transformedList[i];
: index; print('oustside1 $mainTopic');
}); final list =
}, List.from(mainTopic['SubTopic'] ?? []);
title: print('oustside2 $list');
mainTopic['main_topic'] ?? 'No Topic', return CustomExpandableTile(
childWidget: Container( index: i,
decoration: BoxDecoration( isExpanded: expandedIndex == i,
color: Colors.white, onTap: (int index) {
// borderRadius: BorderRadius.all(Radius.circular(20)) // 🔹 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( child: GridView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
gridDelegate: gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount( const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, crossAxisCount: 2,
@ -454,108 +549,20 @@ class _BookMarkState extends ConsumerState<BookMark> {
mainAxisSpacing: 10.0, mainAxisSpacing: 10.0,
mainAxisExtent: 100, mainAxisExtent: 100,
), ),
itemCount: list.length, itemCount: filteredBookmarks.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return _buildBoxes( return _buildBox(
mainTopic['SubTopic'][index], filteredBookmarks[index], context);
context,
mainTopic['valueColor']);
}, },
), ),
), ),
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);
},
),
),
],
),
),
),
],
),
); );
} }

View File

@ -41,147 +41,154 @@ class _ContactState extends ConsumerState<Contact> {
await _userService.updateLanguage(localeCode); await _userService.updateLanguage(localeCode);
}); });
return BaseScaffold( return PopScope(
body: Container( canPop: false,
color: Colors.grey[200], onPopInvokedWithResult: (didPop, result) {
width: screenWidth, if (didPop) return;
padding: const EdgeInsets.all(16.0), context.go('/myhomepage');
child: SingleChildScrollView( },
child: Column( child: BaseScaffold(
children: [ body: Container(
buildContactCard( color: Colors.grey[200],
context, width: screenWidth,
title: 'DUBAI - EMIRATES TOWER -32ND FLOOR', padding: const EdgeInsets.all(16.0),
titleAr: 'دبي - أبراج الإمارات - الطابق 32', child: SingleChildScrollView(
details: [ child: Column(
{ children: [
'icon': EnquiryAssetIconPath.building, buildContactCard(
'text': 'Office : Dubai - Emirates Tower -32nd Floor', context,
'textAr': 'المقر الرئيسي : دبي - أبراج الإمارات - الطابق 32' title: 'DUBAI - EMIRATES TOWER -32ND FLOOR',
}, titleAr: 'دبي - أبراج الإمارات - الطابق 32',
{ details: [
'icon': EnquiryAssetIconPath.phone, {
'text': 'Tel : 00971 46080000', 'icon': EnquiryAssetIconPath.building,
'textAr': 'الهاتف : 0097146080000' 'text': 'Office : Dubai - Emirates Tower -32nd Floor',
}, 'textAr': 'المقر الرئيسي : دبي - أبراج الإمارات - الطابق 32'
{ },
'icon': EnquiryAssetIconPath.fax, {
'text': 'Fax : 0097143273535', 'icon': EnquiryAssetIconPath.phone,
'textAr': 'فاكس : 0097143273535' 'text': 'Tel : 00971 46080000',
}, 'textAr': 'الهاتف : 0097146080000'
{ },
'icon': EnquiryAssetIconPath.map, {
'text': 'P.O.Box : 127000 Dubai', 'icon': EnquiryAssetIconPath.fax,
'textAr': 'ص.ب: : 127000 دبي' 'text': 'Fax : 0097143273535',
}, 'textAr': 'فاكس : 0097143273535'
{ },
'icon': EnquiryAssetIconPath.at, {
'text': 'Email Address : info@fcsc.gov.ae', 'icon': EnquiryAssetIconPath.map,
'textAr': 'البريد الإلكتروني : info@fcsc.gov.ae' 'text': 'P.O.Box : 127000 Dubai',
}, 'textAr': 'ص.ب: : 127000 دبي'
{ },
'icon': EnquiryAssetIconPath.map, {
'text': 'Latitude : 25.223926', 'icon': EnquiryAssetIconPath.at,
'textAr': 'خط العرض : 25.223926' 'text': 'Email Address : info@fcsc.gov.ae',
}, 'textAr': 'البريد الإلكتروني : info@fcsc.gov.ae'
{ },
'icon': EnquiryAssetIconPath.map, {
'text': 'Longitude : 55.350526', 'icon': EnquiryAssetIconPath.map,
'textAr': 'خط الطول : 55.350526' 'text': 'Latitude : 25.223926',
}, 'textAr': 'خط العرض : 25.223926'
], },
), {
const SizedBox(height: 10), 'icon': EnquiryAssetIconPath.map,
buildContactCard( 'text': 'Longitude : 55.350526',
context, 'textAr': 'خط الطول : 55.350526'
title: 'MEDIA SECTION', },
titleAr: 'قسم الاعلام', ],
details: [ ),
{ const SizedBox(height: 10),
'icon': EnquiryAssetIconPath.building, buildContactCard(
'text': 'Office : Media Section', context,
'textAr': 'المقر الرئيسي : قسم الاعلام' title: 'MEDIA SECTION',
}, titleAr: 'قسم الاعلام',
{ details: [
'icon': EnquiryAssetIconPath.phone, {
'text': 'Tel : 00971 46080000', 'icon': EnquiryAssetIconPath.building,
'textAr': 'الهاتف : 0097146080000' 'text': 'Office : Media Section',
}, 'textAr': 'المقر الرئيسي : قسم الاعلام'
{ },
'icon': EnquiryAssetIconPath.fax, {
'text': 'Fax : 0097143273535', 'icon': EnquiryAssetIconPath.phone,
'textAr': 'فاكس : 0097143273535' 'text': 'Tel : 00971 46080000',
}, 'textAr': 'الهاتف : 0097146080000'
{ },
'icon': EnquiryAssetIconPath.map, {
'text': 'P.O.Box : 127000 Dubai', 'icon': EnquiryAssetIconPath.fax,
'textAr': 'ص.ب: : 127000 دبي' 'text': 'Fax : 0097143273535',
}, 'textAr': 'فاكس : 0097143273535'
{ },
'icon': EnquiryAssetIconPath.at, {
'text': 'Email Address : GCO@fcsc.gov.ae', 'icon': EnquiryAssetIconPath.map,
'textAr': 'البريد الإلكتروني : GCO@fcsc.gov.ae' 'text': 'P.O.Box : 127000 Dubai',
}, 'textAr': 'ص.ب: : 127000 دبي'
{ },
'icon': EnquiryAssetIconPath.map, {
'text': 'Latitude : 25.223926', 'icon': EnquiryAssetIconPath.at,
'textAr': 'خط العرض : 25.223926' 'text': 'Email Address : GCO@fcsc.gov.ae',
}, 'textAr': 'البريد الإلكتروني : GCO@fcsc.gov.ae'
{ },
'icon': EnquiryAssetIconPath.map, {
'text': 'Longitude : 55.350526', 'icon': EnquiryAssetIconPath.map,
'textAr': 'خط الطول : 55.350526' 'text': 'Latitude : 25.223926',
}, 'textAr': 'خط العرض : 25.223926'
], },
), {
const SizedBox(height: 10), 'icon': EnquiryAssetIconPath.map,
buildContactCard( 'text': 'Longitude : 55.350526',
context, 'textAr': 'خط الطول : 55.350526'
title: 'SGDS', },
titleAr: 'أهداف التنمية المستدامة', ],
details: [ ),
{ const SizedBox(height: 10),
'icon': EnquiryAssetIconPath.building, buildContactCard(
'text': 'Office : SDGs', context,
'textAr': 'المقر الرئيسي : أهداف التنمية المستدامة' title: 'SGDS',
}, titleAr: 'أهداف التنمية المستدامة',
{ details: [
'icon': EnquiryAssetIconPath.phone, {
'text': 'Tel : 00971 46080000', 'icon': EnquiryAssetIconPath.building,
'textAr': 'الهاتف : 0097146080000' 'text': 'Office : SDGs',
}, 'textAr': 'المقر الرئيسي : أهداف التنمية المستدامة'
{ },
'icon': EnquiryAssetIconPath.fax, {
'text': 'Fax : 0097143273535', 'icon': EnquiryAssetIconPath.phone,
'textAr': 'فاكس : 0097143273535' 'text': 'Tel : 00971 46080000',
}, 'textAr': 'الهاتف : 0097146080000'
{ },
'icon': EnquiryAssetIconPath.map, {
'text': 'P.O.Box : 127000 Dubai', 'icon': EnquiryAssetIconPath.fax,
'textAr': 'ص.ب: : 127000 دبي' 'text': 'Fax : 0097143273535',
}, 'textAr': 'فاكس : 0097143273535'
{ },
'icon': EnquiryAssetIconPath.at, {
'text': 'Email Address : sdgs@fcsc.gov.ae', 'icon': EnquiryAssetIconPath.map,
'textAr': 'البريد الإلكتروني : sdgs@fcsc.gov.ae' 'text': 'P.O.Box : 127000 Dubai',
}, 'textAr': 'ص.ب: : 127000 دبي'
{ },
'icon': EnquiryAssetIconPath.map, {
'text': 'Latitude : 25.223926', 'icon': EnquiryAssetIconPath.at,
'textAr': 'خط العرض : 25.223926' 'text': 'Email Address : sdgs@fcsc.gov.ae',
}, 'textAr': 'البريد الإلكتروني : sdgs@fcsc.gov.ae'
{ },
'icon': EnquiryAssetIconPath.map, {
'text': 'Longitude : 55.350526', 'icon': EnquiryAssetIconPath.map,
'textAr': 'خط الطول : 55.350526' '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', 'اتصل بنا')),
); );
} }

View File

@ -4,6 +4,7 @@ import 'dart:io';
import 'package:external_repos/external_repos.dart'; import 'package:external_repos/external_repos.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
@ -404,9 +405,9 @@ class _EditProfileState extends ConsumerState<EditProfile> {
print('ShowConfirmationuser response - $response '); print('ShowConfirmationuser response - $response ');
// Handle response // Handle response
if (response.statusCode == 200) { if (response.statusCode == 200) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar( // ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text( // content: Text(
AppLocalizations.of(context)!.profile_updated_successfully))); // AppLocalizations.of(context)!.profile_updated_successfully)));
if (changedPreferredLanguage == 1) { if (changedPreferredLanguage == 1) {
print(_selectedLanguage); print(_selectedLanguage);
preferredLang = _selectedLanguage == 'English' ? 'en' : 'ar'; preferredLang = _selectedLanguage == 'English' ? 'en' : 'ar';
@ -421,6 +422,12 @@ class _EditProfileState extends ConsumerState<EditProfile> {
isLoader = false; isLoader = false;
}); });
SchedulerBinding.instance.addPostFrameCallback((_) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(AppLocalizations.of(context)!.profile_updated_successfully)),
);
});
// print('ShowConfirmation userData - $userData '); // print('ShowConfirmation userData - $userData ');
context.go('/myhomepage'); context.go('/myhomepage');
} else { } else {

View File

@ -989,10 +989,8 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
), ),
ListTile( ListTile(
leading: Icon(Icons.mail_outlined), leading: Icon(Icons.mail_outlined),
title: Text( title: Text(context.translate('Contact Us', 'اتصل بنا'),),
context.translate('Contact Us', 'اتصل بنا'), onTap: () => context.go('/contact'),
),
onTap: () => context.push('/contact'),
), ),
if (userId != 'guest') if (userId != 'guest')
ListTile( ListTile(