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

@@ -120,8 +120,6 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
appBar: AppBar(
title: Text(
AppLocalizations.of(context).accountStatement,
style:
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
),
centerTitle: false,
),
@@ -190,19 +188,20 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
child: ElevatedButton(
onPressed: _loadTransactions,
style: ElevatedButton.styleFrom(
backgroundColor: Theme.of(context).primaryColor,
backgroundColor:
Theme.of(context).colorScheme.primaryContainer,
padding: const EdgeInsets.symmetric(vertical: 16),
),
child: Text(
AppLocalizations.of(context).search,
style: TextStyle(
color: Theme.of(context).scaffoldBackgroundColor,
color: Theme.of(context).colorScheme.onPrimaryContainer,
fontSize: 16,
),
),
),
),
const SizedBox(height: 35),
const SizedBox(height: 15),
if (!_txLoading &&
_transactions.isNotEmpty &&
fromDate == null &&
@@ -214,7 +213,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Colors.grey[700],
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
),
@@ -255,10 +254,11 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
: _transactions.isEmpty
? Center(
child: Text(
AppLocalizations.of(context).noTransactions,
style: TextStyle(
fontSize: 16, color: Colors.grey[600]),
),
AppLocalizations.of(context).noTransactions,
style: TextStyle(
fontSize: 16,
color: Theme.of(context).colorScheme.onSurface,
)),
)
: ListView.separated(
itemCount: _transactions.length,
@@ -269,8 +269,9 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
tx.type == 'CR'
? Symbols.call_received
: Symbols.call_made,
color:
tx.type == 'CR' ? Colors.green : Colors.red,
color: tx.type == 'CR'
? Colors.green
: Theme.of(context).colorScheme.error,
),
title: Text(
tx.date ?? '',
@@ -314,7 +315,8 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
border:
Border.all(color: Theme.of(context).colorScheme.onSurfaceVariant),
borderRadius: BorderRadius.circular(6),
),
child: Row(
@@ -324,7 +326,9 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
date != null ? _formatDate(date) : label,
style: TextStyle(
fontSize: 16,
color: date != null ? Colors.black : Colors.grey,
color: date != null
? Theme.of(context).colorScheme.onSurface
: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
const Icon(Icons.arrow_drop_down),