From f934f0bff646a03abadd12afdca9d7a82fe570b7 Mon Sep 17 00:00:00 2001 From: asif Date: Fri, 29 Aug 2025 21:28:45 +0530 Subject: [PATCH] fixed some warnings and colors in the dashboard screen --- .../dashboard/screens/dashboard_screen.dart | 65 ++++++++----------- 1 file changed, 27 insertions(+), 38 deletions(-) diff --git a/lib/features/dashboard/screens/dashboard_screen.dart b/lib/features/dashboard/screens/dashboard_screen.dart index 80e3385..d07483b 100644 --- a/lib/features/dashboard/screens/dashboard_screen.dart +++ b/lib/features/dashboard/screens/dashboard_screen.dart @@ -94,13 +94,12 @@ class _DashboardScreenState extends State { } Widget _buildBalanceShimmer() { + final theme = Theme.of(context); return Shimmer.fromColors( - baseColor: Theme.of(context).dialogBackgroundColor, - highlightColor: Theme.of(context).dialogBackgroundColor, + baseColor: theme.primaryColor, + highlightColor: theme.colorScheme.onPrimary, child: Container( - width: 100, - height: 32, - color: Theme.of(context).scaffoldBackgroundColor), + width: 200, height: 42, color: theme.scaffoldBackgroundColor), ); } @@ -190,6 +189,7 @@ class _DashboardScreenState extends State { @override Widget build(BuildContext context) { + final theme = Theme.of(context); return BlocListener( listener: (context, state) async { if (state is Authenticated && !_biometricPromptShown) { @@ -202,14 +202,14 @@ class _DashboardScreenState extends State { } }, child: Scaffold( - backgroundColor: Theme.of(context).scaffoldBackgroundColor, + backgroundColor: theme.scaffoldBackgroundColor, appBar: AppBar( - backgroundColor: Theme.of(context).scaffoldBackgroundColor, + backgroundColor: theme.scaffoldBackgroundColor, automaticallyImplyLeading: false, title: Text( AppLocalizations.of(context).kconnect, style: TextStyle( - color: Theme.of(context).primaryColor, + color: theme.primaryColor, fontWeight: FontWeight.w500, ), ), @@ -271,7 +271,7 @@ class _DashboardScreenState extends State { "${AppLocalizations.of(context).hi} $firstName", style: GoogleFonts.montserrat().copyWith( fontSize: 25, - color: Theme.of(context).primaryColor, + color: theme.primaryColor, fontWeight: FontWeight.w700, ), ), @@ -285,7 +285,7 @@ class _DashboardScreenState extends State { vertical: 10, ), decoration: BoxDecoration( - color: Theme.of(context).primaryColor, + color: theme.primaryColor, borderRadius: BorderRadius.circular(16), ), child: Column( @@ -296,21 +296,18 @@ class _DashboardScreenState extends State { Text( "${AppLocalizations.of(context).accountNumber}: ", style: TextStyle( - color: - Theme.of(context).dialogBackgroundColor, + color: theme.colorScheme.onPrimary, fontSize: 12, ), ), DropdownButton( value: selectedAccountIndex, - dropdownColor: Theme.of(context).primaryColor, + dropdownColor: theme.primaryColor, underline: const SizedBox(), icon: const Icon(Icons.keyboard_arrow_down), - iconEnabledColor: - Theme.of(context).dialogBackgroundColor, + iconEnabledColor: theme.colorScheme.onPrimary, style: TextStyle( - color: - Theme.of(context).dialogBackgroundColor, + color: theme.colorScheme.onPrimary, fontSize: 14, ), items: List.generate(users.length, (index) { @@ -319,8 +316,7 @@ class _DashboardScreenState extends State { child: Text( users[index].accountNo ?? 'N/A', style: TextStyle( - color: Theme.of(context) - .dialogBackgroundColor, + color: theme.colorScheme.onPrimary, fontSize: 14, ), ), @@ -360,15 +356,13 @@ class _DashboardScreenState extends State { width: 20, height: 20, child: CircularProgressIndicator( - color: Theme.of(context) - .dialogBackgroundColor, + color: theme.colorScheme.onPrimary, strokeWidth: 2, ), ) : Icon( Icons.refresh, - color: Theme.of(context) - .dialogBackgroundColor, + color: theme.colorScheme.onPrimary, ), onPressed: isRefreshing ? null @@ -380,7 +374,7 @@ class _DashboardScreenState extends State { Text( getFullAccountType(currAccount.accountType), style: TextStyle( - color: Theme.of(context).dialogBackgroundColor, + color: theme.colorScheme.onPrimary, fontSize: 16, ), ), @@ -391,8 +385,7 @@ class _DashboardScreenState extends State { Text( "₹ ", style: TextStyle( - color: - Theme.of(context).dialogBackgroundColor, + color: theme.colorScheme.onPrimary, fontSize: 40, fontWeight: FontWeight.w700, ), @@ -405,8 +398,7 @@ class _DashboardScreenState extends State { '0.00' : '********', style: TextStyle( - color: Theme.of(context) - .dialogBackgroundColor, + color: theme.colorScheme.onPrimary, fontSize: 40, fontWeight: FontWeight.w700, ), @@ -436,8 +428,8 @@ class _DashboardScreenState extends State { isVisible ? Symbols.visibility_lock : Symbols.visibility, - color: Theme.of(context) - .scaffoldBackgroundColor, + color: theme.scaffoldBackgroundColor, + weight: 800, ), ), ], @@ -627,30 +619,26 @@ class _DashboardScreenState extends State { } List _buildTransactionShimmer() { + final theme = Theme.of(context); return List.generate(3, (i) { return ListTile( leading: Shimmer.fromColors( baseColor: Colors.grey[300]!, highlightColor: Colors.grey[100]!, child: CircleAvatar( - radius: 12, - backgroundColor: Theme.of(context).scaffoldBackgroundColor), + radius: 12, backgroundColor: theme.scaffoldBackgroundColor), ), title: Shimmer.fromColors( baseColor: Colors.grey[300]!, highlightColor: Colors.grey[100]!, child: Container( - height: 10, - width: 100, - color: Theme.of(context).scaffoldBackgroundColor), + height: 10, width: 100, color: theme.scaffoldBackgroundColor), ), subtitle: Shimmer.fromColors( baseColor: Colors.grey[300]!, highlightColor: Colors.grey[100]!, child: Container( - height: 8, - width: 60, - color: Theme.of(context).scaffoldBackgroundColor), + height: 8, width: 60, color: theme.scaffoldBackgroundColor), ), ); }); @@ -662,6 +650,7 @@ class _DashboardScreenState extends State { VoidCallback onTap, { bool disable = false, }) { + final theme = Theme.of(context); return InkWell( onTap: disable ? null : onTap, child: Column(