FIX-PIE-BAR CHART CHANGES

This commit is contained in:
venbaittech 2025-08-21 15:49:34 +05:30
parent 65a7f87363
commit e6a2d60f09
12 changed files with 1691 additions and 1470 deletions

View File

@ -247,7 +247,7 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
if (isLoading) { if (isLoading) {
return Container( return Container(
color: Color(0x98FFFCE5), color: isDarkTheme ? Colors.black : Colors.white,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@ -291,7 +291,7 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
hintText: AppLocalizations.of(context)!.search, hintText: AppLocalizations.of(context)!.search,
hintStyle: TextStyle( hintStyle: TextStyle(
color: color:
isDarkTheme ? Color(0xFF898C81) : Color(0xFF898C81), isDarkTheme ? Color(0xFF898C81) : Color(0xFF898C81),
fontFamily: context.translate('Roboto', 'NotoKufi'), fontFamily: context.translate('Roboto', 'NotoKufi'),
fontSize: 18, fontSize: 18,
// height: 1.8, // height: 1.8,
@ -314,16 +314,16 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
), ),
suffixIcon: _searchController.text.isNotEmpty suffixIcon: _searchController.text.isNotEmpty
? IconButton( ? IconButton(
icon: Icon( icon: Icon(
Icons.clear, Icons.clear,
color: Color(0xFFAA8E83), color: Color(0xFFAA8E83),
size: 18, size: 18,
), ),
onPressed: () { onPressed: () {
_searchController.clear(); _searchController.clear();
filterData(''); filterData('');
}, },
) )
: null, : null,
// contentPadding: EdgeInsets.symmetric(vertical: 12, horizontal: 18.0), // contentPadding: EdgeInsets.symmetric(vertical: 12, horizontal: 18.0),
border: InputBorder.none, border: InputBorder.none,
@ -339,38 +339,38 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
child: filteredData.isEmpty child: filteredData.isEmpty
? Center(child: Text("No data available")) ? Center(child: Text("No data available"))
: ListView( : ListView(
children: [ children: [
...filteredData.map<Widget>((mainTopic) { ...filteredData.map<Widget>((mainTopic) {
String colorPattern = mainTopic['color_pattern']; String colorPattern = mainTopic['color_pattern'];
Color backgroundColor = Color backgroundColor =
Color(int.parse(colorPattern)); Color(int.parse(colorPattern));
Color borderColor = backgroundColor; Color borderColor = backgroundColor;
int index = filteredData.indexOf(mainTopic); int index = filteredData.indexOf(mainTopic);
return CustomExpandableTile( return CustomExpandableTile(
index: index, index: index,
isExpanded: expandedIndex == index, isExpanded: expandedIndex == index,
onTap: (index) { onTap: (index) {
setState(() { setState(() {
expandedIndex = expandedIndex =
(expandedIndex == index) ? null : index; (expandedIndex == index) ? null : index;
}); });
}, },
title: mainTopic['main_topic'], title: mainTopic['main_topic'],
titleBackgroundColor: backgroundColor, titleBackgroundColor: backgroundColor,
// currentTheme: currentTheme, // currentTheme: currentTheme,
children: _buildSubTopics( children: _buildSubTopics(
mainTopic['sub_topics'] ?? [], mainTopic['sub_topics'] ?? [],
mywidth, mywidth,
myheight, myheight,
borderColor, borderColor,
colorPattern, colorPattern,
mainTopic['main_topic'], mainTopic['main_topic'],
isDarkTheme), isDarkTheme),
); );
}), }),
], ],
), ),
), ),
], ],
), ),
@ -390,13 +390,13 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
return subTopics return subTopics
.map<Widget>((subTopic) => Column( .map<Widget>((subTopic) => Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
buildCategoryTitle(subTopic['sub_topic'], isDarkTheme), buildCategoryTitle(subTopic['sub_topic'], isDarkTheme),
..._buildDataSetCards(subTopic['tile_data'] ?? [], myWidth, ..._buildDataSetCards(subTopic['tile_data'] ?? [], myWidth,
borderColor, colorPattern, mainTopic), borderColor, colorPattern, mainTopic),
], ],
)) ))
.toList(); .toList();
} }
@ -417,7 +417,7 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: rowItems.map<Widget>((data) { children: rowItems.map<Widget>((data) {
final cardWidth = final cardWidth =
rowItems.length == 1 ? myWidth : (myWidth - 18) / 1.6; rowItems.length == 1 ? myWidth : (myWidth - 18) / 1.6;
return Expanded( return Expanded(
child: Padding( child: Padding(
@ -665,19 +665,19 @@ class _CustomExpandableTileState extends ConsumerState<CustomExpandableTile> {
height: widget.isExpanded ? myheight * 0.52 : 0, height: widget.isExpanded ? myheight * 0.52 : 0,
child: widget.isExpanded child: widget.isExpanded
? SingleChildScrollView( ? SingleChildScrollView(
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: isDarkTheme color: isDarkTheme
? Color(0xFF000000) ? Color(0xFF000000)
: Color(0xFFFFFFFF), : Color(0xFFFFFFFF),
// borderRadius: BorderRadius.all(Radius.circular(20)) // borderRadius: BorderRadius.all(Radius.circular(20))
), ),
padding: const EdgeInsets.all(1), padding: const EdgeInsets.all(1),
child: Column( child: Column(
children: widget.children, children: widget.children,
), ),
), ),
) )
: null, : null,
), ),
), ),

View File

@ -63,8 +63,7 @@ class _ResetPasswordScreenState extends State<Changepassword> {
// Proceed with OTP request // Proceed with OTP request
final otpResponse = await http.post( final otpResponse = await http.post(
Uri.parse( Uri.parse('$apiUrl/api/collections/otp_requests/records'),
'$apiUrl/api/collections/otp_requests/records'),
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Authorization': 'Bearer $authToken', 'Authorization': 'Bearer $authToken',
@ -260,12 +259,14 @@ class _ResetPasswordScreenState extends State<Changepassword> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
if (_isLoading) if (_isLoading)
const SizedBox( Container(
width: 20, child: const SizedBox(
height: 20, width: 20,
child: CircularProgressIndicator( height: 20,
color: Colors.white, child: CircularProgressIndicator(
strokeWidth: 2, color: Colors.white,
strokeWidth: 2,
),
), ),
) )
else ...[ else ...[

View File

@ -26,9 +26,9 @@ class CreateNewPw extends ConsumerStatefulWidget {
const CreateNewPw( const CreateNewPw(
{Key? key, {Key? key,
required this.userId, required this.userId,
required this.email, required this.email,
required this.keyParam}); required this.keyParam});
@override @override
ConsumerState<CreateNewPw> createState() => _CreateNewPwState(); ConsumerState<CreateNewPw> createState() => _CreateNewPwState();
@ -125,7 +125,7 @@ class _CreateNewPwState extends ConsumerState<CreateNewPw> {
try { try {
// Attempt to authenticate the user with email and password // Attempt to authenticate the user with email and password
final authResponse = final authResponse =
await _pb.collection('users').authWithPassword(email, password); await _pb.collection('users').authWithPassword(email, password);
if (authResponse != null) { if (authResponse != null) {
print('Password match successful for email: $email'); print('Password match successful for email: $email');
@ -155,20 +155,20 @@ class _CreateNewPwState extends ConsumerState<CreateNewPw> {
}; };
bool isPasswordValid = bool isPasswordValid =
await verifyUserPassword(widget.email, oldPassword); await verifyUserPassword(widget.email, oldPassword);
print(isPasswordValid); print(isPasswordValid);
if (isPasswordValid) { if (isPasswordValid) {
// Update password // Update password
await _pb.collection('users').update( await _pb.collection('users').update(
userId, userId,
body: { body: {
'password': newPassword, 'password': newPassword,
'passwordConfirm': newPassword, 'passwordConfirm': newPassword,
}, },
headers: headers, headers: headers,
); );
setState(() { setState(() {
isLoading = false; isLoading = false;
@ -181,9 +181,9 @@ class _CreateNewPwState extends ConsumerState<CreateNewPw> {
AppLocalizations.of(context)!.password_update_successfully, AppLocalizations.of(context)!.password_update_successfully,
style: TextStyle( style: TextStyle(
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
)), )),
), ),
), ),
); );
@ -206,9 +206,9 @@ class _CreateNewPwState extends ConsumerState<CreateNewPw> {
AppLocalizations.of(context)!.your_old_password_incorrect, AppLocalizations.of(context)!.your_old_password_incorrect,
style: TextStyle( style: TextStyle(
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
)), )),
), ),
backgroundColor: Colors.red, backgroundColor: Colors.red,
), ),
@ -226,9 +226,9 @@ class _CreateNewPwState extends ConsumerState<CreateNewPw> {
'Failed to update password: $e', 'فشل في تحديث كلمة المرور'), 'Failed to update password: $e', 'فشل في تحديث كلمة المرور'),
style: TextStyle( style: TextStyle(
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
)), )),
), ),
backgroundColor: Colors.red, backgroundColor: Colors.red,
), ),
@ -274,13 +274,15 @@ class _CreateNewPwState extends ConsumerState<CreateNewPw> {
child: SafeArea( child: SafeArea(
child: _isPasswordUpdated child: _isPasswordUpdated
? _buildSuccessContent( ? _buildSuccessContent(
screenHeight, screenWidth, isDarkTheme) screenHeight, screenWidth, isDarkTheme)
: _buildPasswordForm(ref, screenHeight, screenWidth), : _buildPasswordForm(ref, screenHeight, screenWidth),
), ),
), ),
if (isLoading) if (isLoading)
Container( Container(
color: Color(0x98FFFCE5), // Semi-transparent background color: isDarkTheme
? Colors.black
: Colors.white, // Semi-transparent background
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@ -290,7 +292,7 @@ class _CreateNewPwState extends ConsumerState<CreateNewPw> {
child: LinearProgressIndicator( child: LinearProgressIndicator(
minHeight: 5, // Adjust thickness minHeight: 5, // Adjust thickness
backgroundColor: backgroundColor:
Colors.grey[100], // Optional: Background color Colors.grey[100], // Optional: Background color
valueColor: AlwaysStoppedAnimation<Color>( valueColor: AlwaysStoppedAnimation<Color>(
Color(0xFFAA8E83)), // Loader color Color(0xFFAA8E83)), // Loader color
), ),
@ -403,7 +405,7 @@ class _CreateNewPwState extends ConsumerState<CreateNewPw> {
'NotoKufi', 'NotoKufi',
), ),
fontSize: fontSize:
passwordLocale?.languageCode == 'ar' ? 14 : 15, passwordLocale?.languageCode == 'ar' ? 14 : 15,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0xFF898C81)), color: Color(0xFF898C81)),
), ),
@ -416,7 +418,7 @@ class _CreateNewPwState extends ConsumerState<CreateNewPw> {
'NotoKufi', 'NotoKufi',
), ),
fontSize: fontSize:
passwordLocale?.languageCode == 'ar' ? 14 : 15, passwordLocale?.languageCode == 'ar' ? 14 : 15,
color: Color(0xFF898C81), color: Color(0xFF898C81),
fontWeight: FontWeight.w700), fontWeight: FontWeight.w700),
), ),
@ -721,7 +723,7 @@ class _CreateNewPwState extends ConsumerState<CreateNewPw> {
'NotoKufi', 'NotoKufi',
), ),
fontSize: fontSize:
passwordLocale?.languageCode == 'ar' ? 14 : 18, passwordLocale?.languageCode == 'ar' ? 14 : 18,
color: Colors.white), color: Colors.white),
), ),
SizedBox(width: 2), SizedBox(width: 2),

