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

View File

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

View File

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

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/connectivity_provider.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/infrastructure/data/p_auth_repo.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");
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('User not found',
content: Text(
'User not found',
style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)
),),
'Roboto',
'NotoKufi',
)),
),
backgroundColor: Colors.red,
),
);
@ -222,15 +224,14 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content:
Text(AppLocalizations.of(context)!.password_update_successfully,
style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)
),
),
content: Text(
AppLocalizations.of(context)!.password_update_successfully,
style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)),
),
backgroundColor: Colors.green,
),
);
@ -243,13 +244,13 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Failed to update password: $e',
content: Text(
'Failed to update password: $e',
style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)
),
'Roboto',
'NotoKufi',
)),
),
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(
backgroundColor: Colors.white,
body: Stack(children: [
@ -289,7 +296,9 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
),
if (isLoading)
Container(
color: Color(0x98FFFCE5), // Semi-transparent background
color: isDarkTheme
? Colors.black
: Colors.white, // Semi-transparent background
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -386,7 +395,6 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
'NotoKufi',
),
fontWeight: FontWeight.w300,
),
),
SizedBox(height: 10),
@ -404,11 +412,10 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
passwordLocale?.languageCode == 'ar' ? 14 : 15,
fontWeight: FontWeight.w700,
color: Color(0xFF898C81),
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)
),
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)),
),
TextSpan(
text: context.translate('from Previously Used Password',
@ -435,8 +442,8 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
hintText: AppLocalizations.of(context)!.enter_new_password,
// prefixIcon: Icon(Icons.lock, color: Colors.blue),
hintStyle: TextStyle(
color: Color(0xFFC3C6CB),
fontWeight: FontWeight.w400,
color: Color(0xFFC3C6CB),
fontWeight: FontWeight.w400,
fontFamily: context.translate(
'Roboto',
'NotoKufi',
@ -518,8 +525,8 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
// hintText: 'Confirm new password',
hintText: AppLocalizations.of(context)!.confirm_new_password,
hintStyle: TextStyle(
color: Color(0xFFC3C6CB),
fontWeight: FontWeight.w400,
color: Color(0xFFC3C6CB),
fontWeight: FontWeight.w400,
fontFamily: context.translate(
'Roboto',
'NotoKufi',
@ -629,11 +636,7 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)
),
)),
),
SizedBox(width: 2),
Icon(
@ -681,14 +684,13 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
AppLocalizations.of(context)!.password_changed_successfully,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Color(0xFF414042),
fontSize: 16,
fontWeight: FontWeight.w500,
color: Color(0xFF414042),
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)
),
)),
),
SizedBox(height: 20),
ElevatedButton(

View File

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

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

View File

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

View File

@ -201,7 +201,7 @@ class _MyHomePageState extends ConsumerState<MyHomePage> {
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;
showDialog(
context: context,
@ -215,10 +215,15 @@ class _MyHomePageState extends ConsumerState<MyHomePage> {
title: Text(
context.translate('Log Out Confirmation', 'تأكيد تسجيل الخروج'),
textAlign: TextAlign.center,
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold, color: isDarkTheme ? Colors.white : Colors.black, fontFamily: context.translate(
'Roboto',
'NotoKufi',
),),
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: isDarkTheme ? Colors.white : Colors.black,
fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
),
),
content: Padding(
padding: const EdgeInsets.all(20.0),
@ -285,10 +290,14 @@ class _MyHomePageState extends ConsumerState<MyHomePage> {
.scaleDown, // Prevents wrapping while adjusting text size
child: Text(
context.translate('Log Out', 'تسجيل الخروج'),
style: TextStyle(color: Colors.white, fontSize: 16, fontFamily: context.translate(
'Roboto',
'NotoKufi',
),),
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
),
textAlign: TextAlign.center,
),
),
@ -355,14 +364,18 @@ class _MyHomePageState extends ConsumerState<MyHomePage> {
canPop: false, // Allow back navigation only if not login screen
onPopInvokedWithResult: (didPop, result) {
if (didPop) return;
_showExitConfirmation(context,isDarkTheme); // Show exit confirmation dialog
_showExitConfirmation(
context, isDarkTheme); // Show exit confirmation dialog
},
child: BaseScaffold(
title: Center(
child: SizedBox(
height: myheight / 5,
width: mywidth / 3,
child: Image(image: AssetImage(isDarkTheme ? LogoAssetPath.uaeStatDark : LogoAssetPath.uaeStatLight)))),
child: Image(
image: AssetImage(isDarkTheme
? LogoAssetPath.uaeStatDark
: LogoAssetPath.uaeStatLight)))),
body: EconomyStatsWidget(),
),
);
@ -1107,7 +1120,6 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
fetchData(locale?.languageCode ?? 'en', themeMode);
// _fetchUserData();
_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 = '$apiUrl/api/getHomePageData';
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) {
setState(() {
data = json.decode(response.body);
@ -1229,7 +1242,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
MediaQuery.of(context).platformBrightness == Brightness.dark);
final themeString = isDark ? 'dark' : 'light';
fetchData(localeCode,themeString);
fetchData(localeCode, themeString);
});
final isConnected = ref.watch(connectivityProvider);
@ -1257,7 +1270,7 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
MediaQuery.of(context).platformBrightness == Brightness.dark);
final themeString = isDark ? 'dark' : 'light';
fetchData(localeCode,themeString);
fetchData(localeCode, themeString);
});
final isDarkTheme = ref.watch(themeProvider) == ThemeMode.dark ||
@ -1269,7 +1282,9 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
if (isLoading) {
return Container(
color: Color(0x98FFFCE5), // Semi-transparent background
color: isDarkTheme
? Colors.black
: Colors.white, // Semi-transparent background
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -1406,7 +1421,6 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
borderColor,
mainTopic['color_pattern'],
mainTopic['main_topic']),
),
),
],
@ -1492,10 +1506,10 @@ List<Widget> _buildRows(List<Map<String, dynamic>> tileData, Color borderColor,
.map((tile) {
return Expanded(
child: Container(
margin: EdgeInsets.only(
right: 5,
left: 5,
),
margin: EdgeInsets.only(
right: 5,
left: 5,
),
child: InfoCard(
// title: tile['data_set_tile_heading']!,
title: tile['data_set_tile_heading'] ?? 'Unknown Title',
@ -1510,8 +1524,7 @@ List<Widget> _buildRows(List<Map<String, dynamic>> tileData, Color borderColor,
mainTopic: mainTopic,
onTap: () {},
),
)
);
));
}).toList(),
),
),
@ -1538,13 +1551,15 @@ class RoundedCornerContainer extends StatelessWidget {
return Container(
decoration: BoxDecoration(
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: Text(
text,
style: textStyle ??
TextStyle(
TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
@ -1595,8 +1610,7 @@ class InfoCard extends StatelessWidget {
final encodedTitle = Uri.encodeComponent(title);
final encodedKey = Uri.encodeQueryComponent('home');
return Consumer(
builder: (context, ref, _) {
return Consumer(builder: (context, ref, _) {
final themeMode = ref.watch(themeProvider);
final isDarkTheme = themeMode == ThemeMode.dark ||
(themeMode == ThemeMode.system &&
@ -1614,7 +1628,8 @@ class InfoCard extends StatelessWidget {
margin: const EdgeInsets.symmetric(horizontal: 0),
// 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(
color: isDarkTheme ? Color(0xFF111111) : null,
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
.authWithPassword('pb@venbainfotech.com', 'pb@venbainfotech.com');
final result = await _pb.collection('users').getFullList(
filter: 'role="user"',
);
filter: 'role="user"',
);
setState(() {
userData = result.map((record) {
@ -108,10 +108,10 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
}
void _sort<T>(
Comparable<T>? Function(User user) getField,
int columnIndex,
bool ascending,
) {
Comparable<T>? Function(User user) getField,
int columnIndex,
bool ascending,
) {
setState(() {
_sortColumnIndex = columnIndex;
_isAscending = ascending;
@ -160,9 +160,9 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
AppLocalizations.of(context)!.status_success,
style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)),
'Roboto',
'NotoKufi',
)),
),
),
);
@ -174,14 +174,14 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
context.translate(
'Error updating status: $e', '$e خطأ في تحديث الحالة: '),
style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)),
)),
context.translate(
'Error updating status: $e', '$e خطأ في تحديث الحالة: '),
style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)),
)),
);
}
}
@ -201,7 +201,7 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
borderRadius: BorderRadius.circular(5.0), // Rounded corners
),
contentPadding:
EdgeInsets.zero, // Ensure no padding issues with close icon
EdgeInsets.zero, // Ensure no padding issues with close icon
content: Stack(
children: [
Padding(
@ -232,7 +232,7 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
'NotoKufi',
),
fontWeight:
FontWeight.bold, // Makes newStatus bold
FontWeight.bold, // Makes newStatus bold
fontSize: 18,
color: Color(0xFF898C81),
),
@ -301,11 +301,11 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
},
style: TextButton.styleFrom(
backgroundColor:
Color(0xFFAA8E83), // Set background color
Color(0xFFAA8E83), // Set background color
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(10.0), // Set text color
BorderRadius.circular(10.0), // Set text color
),
),
child: Text(
@ -406,314 +406,320 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
AppLocalizations.of(context)!.manage_user,
style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)),
'Roboto',
'NotoKufi',
)),
),
body: isLoading
? Container(
color: Color(0x98FFFCE5), // Semi-transparent background
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
margin: EdgeInsets.symmetric(
horizontal: 40), // Left & Right space
child: LinearProgressIndicator(
minHeight: 5, // Adjust thickness
backgroundColor:
Colors.grey[100], // Optional: Background color
valueColor: AlwaysStoppedAnimation<Color>(
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,
color: isDarkTheme
? Colors.black
: Colors.white, // Semi-transparent background
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
margin: EdgeInsets.symmetric(
horizontal: 40), // Left & Right space
child: LinearProgressIndicator(
minHeight: 5, // Adjust thickness
backgroundColor:
Colors.grey[100], // Optional: Background color
valueColor: AlwaysStoppedAnimation<Color>(
Color(0xFFAA8E83)), // Loader color
),
onChanged: filterUsers,
),
),
],
),
SizedBox(height: myheight / 40),
filteredUserData.isEmpty
? Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(height: myheight / 5),
// Icon(Icons.search,
// size: 60, color: Colors.grey),
Image.asset(
MiscIconAssetPath.group,
width: 60,
height: 60,
)
: 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)),
),
SizedBox(height: 15),
// Space between icon and text
Text(
AppLocalizations.of(context)!
.no_result_found,
style: TextStyle(
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',
),
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,
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',
)),
// 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,
),
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,
onChanged: filterUsers,
),
),
),
SizedBox(height: myheight / 40),
filteredUserData.isEmpty
? Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(height: myheight / 5),
// Icon(Icons.search,
// size: 60, color: Colors.grey),
Image.asset(
MiscIconAssetPath.group,
width: 60,
height: 60,
),
SizedBox(height: 15),
// Space between icon and text
Text(
AppLocalizations.of(context)!
.no_result_found,
style: TextStyle(
fontFamily:
context.translate(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
color: getStatusColor(
status.key),
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.grey[700],
),
),
);
}).toList(),
onChanged: (newStatus) {
print(user);
if (newStatus != null) {
_showConfirmationDialog(
user,
newStatus,
statusOptions[
newStatus]!,
);
}
},
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,
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(),
),
],
),
),
],
),
),
),
),
),
);
}
@ -734,4 +740,4 @@ class User {
required this.registrationDate,
this.status = 'Pending',
});
}
}

View File

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

View File

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