Theme
This commit is contained in:
@@ -191,7 +191,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
textInputAction: TextInputAction.next,
|
||||
@@ -206,7 +206,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
textInputAction: TextInputAction.done,
|
||||
@@ -220,9 +220,9 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
),
|
||||
child: const Icon(
|
||||
child: Icon(
|
||||
Symbols.arrow_forward,
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
|
50
lib/features/auth/controllers/theme_cubit.dart
Normal file
50
lib/features/auth/controllers/theme_cubit.dart
Normal file
@@ -0,0 +1,50 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'theme_state.dart';
|
||||
import 'package:kmobile/config/theme_type.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:kmobile/config/themes.dart';
|
||||
|
||||
class ThemeCubit extends Cubit<ThemeState> {
|
||||
ThemeCubit()
|
||||
: super(ThemeState(
|
||||
lightTheme: AppThemes.getLightTheme(ThemeType.violet),
|
||||
themeMode: ThemeMode.light,
|
||||
themeType: ThemeType.violet,
|
||||
)) {
|
||||
loadTheme();
|
||||
}
|
||||
|
||||
Future<void> loadTheme() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final themeIndex = prefs.getInt('theme_type') ?? 0;
|
||||
final isDark = prefs.getBool('is_dark_mode') ?? false;
|
||||
|
||||
final type = ThemeType.values[themeIndex];
|
||||
emit(state.copyWith(
|
||||
lightTheme: AppThemes.getLightTheme(type),
|
||||
themeMode: isDark ? ThemeMode.dark : ThemeMode.light,
|
||||
themeType: type,
|
||||
));
|
||||
}
|
||||
|
||||
Future<void> changeTheme(ThemeType type) async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setInt('theme_type', type.index);
|
||||
|
||||
emit(state.copyWith(
|
||||
lightTheme: AppThemes.getLightTheme(type),
|
||||
themeType: type,
|
||||
));
|
||||
}
|
||||
|
||||
Future<void> toggleDarkMode(bool isDark) async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setBool('is_dark_mode', isDark);
|
||||
|
||||
emit(state.copyWith(
|
||||
themeMode: isDark ? ThemeMode.dark : ThemeMode.light,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
27
lib/features/auth/controllers/theme_state.dart
Normal file
27
lib/features/auth/controllers/theme_state.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:kmobile/config/theme_type.dart';
|
||||
|
||||
class ThemeState {
|
||||
final ThemeData lightTheme;
|
||||
final ThemeMode themeMode;
|
||||
final ThemeType themeType;
|
||||
|
||||
ThemeState({
|
||||
required this.lightTheme,
|
||||
required this.themeMode,
|
||||
required this.themeType,
|
||||
});
|
||||
|
||||
ThemeState copyWith({
|
||||
ThemeData? lightTheme,
|
||||
ThemeMode? themeMode,
|
||||
ThemeType? themeType,
|
||||
}) {
|
||||
return ThemeState(
|
||||
lightTheme: lightTheme ?? this.lightTheme,
|
||||
themeMode: themeMode ?? this.themeMode,
|
||||
themeType: themeType ?? this.themeType,
|
||||
);
|
||||
}
|
||||
bool get isDarkMode => themeMode == ThemeMode.dark;
|
||||
}
|
@@ -108,10 +108,10 @@ class LoginScreenState extends State<LoginScreen>
|
||||
width: 150,
|
||||
height: 150,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return const Icon(
|
||||
return Icon(
|
||||
Icons.account_balance,
|
||||
size: 100,
|
||||
color: Colors.blue,
|
||||
color: Theme.of(context).primaryColor,
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -123,7 +123,7 @@ class LoginScreenState extends State<LoginScreen>
|
||||
style: TextStyle(
|
||||
fontSize: 32,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.blue,
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 48),
|
||||
@@ -136,7 +136,7 @@ class LoginScreenState extends State<LoginScreen>
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -166,7 +166,7 @@ class LoginScreenState extends State<LoginScreen>
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -202,8 +202,8 @@ class LoginScreenState extends State<LoginScreen>
|
||||
style: ElevatedButton.styleFrom(
|
||||
shape: const StadiumBorder(),
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
backgroundColor: Colors.white,
|
||||
foregroundColor: Colors.blueAccent,
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
foregroundColor: Theme.of(context).primaryColorDark,
|
||||
side: const BorderSide(color: Colors.black, width: 1),
|
||||
elevation: 0,
|
||||
),
|
||||
@@ -242,7 +242,7 @@ class LoginScreenState extends State<LoginScreen>
|
||||
style: OutlinedButton.styleFrom(
|
||||
shape: const StadiumBorder(),
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
backgroundColor: Colors.lightBlue[100],
|
||||
backgroundColor: Theme.of(context).primaryColorLight,
|
||||
foregroundColor: Colors.black,
|
||||
),
|
||||
child: Text(AppLocalizations.of(context).register),
|
||||
|
@@ -197,7 +197,7 @@ class _MPinScreenState extends State<MPinScreen> {
|
||||
key == '<' ? '⌫' : key,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
color: key == 'Enter' ? Colors.blue : Colors.black,
|
||||
color: key == 'Enter' ? Theme.of(context).primaryColor : Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@@ -43,10 +43,10 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context).kconnect,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 36,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).dialogBackgroundColor,
|
||||
letterSpacing: 1.5,
|
||||
),
|
||||
),
|
||||
@@ -54,9 +54,9 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
||||
Text(
|
||||
AppLocalizations.of(context).kccBankFull,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).dialogBackgroundColor,
|
||||
letterSpacing: 1.2,
|
||||
),
|
||||
),
|
||||
@@ -65,12 +65,12 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
||||
),
|
||||
|
||||
/// 🔹 Loading Spinner at Bottom
|
||||
const Positioned(
|
||||
Positioned(
|
||||
bottom: 40,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(color: Colors.white),
|
||||
child: CircularProgressIndicator(color: Theme.of(context).scaffoldBackgroundColor),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@@ -49,7 +49,7 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
Expanded(
|
||||
child: Text(
|
||||
AppLocalizations.of(context).beneficiaryAdded,
|
||||
style: TextStyle(color: Colors.white),
|
||||
style: TextStyle(color: Theme.of(context).dialogBackgroundColor),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
@@ -176,7 +176,7 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -211,7 +211,7 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -247,7 +247,7 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).dialogBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -376,7 +376,7 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -425,7 +425,7 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white, // disabled color
|
||||
fillColor: Theme.of(context).dialogBackgroundColor, // disabled color
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -448,7 +448,7 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).dialogBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -470,7 +470,7 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -510,7 +510,7 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -542,8 +542,8 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
style: ElevatedButton.styleFrom(
|
||||
shape: const StadiumBorder(),
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
backgroundColor: Colors.blue[900],
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: Theme.of(context).primaryColorDark,
|
||||
foregroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
),
|
||||
child: Text(AppLocalizations.of(context).validateAndAdd),
|
||||
),
|
||||
|
@@ -58,8 +58,8 @@ class _ManageBeneficiariesScreen extends State<ManageBeneficiariesScreen> {
|
||||
itemBuilder: (context, index) {
|
||||
final beneficiary = beneficiaries[index];
|
||||
return ListTile(
|
||||
leading: const CircleAvatar(
|
||||
backgroundColor: Colors.blue,
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
child: Text('A'),
|
||||
),
|
||||
title: Text(beneficiary['name']!),
|
||||
@@ -85,8 +85,8 @@ class _ManageBeneficiariesScreen extends State<ManageBeneficiariesScreen> {
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: Colors.grey[300],
|
||||
foregroundColor: Colors.blue[900],
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
foregroundColor: Theme.of(context).primaryColor,
|
||||
elevation: 5,
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
|
@@ -42,7 +42,7 @@ class _BlockCardScreen extends State<BlockCardScreen> {
|
||||
onPressed: () {
|
||||
// Just close the SnackBar
|
||||
},
|
||||
textColor: Colors.white,
|
||||
textColor: Theme.of(context).dialogBackgroundColor,
|
||||
),
|
||||
backgroundColor: Colors.black,
|
||||
behavior: SnackBarBehavior.floating,
|
||||
@@ -97,7 +97,7 @@ class _BlockCardScreen extends State<BlockCardScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -122,7 +122,7 @@ class _BlockCardScreen extends State<BlockCardScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -150,7 +150,7 @@ class _BlockCardScreen extends State<BlockCardScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -174,7 +174,7 @@ class _BlockCardScreen extends State<BlockCardScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -198,8 +198,8 @@ class _BlockCardScreen extends State<BlockCardScreen> {
|
||||
style: ElevatedButton.styleFrom(
|
||||
shape: const StadiumBorder(),
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
backgroundColor: Colors.blue[900],
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
foregroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
),
|
||||
child: Text(AppLocalizations.of(context).block),
|
||||
),
|
||||
|
@@ -87,7 +87,7 @@ class _CardPinChangeDetailsScreen extends State<CardPinChangeDetailsScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -112,7 +112,7 @@ class _CardPinChangeDetailsScreen extends State<CardPinChangeDetailsScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -140,7 +140,7 @@ class _CardPinChangeDetailsScreen extends State<CardPinChangeDetailsScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -164,7 +164,7 @@ class _CardPinChangeDetailsScreen extends State<CardPinChangeDetailsScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -188,8 +188,8 @@ class _CardPinChangeDetailsScreen extends State<CardPinChangeDetailsScreen> {
|
||||
style: ElevatedButton.styleFrom(
|
||||
shape: const StadiumBorder(),
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
backgroundColor: Colors.blue[900],
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
foregroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
),
|
||||
child: Text(AppLocalizations.of(context).next),
|
||||
),
|
||||
|
@@ -25,7 +25,7 @@ class _CardPinSetScreen extends State<CardPinSetScreen> {
|
||||
onPressed: () {
|
||||
// Just close the SnackBar
|
||||
},
|
||||
textColor: Colors.white,
|
||||
textColor: Theme.of(context).dialogBackgroundColor,
|
||||
),
|
||||
backgroundColor: Colors.black,
|
||||
behavior: SnackBarBehavior.floating,
|
||||
@@ -87,7 +87,7 @@ class _CardPinSetScreen extends State<CardPinSetScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -116,7 +116,7 @@ class _CardPinSetScreen extends State<CardPinSetScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -143,8 +143,8 @@ class _CardPinSetScreen extends State<CardPinSetScreen> {
|
||||
style: ElevatedButton.styleFrom(
|
||||
shape: const StadiumBorder(),
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
backgroundColor: Colors.blue[900],
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
foregroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
),
|
||||
child: Text(AppLocalizations.of(context).submit),
|
||||
),
|
||||
|
@@ -93,9 +93,9 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
|
||||
Widget _buildBalanceShimmer() {
|
||||
return Shimmer.fromColors(
|
||||
baseColor: Colors.white.withOpacity(0.7),
|
||||
highlightColor: Colors.white.withOpacity(0.3),
|
||||
child: Container(width: 100, height: 32, color: Colors.white),
|
||||
baseColor: Theme.of(context).dialogBackgroundColor,
|
||||
highlightColor: Theme.of(context).dialogBackgroundColor,
|
||||
child: Container(width: 100, height: 32, color: Theme.of(context).scaffoldBackgroundColor),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -197,9 +197,9 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: const Color(0xfff5f9fc),
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
appBar: AppBar(
|
||||
backgroundColor: const Color(0xfff5f9fc),
|
||||
backgroundColor:Theme.of(context).scaffoldBackgroundColor,
|
||||
automaticallyImplyLeading: false,
|
||||
title: Text(
|
||||
AppLocalizations.of(context).kMobile,
|
||||
@@ -208,6 +208,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
centerTitle: true,
|
||||
actions: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 10.0),
|
||||
@@ -265,7 +266,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
"${AppLocalizations.of(context).hi} $firstName",
|
||||
style: GoogleFonts.montserrat().copyWith(
|
||||
fontSize: 25,
|
||||
color: Theme.of(context).primaryColorDark,
|
||||
color: Theme.of(context).primaryColor,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
@@ -289,8 +290,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
children: [
|
||||
Text(
|
||||
"${AppLocalizations.of(context).accountNumber}: ",
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).dialogBackgroundColor,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
@@ -299,9 +300,9 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
dropdownColor: Theme.of(context).primaryColor,
|
||||
underline: const SizedBox(),
|
||||
icon: const Icon(Icons.keyboard_arrow_down),
|
||||
iconEnabledColor: Colors.white,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
iconEnabledColor:Theme.of(context).dialogBackgroundColor,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).dialogBackgroundColor,
|
||||
fontSize: 14,
|
||||
),
|
||||
items: List.generate(users.length, (index) {
|
||||
@@ -309,8 +310,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
value: index,
|
||||
child: Text(
|
||||
users[index].accountNo ?? 'N/A',
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).dialogBackgroundColor,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
@@ -346,17 +347,17 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
icon: isRefreshing
|
||||
? const SizedBox(
|
||||
? SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).dialogBackgroundColor,
|
||||
strokeWidth: 2,
|
||||
),
|
||||
)
|
||||
: const Icon(
|
||||
: Icon(
|
||||
Icons.refresh,
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).dialogBackgroundColor,
|
||||
),
|
||||
onPressed: isRefreshing
|
||||
? null
|
||||
@@ -367,8 +368,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
),
|
||||
Text(
|
||||
getFullAccountType(currAccount.accountType),
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).dialogBackgroundColor,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
@@ -376,10 +377,10 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
Text(
|
||||
"₹ ",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).dialogBackgroundColor,
|
||||
fontSize: 40,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
@@ -391,8 +392,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
? currAccount.currentBalance ??
|
||||
'0.00'
|
||||
: '********',
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).dialogBackgroundColor,
|
||||
fontSize: 40,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
@@ -422,7 +423,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
isVisible
|
||||
? Symbols.visibility_lock
|
||||
: Symbols.visibility,
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -598,17 +599,17 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
leading: Shimmer.fromColors(
|
||||
baseColor: Colors.grey[300]!,
|
||||
highlightColor: Colors.grey[100]!,
|
||||
child: const CircleAvatar(radius: 12, backgroundColor: Colors.white),
|
||||
child: CircleAvatar(radius: 12, backgroundColor: Theme.of(context).scaffoldBackgroundColor),
|
||||
),
|
||||
title: Shimmer.fromColors(
|
||||
baseColor: Colors.grey[300]!,
|
||||
highlightColor: Colors.grey[100]!,
|
||||
child: Container(height: 10, width: 100, color: Colors.white),
|
||||
child: Container(height: 10, width: 100, color: Theme.of(context).scaffoldBackgroundColor),
|
||||
),
|
||||
subtitle: Shimmer.fromColors(
|
||||
baseColor: Colors.grey[300]!,
|
||||
highlightColor: Colors.grey[100]!,
|
||||
child: Container(height: 8, width: 60, color: Colors.white),
|
||||
child: Container(height: 8, width: 60, color: Theme.of(context).scaffoldBackgroundColor),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
@@ -39,8 +39,8 @@ class AccountCard extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
account.accountType,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -49,20 +49,20 @@ class AccountCard extends StatelessWidget {
|
||||
account.accountType == 'Savings'
|
||||
? Icons.savings
|
||||
: Icons.account_balance,
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
account.accountNumber,
|
||||
style: const TextStyle(color: Colors.white70, fontSize: 16),
|
||||
style: TextStyle(color: Theme.of(context).dialogBackgroundColor, fontSize: 16),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
Text(
|
||||
'${account.currency} ${account.balance.toStringAsFixed(2)}',
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
|
@@ -38,12 +38,12 @@ class _EnquiryScreen extends State<EnquiryScreen> {
|
||||
const SizedBox(height: 4),
|
||||
GestureDetector(
|
||||
onTap: () => _launchEmailAddress(email),
|
||||
child: Text(email, style: const TextStyle(color: Colors.blue)),
|
||||
child: Text(email, style: TextStyle(color: Theme.of(context).primaryColor)),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
GestureDetector(
|
||||
onTap: () => _launchPhoneNumber(phone),
|
||||
child: Text(phone, style: const TextStyle(color: Colors.blue)),
|
||||
child: Text(phone, style: TextStyle(color: Theme.of(context).scaffoldBackgroundColor)),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -92,9 +92,9 @@ class _EnquiryScreen extends State<EnquiryScreen> {
|
||||
style: TextStyle(color: Colors.grey),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
const Text(
|
||||
Text(
|
||||
"complaint@kccb.in",
|
||||
style: TextStyle(color: Colors.blue),
|
||||
style: TextStyle(color: Theme.of(context).primaryColor),
|
||||
),
|
||||
|
||||
SizedBox(height: 20),
|
||||
|
@@ -60,8 +60,8 @@ class _FundTransferBeneficiaryScreen
|
||||
itemBuilder: (context, index) {
|
||||
final beneficiary = beneficiaries[index];
|
||||
return ListTile(
|
||||
leading: const CircleAvatar(
|
||||
backgroundColor: Colors.blue,
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
child: Text('A'),
|
||||
),
|
||||
title: Text(beneficiary['name']!),
|
||||
@@ -96,7 +96,7 @@ class _FundTransferBeneficiaryScreen
|
||||
);
|
||||
},
|
||||
backgroundColor: Colors.grey[300],
|
||||
foregroundColor: Colors.blue[900],
|
||||
foregroundColor: Theme.of(context).primaryColor,
|
||||
elevation: 5,
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
|
@@ -135,7 +135,7 @@ class _FundTransferScreen extends State<FundTransferScreen> {
|
||||
const Spacer(),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
child: GridView.count(
|
||||
crossAxisCount: 3,
|
||||
shrinkWrap: true,
|
||||
|
@@ -8,8 +8,9 @@ import 'package:lottie/lottie.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
import 'package:confetti/confetti.dart';
|
||||
|
||||
class PaymentAnimationScreen extends StatefulWidget {
|
||||
/*class PaymentAnimationScreen extends StatefulWidget {
|
||||
final Future<PaymentResponse> paymentResponse;
|
||||
|
||||
const PaymentAnimationScreen({super.key, required this.paymentResponse});
|
||||
@@ -97,7 +98,7 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).paymentSuccessful,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.green,
|
||||
@@ -133,7 +134,7 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context).paymentFailed,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.red,
|
||||
@@ -223,4 +224,238 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
|
||||
),
|
||||
);
|
||||
}
|
||||
}*/
|
||||
|
||||
class PaymentAnimationScreen extends StatefulWidget {
|
||||
final Future<PaymentResponse> paymentResponse;
|
||||
|
||||
const PaymentAnimationScreen({super.key, required this.paymentResponse});
|
||||
|
||||
@override
|
||||
State<PaymentAnimationScreen> createState() => _PaymentAnimationScreenState();
|
||||
}
|
||||
|
||||
class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
|
||||
final GlobalKey _shareKey = GlobalKey();
|
||||
late ConfettiController _confettiController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_confettiController = ConfettiController(duration: const Duration(seconds: 2));
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_confettiController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> _shareScreenshot() async {
|
||||
try {
|
||||
RenderRepaintBoundary boundary =
|
||||
_shareKey.currentContext!.findRenderObject() as RenderRepaintBoundary;
|
||||
ui.Image image = await boundary.toImage(pixelRatio: 3.0);
|
||||
ByteData? byteData = await image.toByteData(format: ui.ImageByteFormat.png);
|
||||
Uint8List pngBytes = byteData!.buffer.asUint8List();
|
||||
|
||||
final tempDir = await getTemporaryDirectory();
|
||||
final file = await File('${tempDir.path}/payment_result.png').create();
|
||||
await file.writeAsBytes(pngBytes);
|
||||
|
||||
await Share.shareXFiles(
|
||||
[XFile(file.path)],
|
||||
text: AppLocalizations.of(context).paymentResult,
|
||||
);
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'${AppLocalizations.of(context).failedToShareScreenshot}: $e',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: FutureBuilder<PaymentResponse>(
|
||||
future: widget.paymentResponse,
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData) {
|
||||
return Center(
|
||||
child: Lottie.asset(
|
||||
'assets/animations/rupee.json',
|
||||
width: 200,
|
||||
height: 200,
|
||||
repeat: true,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final response = snapshot.data!;
|
||||
final isSuccess = response.isSuccess;
|
||||
|
||||
if (isSuccess) _confettiController.play();
|
||||
|
||||
return Stack(
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: ConfettiWidget(
|
||||
confettiController: _confettiController,
|
||||
blastDirectionality: BlastDirectionality.explosive,
|
||||
emissionFrequency: 0.2,
|
||||
numberOfParticles: 40,
|
||||
gravity: 0.3,
|
||||
maxBlastForce: 25,
|
||||
minBlastForce: 10,
|
||||
shouldLoop: false,
|
||||
colors: const [
|
||||
Colors.green,
|
||||
Colors.blue,
|
||||
Colors.pink,
|
||||
Colors.orange,
|
||||
],
|
||||
),
|
||||
),
|
||||
Center(
|
||||
child: RepaintBoundary(
|
||||
key: _shareKey,
|
||||
child: Container(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(height: 80),
|
||||
Lottie.asset(
|
||||
isSuccess
|
||||
? 'assets/animations/done.json'
|
||||
: 'assets/animations/error.json',
|
||||
width: 200,
|
||||
height: 200,
|
||||
repeat: false,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
isSuccess
|
||||
? Column(
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context).paymentSuccessful,
|
||||
style: const TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.green,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
if (response.amount != null)
|
||||
Text(
|
||||
'${AppLocalizations.of(context).amount}: ${response.amount} ${response.currency ?? ""}',
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontFamily: 'Rubik',
|
||||
),
|
||||
),
|
||||
if (response.creditedAccount != null)
|
||||
Text(
|
||||
'${AppLocalizations.of(context).creditedAccount}: ${response.creditedAccount}',
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontFamily: 'Rubik',
|
||||
),
|
||||
),
|
||||
if (response.date != null)
|
||||
Text(
|
||||
"Date: ${response.date!.toLocal().toIso8601String()}",
|
||||
style: const TextStyle(fontSize: 16),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Column(
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context).paymentFailed,
|
||||
style: const TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
if (response.errorMessage != null)
|
||||
Text(
|
||||
response.errorMessage!,
|
||||
style: const TextStyle(fontSize: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 40),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 80,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
ElevatedButton.icon(
|
||||
onPressed: _shareScreenshot,
|
||||
icon: Icon(
|
||||
Icons.share_rounded,
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
label: Text(
|
||||
AppLocalizations.of(context).share,
|
||||
style: TextStyle(color: Theme.of(context).primaryColor),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(color: Theme.of(context).primaryColor, width: 1),
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
),
|
||||
textStyle: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
ElevatedButton.icon(
|
||||
onPressed: () {
|
||||
Navigator.of(context).popUntil((route) => route.isFirst);
|
||||
},
|
||||
icon: const Icon(Icons.check),
|
||||
label: Text(AppLocalizations.of(context).done),
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 45, vertical: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
),
|
||||
textStyle: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -73,8 +73,8 @@ class _TransactionPinScreen extends State<TransactionPinScreen> {
|
||||
height: 20,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: Colors.blue, width: 2),
|
||||
color: index < _pin.length ? Colors.blue : Colors.transparent,
|
||||
border: Border.all(color: Theme.of(context).primaryColor, width: 2),
|
||||
color: index < _pin.length ? Theme.of(context).primaryColor : Colors.transparent,
|
||||
),
|
||||
);
|
||||
}),
|
||||
|
@@ -50,10 +50,10 @@ class _TransactionSuccessScreen extends State<TransactionSuccessScreen> {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const CircleAvatar(
|
||||
CircleAvatar(
|
||||
radius: 50,
|
||||
backgroundColor: Colors.blue,
|
||||
child: Icon(Icons.check, color: Colors.white, size: 60),
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
child: Icon(Icons.check, color: Theme.of(context).scaffoldBackgroundColor, size: 60),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
@@ -92,8 +92,8 @@ class _TransactionSuccessScreen extends State<TransactionSuccessScreen> {
|
||||
style: ElevatedButton.styleFrom(
|
||||
shape: const StadiumBorder(),
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
backgroundColor: Colors.white,
|
||||
foregroundColor: Colors.blueAccent,
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
foregroundColor: Theme.of(context).primaryColorLight,
|
||||
side: const BorderSide(color: Colors.black, width: 1),
|
||||
elevation: 0,
|
||||
),
|
||||
@@ -114,8 +114,8 @@ class _TransactionSuccessScreen extends State<TransactionSuccessScreen> {
|
||||
style: ElevatedButton.styleFrom(
|
||||
shape: const StadiumBorder(),
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
backgroundColor: Colors.blue[900],
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: Theme.of(context).primaryColorDark,
|
||||
foregroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
),
|
||||
child: Text(AppLocalizations.of(context).done),
|
||||
),
|
||||
|
35
lib/features/profile/preferences/color_theme_dialog.dart
Normal file
35
lib/features/profile/preferences/color_theme_dialog.dart
Normal file
@@ -0,0 +1,35 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:kmobile/config/theme_type.dart';
|
||||
import 'package:kmobile/features/auth/controllers/theme_cubit.dart';
|
||||
import 'package:kmobile/features/auth/controllers/theme_state.dart';
|
||||
|
||||
|
||||
void showColorThemeDialog(BuildContext context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
title: const Text('Select Theme Color'),
|
||||
content: BlocBuilder<ThemeCubit, ThemeState>(
|
||||
builder: (context, state) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: ThemeType.values.map((type) {
|
||||
return RadioListTile<ThemeType>(
|
||||
value: type,
|
||||
groupValue: state.themeType,
|
||||
title: Text(type.name.toUpperCase()),
|
||||
onChanged: (val) {
|
||||
if (val != null) {
|
||||
context.read<ThemeCubit>().changeTheme(val);
|
||||
Navigator.pop(context);
|
||||
}
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
@@ -1,6 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'language_dialog.dart';
|
||||
import 'color_theme_dialog.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
import 'package:kmobile/features/auth/controllers/theme_cubit.dart';
|
||||
import 'package:kmobile/features/auth/controllers/theme_state.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
class PreferenceScreen extends StatelessWidget {
|
||||
const PreferenceScreen({super.key});
|
||||
@@ -11,22 +15,44 @@ class PreferenceScreen extends StatelessWidget {
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(loc.preferences), // Localized "Preferences"
|
||||
title: Text(loc.preferences),
|
||||
),
|
||||
body: ListView(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.language),
|
||||
title: Text(loc.language), // Localized "Language"
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => LanguageDialog(),
|
||||
);
|
||||
},
|
||||
body: BlocBuilder<ThemeCubit, ThemeState>(
|
||||
builder: (context, state) {
|
||||
return ListView(
|
||||
children: [
|
||||
// Theme Mode Switch (Light/Dark)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.brightness_6),
|
||||
title: const Text("Theme Mode"),
|
||||
trailing: Switch(
|
||||
value: state.isDarkMode,
|
||||
onChanged: (val) {
|
||||
context.read<ThemeCubit>().toggleDarkMode(val);
|
||||
},
|
||||
),
|
||||
),
|
||||
//Color_Theme_Selection
|
||||
ListTile(
|
||||
leading: const Icon(Icons.color_lens),
|
||||
title: const Text('Theme Color'),
|
||||
onTap: () => showColorThemeDialog(context),
|
||||
),
|
||||
],
|
||||
// Language Selection
|
||||
ListTile(
|
||||
leading: const Icon(Icons.language),
|
||||
title: Text(loc.language),
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => const LanguageDialog(), // your custom language dialog
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@@ -21,7 +21,7 @@ class ProfileScreen extends StatelessWidget {
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (_) => const PreferenceScreen()),
|
||||
MaterialPageRoute(builder: (context) => const PreferenceScreen()),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
@@ -122,7 +122,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -152,7 +152,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -179,7 +179,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -204,7 +204,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -228,7 +228,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -255,7 +255,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -282,7 +282,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -320,7 +320,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -342,7 +342,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -382,9 +382,9 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: SwipeButton.expand(
|
||||
thumb: const Icon(Icons.arrow_forward, color: Colors.white),
|
||||
activeThumbColor: Colors.blue[900],
|
||||
activeTrackColor: Colors.blue.shade100,
|
||||
thumb: Icon(Icons.arrow_forward, color: Theme.of(context).scaffoldBackgroundColor),
|
||||
activeThumbColor: Theme.of(context).primaryColorDark,
|
||||
activeTrackColor: Theme.of(context).primaryColorLight,
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
height: 56,
|
||||
child: Text(
|
||||
@@ -438,10 +438,10 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
||||
margin: const EdgeInsets.symmetric(horizontal: 4),
|
||||
padding: const EdgeInsets.symmetric(vertical: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? Colors.blue[200] : Colors.white,
|
||||
color: isSelected ? Theme.of(context).primaryColor : Theme.of(context).scaffoldBackgroundColor,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
border: Border.all(
|
||||
color: isSelected ? Colors.blue : Colors.grey,
|
||||
color: isSelected ? Theme.of(context).primaryColor : Theme.of(context).scaffoldBackgroundColor,
|
||||
width: isSelected ? 0 : 1.2,
|
||||
),
|
||||
),
|
||||
|
@@ -129,7 +129,7 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
),
|
||||
readOnly: true,
|
||||
controller: TextEditingController(text: widget.debitAccount),
|
||||
@@ -144,7 +144,7 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -183,7 +183,7 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -265,7 +265,7 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -312,7 +312,7 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
@@ -338,7 +338,7 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: SwipeButton.expand(
|
||||
thumb: const Icon(Icons.arrow_forward, color: Colors.white),
|
||||
thumb: Icon(Icons.arrow_forward, color: Theme.of(context).dialogBackgroundColor),
|
||||
activeThumbColor: Theme.of(context).primaryColor,
|
||||
activeTrackColor: Theme.of(
|
||||
context,
|
||||
@@ -461,7 +461,7 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: Theme.of(context).dialogBackgroundColor,
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
|
Reference in New Issue
Block a user