fixed some warnings and colors in the dashboard screen

This commit is contained in:
asif
2025-08-29 21:28:45 +05:30
parent da0287ef38
commit f934f0bff6

View File

@@ -94,13 +94,12 @@ class _DashboardScreenState extends State<DashboardScreen> {
} }
Widget _buildBalanceShimmer() { Widget _buildBalanceShimmer() {
final theme = Theme.of(context);
return Shimmer.fromColors( return Shimmer.fromColors(
baseColor: Theme.of(context).dialogBackgroundColor, baseColor: theme.primaryColor,
highlightColor: Theme.of(context).dialogBackgroundColor, highlightColor: theme.colorScheme.onPrimary,
child: Container( child: Container(
width: 100, width: 200, height: 42, color: theme.scaffoldBackgroundColor),
height: 32,
color: Theme.of(context).scaffoldBackgroundColor),
); );
} }
@@ -190,6 +189,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
return BlocListener<AuthCubit, AuthState>( return BlocListener<AuthCubit, AuthState>(
listener: (context, state) async { listener: (context, state) async {
if (state is Authenticated && !_biometricPromptShown) { if (state is Authenticated && !_biometricPromptShown) {
@@ -202,14 +202,14 @@ class _DashboardScreenState extends State<DashboardScreen> {
} }
}, },
child: Scaffold( child: Scaffold(
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: theme.scaffoldBackgroundColor,
appBar: AppBar( appBar: AppBar(
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: theme.scaffoldBackgroundColor,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
title: Text( title: Text(
AppLocalizations.of(context).kconnect, AppLocalizations.of(context).kconnect,
style: TextStyle( style: TextStyle(
color: Theme.of(context).primaryColor, color: theme.primaryColor,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
), ),
@@ -271,7 +271,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
"${AppLocalizations.of(context).hi} $firstName", "${AppLocalizations.of(context).hi} $firstName",
style: GoogleFonts.montserrat().copyWith( style: GoogleFonts.montserrat().copyWith(
fontSize: 25, fontSize: 25,
color: Theme.of(context).primaryColor, color: theme.primaryColor,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
), ),
@@ -285,7 +285,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
vertical: 10, vertical: 10,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).primaryColor, color: theme.primaryColor,
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
), ),
child: Column( child: Column(
@@ -296,21 +296,18 @@ class _DashboardScreenState extends State<DashboardScreen> {
Text( Text(
"${AppLocalizations.of(context).accountNumber}: ", "${AppLocalizations.of(context).accountNumber}: ",
style: TextStyle( style: TextStyle(
color: color: theme.colorScheme.onPrimary,
Theme.of(context).dialogBackgroundColor,
fontSize: 12, fontSize: 12,
), ),
), ),
DropdownButton<int>( DropdownButton<int>(
value: selectedAccountIndex, value: selectedAccountIndex,
dropdownColor: Theme.of(context).primaryColor, dropdownColor: theme.primaryColor,
underline: const SizedBox(), underline: const SizedBox(),
icon: const Icon(Icons.keyboard_arrow_down), icon: const Icon(Icons.keyboard_arrow_down),
iconEnabledColor: iconEnabledColor: theme.colorScheme.onPrimary,
Theme.of(context).dialogBackgroundColor,
style: TextStyle( style: TextStyle(
color: color: theme.colorScheme.onPrimary,
Theme.of(context).dialogBackgroundColor,
fontSize: 14, fontSize: 14,
), ),
items: List.generate(users.length, (index) { items: List.generate(users.length, (index) {
@@ -319,8 +316,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
child: Text( child: Text(
users[index].accountNo ?? 'N/A', users[index].accountNo ?? 'N/A',
style: TextStyle( style: TextStyle(
color: Theme.of(context) color: theme.colorScheme.onPrimary,
.dialogBackgroundColor,
fontSize: 14, fontSize: 14,
), ),
), ),
@@ -360,15 +356,13 @@ class _DashboardScreenState extends State<DashboardScreen> {
width: 20, width: 20,
height: 20, height: 20,
child: CircularProgressIndicator( child: CircularProgressIndicator(
color: Theme.of(context) color: theme.colorScheme.onPrimary,
.dialogBackgroundColor,
strokeWidth: 2, strokeWidth: 2,
), ),
) )
: Icon( : Icon(
Icons.refresh, Icons.refresh,
color: Theme.of(context) color: theme.colorScheme.onPrimary,
.dialogBackgroundColor,
), ),
onPressed: isRefreshing onPressed: isRefreshing
? null ? null
@@ -380,7 +374,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
Text( Text(
getFullAccountType(currAccount.accountType), getFullAccountType(currAccount.accountType),
style: TextStyle( style: TextStyle(
color: Theme.of(context).dialogBackgroundColor, color: theme.colorScheme.onPrimary,
fontSize: 16, fontSize: 16,
), ),
), ),
@@ -391,8 +385,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
Text( Text(
"", "",
style: TextStyle( style: TextStyle(
color: color: theme.colorScheme.onPrimary,
Theme.of(context).dialogBackgroundColor,
fontSize: 40, fontSize: 40,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
@@ -405,8 +398,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
'0.00' '0.00'
: '********', : '********',
style: TextStyle( style: TextStyle(
color: Theme.of(context) color: theme.colorScheme.onPrimary,
.dialogBackgroundColor,
fontSize: 40, fontSize: 40,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
@@ -436,8 +428,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
isVisible isVisible
? Symbols.visibility_lock ? Symbols.visibility_lock
: Symbols.visibility, : Symbols.visibility,
color: Theme.of(context) color: theme.scaffoldBackgroundColor,
.scaffoldBackgroundColor, weight: 800,
), ),
), ),
], ],
@@ -627,30 +619,26 @@ class _DashboardScreenState extends State<DashboardScreen> {
} }
List<Widget> _buildTransactionShimmer() { List<Widget> _buildTransactionShimmer() {
final theme = Theme.of(context);
return List.generate(3, (i) { return List.generate(3, (i) {
return ListTile( return ListTile(
leading: Shimmer.fromColors( leading: Shimmer.fromColors(
baseColor: Colors.grey[300]!, baseColor: Colors.grey[300]!,
highlightColor: Colors.grey[100]!, highlightColor: Colors.grey[100]!,
child: CircleAvatar( child: CircleAvatar(
radius: 12, radius: 12, backgroundColor: theme.scaffoldBackgroundColor),
backgroundColor: Theme.of(context).scaffoldBackgroundColor),
), ),
title: Shimmer.fromColors( title: Shimmer.fromColors(
baseColor: Colors.grey[300]!, baseColor: Colors.grey[300]!,
highlightColor: Colors.grey[100]!, highlightColor: Colors.grey[100]!,
child: Container( child: Container(
height: 10, height: 10, width: 100, color: theme.scaffoldBackgroundColor),
width: 100,
color: Theme.of(context).scaffoldBackgroundColor),
), ),
subtitle: Shimmer.fromColors( subtitle: Shimmer.fromColors(
baseColor: Colors.grey[300]!, baseColor: Colors.grey[300]!,
highlightColor: Colors.grey[100]!, highlightColor: Colors.grey[100]!,
child: Container( child: Container(
height: 8, height: 8, width: 60, color: theme.scaffoldBackgroundColor),
width: 60,
color: Theme.of(context).scaffoldBackgroundColor),
), ),
); );
}); });
@@ -662,6 +650,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
VoidCallback onTap, { VoidCallback onTap, {
bool disable = false, bool disable = false,
}) { }) {
final theme = Theme.of(context);
return InkWell( return InkWell(
onTap: disable ? null : onTap, onTap: disable ? null : onTap,
child: Column( child: Column(