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: [

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,13 +259,15 @@ class _ResetPasswordScreenState extends State<Changepassword> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (_isLoading)
const SizedBox(
Container(
child: const SizedBox(
width: 20,
height: 20,
child: CircularProgressIndicator(
color: Colors.white,
strokeWidth: 2,
),
),
)
else ...[
const Text(

View File

@ -280,7 +280,9 @@ class _CreateNewPwState extends ConsumerState<CreateNewPw> {
),
if (isLoading)
Container(
color: Color(0x98FFFCE5), // Semi-transparent background
color: isDarkTheme
? Colors.black
: Colors.white, // Semi-transparent background
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [

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',
)
),),
)),
),
backgroundColor: Colors.red,
),
);
@ -222,14 +224,13 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content:
Text(AppLocalizations.of(context)!.password_update_successfully,
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',
)
),
)),
),
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),
@ -407,8 +415,7 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)
),
)),
),
TextSpan(
text: context.translate('from Previously Used Password',
@ -629,11 +636,7 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)
),
)),
),
SizedBox(width: 2),
Icon(
@ -687,8 +690,7 @@ class _ForgotPasswordState extends ConsumerState<ForgotPassword> {
fontFamily: context.translate(
'Roboto',
'NotoKufi',
)
),
)),
),
SizedBox(height: 20),
ElevatedButton(

View File

@ -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);
@ -2048,8 +2049,10 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
'en';
print('locale22- $locale');
final isDark = ref.watch(themeProvider) == ThemeMode.dark ||
(ref.watch(themeProvider) == ThemeMode.system &&
final isDark =
ref.watch(themeProvider) == ThemeMode.dark ||
(ref.watch(themeProvider) ==
ThemeMode.system &&
MediaQuery.of(context)
.platformBrightness ==
Brightness.dark);
@ -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'] ?? '';
@ -2760,8 +2764,6 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
// '#', '0xff')))
// : Colors.white,
),
],
),
),
@ -2804,10 +2806,16 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
) // Show loading spinner
: Image(
image: AssetImage(
isDarkTheme ? UaeNumbersAssetPath.shareDark : UaeNumbersAssetPath.shareLight,
isDarkTheme
? UaeNumbersAssetPath
.shareDark
: UaeNumbersAssetPath
.shareLight,
),
width: 24, // Set your desired width
height: 24, // Set your desired height
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),
@ -3122,6 +3129,8 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
(chartScreenData['header_color'] ?? '#898C81')
.replaceFirst(
'#', '0xff'))), // Semi-transparent background
child: Container(
color: isDarkTheme ? Colors.black : Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -3139,6 +3148,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
),
],
),
),
)
])),
);
@ -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
@ -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,
@ -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,

File diff suppressed because it is too large Load Diff

View File

@ -214,7 +214,6 @@ class LoginRoute extends HookConsumerWidget {
final body = json.decode(response.body);
if (response.statusCode == 200) {
return body['status'] ?? 'Reset link sent successfully.';
} else {
final errorResponse = json.decode(response.body);
throw Exception(
@ -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,17 +320,21 @@ 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 =
@ -567,7 +571,6 @@ class LoginRoute extends HookConsumerWidget {
// }
// }
@override
Widget build(BuildContext context, WidgetRef ref) {
ref.listen<AsyncValue<bool>>(connectivityProvider, (previous, hasInternet) {
@ -792,7 +795,6 @@ class LoginRoute extends HookConsumerWidget {
),
);
}
},
style: TextButton.styleFrom(
padding: EdgeInsets.zero,
@ -1026,7 +1028,9 @@ class LoginRoute extends HookConsumerWidget {
6.horizontalSpace,
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
)
],
),
@ -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),
@ -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();

View File

@ -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(
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(
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();
}
@ -1170,7 +1182,8 @@ class EconomyStatsState extends ConsumerState<EconomyStatsWidget> {
// 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);
@ -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']),
),
),
],
@ -1510,8 +1524,7 @@ List<Widget> _buildRows(List<Map<String, dynamic>> tileData, Color borderColor,
mainTopic: mainTopic,
onTap: () {},
),
)
);
));
}).toList(),
),
),
@ -1538,7 +1551,9 @@ 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(
@ -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

@ -412,7 +412,9 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
),
body: isLoading
? Container(
color: Color(0x98FFFCE5), // Semi-transparent background
color: isDarkTheme
? Colors.black
: Colors.white, // Semi-transparent background
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -436,13 +438,13 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
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)),
border:
Border.all(width: 2, color: Color(0xFFA0A0A0)),
),
child: Padding(
padding: EdgeInsets.only(left: 5.0),
@ -450,8 +452,11 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
decoration: InputDecoration(
hintText: AppLocalizations.of(context)!.search,
hintStyle: TextStyle(
color: isDarkTheme ? Color(0xFF898C81) : Color(0xFF898C81),
fontFamily: context.translate('Roboto', 'NotoKufi'),
color: isDarkTheme
? Color(0xFF898C81)
: Color(0xFF898C81),
fontFamily:
context.translate('Roboto', 'NotoKufi'),
fontSize: 18,
// height: 1.8,
),
@ -465,7 +470,8 @@ class _ManageUserRouterState extends ConsumerState<ManageUserRouter> {
child: SvgPicture.asset(
MiscIconAssetPath.Search,
semanticsLabel: 'Search',
colorFilter: ColorFilter.mode(Color(0xFFAA8E83), BlendMode.srcIn),
colorFilter: ColorFilter.mode(
Color(0xFFAA8E83), BlendMode.srcIn),
height: 18,
width: 18,
),

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),
),
],
);