changed primary color usage to fix the color bug in dark mode

Changed Theme.of(context).primaryColor to Theme.of(contex).colorScheme.primary to make dark mode work properly.
This commit is contained in:
asif
2025-09-03 23:49:30 +05:30
parent 85f58c1e25
commit 64e80148a3
17 changed files with 234 additions and 202 deletions

View File

@@ -98,7 +98,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
Widget _buildBalanceShimmer() {
final theme = Theme.of(context);
return Shimmer.fromColors(
baseColor: theme.primaryColor,
baseColor: theme.colorScheme.primary,
highlightColor: theme.colorScheme.onPrimary,
child: Container(
width: 200, height: 42, color: theme.scaffoldBackgroundColor),
@@ -213,7 +213,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
title: Text(
AppLocalizations.of(context).kconnect,
style: TextStyle(
color: theme.primaryColor,
color: theme.colorScheme.primary,
fontWeight: FontWeight.w700,
),
),
@@ -275,7 +275,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
"${AppLocalizations.of(context).hi} $firstName!",
style: GoogleFonts.baumans().copyWith(
fontSize: 20,
color: theme.primaryColor,
color: theme.colorScheme.primary,
fontWeight: FontWeight.w700,
),
),
@@ -289,7 +289,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
vertical: 10,
),
decoration: BoxDecoration(
color: theme.primaryColor,
color: theme.colorScheme.primary,
borderRadius: BorderRadius.circular(16),
),
child: Column(
@@ -307,7 +307,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
),
DropdownButton<int>(
value: selectedAccountIndex,
dropdownColor: theme.primaryColor,
dropdownColor: theme.colorScheme.primary,
underline: const SizedBox(),
icon: const Icon(Icons.keyboard_arrow_down),
iconEnabledColor: theme.colorScheme.onPrimary,
@@ -602,7 +602,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
AppLocalizations.of(context).noTransactions,
style: TextStyle(
fontSize: 16,
color: Colors.grey[600],
color: Theme.of(context).colorScheme.outline,
),
),
),
@@ -663,8 +663,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
icon,
size: 30,
color: disable
? theme.colorScheme.surfaceContainerHighest
: theme.primaryColor,
? theme.colorScheme.onSurface.withValues(alpha: 0.3)
: theme.colorScheme.primary,
grade: 200,
weight: 700,
),

View File

@@ -13,7 +13,7 @@ class AccountCard extends StatelessWidget {
width: 300,
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.onPrimary,
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
@@ -33,7 +33,7 @@ class AccountCard extends StatelessWidget {
Text(
account.accountType,
style: TextStyle(
color: Theme.of(context).scaffoldBackgroundColor,
color: Theme.of(context).colorScheme.onPrimary,
fontSize: 18,
fontWeight: FontWeight.bold,
),
@@ -42,7 +42,7 @@ class AccountCard extends StatelessWidget {
account.accountType == 'Savings'
? Icons.savings
: Icons.account_balance,
color: Theme.of(context).scaffoldBackgroundColor,
color: Theme.of(context).colorScheme.onPrimary,
),
],
),
@@ -50,13 +50,13 @@ class AccountCard extends StatelessWidget {
Text(
account.accountNumber,
style: TextStyle(
color: Theme.of(context).scaffoldBackgroundColor, fontSize: 16),
color: Theme.of(context).colorScheme.onPrimary, fontSize: 16),
),
const SizedBox(height: 30),
Text(
'${account.currency} ${account.balance.toStringAsFixed(2)}',
style: TextStyle(
color: Theme.of(context).scaffoldBackgroundColor,
color: Theme.of(context).colorScheme.onPrimary,
fontSize: 22,
fontWeight: FontWeight.bold,
),
@@ -65,10 +65,11 @@ class AccountCard extends StatelessWidget {
Text(
AppLocalizations.of(context).availableBalance,
style: TextStyle(
color: Theme.of(context).scaffoldBackgroundColor, fontSize: 16),
color: Theme.of(context).colorScheme.onPrimary, fontSize: 16),
),
],
),
);
}
}