View File

@ -7,6 +7,7 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:uae_stat/config/api_config.dart'; import 'package:uae_stat/config/api_config.dart';
import 'package:uae_stat/config/connectivity_provider.dart'; import 'package:uae_stat/config/connectivity_provider.dart';
import 'package:uae_stat/config/my_router.dart'; import 'package:uae_stat/config/my_router.dart';
import 'package:uae_stat/config/theme/theme_provider.dart';
import 'package:uae_stat/domain/use_cases/language.dart'; import 'package:uae_stat/domain/use_cases/language.dart';
import 'package:uae_stat/infrastructure/data/p_auth_repo.dart'; import 'package:uae_stat/infrastructure/data/p_auth_repo.dart';
import 'package:uae_stat/infrastructure/services/img_asset_paths/banner_asset_path.dart'; import 'package:uae_stat/infrastructure/services/img_asset_paths/banner_asset_path.dart';
@ -191,13 +192,14 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
// throw Exception("User not found"); // throw Exception("User not found");
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text('User not found', content: Text(
'User not found',
style: TextStyle( style: TextStyle(
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
) )),
),), ),
backgroundColor: Colors.red, backgroundColor: Colors.red,
), ),
); );
@ -222,15 +224,14 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: content: Text(
Text(AppLocalizations.of(context)!.password_update_successfully, AppLocalizations.of(context)!.password_update_successfully,
style: TextStyle( style: TextStyle(
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
) )),
), ),
),
backgroundColor: Colors.green, backgroundColor: Colors.green,
), ),
); );
@ -243,13 +244,13 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text('Failed to update password: $e', content: Text(
'Failed to update password: $e',
style: TextStyle( style: TextStyle(
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
) )),
),
), ),
backgroundColor: Colors.red, backgroundColor: Colors.red,
), ),
@ -277,6 +278,12 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
} }
}); });
// final themeMode = ref.read(themeProvider);
// final themeMode = ThemeMode.dark;
final isDarkTheme = ref.read(themeProvider) == ThemeMode.dark ||
(ref.read(themeProvider) == ThemeMode.system &&
MediaQuery.of(context).platformBrightness == Brightness.dark);
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
body: Stack(children: [ body: Stack(children: [
@ -289,7 +296,9 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
), ),
if (isLoading) if (isLoading)
Container( Container(
color: Color(0x98FFFCE5), // Semi-transparent background color: isDarkTheme
? Colors.black
: Colors.white, // Semi-transparent background
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@ -386,7 +395,6 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
'NotoKufi', 'NotoKufi',
), ),
fontWeight: FontWeight.w300, fontWeight: FontWeight.w300,
), ),
), ),
SizedBox(height: 10), SizedBox(height: 10),
@ -404,11 +412,10 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
passwordLocale?.languageCode == 'ar' ? 14 : 15, passwordLocale?.languageCode == 'ar' ? 14 : 15,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0xFF898C81), color: Color(0xFF898C81),
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
) )),
),
), ),
TextSpan( TextSpan(
text: context.translate('from Previously Used Password', text: context.translate('from Previously Used Password',
@ -435,8 +442,8 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
hintText: AppLocalizations.of(context)!.enter_new_password, hintText: AppLocalizations.of(context)!.enter_new_password,
// prefixIcon: Icon(Icons.lock, color: Colors.blue), // prefixIcon: Icon(Icons.lock, color: Colors.blue),
hintStyle: TextStyle( hintStyle: TextStyle(
color: Color(0xFFC3C6CB), color: Color(0xFFC3C6CB),
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
@ -518,8 +525,8 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
// hintText: 'Confirm new password', // hintText: 'Confirm new password',
hintText: AppLocalizations.of(context)!.confirm_new_password, hintText: AppLocalizations.of(context)!.confirm_new_password,
hintStyle: TextStyle( hintStyle: TextStyle(
color: Color(0xFFC3C6CB), color: Color(0xFFC3C6CB),
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
@ -629,11 +636,7 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
) )),
),
), ),
SizedBox(width: 2), SizedBox(width: 2),
Icon( Icon(
@ -681,14 +684,13 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
AppLocalizations.of(context)!.password_changed_successfully, AppLocalizations.of(context)!.password_changed_successfully,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Color(0xFF414042), color: Color(0xFF414042),
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
) )),
),
), ),
SizedBox(height: 20), SizedBox(height: 20),
ElevatedButton( ElevatedButton(

View File

@ -122,7 +122,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
final themeMode = (isDark ? 'dark' : 'light'); final themeMode = (isDark ? 'dark' : 'light');
fetchChartData(widget.dataSets, locale?.languageCode ?? 'en', widget.kpi, fetchChartData(widget.dataSets, locale?.languageCode ?? 'en', widget.kpi,
widget.filter_data, themeMode) widget.filter_data, themeMode)
.then((_) { .then((_) {
if (_tabsData.isNotEmpty) { if (_tabsData.isNotEmpty) {
// Call onTabSelected for the first tab // Call onTabSelected for the first tab
@ -196,9 +196,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
AppLocalizations.of(context)!.added_to_Bookmark, AppLocalizations.of(context)!.added_to_Bookmark,
style: TextStyle( style: TextStyle(
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
)), )),
), ),
duration: Duration(seconds: 2), duration: Duration(seconds: 2),
), ),
@ -212,9 +212,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
AppLocalizations.of(context)!.failed_To_Remove, AppLocalizations.of(context)!.failed_To_Remove,
style: TextStyle( style: TextStyle(
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
)), )),
), ),
// backgroundColor: Color(0xFFEB5F24), // backgroundColor: Color(0xFFEB5F24),
duration: Duration(seconds: 2), duration: Duration(seconds: 2),
@ -247,9 +247,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
AppLocalizations.of(context)!.removed_from_Bookmark, AppLocalizations.of(context)!.removed_from_Bookmark,
style: TextStyle( style: TextStyle(
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
)), )),
), ),
duration: Duration(seconds: 2), duration: Duration(seconds: 2),
), ),
@ -263,9 +263,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
'Failed to Remove', 'Failed to Remove',
style: TextStyle( style: TextStyle(
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
)), )),
), ),
// backgroundColor: Color(0xFFEB5F24), // backgroundColor: Color(0xFFEB5F24),
duration: Duration(seconds: 2), duration: Duration(seconds: 2),
@ -364,7 +364,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
foregroundColor: Colors.white, foregroundColor: Colors.white,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: borderRadius:
BorderRadius.circular(10.0), // Set text color BorderRadius.circular(10.0), // Set text color
), ),
), ),
child: Text( child: Text(
@ -475,7 +475,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
foregroundColor: Colors.white, foregroundColor: Colors.white,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: borderRadius:
BorderRadius.circular(10.0), // Set text color BorderRadius.circular(10.0), // Set text color
), ),
), ),
child: Text( child: Text(
@ -514,7 +514,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Future<double?> _getWidget() async { Future<double?> _getWidget() async {
await Future.delayed(Duration(milliseconds: 50)); // Ensures widget is built await Future.delayed(Duration(milliseconds: 50)); // Ensures widget is built
final RenderBox? box = final RenderBox? box =
cardKey.currentContext?.findRenderObject() as RenderBox?; cardKey.currentContext?.findRenderObject() as RenderBox?;
if (box != null) { if (box != null) {
final Offset position = box.localToGlobal(Offset.zero); final Offset position = box.localToGlobal(Offset.zero);
@ -705,7 +705,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
.state = true; .state = true;
ref ref
.read(previousHomeTourProvider .read(previousHomeTourProvider
.notifier) .notifier)
.state = false; .state = false;
tutorialCoachMark.finish(); tutorialCoachMark.finish();
} }
@ -736,7 +736,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
.state = true; .state = true;
ref ref
.read(previousHomeTourProvider .read(previousHomeTourProvider
.notifier) .notifier)
.state = false; .state = false;
tutorialCoachMark.finish(); tutorialCoachMark.finish();
} else { } else {
@ -1223,11 +1223,11 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
} else { } else {
ref ref
.read(previousChartsTourProvider .read(previousChartsTourProvider
.notifier) .notifier)
.state = true; .state = true;
ref ref
.read(previousHomeTourProvider .read(previousHomeTourProvider
.notifier) .notifier)
.state = false; .state = false;
tutorialCoachMark.finish(); tutorialCoachMark.finish();
} }
@ -1257,11 +1257,11 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
if (locale.languageCode == 'ar') { if (locale.languageCode == 'ar') {
ref ref
.read(previousChartsTourProvider .read(previousChartsTourProvider
.notifier) .notifier)
.state = true; .state = true;
ref ref
.read(previousHomeTourProvider .read(previousHomeTourProvider
.notifier) .notifier)
.state = false; .state = false;
tutorialCoachMark.finish(); tutorialCoachMark.finish();
} else { } else {
@ -1396,8 +1396,8 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
String formattedKpi = kpi String formattedKpi = kpi
.split('_') // Split by underscore .split('_') // Split by underscore
.map((word) => word.isNotEmpty .map((word) => word.isNotEmpty
? word[0].toUpperCase() + word.substring(1) ? word[0].toUpperCase() + word.substring(1)
: '') // Capitalize : '') // Capitalize
.join(' '); // Join words with space .join(' '); // Join words with space
return {'id': kpi, 'name': tabHeading, 'order': tabOrder.toString()}; return {'id': kpi, 'name': tabHeading, 'order': tabOrder.toString()};
}).toList(); }).toList();
@ -1435,7 +1435,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
selectedFiltersApi = filter_data.map<Map<String, dynamic>>((entry) { selectedFiltersApi = filter_data.map<Map<String, dynamic>>((entry) {
if (entry is Map<dynamic, dynamic>) { if (entry is Map<dynamic, dynamic>) {
return entry.map<String, dynamic>( return entry.map<String, dynamic>(
(key, value) => MapEntry(key.toString(), value)); (key, value) => MapEntry(key.toString(), value));
} }
return {}; return {};
}).toList(); }).toList();
@ -1503,12 +1503,12 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
// Transform the selectedFilters list into the required format // Transform the selectedFilters list into the required format
formattedFilters = selectedFilters formattedFilters = selectedFilters
// .where((filter) => filter['filter_data'] != null && filter['filter_data'].isNotEmpty) // .where((filter) => filter['filter_data'] != null && filter['filter_data'].isNotEmpty)
.map((filter) { .map((filter) {
return { return {
'filter_key': filter['filter_key'], 'filter_key': filter['filter_key'],
'filter_data': 'filter_data':
filter['filter_data'].map((item) => item.toString()).toList() filter['filter_data'].map((item) => item.toString()).toList()
}; };
}).toList(); }).toList();
@ -1516,7 +1516,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
// Convert to JSON format // Convert to JSON format
String selectedFormatFilters = String selectedFormatFilters =
jsonEncode({'kpi': tabWiseKpi, 'filter_data': formattedFilters}); jsonEncode({'kpi': tabWiseKpi, 'filter_data': formattedFilters});
print('Formatted Filters2: $selectedFormatFilters'); print('Formatted Filters2: $selectedFormatFilters');
final locale = ref.watch(localeProvider)?.languageCode ?? 'en'; final locale = ref.watch(localeProvider)?.languageCode ?? 'en';
@ -1599,8 +1599,8 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
if (kDebugMode) { if (kDebugMode) {
print( print(
"Selected year: ${selectedFilters.firstWhere((f) => f['filter_key'] == 'TIME_PERIOD', orElse: () => { "Selected year: ${selectedFilters.firstWhere((f) => f['filter_key'] == 'TIME_PERIOD', orElse: () => {
'filter_data': ['Unknown'] 'filter_data': ['Unknown']
})['filter_data']} - No data for chart: : $chartHeading"); })['filter_data']} - No data for chart: : $chartHeading");
} }
// Add the complete chart data to the filteredData list // Add the complete chart data to the filteredData list
@ -1686,11 +1686,11 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
// Initialize selected filters structure from the stored value, if exists // Initialize selected filters structure from the stored value, if exists
List<Map<String, dynamic>> selectedFilters = List<Map<String, dynamic>> selectedFilters =
selectedFiltersStorage.isNotEmpty selectedFiltersStorage.isNotEmpty
? List.from(selectedFiltersStorage) // Use stored filters ? List.from(selectedFiltersStorage) // Use stored filters
: filters.map((filter) { : filters.map((filter) {
return {"filter_key": filter["filter_key"], "filter_data": []}; return {"filter_key": filter["filter_key"], "filter_data": []};
}).toList(); // Or initialize empty filters }).toList(); // Or initialize empty filters
print('selectedFiltersStoragedrgt- $selectedFiltersStorage'); print('selectedFiltersStoragedrgt- $selectedFiltersStorage');
@ -1769,7 +1769,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
final filterKey = filter["filter_key"]; final filterKey = filter["filter_key"];
final filterData = filter["filter_data"]; final filterData = filter["filter_data"];
final filter_text_and_order = final filter_text_and_order =
filter["filter_text_and_order"]; filter["filter_text_and_order"];
final fieldOrder = filter_text_and_order['order']; final fieldOrder = filter_text_and_order['order'];
return StatefulBuilder( return StatefulBuilder(
@ -1808,7 +1808,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
return StatefulBuilder( return StatefulBuilder(
builder: (context, dialogSetState) { builder: (context, dialogSetState) {
final locale = final locale =
ref.watch(localeProvider); ref.watch(localeProvider);
print('localelocale $locale'); print('localelocale $locale');
return AlertDialog( return AlertDialog(
@ -1817,10 +1817,10 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
"${context.translate(filter_text_and_order['en'], filter_text_and_order['ar'])}", "${context.translate(filter_text_and_order['en'], filter_text_and_order['ar'])}",
style: TextStyle( style: TextStyle(
fontFamily: fontFamily:
context.translate( context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
)), )),
), ),
content: SingleChildScrollView( content: SingleChildScrollView(
child: ListBody( child: ListBody(
@ -1832,12 +1832,12 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
style: TextStyle( style: TextStyle(
fontFamily: context fontFamily: context
.translate( .translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
)), )),
), ),
value: selectedFilter[ value: selectedFilter[
"filter_data"] "filter_data"]
.contains(value), .contains(value),
onChanged: onChanged:
(bool? isChecked) { (bool? isChecked) {
@ -1845,11 +1845,11 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
if (isChecked == if (isChecked ==
true) { true) {
selectedFilter[ selectedFilter[
"filter_data"] "filter_data"]
.add(value); .add(value);
} else { } else {
selectedFilter[ selectedFilter[
"filter_data"] "filter_data"]
.remove(value); .remove(value);
} }
}); });
@ -1872,7 +1872,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
), ),
style: TextStyle( style: TextStyle(
fontFamily: fontFamily:
context.translate( context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
), ),
@ -1895,51 +1895,51 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
horizontal: 16.0, vertical: 12.0), horizontal: 16.0, vertical: 12.0),
decoration: BoxDecoration( decoration: BoxDecoration(
border: border:
Border.all(color: Color(0xFF7296BE)), Border.all(color: Color(0xFF7296BE)),
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
), ),
child: Wrap( child: Wrap(
spacing: 8.0, spacing: 8.0,
runSpacing: 4.0, runSpacing: 4.0,
children: selectedFilter["filter_data"] children: selectedFilter["filter_data"]
.isEmpty .isEmpty
? [ ? [
Text( Text(
// "${locale == 'ar' ? 'يختار ' : 'Select '}" // "${locale == 'ar' ? 'يختار ' : 'Select '}"
"${context.translate(filter_text_and_order['en'], filter_text_and_order['ar'])}", "${context.translate(filter_text_and_order['en'], filter_text_and_order['ar'])}",
style: TextStyle( style: TextStyle(
color: isDarkTheme color: isDarkTheme
? Color(0xFFFFFFFF) ? Color(0xFFFFFFFF)
: Colors.grey, : Colors.grey,
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
), ),
), ),
) )
] ]
: selectedFilter["filter_data"] : selectedFilter["filter_data"]
.map<Widget>((value) { .map<Widget>((value) {
return Chip( return Chip(
label: Text( label: Text(
value, value,
style: TextStyle( style: TextStyle(
fontFamily: fontFamily:
context.translate( context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
)), )),
), ),
// backgroundColor: Colors.white, // Default background color // backgroundColor: Colors.white, // Default background color
onDeleted: () { onDeleted: () {
setState(() { setState(() {
selectedFilter[ selectedFilter[
"filter_data"] "filter_data"]
.remove(value); .remove(value);
}); });
}, },
); );
}).toList(), }).toList(),
), ),
), ),
), ),
@ -1976,7 +1976,8 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
ref.watch(localeProvider)?.languageCode ?? 'en'; ref.watch(localeProvider)?.languageCode ?? 'en';
print('locale22- $locale'); print('locale22- $locale');
final isDark = ref.watch(themeProvider) == ThemeMode.dark || final isDark = ref.watch(themeProvider) ==
ThemeMode.dark ||
(ref.watch(themeProvider) == ThemeMode.system && (ref.watch(themeProvider) == ThemeMode.system &&
MediaQuery.of(context).platformBrightness == MediaQuery.of(context).platformBrightness ==
Brightness.dark); Brightness.dark);
@ -2015,7 +2016,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
overflow: overflow:
TextOverflow.ellipsis, // Prevents wrapping TextOverflow.ellipsis, // Prevents wrapping
maxLines: 1, // Ensures single line maxLines: 1, // Ensures single line
), ),
), ),
@ -2029,7 +2030,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
"Selected Filters before applying: $selectedFilters"); "Selected Filters before applying: $selectedFilters");
if (selectedFilters.every( if (selectedFilters.every(
(filter) => filter['filter_data'].isEmpty)) { (filter) => filter['filter_data'].isEmpty)) {
setState(() { setState(() {
isLoading = true; isLoading = true;
}); });
@ -2048,11 +2049,13 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
'en'; 'en';
print('locale22- $locale'); print('locale22- $locale');
final isDark = ref.watch(themeProvider) == ThemeMode.dark || final isDark =
(ref.watch(themeProvider) == ThemeMode.system && ref.watch(themeProvider) == ThemeMode.dark ||
MediaQuery.of(context) (ref.watch(themeProvider) ==
.platformBrightness == ThemeMode.system &&
Brightness.dark); MediaQuery.of(context)
.platformBrightness ==
Brightness.dark);
final themeMode = (isDark ? 'dark' : 'light'); final themeMode = (isDark ? 'dark' : 'light');
fetchChartData( fetchChartData(
@ -2099,7 +2102,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
overflow: overflow:
TextOverflow.ellipsis, // Prevents wrapping TextOverflow.ellipsis, // Prevents wrapping
maxLines: 1, // Ensures single line maxLines: 1, // Ensures single line
), ),
), ),
@ -2275,7 +2278,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
double calculateAspectRatio(int crossAxisCount, List<dynamic> cardData) { double calculateAspectRatio(int crossAxisCount, List<dynamic> cardData) {
// Determine a default aspect ratio based on the most common chart type in the list // Determine a default aspect ratio based on the most common chart type in the list
if (cardData.any((item) => if (cardData.any((item) =>
item['chart_type'] == 'total' || item['chart_type'] == 'average')) { item['chart_type'] == 'total' || item['chart_type'] == 'average')) {
// return crossAxisCount == 1 ? 0.2 : (crossAxisCount > 2 ? 0.9 : 0.7); // return crossAxisCount == 1 ? 0.2 : (crossAxisCount > 2 ? 0.9 : 0.7);
return crossAxisCount == 2 ? 1.0 : 0.7; // Larger Content return crossAxisCount == 2 ? 1.0 : 0.7; // Larger Content
// return crossAxisCount == 2 ? 1.5 : 0.9; // return crossAxisCount == 2 ? 1.5 : 0.9;
@ -2310,7 +2313,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
); );
final Uint8List? capturedImage = final Uint8List? capturedImage =
await screenshotController.captureFromWidget( await screenshotController.captureFromWidget(
Material(child: svgWidget), Material(child: svgWidget),
); );
@ -2414,7 +2417,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
widget.filter_data ?? []; widget.filter_data ?? [];
final String safeKpi = widget.kpi ?? ''; final String safeKpi = widget.kpi ?? '';
fetchChartData( fetchChartData(
widget.dataSets, localeCode, safeKpi, safeFilterData, themeString) widget.dataSets, localeCode, safeKpi, safeFilterData, themeString)
.then((_) { .then((_) {
print('DEBUG KPI: $safeKpi'); print('DEBUG KPI: $safeKpi');
@ -2461,7 +2464,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
/// 🔥 Call your API /// 🔥 Call your API
fetchChartData( fetchChartData(
widget.dataSets, localeCode, safeKpi, safeFilterData, themeString) widget.dataSets, localeCode, safeKpi, safeFilterData, themeString)
.then((_) { .then((_) {
print('DEBUG KPI: $safeKpi'); print('DEBUG KPI: $safeKpi');
print('TAB11: $currentTab'); print('TAB11: $currentTab');
@ -2486,10 +2489,10 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
mainTopic = chartScreenData['main_topic'] ?? ''; mainTopic = chartScreenData['main_topic'] ?? '';
int crossAxisCount = int crossAxisCount =
cardData.isNotEmpty ? (cardData.length / 2).ceil().clamp(1, 2) : 1; cardData.isNotEmpty ? (cardData.length / 2).ceil().clamp(1, 2) : 1;
final color = final color =
Color(int.parse(widget.bgColor.replaceFirst('0x', ''), radix: 16)); Color(int.parse(widget.bgColor.replaceFirst('0x', ''), radix: 16));
// Color bodyColor = Color( // Color bodyColor = Color(
// int.parse( // int.parse(
// (chartScreenData['body_color'] ?? '#898C81') // (chartScreenData['body_color'] ?? '#898C81')
@ -2501,7 +2504,8 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
// //
final bodyColor = Color( final bodyColor = Color(
int.parse( int.parse(
(chartScreenData['header_color'] ?? '#898C81').replaceFirst('#', '0xff'), (chartScreenData['header_color'] ?? '#898C81')
.replaceFirst('#', '0xff'),
), ),
); );
final chartHeader = chartScreenData['main_topic'] ?? ''; final chartHeader = chartScreenData['main_topic'] ?? '';
@ -2526,31 +2530,31 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
key: _scaffoldKey, key: _scaffoldKey,
title: (pageTitle == 'home') title: (pageTitle == 'home')
? Text( ? Text(
AppLocalizations.of(context)!.nav_home, AppLocalizations.of(context)!.nav_home,
style: TextStyle( style: TextStyle(
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
), ),
color: isDarkTheme ? Color(0xFFFFFFFF) : Color(0xFF000000), color: isDarkTheme ? Color(0xFFFFFFFF) : Color(0xFF000000),
), ),
) )
: Text( : Text(
context.translate( context.translate(
'UAE Numbers', 'UAE Numbers',
'أرقام الإمارات', 'أرقام الإمارات',
), ),
style: TextStyle( style: TextStyle(
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
),
color: isDarkTheme ? Color(0xFFFFFFFF) : Color(0xFF000000),
),
), ),
color: isDarkTheme ? Color(0xFFFFFFFF) : Color(0xFF000000),
),
),
// appbarColor: Color(int.parse(widget.bgColor)), // Example color // appbarColor: Color(int.parse(widget.bgColor)), // Example color
appbarColor: appbarColor:
isDarkTheme ? Colors.black : Colors.white, // Example color isDarkTheme ? Colors.black : Colors.white, // Example color
// appbarColor: Color(int.parse( // appbarColor: Color(int.parse(
// (chartScreenData['header_color'] ?? '#ffffff') // (chartScreenData['header_color'] ?? '#ffffff')
// .replaceFirst('#', '0xff'))), // .replaceFirst('#', '0xff'))),
@ -2566,7 +2570,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
child: Column( child: Column(
children: [ children: [
Container( Container(
// height: myheight / 5, // height: myheight / 5,
width: double.infinity, width: double.infinity,
// color: color, // color: color,
@ -2584,7 +2588,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(int.parse( color: Color(int.parse(
(chartScreenData['header_color'] ?? (chartScreenData['header_color'] ??
'#898C81') '#898C81')
.replaceFirst('#', '0xff'))), .replaceFirst('#', '0xff'))),
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.circular(20), topLeft: Radius.circular(20),
@ -2668,8 +2672,8 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
color: isBookmarked color: isBookmarked
? isDarkTheme ? isDarkTheme
? Colors.white.withAlpha(90) ? Colors.white.withAlpha(90)
: Colors.grey.shade200 : Colors.grey.shade200
: null, // Background color : null, // Background color
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
8), // Curved corners 8), // Curved corners
@ -2678,47 +2682,47 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
children: [ children: [
isBookmarked isBookmarked
? Text( ? Text(
context.translate( context.translate(
'Bookmarked', 'Bookmarked',
'إشارة مرجعية', 'إشارة مرجعية',
), ),
style: TextStyle( style: TextStyle(
fontFamily: fontFamily:
context.translate( context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
), ),
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: isDarkTheme color: isDarkTheme
? Colors.grey ? Colors.grey
: Color(0xFF416587), : Color(0xFF416587),
// color: Color(int.parse( // color: Color(int.parse(
// (chartScreenData[ // (chartScreenData[
// 'body_color'] ?? // 'body_color'] ??
// '#898C81') // '#898C81')
// .replaceFirst( // .replaceFirst(
// '#', '0xff'))), // '#', '0xff'))),
), ),
) )
: Text( : Text(
context.translate( context.translate(
'Bookmark', 'Bookmark',
'إشارة مرجعية', 'إشارة مرجعية',
), ),
style: TextStyle( style: TextStyle(
fontFamily: fontFamily:
context.translate( context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
), ),
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: isDarkTheme color: isDarkTheme
? Colors.grey ? Colors.grey
: Color(0xFF416587), : Color(0xFF416587),
), ),
), ),
SizedBox(width: 5), SizedBox(width: 5),
// Text( // Text(
@ -2746,11 +2750,11 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
color: isBookmarked color: isBookmarked
? isDarkTheme ? isDarkTheme
? Colors.grey ? Colors.grey
: Color(0xFF416587) : Color(0xFF416587)
: isDarkTheme : isDarkTheme
? Colors.grey ? Colors.grey
: Color(0xFF416587), : Color(0xFF416587),
// color: isBookmarked // color: isBookmarked
// ? Color(int.parse( // ? Color(int.parse(
// (chartScreenData[ // (chartScreenData[
@ -2760,8 +2764,6 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
// '#', '0xff'))) // '#', '0xff')))
// : Colors.white, // : Colors.white,
), ),
], ],
), ),
), ),
@ -2794,21 +2796,27 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
SizedBox(width: 5), SizedBox(width: 5),
_isSharing _isSharing
? SizedBox( ? SizedBox(
width: 24, width: 24,
height: 24, height: 24,
child: child:
CircularProgressIndicator( CircularProgressIndicator(
color: Colors.white, color: Colors.white,
strokeWidth: 2, strokeWidth: 2,
), ),
) // Show loading spinner ) // Show loading spinner
: Image( : Image(
image: AssetImage( image: AssetImage(
isDarkTheme ? UaeNumbersAssetPath.shareDark : UaeNumbersAssetPath.shareLight, isDarkTheme
), ? UaeNumbersAssetPath
width: 24, // Set your desired width .shareDark
height: 24, // Set your desired height : UaeNumbersAssetPath
) .shareLight,
),
width:
24, // Set your desired width
height:
24, // Set your desired height
)
], ],
), ),
), ),
@ -2869,7 +2877,6 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
// context, filterData, chartsData); // context, filterData, chartsData);
// }, // },
// ), // ),
], ],
), ),
SizedBox(width: 10), SizedBox(width: 10),
@ -2885,11 +2892,11 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
color: isDarkTheme color: isDarkTheme
? Color(int.parse( ? Color(int.parse(
(chartScreenData['body_color'] ?? '#898C81') (chartScreenData['body_color'] ?? '#898C81')
.replaceFirst('#', '0xff'))) .replaceFirst('#', '0xff')))
: Color(int.parse( : Color(int.parse(
(chartScreenData['body_color'] ?? '#898C81') (chartScreenData['body_color'] ?? '#898C81')
.replaceFirst('#', '0xff'))), .replaceFirst('#', '0xff'))),
// color: Color(int.parse( // color: Color(int.parse(
// (chartScreenData['body_color'] ?? '#898C81') // (chartScreenData['body_color'] ?? '#898C81')
@ -2922,7 +2929,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
return _buildTab( return _buildTab(
_tabsData[index], _tabsData[index],
isActive: isActive:
index == _activeTabIndex, index == _activeTabIndex,
); );
}), }),
), ),
@ -2932,9 +2939,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
if (_tabsData.length > 1) if (_tabsData.length > 1)
_buildArrowButton( _buildArrowButton(
onPressed: onPressed:
_activeTabIndex < _tabsData.length - 1 _activeTabIndex < _tabsData.length - 1
? _scrollRight ? _scrollRight
: null, : null,
icon: Icons.arrow_forward_ios, icon: Icons.arrow_forward_ios,
), ),
], ],
@ -2969,7 +2976,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
child: CardWidget( child: CardWidget(
card: card, card: card,
chartScreenData: chartScreenData:
chartScreenData, chartScreenData,
themeMode: themeMode)), themeMode: themeMode)),
], ],
)); ));
@ -2978,7 +2985,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
child: CardWidget( child: CardWidget(
card: card, card: card,
chartScreenData: chartScreenData:
chartScreenData, chartScreenData,
themeMode: themeMode))); themeMode: themeMode)));
if (tempRow.length == 2) { if (tempRow.length == 2) {
rows.add(Row(children: tempRow)); rows.add(Row(children: tempRow));
@ -3008,7 +3015,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
themeMode == ThemeMode.dark || themeMode == ThemeMode.dark ||
(themeMode == ThemeMode.system && (themeMode == ThemeMode.system &&
MediaQuery.of(context) MediaQuery.of(context)
.platformBrightness == .platformBrightness ==
Brightness.dark); Brightness.dark);
// final Map<String, Color> mainTopicColors = { // final Map<String, Color> mainTopicColors = {
@ -3018,11 +3025,11 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
// }; // };
final String mainTopic = final String mainTopic =
chartScreenData['main_topic']; chartScreenData['main_topic'];
final Color backgroundColor = Color(int.parse( final Color backgroundColor = Color(int.parse(
(chartScreenData['body_color'] ?? (chartScreenData['body_color'] ??
'#898C81') '#898C81')
.replaceFirst('#', '0xff'))); .replaceFirst('#', '0xff')));
// final Color backgroundColor = isDarkTheme // final Color backgroundColor = isDarkTheme
@ -3039,8 +3046,8 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
color: Color( color: Color(
int.parse( int.parse(
(chartScreenData[ (chartScreenData[
'border_color'] ?? 'border_color'] ??
'#898C81') '#898C81')
.replaceFirst('#', '0xff'), .replaceFirst('#', '0xff'),
), ),
), // Border color ), // Border color
@ -3054,21 +3061,21 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
// ConstrainedBox // ConstrainedBox
Container( Container(
height: (chartsData[index][ height: (chartsData[index][
'chart_height'] == 'chart_height'] ==
null || null ||
chartsData[index][ chartsData[index][
'chart_height'] == 'chart_height'] ==
0) 0)
? 350 ? 350
: double.tryParse( : double.tryParse(
chartsData[index] chartsData[index]
['chart_height'] ['chart_height']
.toString()), .toString()),
// height: (chartsData[index] // height: (chartsData[index]
// ['chart_type'] == // ['chart_type'] ==
// 'pie_chart') // 'pie_chart')
@ -3091,7 +3098,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
// child: buildChart(chartsData[index]), // child: buildChart(chartsData[index]),
child: ChartWidget( child: ChartWidget(
chartData: chartData:
chartsData[index], chartsData[index],
bodyColor: bodyColor, bodyColor: bodyColor,
chartHeader: chartHeader, chartHeader: chartHeader,
isDarkTheme: isDarkTheme), isDarkTheme: isDarkTheme),
@ -3119,25 +3126,28 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
color: isDarkTheme color: isDarkTheme
? Colors.transparent ? Colors.transparent
: Color(int.parse( : Color(int.parse(
(chartScreenData['header_color'] ?? '#898C81') (chartScreenData['header_color'] ?? '#898C81')
.replaceFirst( .replaceFirst(
'#', '0xff'))), // Semi-transparent background '#', '0xff'))), // Semi-transparent background
child: Column( child: Container(
mainAxisAlignment: MainAxisAlignment.center, color: isDarkTheme ? Colors.black : Colors.white,
children: [ child: Column(
Container( mainAxisAlignment: MainAxisAlignment.center,
margin: EdgeInsets.symmetric( children: [
horizontal: 40), // Left & Right space Container(
child: LinearProgressIndicator( margin: EdgeInsets.symmetric(
minHeight: 5, // Adjust thickness horizontal: 40), // Left & Right space
backgroundColor: isDarkTheme child: LinearProgressIndicator(
? Colors.transparent minHeight: 5, // Adjust thickness
: Colors.grey[100], // Optional: Background color backgroundColor: isDarkTheme
valueColor: AlwaysStoppedAnimation<Color>( ? Colors.transparent
Color(0xFFAA8E83)), // Loader color : Colors.grey[100], // Optional: Background color
valueColor: AlwaysStoppedAnimation<Color>(
Color(0xFFAA8E83)), // Loader color
),
), ),
), ],
], ),
), ),
) )
])), ])),
@ -3147,7 +3157,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Widget _buildArrowButton( Widget _buildArrowButton(
{required VoidCallback? onPressed, required IconData icon}) { {required VoidCallback? onPressed, required IconData icon}) {
final color = final color =
Color(int.parse(widget.bgColor.replaceFirst('0x', ''), radix: 16)); Color(int.parse(widget.bgColor.replaceFirst('0x', ''), radix: 16));
return Container( return Container(
margin: EdgeInsets.symmetric(horizontal: 5.0), margin: EdgeInsets.symmetric(horizontal: 5.0),
width: 25.0, // Set the width of the circle width: 25.0, // Set the width of the circle
@ -3156,10 +3166,10 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
// color: onPressed == null ? Colors.grey[400] : Colors.white, // color: onPressed == null ? Colors.grey[400] : Colors.white,
color: onPressed != null color: onPressed != null
? Color(int.parse((chartScreenData['header_color'] ?? '#898C81') ? Color(int.parse((chartScreenData['header_color'] ?? '#898C81')
.replaceFirst('#', '0xff'))) .replaceFirst('#', '0xff')))
: isDarkTheme : isDarkTheme
? Colors.grey[700] ? Colors.grey[700]
: Colors.grey[200], : Colors.grey[200],
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(5.0), borderRadius: BorderRadius.circular(5.0),
// boxShadow: [ // boxShadow: [
@ -3170,7 +3180,8 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
// ), // ),
// ], // ],
), ),
child: Center( // Center the IconButton child: Center(
// Center the IconButton
child: IconButton( child: IconButton(
padding: EdgeInsets.zero, // Remove default padding padding: EdgeInsets.zero, // Remove default padding
constraints: BoxConstraints(), // Remove default constraints constraints: BoxConstraints(), // Remove default constraints
@ -3201,10 +3212,10 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
// color: isActive ? Colors.white : Colors.grey[400], // color: isActive ? Colors.white : Colors.grey[400],
color: isActive color: isActive
? Color(int.parse((chartScreenData['header_color'] ?? '#898C81') ? Color(int.parse((chartScreenData['header_color'] ?? '#898C81')
.replaceFirst('#', '0xff'))) .replaceFirst('#', '0xff')))
: isDarkTheme : isDarkTheme
? Colors.black ? Colors.black
: Color(0XFFDFE1DB), : Color(0XFFDFE1DB),
borderRadius: BorderRadius.circular(5.0), borderRadius: BorderRadius.circular(5.0),
), ),
child: Text( child: Text(
@ -3215,7 +3226,17 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
'NotoKufi', 'NotoKufi',
), ),
// color: isActive ? Colors.black : Colors.white, // color: isActive ? Colors.black : Colors.white,
color: chartScreenData['main_topic'] == 'SOCIAL' ? isActive ? Colors.white : isDarkTheme ? Colors.white : Colors.black : isActive ? Colors.black : isDarkTheme ? Colors.white : Colors.black, color: chartScreenData['main_topic'] == 'SOCIAL'
? isActive
? Colors.white
: isDarkTheme
? Colors.white
: Colors.black
: isActive
? Colors.black
: isDarkTheme
? Colors.white
: Colors.black,
// color: Colors.white, // color: Colors.white,
fontWeight: isActive ? FontWeight.w500 : FontWeight.w400, fontWeight: isActive ? FontWeight.w500 : FontWeight.w400,
fontSize: 13, fontSize: 13,
@ -3242,9 +3263,9 @@ class CardWidget extends StatelessWidget {
const CardWidget( const CardWidget(
{Key? key, {Key? key,
required this.card, required this.card,
required this.chartScreenData, required this.chartScreenData,
required this.themeMode}) required this.themeMode})
: super(key: key); : super(key: key);
@override @override
@ -3256,7 +3277,7 @@ class CardWidget extends StatelessWidget {
final response = card['response'] as List<dynamic>? ?? []; final response = card['response'] as List<dynamic>? ?? [];
final card_logo = card['card_logo']; final card_logo = card['card_logo'];
double cardHeight = double cardHeight =
(chart_type == 'totals' || chart_type == 'averages') ? 180.0 : 130.0; (chart_type == 'totals' || chart_type == 'averages') ? 180.0 : 130.0;
final bodyColor = Color( final bodyColor = Color(
int.parse( int.parse(
@ -3314,8 +3335,8 @@ class CardWidget extends StatelessWidget {
left: 16.0, right: 16.0, bottom: 2.0, top: 1.0), left: 16.0, right: 16.0, bottom: 2.0, top: 1.0),
decoration: BoxDecoration( decoration: BoxDecoration(
color: backgroundColor, // Move color inside BoxDecoration color: backgroundColor, // Move color inside BoxDecoration
borderRadius: BorderRadius.circular( borderRadius:
5), // Ensure border radius is applied BorderRadius.circular(5), // Ensure border radius is applied
), ),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -3373,7 +3394,7 @@ class CardWidget extends StatelessWidget {
textAlign: TextAlign.center, textAlign: TextAlign.center,
maxLines: 2, maxLines: 2,
overflow: overflow:
TextOverflow.ellipsis, // Truncate text with '...' TextOverflow.ellipsis, // Truncate text with '...'
style: TextStyle( style: TextStyle(
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
@ -3398,7 +3419,7 @@ class CardWidget extends StatelessWidget {
fontSize: 11, fontSize: 11,
color: Colors.grey, color: Colors.grey,
overflow: overflow:
TextOverflow.ellipsis, // Truncate if text overflows TextOverflow.ellipsis, // Truncate if text overflows
), ),
maxLines: 1, // Limit to one line to prevent overflow maxLines: 1, // Limit to one line to prevent overflow
textAlign: TextAlign.center, // Ensure proper alignment textAlign: TextAlign.center, // Ensure proper alignment
@ -3466,11 +3487,11 @@ class CardWidget extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: backgroundColor, // Move color inside BoxDecoration color: backgroundColor, // Move color inside BoxDecoration
borderRadius: borderRadius:
BorderRadius.circular(5), // Ensure border radius is applied BorderRadius.circular(5), // Ensure border radius is applied
), ),
child: Column( child: Column(
mainAxisSize: mainAxisSize:
MainAxisSize.min, // Adjust card height based on content MainAxisSize.min, // Adjust card height based on content
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
// const Icon(Icons.public, // const Icon(Icons.public,
@ -3617,7 +3638,7 @@ class CardWidget extends StatelessWidget {
), ),
textAlign: TextAlign.center, // Ensure proper alignment textAlign: TextAlign.center, // Ensure proper alignment
overflow: overflow:
TextOverflow.ellipsis, // Truncate if text overflows TextOverflow.ellipsis, // Truncate if text overflows
), ),
const SizedBox(width: 1), // Space between text and icon const SizedBox(width: 1), // Space between text and icon
if (response[1]['font_color'] != '') ...[ if (response[1]['font_color'] != '') ...[

File diff suppressed because it is too large Load Diff

View File

@ -40,12 +40,12 @@ extension Dialogs on BuildContext {
/// If [errorDialogBuilder] is provided, an /// If [errorDialogBuilder] is provided, an
/// [showLogBtn] is also true exception is thrown; /// [showLogBtn] is also true exception is thrown;
Future<T> loaderWithErrorDialog<T>( Future<T> loaderWithErrorDialog<T>(
FutureOr<T> Function() computation, { FutureOr<T> Function() computation, {
Future<void> Function( Future<void> Function(
Object error, [ Object error, [
StackTrace stackTrace, StackTrace stackTrace,
])? errorDialogBuilder, ])? errorDialogBuilder,
}) async { }) async {
final loaderContext = await _pushLoaderDialog(); final loaderContext = await _pushLoaderDialog();
late final T value; late final T value;
try { try {
@ -104,14 +104,14 @@ extension Dialogs on BuildContext {
color: Color(0xFF898C81), fontWeight: FontWeight.w700)), color: Color(0xFF898C81), fontWeight: FontWeight.w700)),
content: content.length > 300 content: content.length > 300
? SingleChildScrollView( ? SingleChildScrollView(
child: Text(content, child: Text(content,
style: TextStyle(color: Color(0xFF898C81))), style: TextStyle(color: Color(0xFF898C81))),
) )
: Text( : Text(
content, content,
style: TextStyle( style: TextStyle(
color: Color(0xFF898C81)), // Set content text color color: Color(0xFF898C81)), // Set content text color
), ),
actions: [ actions: [
TextButton( TextButton(
onPressed: Navigator.of( onPressed: Navigator.of(
@ -123,11 +123,11 @@ extension Dialogs on BuildContext {
backgroundColor: Color(0xFFB68A34), // Background color backgroundColor: Color(0xFFB68A34), // Background color
foregroundColor: Colors.white, // Font (text) color foregroundColor: Colors.white, // Font (text) color
side: BorderSide( side: BorderSide(
// color: Color(0xFF92722A)), // Border outline color // color: Color(0xFF92722A)), // Border outline color
color: Color(0xFFB68A34)), // Border outline color color: Color(0xFFB68A34)), // Border outline color
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: borderRadius:
BorderRadius.circular(8), // Optional: Rounded corners BorderRadius.circular(8), // Optional: Rounded corners
), ),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 16, vertical: 12), // Optional: Padding horizontal: 16, vertical: 12), // Optional: Padding
@ -152,11 +152,11 @@ extension Dialogs on BuildContext {
); );
Future<bool?> confirmationDialog( Future<bool?> confirmationDialog(
String titleText, String titleText,
String contentText, { String contentText, {
String cancelText = 'Cancel', String cancelText = 'Cancel',
String confirmText = 'Confirm', String confirmText = 'Confirm',
}) => }) =>
showDialog<bool>( showDialog<bool>(
context: this, context: this,
barrierDismissible: false, barrierDismissible: false,

View File

@ -37,7 +37,7 @@ import 'package:http/http.dart' as http;
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import '../../Screens/auth_verification/registration.dart'; import '../../Screens/auth_verification/registration.dart';
import 'package:pocketbase/pocketbase.dart'; import 'package:pocketbase/pocketbase.dart';
import 'package:uae_stat/config/api_config.dart'; import 'package:uae_stat/config/api_config.dart';
import '../../components/indicators/locale_provider.dart'; import '../../components/indicators/locale_provider.dart';
import '../../components/my_toggle.dart'; import '../../components/my_toggle.dart';
@ -213,8 +213,7 @@ class LoginRoute extends HookConsumerWidget {
final response = await http.get(url); final response = await http.get(url);
final body = json.decode(response.body); final body = json.decode(response.body);
if (response.statusCode == 200) { if (response.statusCode == 200) {
return body['status'] ?? 'Reset link sent successfully.'; return body['status'] ?? 'Reset link sent successfully.';
} else { } else {
final errorResponse = json.decode(response.body); final errorResponse = json.decode(response.body);
throw Exception( throw Exception(
@ -275,10 +274,10 @@ class LoginRoute extends HookConsumerWidget {
title: const Text('Enable App Links'), title: const Text('Enable App Links'),
content: const Text( content: const Text(
'To enable links like www.fcsc.com to open in this app:\n\n' 'To enable links like www.fcsc.com to open in this app:\n\n'
'1. Tap "Open Settings".\n' '1. Tap "Open Settings".\n'
'2. Then tap on "Supported web addresses".\n' '2. Then tap on "Supported web addresses".\n'
'3. Make sure your domain is enabled.\n\n' '3. Make sure your domain is enabled.\n\n'
'This helps open web links directly in the app.', 'This helps open web links directly in the app.',
), ),
actions: [ actions: [
TextButton( TextButton(
@ -302,7 +301,8 @@ class LoginRoute extends HookConsumerWidget {
} }
void openAppLinkSettings() { void openAppLinkSettings() {
const packageName = 'ae.gov.fcsc.frontend'; // Replace with your app's package const packageName =
'ae.gov.fcsc.frontend'; // Replace with your app's package
final intent = AndroidIntent( final intent = AndroidIntent(
action: 'android.settings.APP_OPEN_BY_DEFAULT_SETTINGS', action: 'android.settings.APP_OPEN_BY_DEFAULT_SETTINGS',
data: 'package:$packageName', data: 'package:$packageName',
@ -320,21 +320,25 @@ class LoginRoute extends HookConsumerWidget {
} }
} }
Future<void> initializeTheme(BuildContext context,WidgetRef ref, String userId) async { Future<void> initializeTheme(
BuildContext context, WidgetRef ref, String userId) async {
final themeService = ThemeBaseService(); final themeService = ThemeBaseService();
final theme = await themeService.getUserTheme(userId); // e.g., "dark" final theme = await themeService.getUserTheme(userId); // e.g., "dark"
final platformBrightness = MediaQuery.of(context).platformBrightness; final platformBrightness = MediaQuery.of(context).platformBrightness;
ref.read(themeProvider.notifier).updateTheme(AppThemeExtension.fromString(theme),platformBrightness); ref
.read(themeProvider.notifier)
.updateTheme(AppThemeExtension.fromString(theme), platformBrightness);
final themeMode = ref.watch(themeProvider); final themeMode = ref.watch(themeProvider);
print('themeMode Login'); print('themeMode Login');
print('themeMode $themeMode'); print('themeMode $themeMode');
} }
Future<void> oAuthGoogleAndAppleLogin(BuildContext context, WidgetRef ref,platform) async { Future<void> oAuthGoogleAndAppleLogin(
BuildContext context, WidgetRef ref, platform) async {
print(platform); print(platform);
try { try {
final authData = final authData =
await pb.collection('users').authWithOAuth2(platform, (url) async { await pb.collection('users').authWithOAuth2(platform, (url) async {
await launchUrl(url); await launchUrl(url);
}); });
print(authData); print(authData);
@ -363,15 +367,15 @@ class LoginRoute extends HookConsumerWidget {
await initializeTheme(context, ref, userId); await initializeTheme(context, ref, userId);
final session = await context.loaderWithErrorDialog( final session = await context.loaderWithErrorDialog(
() => ref () => ref
.read( .read(
authUseCaseProvider.notifier, authUseCaseProvider.notifier,
) )
.googleAndAppleAuthencation(authData), .googleAndAppleAuthencation(authData),
errorDialogBuilder: ( errorDialogBuilder: (
error, [ error, [
StackTrace? stackTrace, StackTrace? stackTrace,
]) { ]) {
if (error == LoginError.invalidEmailPw) { if (error == LoginError.invalidEmailPw) {
return context.simpleDialog( return context.simpleDialog(
title: context.translate( title: context.translate(
@ -395,7 +399,7 @@ class LoginRoute extends HookConsumerWidget {
// Extract intendedPath from query parameters (if coming from redirect) // Extract intendedPath from query parameters (if coming from redirect)
final String? intendedPath = final String? intendedPath =
GoRouterState.of(context).uri.queryParameters['intendedPath']; GoRouterState.of(context).uri.queryParameters['intendedPath'];
print("Extracted intendedPath after login: $intendedPath"); print("Extracted intendedPath after login: $intendedPath");
if (isProfileComplete) { if (isProfileComplete) {
@ -427,8 +431,8 @@ class LoginRoute extends HookConsumerWidget {
Future<void> loginCountApi(String userId) async { Future<void> loginCountApi(String userId) async {
if (userId.isNotEmpty) { if (userId.isNotEmpty) {
final url = final url =
// Uri.parse("https://pb.venbait.in/api/login_success?id=$userId"); // Uri.parse("https://pb.venbait.in/api/login_success?id=$userId");
Uri.parse('$apiUrl/api/login_success?id=$userId'); Uri.parse('$apiUrl/api/login_success?id=$userId');
try { try {
final response = await http.get(url); final response = await http.get(url);
@ -567,7 +571,6 @@ class LoginRoute extends HookConsumerWidget {
// } // }
// } // }
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
ref.listen<AsyncValue<bool>>(connectivityProvider, (previous, hasInternet) { ref.listen<AsyncValue<bool>>(connectivityProvider, (previous, hasInternet) {
@ -703,7 +706,7 @@ class LoginRoute extends HookConsumerWidget {
color: Color(0xFF92722A)), // Border outline color color: Color(0xFF92722A)), // Border outline color
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: borderRadius:
BorderRadius.circular(8), // Optional: Rounded corners BorderRadius.circular(8), // Optional: Rounded corners
), ),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 10, vertical: 10), // Optional: Padding horizontal: 10, vertical: 10), // Optional: Padding
@ -792,7 +795,6 @@ class LoginRoute extends HookConsumerWidget {
), ),
); );
} }
}, },
style: TextButton.styleFrom( style: TextButton.styleFrom(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
@ -917,7 +919,7 @@ class LoginRoute extends HookConsumerWidget {
await saveUserId(userId, loginCount); await saveUserId(userId, loginCount);
await getDeviceToken(context, userId); await getDeviceToken(context, userId);
await initializeTheme(context,ref,userId); await initializeTheme(context, ref, userId);
} }
try { try {
final bool isProfileComplete = await profileStatus(userId, ref); final bool isProfileComplete = await profileStatus(userId, ref);
@ -995,7 +997,7 @@ class LoginRoute extends HookConsumerWidget {
), ),
backgroundColor: WidgetStatePropertyAll( backgroundColor: WidgetStatePropertyAll(
// isDarkTheme ? Color(0xFFB68A34) : Color(0xFFB68A34), // isDarkTheme ? Color(0xFFB68A34) : Color(0xFFB68A34),
Color(0xFFB68A34), Color(0xFFB68A34),
// MyTheme.topicColor(IndicatorTopic.social), // MyTheme.topicColor(IndicatorTopic.social),
), ),
// surfaceTintColor: MaterialStatePropertyAll( // surfaceTintColor: MaterialStatePropertyAll(
@ -1024,9 +1026,11 @@ class LoginRoute extends HookConsumerWidget {
), ),
), ),
6.horizontalSpace, 6.horizontalSpace,
Icon( Icon(
Icons.chevron_right_outlined, Icons.chevron_right_outlined,
color: isDarkTheme ? Colors.white : Colors.white, // Set your desired color here color: isDarkTheme
? Colors.white
: Colors.white, // Set your desired color here
) )
], ],
), ),
@ -1156,7 +1160,7 @@ class LoginRoute extends HookConsumerWidget {
), ),
style: TextStyle( style: TextStyle(
fontSize: locale?.languageCode == 'ar' ? 12 : 14, fontSize: locale?.languageCode == 'ar' ? 12 : 14,
color: isDarkTheme ? Color(0xFFFFFFFF) : Color(0xFF898C81), color: isDarkTheme ? Color(0xFFFFFFFF) : Color(0xFF898C81),
), ),
), ),
const TextSpan( const TextSpan(
@ -1235,7 +1239,7 @@ class LoginRoute extends HookConsumerWidget {
width: double.infinity, width: double.infinity,
child: OutlinedButton( child: OutlinedButton(
onPressed: () async { onPressed: () async {
oAuthGoogleAndAppleLogin(context,ref,'google'); oAuthGoogleAndAppleLogin(context, ref, 'google');
}, },
style: OutlinedButton.styleFrom( style: OutlinedButton.styleFrom(
side: const BorderSide(color: Color(0xFF000000)), side: const BorderSide(color: Color(0xFF000000)),
@ -1255,7 +1259,8 @@ class LoginRoute extends HookConsumerWidget {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Image.asset( Image.asset(
MiscIconAssetPath.signInWithGoogle, // replace with your Google icon asset MiscIconAssetPath
.signInWithGoogle, // replace with your Google icon asset
height: 20, height: 20,
), ),
const SizedBox(width: 10), const SizedBox(width: 10),
@ -1275,7 +1280,7 @@ class LoginRoute extends HookConsumerWidget {
width: double.infinity, width: double.infinity,
child: OutlinedButton( child: OutlinedButton(
onPressed: () async { onPressed: () async {
oAuthGoogleAndAppleLogin(context,ref,'apple'); oAuthGoogleAndAppleLogin(context, ref, 'apple');
}, },
style: OutlinedButton.styleFrom( style: OutlinedButton.styleFrom(
side: const BorderSide(color: Color(0xFF000000)), side: const BorderSide(color: Color(0xFF000000)),
@ -1295,7 +1300,8 @@ class LoginRoute extends HookConsumerWidget {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Image.asset( Image.asset(
MiscIconAssetPath.signInWithApple, // replace with your Google icon asset MiscIconAssetPath
.signInWithApple, // replace with your Google icon asset
height: 20, height: 20,
), ),
const SizedBox(width: 10), const SizedBox(width: 10),
@ -1333,7 +1339,8 @@ class LoginRoute extends HookConsumerWidget {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Image.asset( Image.asset(
MiscIconAssetPath.signInWithUAEPass, // replace with your Google icon asset MiscIconAssetPath
.signInWithUAEPass, // replace with your Google icon asset
height: 20, height: 20,
), ),
const SizedBox(width: 10), const SizedBox(width: 10),
@ -1497,7 +1504,6 @@ class LoginRoute extends HookConsumerWidget {
// } // }
} }
// abstract class _LocalAuthRepo { // abstract class _LocalAuthRepo {
// static const _key = 'session'; // static const _key = 'session';
// static const _storage = FlutterSecureStorage(); // static const _storage = FlutterSecureStorage();

View File

@ -201,7 +201,7 @@ class _MyHomePageState extends ConsumerState<MyHomePage> {
context.go('/login'); // Redirect to login after logout context.go('/login'); // Redirect to login after logout
} }
void _showExitConfirmation(BuildContext context,isDarkTheme) { void _showExitConfirmation(BuildContext context, isDarkTheme) {
double myheight = MediaQuery.of(context).size.height; double myheight = MediaQuery.of(context).size.height;
showDialog( showDialog(
context: context, context: context,
@ -215,10 +215,15 @@ class _MyHomePageState extends ConsumerState<MyHomePage> {
title: Text( title: Text(
context.translate('Log Out Confirmation', 'تأكيد تسجيل الخروج'), context.translate('Log Out Confirmation', 'تأكيد تسجيل الخروج'),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold, color: isDarkTheme ? Colors.white : Colors.black, fontFamily: context.translate( style: TextStyle(
'Roboto', fontSize: 20,
'NotoKufi', fontWeight: FontWeight.bold,
),), color: isDarkTheme ? Colors.white : Colors.black,
fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
),
), ),
content: Padding( content: Padding(
padding: const EdgeInsets.all(20.0), padding: const EdgeInsets.all(20.0),
@ -285,10 +290,14 @@ class _MyHomePageState extends ConsumerState<MyHomePage> {
.scaleDown, // Prevents wrapping while adjusting text size .scaleDown, // Prevents wrapping while adjusting text size
child: Text( child: Text(
context.translate('Log Out', 'تسجيل الخروج'), context.translate('Log Out', 'تسجيل الخروج'),
style: TextStyle(color: Colors.white, fontSize: 16, fontFamily: context.translate( style: TextStyle(
'Roboto', color: Colors.white,
'NotoKufi', fontSize: 16,
),), fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
), ),
@ -355,14 +364,18 @@ class _MyHomePageState extends ConsumerState<MyHomePage> {
canPop: false, // Allow back navigation only if not login screen canPop: false, // Allow back navigation only if not login screen
onPopInvokedWithResult: (didPop, result) { onPopInvokedWithResult: (didPop, result) {
if (didPop) return; if (didPop) return;
_showExitConfirmation(context,isDarkTheme); // Show exit confirmation dialog _showExitConfirmation(
context, isDarkTheme); // Show exit confirmation dialog
}, },
child: BaseScaffold( child: BaseScaffold(
title: Center( title: Center(
child: SizedBox( child: SizedBox(
height: myheight / 5, height: myheight / 5,
width: mywidth / 3, width: mywidth / 3,
child: Image(image: AssetImage(isDarkTheme ? LogoAssetPath.uaeStatDark : LogoAssetPath.uaeStatLight)))), child: Image(
image: AssetImage(isDarkTheme
? LogoAssetPath.uaeStatDark
: LogoAssetPath.uaeStatLight)))),
body: EconomyStatsWidget(), body: EconomyStatsWidget(),
), ),
); );
@ -1107,7 +1120,6 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
fetchData(locale?.languageCode ?? 'en', themeMode); fetchData(locale?.languageCode ?? 'en', themeMode);
// _fetchUserData(); // _fetchUserData();
_loadLoginCount(); _loadLoginCount();
} }
@ -1166,11 +1178,12 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
// } // }
// } // }
Future<void> fetchData(locale,themeMode) async { Future<void> fetchData(locale, themeMode) async {
// const baseUrl = 'https://pb.venbait.in/api/getHomePageData'; // const baseUrl = 'https://pb.venbait.in/api/getHomePageData';
const baseUrl = '$apiUrl/api/getHomePageData'; const baseUrl = '$apiUrl/api/getHomePageData';
try { try {
final response = await http.get(Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode')); final response = await http
.get(Uri.parse(baseUrl + '?language=$locale&color_mode=$themeMode'));
if (response.statusCode == 200) { if (response.statusCode == 200) {
setState(() { setState(() {
data = json.decode(response.body); data = json.decode(response.body);
@ -1229,7 +1242,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
MediaQuery.of(context).platformBrightness == Brightness.dark); MediaQuery.of(context).platformBrightness == Brightness.dark);
final themeString = isDark ? 'dark' : 'light'; final themeString = isDark ? 'dark' : 'light';
fetchData(localeCode,themeString); fetchData(localeCode, themeString);
}); });
final isConnected = ref.watch(connectivityProvider); final isConnected = ref.watch(connectivityProvider);
@ -1257,7 +1270,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
MediaQuery.of(context).platformBrightness == Brightness.dark); MediaQuery.of(context).platformBrightness == Brightness.dark);
final themeString = isDark ? 'dark' : 'light'; final themeString = isDark ? 'dark' : 'light';
fetchData(localeCode,themeString); fetchData(localeCode, themeString);
}); });
final isDarkTheme = ref.watch(themeProvider) == ThemeMode.dark || final isDarkTheme = ref.watch(themeProvider) == ThemeMode.dark ||
@ -1269,7 +1282,9 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
if (isLoading) { if (isLoading) {
return Container( return Container(
color: Color(0x98FFFCE5), // Semi-transparent background color: isDarkTheme
? Colors.black
: Colors.white, // Semi-transparent background
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@ -1406,7 +1421,6 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
borderColor, borderColor,
mainTopic['color_pattern'], mainTopic['color_pattern'],
mainTopic['main_topic']), mainTopic['main_topic']),
), ),
), ),
], ],
@ -1492,10 +1506,10 @@ List<Widget> _buildRows(List<Map<String, dynamic>> tileData, Color borderColor,
.map((tile) { .map((tile) {
return Expanded( return Expanded(
child: Container( child: Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
right: 5, right: 5,
left: 5, left: 5,
), ),
child: InfoCard( child: InfoCard(
// title: tile['data_set_tile_heading']!, // title: tile['data_set_tile_heading']!,
title: tile['data_set_tile_heading'] ?? 'Unknown Title', title: tile['data_set_tile_heading'] ?? 'Unknown Title',
@ -1510,8 +1524,7 @@ List<Widget> _buildRows(List<Map<String, dynamic>> tileData, Color borderColor,
mainTopic: mainTopic, mainTopic: mainTopic,
onTap: () {}, onTap: () {},
), ),
) ));
);
}).toList(), }).toList(),
), ),
), ),
@ -1538,13 +1551,15 @@ class RoundedCornerContainer extends StatelessWidget {
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: backgroundColor, color: backgroundColor,
borderRadius: BorderRadius.only(topRight: Radius.circular(20),topLeft: Radius.circular(20)), // Rounded corners borderRadius: BorderRadius.only(
topRight: Radius.circular(20),
topLeft: Radius.circular(20)), // Rounded corners
), ),
child: Center( child: Center(
child: Text( child: Text(
text, text,
style: textStyle ?? style: textStyle ??
TextStyle( TextStyle(
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
@ -1595,8 +1610,7 @@ class InfoCard extends StatelessWidget {
final encodedTitle = Uri.encodeComponent(title); final encodedTitle = Uri.encodeComponent(title);
final encodedKey = Uri.encodeQueryComponent('home'); final encodedKey = Uri.encodeQueryComponent('home');
return Consumer( return Consumer(builder: (context, ref, _) {
builder: (context, ref, _) {
final themeMode = ref.watch(themeProvider); final themeMode = ref.watch(themeProvider);
final isDarkTheme = themeMode == ThemeMode.dark || final isDarkTheme = themeMode == ThemeMode.dark ||
(themeMode == ThemeMode.system && (themeMode == ThemeMode.system &&
@ -1614,7 +1628,8 @@ class InfoCard extends StatelessWidget {
margin: const EdgeInsets.symmetric(horizontal: 0), margin: const EdgeInsets.symmetric(horizontal: 0),
// padding: const EdgeInsets.all(10), // padding: const EdgeInsets.all(10),
padding: const EdgeInsets.only(bottom: 0.5, top: 1, left: 10, right: 10), padding:
const EdgeInsets.only(bottom: 0.5, top: 1, left: 10, right: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
color: isDarkTheme ? Color(0xFF111111) : null, color: isDarkTheme ? Color(0xFF111111) : null,
border: Border.all(color: bordercolor), border: Border.all(color: bordercolor),
@ -1722,9 +1737,6 @@ class InfoCard extends StatelessWidget {
), ),
), ),
); );
} });
);
} }
} }

View File

@ -61,8 +61,8 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
await _pb.admins await _pb.admins
.authWithPassword('pb@venbainfotech.com', 'pb@venbainfotech.com'); .authWithPassword('pb@venbainfotech.com', 'pb@venbainfotech.com');
final result = await _pb.collection('users').getFullList( final result = await _pb.collection('users').getFullList(
filter: 'role="user"', filter: 'role="user"',
); );
setState(() { setState(() {
userData = result.map((record) { userData = result.map((record) {
@ -108,10 +108,10 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
} }
void _sort<T>( void _sort<T>(
Comparable<T>? Function(User user) getField, Comparable<T>? Function(User user) getField,
int columnIndex, int columnIndex,
bool ascending, bool ascending,
) { ) {
setState(() { setState(() {
_sortColumnIndex = columnIndex; _sortColumnIndex = columnIndex;
_isAscending = ascending; _isAscending = ascending;
@ -160,9 +160,9 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
AppLocalizations.of(context)!.status_success, AppLocalizations.of(context)!.status_success,
style: TextStyle( style: TextStyle(
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
)), )),
), ),
), ),
); );
@ -174,14 +174,14 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text( content: Text(
context.translate( context.translate(
'Error updating status: $e', '$e خطأ في تحديث الحالة: '), 'Error updating status: $e', '$e خطأ في تحديث الحالة: '),
style: TextStyle( style: TextStyle(
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
)), )),
)), )),
); );
} }
} }
@ -201,7 +201,7 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
borderRadius: BorderRadius.circular(5.0), // Rounded corners borderRadius: BorderRadius.circular(5.0), // Rounded corners
), ),
contentPadding: contentPadding:
EdgeInsets.zero, // Ensure no padding issues with close icon EdgeInsets.zero, // Ensure no padding issues with close icon
content: Stack( content: Stack(
children: [ children: [
Padding( Padding(
@ -232,7 +232,7 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
'NotoKufi', 'NotoKufi',
), ),
fontWeight: fontWeight:
FontWeight.bold, // Makes newStatus bold FontWeight.bold, // Makes newStatus bold
fontSize: 18, fontSize: 18,
color: Color(0xFF898C81), color: Color(0xFF898C81),
), ),
@ -301,11 +301,11 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
}, },
style: TextButton.styleFrom( style: TextButton.styleFrom(
backgroundColor: backgroundColor:
Color(0xFFAA8E83), // Set background color Color(0xFFAA8E83), // Set background color
foregroundColor: Colors.white, foregroundColor: Colors.white,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: borderRadius:
BorderRadius.circular(10.0), // Set text color BorderRadius.circular(10.0), // Set text color
), ),
), ),
child: Text( child: Text(
@ -406,314 +406,320 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
AppLocalizations.of(context)!.manage_user, AppLocalizations.of(context)!.manage_user,
style: TextStyle( style: TextStyle(
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
)), )),
), ),
body: isLoading body: isLoading
? Container( ? Container(
color: Color(0x98FFFCE5), // Semi-transparent background color: isDarkTheme
child: Column( ? Colors.black
mainAxisAlignment: MainAxisAlignment.center, : Colors.white, // Semi-transparent background
children: [ child: Column(
Container( mainAxisAlignment: MainAxisAlignment.center,
margin: EdgeInsets.symmetric( children: [
horizontal: 40), // Left & Right space Container(
child: LinearProgressIndicator( margin: EdgeInsets.symmetric(
minHeight: 5, // Adjust thickness horizontal: 40), // Left & Right space
backgroundColor: child: LinearProgressIndicator(
Colors.grey[100], // Optional: Background color minHeight: 5, // Adjust thickness
valueColor: AlwaysStoppedAnimation<Color>( backgroundColor:
Color(0xFFAA8E83)), // Loader color Colors.grey[100], // Optional: Background color
), valueColor: AlwaysStoppedAnimation<Color>(
), Color(0xFFAA8E83)), // Loader color
],
),
)
: SingleChildScrollView(
child: Padding(
padding:
const EdgeInsets.only(left: 10.0, right: 10.0, top: 3.0),
child: Column(
children: [
Container(
height: 40,
decoration: BoxDecoration(
color: isDarkTheme ? Color(0xFF000000) : Colors.white,
borderRadius: BorderRadius.circular(5.0),
border: Border.all(width: 2, color: Color(0xFFA0A0A0)),
),
child: Padding(
padding: EdgeInsets.only(left: 5.0),
child: TextField(
decoration: InputDecoration(
hintText: AppLocalizations.of(context)!.search,
hintStyle: TextStyle(
color: isDarkTheme ? Color(0xFF898C81) : Color(0xFF898C81),
fontFamily: context.translate('Roboto', 'NotoKufi'),
fontSize: 18,
// height: 1.8,
),
prefixIconConstraints: BoxConstraints(
maxWidth: 42,
maxHeight: 42,
),
prefixIcon: Container(
padding: EdgeInsets.only(right: 5, left: 5),
alignment: Alignment.center,
child: SvgPicture.asset(
MiscIconAssetPath.Search,
semanticsLabel: 'Search',
colorFilter: ColorFilter.mode(Color(0xFFAA8E83), BlendMode.srcIn),
height: 18,
width: 18,
),
),
// contentPadding: EdgeInsets.symmetric(vertical: 12, horizontal: 18.0),
border: InputBorder.none,
), ),
onChanged: filterUsers,
), ),
), ],
), ),
SizedBox(height: myheight / 40), )
filteredUserData.isEmpty : SingleChildScrollView(
? Center( child: Padding(
child: Padding( padding:
padding: const EdgeInsets.all(16.0), const EdgeInsets.only(left: 10.0, right: 10.0, top: 3.0),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, children: [
children: [ Container(
SizedBox(height: myheight / 5), height: 40,
decoration: BoxDecoration(
// Icon(Icons.search, color: isDarkTheme ? Color(0xFF000000) : Colors.white,
// size: 60, color: Colors.grey), borderRadius: BorderRadius.circular(5.0),
Image.asset( border:
MiscIconAssetPath.group, Border.all(width: 2, color: Color(0xFFA0A0A0)),
width: 60,
height: 60,
), ),
child: Padding(
SizedBox(height: 15), padding: EdgeInsets.only(left: 5.0),
// Space between icon and text child: TextField(
Text( decoration: InputDecoration(
AppLocalizations.of(context)! hintText: AppLocalizations.of(context)!.search,
.no_result_found, hintStyle: TextStyle(
style: TextStyle( color: isDarkTheme
fontFamily: context.translate( ? Color(0xFF898C81)
'Roboto', : Color(0xFF898C81),
'NotoKufi', fontFamily:
), context.translate('Roboto', 'NotoKufi'),
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.grey[700],
),
),
SizedBox(height: 12), // Space between texts
FittedBox(
child: Text(
context.translate(
"We couldn't find anything matching your search.",
'لم نعثر على أي شيء يطابق بحثك.'),
style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
fontSize: 18, fontSize: 18,
color: Color(0xFF898C81)), // height: 1.8,
textAlign: TextAlign.center,
),
),
],
),
),
)
: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: ConstrainedBox(
constraints: BoxConstraints(
minWidth: MediaQuery.of(context).size.width,
),
child: DataTable(
sortColumnIndex: _sortColumnIndex,
sortAscending: _isAscending,
columns: [
DataColumn(
label: Text(
AppLocalizations.of(context)!.user_name,
style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)),
),
onSort: (columnIndex, ascending) {
_sort(
(user) =>
user.userName.toLowerCase(),
columnIndex,
ascending);
},
),
DataColumn(
label: Text(
AppLocalizations.of(context)!.email_id,
style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)),
),
onSort: (columnIndex, ascending) {
_sort(
(user) =>
user.emailId.toLowerCase(),
columnIndex,
ascending);
},
),
DataColumn(
label: Text(
AppLocalizations.of(context)!.reg_date,
style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)),
),
onSort: (columnIndex, ascending) {
_sort(
(user) => DateFormat('dd/MM/yyyy')
.parse(user.registrationDate),
columnIndex,
ascending,
);
},
),
DataColumn(
label: Text(
AppLocalizations.of(context)!.status,
style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)),
),
onSort: (columnIndex, ascending) {
_sort(
(user) => user.status.toLowerCase(),
columnIndex,
ascending);
},
),
],
rows: filteredUserData.isEmpty
? [
DataRow(
cells: List<DataCell>.generate(
4, // Ensure it matches the number of DataColumns
(index) => DataCell(
index == 0
? Text(
AppLocalizations.of(
context)!
.no_result_found,
style: TextStyle(
fontFamily: context
.translate(
'Roboto',
'NotoKufi',
),
fontStyle: FontStyle
.italic),
)
: const Text(
''), // Empty cells for other columns
placeholder: true,
),
),
),
]
: filteredUserData.map((user) {
return DataRow(
cells: [
DataCell(
Text(
user.userName,
style: TextStyle(
fontFamily:
context.translate(
'Roboto',
'NotoKufi',
)),
), ),
prefixIconConstraints: BoxConstraints(
maxWidth: 42,
maxHeight: 42,
),
prefixIcon: Container(
padding: EdgeInsets.only(right: 5, left: 5),
alignment: Alignment.center,
child: SvgPicture.asset(
MiscIconAssetPath.Search,
semanticsLabel: 'Search',
colorFilter: ColorFilter.mode(
Color(0xFFAA8E83), BlendMode.srcIn),
height: 18,
width: 18,
),
),
// contentPadding: EdgeInsets.symmetric(vertical: 12, horizontal: 18.0),
border: InputBorder.none,
), ),
DataCell(Text( onChanged: filterUsers,
user.emailId, ),
style: TextStyle( ),
fontFamily: ),
context.translate( SizedBox(height: myheight / 40),
'Roboto', filteredUserData.isEmpty
'NotoKufi', ? Center(
)), child: Padding(
)), padding: const EdgeInsets.all(16.0),
DataCell(Text( child: Column(
user.registrationDate, mainAxisSize: MainAxisSize.min,
style: TextStyle( children: [
fontFamily: SizedBox(height: myheight / 5),
context.translate(
'Roboto', // Icon(Icons.search,
'NotoKufi', // size: 60, color: Colors.grey),
)), Image.asset(
)), MiscIconAssetPath.group,
DataCell( width: 60,
DropdownButton<String>( height: 60,
value: user.status, ),
items: statusOptions.entries
.map((status) { SizedBox(height: 15),
return DropdownMenuItem< // Space between icon and text
String>( Text(
value: status.key, AppLocalizations.of(context)!
child: Text( .no_result_found,
status.value,
style: TextStyle( style: TextStyle(
fontFamily: fontFamily: context.translate(
context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',
), ),
color: getStatusColor( fontSize: 24,
status.key), fontWeight: FontWeight.bold,
color: Colors.grey[700],
), ),
), ),
);
}).toList(), SizedBox(height: 12), // Space between texts
onChanged: (newStatus) { FittedBox(
print(user); child: Text(
if (newStatus != null) { context.translate(
_showConfirmationDialog( "We couldn't find anything matching your search.",
user, 'لم نعثر على أي شيء يطابق بحثك.'),
newStatus, style: TextStyle(
statusOptions[ fontFamily: context.translate(
newStatus]!, 'Roboto',
); 'NotoKufi',
} ),
}, fontSize: 18,
color: Color(0xFF898C81)),
textAlign: TextAlign.center,
),
),
],
),
),
)
: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: ConstrainedBox(
constraints: BoxConstraints(
minWidth: MediaQuery.of(context).size.width,
),
child: DataTable(
sortColumnIndex: _sortColumnIndex,
sortAscending: _isAscending,
columns: [
DataColumn(
label: Text(
AppLocalizations.of(context)!.user_name,
style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)),
),
onSort: (columnIndex, ascending) {
_sort(
(user) =>
user.userName.toLowerCase(),
columnIndex,
ascending);
},
),
DataColumn(
label: Text(
AppLocalizations.of(context)!.email_id,
style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)),
),
onSort: (columnIndex, ascending) {
_sort(
(user) =>
user.emailId.toLowerCase(),
columnIndex,
ascending);
},
),
DataColumn(
label: Text(
AppLocalizations.of(context)!.reg_date,
style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)),
),
onSort: (columnIndex, ascending) {
_sort(
(user) => DateFormat('dd/MM/yyyy')
.parse(user.registrationDate),
columnIndex,
ascending,
);
},
),
DataColumn(
label: Text(
AppLocalizations.of(context)!.status,
style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)),
),
onSort: (columnIndex, ascending) {
_sort(
(user) => user.status.toLowerCase(),
columnIndex,
ascending);
},
),
],
rows: filteredUserData.isEmpty
? [
DataRow(
cells: List<DataCell>.generate(
4, // Ensure it matches the number of DataColumns
(index) => DataCell(
index == 0
? Text(
AppLocalizations.of(
context)!
.no_result_found,
style: TextStyle(
fontFamily: context
.translate(
'Roboto',
'NotoKufi',
),
fontStyle: FontStyle
.italic),
)
: const Text(
''), // Empty cells for other columns
placeholder: true,
),
),
),
]
: filteredUserData.map((user) {
return DataRow(
cells: [
DataCell(
Text(
user.userName,
style: TextStyle(
fontFamily:
context.translate(
'Roboto',
'NotoKufi',
)),
),
),
DataCell(Text(
user.emailId,
style: TextStyle(
fontFamily:
context.translate(
'Roboto',
'NotoKufi',
)),
)),
DataCell(Text(
user.registrationDate,
style: TextStyle(
fontFamily:
context.translate(
'Roboto',
'NotoKufi',
)),
)),
DataCell(
DropdownButton<String>(
value: user.status,
items: statusOptions.entries
.map((status) {
return DropdownMenuItem<
String>(
value: status.key,
child: Text(
status.value,
style: TextStyle(
fontFamily:
context.translate(
'Roboto',
'NotoKufi',
),
color: getStatusColor(
status.key),
),
),
);
}).toList(),
onChanged: (newStatus) {
print(user);
if (newStatus != null) {
_showConfirmationDialog(
user,
newStatus,
statusOptions[
newStatus]!,
);
}
},
),
),
],
);
}).toList(),
),
), ),
), ),
], ],
);
}).toList(),
),
), ),
), ),
], ),
),
),
),
), ),
); );
} }

View File

@ -239,8 +239,8 @@ class _NotificationDetailsState extends ConsumerState<NotificationDetails> {
body: isLoading body: isLoading
? Container( ? Container(
color: isDarkTheme color: isDarkTheme
? Color(0xFF111111) ? Colors.black
: Color(0x98FFFCE5), // Semi-transparent background : Colors.white, // Semi-transparent background
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@ -309,9 +309,8 @@ class _NotificationDetailsState extends ConsumerState<NotificationDetails> {
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: isDarkTheme color:
? Colors.white isDarkTheme ? Colors.white : Color(0xFF8E8E8E),
: Color(0xFF8E8E8E),
fontFamily: context.translate( fontFamily: context.translate(
'Roboto', 'Roboto',
'NotoKufi', 'NotoKufi',

View File

@ -270,7 +270,7 @@ class ProfileRoute extends HookConsumerWidget {
), ),
), ),
Expanded( Expanded(
child: bodyContent, child: Container(color: Colors.lightGreenAccent, child: bodyContent),
), ),
], ],
); );