Theme Colour bugs fixed

This commit is contained in:
2025-08-25 17:47:18 +05:30
parent 04c992c934
commit 180d3a3a60
7 changed files with 70 additions and 50 deletions

View File

@@ -7,6 +7,9 @@
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
analyzer:
errors:
dead_code: ignore
include: package:flutter_lints/flutter.yaml
linter:

View File

@@ -29,3 +29,5 @@ class ImpsService {
}
}
}

View File

@@ -1,4 +1,5 @@
import 'package:dio/dio.dart';
import 'package:kmobile/data/models/imps_transaction.dart';
import 'package:kmobile/data/models/rtgs_response.dart';
import 'package:kmobile/data/models/rtgs_transaction.dart';
@@ -28,4 +29,6 @@ class RtgsService {
throw Exception('An unexpected error occurred: ${e.toString()}');
}
}
processImpsTransaction(ImpsTransaction impsTx) {}
}

View File

@@ -99,7 +99,7 @@ class _KMobileState extends State<KMobile> {
title: 'kMobile',
theme: themeState.getThemeData(),
//darkTheme: themeState.getThemeData(),
themeMode: ThemeMode.system,
themeMode: ThemeMode.light,
onGenerateRoute: AppRoutes.generateRoute,
initialRoute: AppRoutes.splash,
home: showSplash ? const SplashScreen() : const AuthGate(),

View File

@@ -2,31 +2,40 @@ import 'package:flutter/material.dart';
import 'theme_type.dart';
class AppThemes {
static ThemeData getLightTheme(ThemeType type) {
switch (type) {
case ThemeType.green:
return ThemeData(primarySwatch: Colors.green);
case ThemeType.orange:
return ThemeData(primarySwatch: Colors.orange);
case ThemeType.blue:
return ThemeData(primarySwatch: Colors.blue);
case ThemeType.violet:
default:
return ThemeData(primarySwatch: Colors.deepPurple);
}
}
// static ThemeData getDarkTheme(ThemeType type) {
// switch (type) {
// case ThemeType.green:
// return ThemeData.dark().copyWith(primaryColor: Colors.green);
// case ThemeType.orange:
// return ThemeData.dark().copyWith(primaryColor: Colors.orange);
// case ThemeType.blue:
// return ThemeData.dark().copyWith(primaryColor: Colors.blue);
// case ThemeType.violet:
// default:
// return ThemeData.dark().copyWith(primaryColor: Colors.deepPurple);
// }
// }
static ThemeData getLightTheme(ThemeType type) {
// Define a seed color based on the theme type
final Color seedColor;
switch (type) {
case ThemeType.green:
seedColor = Colors.green;
break;
case ThemeType.orange:
seedColor = Colors.orange;
break;
case ThemeType.blue:
seedColor = Colors.blue;
break;
case ThemeType.violet:
default:
seedColor = Colors.deepPurple;
break;
}
// Create a ColorScheme from the seed color
final colorScheme = ColorScheme.fromSeed(
seedColor: seedColor,
brightness: Brightness.light, // Explicitly set for a light theme
);
// Create the ThemeData from the ColorScheme
return ThemeData.from(
colorScheme: colorScheme,
useMaterial3: true, // Recommended for modern Flutter apps
).copyWith(
scaffoldBackgroundColor: Colors.white,
bottomNavigationBarTheme: BottomNavigationBarThemeData(
backgroundColor: colorScheme.surface,
),
);
}
}

View File

@@ -262,7 +262,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
fontSize: 16, color: Colors.grey[600]),
),
)
: ListView.builder(
: ListView.separated(
itemCount: _transactions.length,
itemBuilder: (context, index) {
final tx = _transactions[index];
@@ -275,21 +275,21 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
tx.type == 'CR' ? Colors.green : Colors.red,
),
title: Text(
tx.name != null
? (tx.name!.length > 18
? tx.name!.substring(0, 22)
: tx.name!)
: '',
style: const TextStyle(fontSize: 14),
),
subtitle: Text(
tx.date ?? '',
style: const TextStyle(fontSize: 12),
),
trailing: Text(
"${tx.amount}",
style: const TextStyle(fontSize: 16),
),
tx.date ?? '',
style: const TextStyle(fontSize: 15),
),
subtitle: Text(
tx.name != null
? (tx.name!.length > 18
? tx.name!.substring(0, 22)
: tx.name!)
: '',
style: const TextStyle(fontSize: 12),
),
trailing: Text(
"${tx.amount}",
style: const TextStyle(fontSize: 17),
),
onTap: () {
Navigator.push(
context,
@@ -301,6 +301,9 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
},
);
},
separatorBuilder: (context, index) {
return const Divider();
},
),
),
],

View File

@@ -572,20 +572,20 @@ class _DashboardScreenState extends State<DashboardScreen> {
tx.type == 'CR' ? Colors.green : Colors.red,
),
title: Text(
tx.name != null
tx.date ?? '',
style: const TextStyle(fontSize: 15),
),
subtitle: Text(
tx.name != null
? (tx.name!.length > 18
? tx.name!.substring(0, 22)
: tx.name!)
: '',
style: const TextStyle(fontSize: 14),
),
subtitle: Text(
tx.date ?? '',
style: const TextStyle(fontSize: 12),
),
trailing: Text(
"${tx.amount}",
style: const TextStyle(fontSize: 16),
style: const TextStyle(fontSize: 17),
),
onTap: () {
Navigator.push(