Compare commits
10 Commits
2fdef7c850
...
language-t
Author | SHA1 | Date | |
---|---|---|---|
3024ddef15 | |||
83609fb778 | |||
dbc61abf00 | |||
763c101f58 | |||
117e2d5786 | |||
ae40f61c01 | |||
a1365b19d5 | |||
2dd7f4079b | |||
99e23bf21d | |||
c4d4261afc |
@@ -1,4 +1,6 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:kmobile/data/models/ifsc.dart';
|
||||
import 'package:kmobile/data/models/beneficiary.dart';
|
||||
|
||||
class BeneficiaryService {
|
||||
final Dio _dio;
|
||||
@@ -22,4 +24,156 @@ class BeneficiaryService {
|
||||
throw Exception('Unexpected error: ${e.toString()}');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Future<ifsc?> validateIFSC(String ifscCode) async {
|
||||
try {
|
||||
final response = await _dio.get('/api/beneficiary/ifsc-details', queryParameters: {
|
||||
"ifscCode": ifscCode
|
||||
}
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
return ifsc.fromJson(response.data);
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
if (e.response?.statusCode == 404) {
|
||||
print('Invalid IFSC code.');
|
||||
} else {
|
||||
print('API error: ${e.message}');
|
||||
}
|
||||
} catch (e) {
|
||||
print('Unexpected error: $e');
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
///Step 1: Validate beneficiary (returns refNo)
|
||||
Future<String?> validateBeneficiary({
|
||||
required String accountNo,
|
||||
required String ifscCode,
|
||||
required String remitterName,
|
||||
}) async {
|
||||
|
||||
try {
|
||||
final response = await _dio.post(
|
||||
'/api/beneficiary/validate/outside_bank',
|
||||
queryParameters: {
|
||||
'accountNo': accountNo,
|
||||
'ifscCode': ifscCode,
|
||||
'remitterName': remitterName,
|
||||
},
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
return response.data['refNo'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} catch (e) {
|
||||
print("Error validating beneficiary: $e");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// Step 2: Check validation status (returns Beneficiary name if success)
|
||||
Future<String?> checkValidationStatus(String refNo) async {
|
||||
try {
|
||||
final response = await _dio.get(
|
||||
'/api/beneficiary/check',
|
||||
queryParameters: {
|
||||
'refNo': refNo,
|
||||
},
|
||||
);
|
||||
|
||||
if (response.statusCode == 200 && response.data != null) {
|
||||
return Beneficiary.fromJson(response.data).name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} catch (e) {
|
||||
print("Error checking validation status: $e");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Send Data for Validation
|
||||
Future<void> sendForValidation(Beneficiary beneficiary) async {
|
||||
try {
|
||||
print(beneficiary.toJson());
|
||||
final response = await _dio.post(
|
||||
'/api/beneficiary/add',
|
||||
data: beneficiary.toJson(),
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
print("SENT FOR VALIDATION");
|
||||
} else {
|
||||
print("VALIDATION REQUEST FAILED: ${response.statusCode}");
|
||||
}
|
||||
} catch (e) {
|
||||
print("ERROR IN SENDING REQUEST: $e");
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
// Poll to check if beneficiary is found
|
||||
Future<bool> checkIfFound(String accountNo) async {
|
||||
const int timeoutInSeconds = 30;
|
||||
const int intervalInSeconds = 2;
|
||||
const int maxTries = timeoutInSeconds ~/ intervalInSeconds;
|
||||
|
||||
int attempts = 0;
|
||||
|
||||
while (attempts < maxTries) {
|
||||
try {
|
||||
final response = await _dio.get(
|
||||
'/api/beneficiary/check?',
|
||||
queryParameters: {
|
||||
'accountNo': accountNo
|
||||
}
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
print("FOUND");
|
||||
return true;
|
||||
} else if (response.statusCode == 404) {
|
||||
print("NOT FOUND");
|
||||
}
|
||||
} catch (e) {
|
||||
print("ERROR DURING STATUS: $e");
|
||||
}
|
||||
attempts++;
|
||||
}
|
||||
|
||||
print("Beneficiary not found within timeout.");
|
||||
return false;
|
||||
}
|
||||
|
||||
Future<List<Beneficiary>> fetchBeneficiaryList() async{
|
||||
try {
|
||||
final response = await _dio.get(
|
||||
"/api/beneficiary/get",
|
||||
options: Options(
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
return Beneficiary.listFromJson(response.data);
|
||||
|
||||
} else {
|
||||
throw Exception("Failed to fetch beneficiaries");
|
||||
}
|
||||
} catch (e) {
|
||||
print("Error fetching beneficiaries: $e");
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
365
lib/app.dart
365
lib/app.dart
@@ -5,7 +5,8 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:kmobile/security/secure_storage.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import './l10n/app_localizations.dart';
|
||||
import 'config/themes.dart';
|
||||
import 'package:kmobile/features/auth/controllers/theme_cubit.dart';
|
||||
import 'package:kmobile/features/auth/controllers/theme_state.dart';
|
||||
import 'config/routes.dart';
|
||||
import 'di/injection.dart';
|
||||
import 'features/auth/controllers/auth_cubit.dart';
|
||||
@@ -17,7 +18,6 @@ import 'features/dashboard/screens/dashboard_screen.dart';
|
||||
import 'features/auth/screens/mpin_screen.dart';
|
||||
import 'package:local_auth/local_auth.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
//import 'package:flutter_neumorphic/flutter_neumorphic.dart';
|
||||
|
||||
class KMobile extends StatefulWidget {
|
||||
const KMobile({super.key});
|
||||
@@ -32,31 +32,33 @@ class KMobile extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _KMobileState extends State<KMobile> {
|
||||
bool _showSplash = false;
|
||||
bool showSplash = true;
|
||||
Locale? _locale;
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadLocale();
|
||||
// Simulate a splash screen delay
|
||||
loadPreferences();
|
||||
Future.delayed(const Duration(seconds: 2), () {
|
||||
setState(() {
|
||||
_showSplash = false;
|
||||
showSplash = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _loadLocale() async{
|
||||
Future<void> loadPreferences() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
|
||||
// Load Locale
|
||||
final String? langCode = prefs.getString('locale');
|
||||
if (langCode != null) {
|
||||
setState(() {
|
||||
_locale = Locale(langCode);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void setLocale(Locale locale) {
|
||||
setState(() {
|
||||
@@ -64,94 +66,54 @@ class _KMobileState extends State<KMobile> {
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Set status bar color
|
||||
SystemChrome.setSystemUIOverlayStyle(
|
||||
const SystemUiOverlayStyle(
|
||||
statusBarColor: Colors.transparent,
|
||||
statusBarIconBrightness: Brightness.dark,
|
||||
),
|
||||
);
|
||||
|
||||
if (_showSplash) {
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
locale: _locale,
|
||||
supportedLocales: const [
|
||||
Locale('en'),
|
||||
Locale('hi'),
|
||||
],
|
||||
localizationsDelegates: const [
|
||||
AppLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
home: const SplashScreen(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider<AuthCubit>(create: (_) => getIt<AuthCubit>()),
|
||||
],
|
||||
child: MaterialApp(
|
||||
title: 'kMobile',
|
||||
// debugShowCheckedModeBanner: false,
|
||||
theme: AppThemes.lightTheme,
|
||||
// darkTheme: AppThemes.darkTheme,
|
||||
themeMode: ThemeMode.system, // Use system theme by default
|
||||
onGenerateRoute: AppRoutes.generateRoute,
|
||||
initialRoute: AppRoutes.splash,
|
||||
home: const AuthGate(),
|
||||
),
|
||||
);
|
||||
}
|
||||
*/
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Set status bar color
|
||||
SystemChrome.setSystemUIOverlayStyle(
|
||||
const SystemUiOverlayStyle(
|
||||
statusBarColor: Colors.transparent,
|
||||
statusBarIconBrightness: Brightness.dark,
|
||||
),
|
||||
);
|
||||
// Set status bar color and brightness
|
||||
SystemChrome.setSystemUIOverlayStyle(
|
||||
const SystemUiOverlayStyle(
|
||||
statusBarColor: Colors.transparent,
|
||||
statusBarIconBrightness: Brightness.dark,
|
||||
),
|
||||
);
|
||||
|
||||
return MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider<AuthCubit>(create: (_) => getIt<AuthCubit>()),
|
||||
],
|
||||
child: MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
locale: _locale, // Dynamic locale
|
||||
supportedLocales: const [
|
||||
Locale('en'),
|
||||
Locale('hi'),
|
||||
],
|
||||
localizationsDelegates: const [
|
||||
AppLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
title: 'kMobile',
|
||||
theme: AppThemes.lightTheme,
|
||||
// darkTheme: AppThemes.darkTheme,
|
||||
themeMode: ThemeMode.system,
|
||||
onGenerateRoute: AppRoutes.generateRoute,
|
||||
initialRoute: AppRoutes.splash,
|
||||
home: _showSplash ? const SplashScreen() : const AuthGate(),
|
||||
),
|
||||
);
|
||||
}
|
||||
return MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider<AuthCubit>(create: (_) => getIt<AuthCubit>()),
|
||||
BlocProvider<ThemeCubit>(create: (_) => getIt<ThemeCubit>()),
|
||||
],
|
||||
child: BlocBuilder<ThemeCubit, ThemeState>(
|
||||
builder: (context, themeState) {
|
||||
print('global theme state changed');
|
||||
print(themeState);
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
locale: _locale ?? const Locale('en'),
|
||||
supportedLocales: const [
|
||||
Locale('en'),
|
||||
Locale('hi'),
|
||||
],
|
||||
localizationsDelegates: const [
|
||||
AppLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
title: 'kMobile',
|
||||
//theme: AppThemes.getLightTheme(themeState.themeType),
|
||||
theme: themeState.getThemeData(),
|
||||
// darkTheme: AppThemes.getDarkTheme(themeState.themeType),
|
||||
themeMode: ThemeMode.system,
|
||||
onGenerateRoute: AppRoutes.generateRoute,
|
||||
initialRoute: AppRoutes.splash,
|
||||
home: showSplash ? const SplashScreen() : const AuthGate(),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
class AuthGate extends StatefulWidget {
|
||||
const AuthGate({super.key});
|
||||
|
||||
@@ -210,105 +172,6 @@ class _AuthGateState extends State<AuthGate> {
|
||||
}
|
||||
}
|
||||
|
||||
/* @override
|
||||
Widget build(BuildContext context) {
|
||||
if (_checking) {
|
||||
return const SplashScreen();
|
||||
}
|
||||
if (_isLoggedIn) {
|
||||
if (_hasMPin) {
|
||||
if (_biometricEnabled) {
|
||||
return FutureBuilder<bool>(
|
||||
future: _tryBiometric(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const SplashScreen();
|
||||
}
|
||||
if (snapshot.data == true) {
|
||||
// Authenticated with biometrics, go to dashboard
|
||||
return const NavigationScaffold();
|
||||
}
|
||||
// If not authenticated or user dismissed, show mPIN screen
|
||||
return MPinScreen(
|
||||
mode: MPinMode.enter,
|
||||
onCompleted: (_) {
|
||||
Navigator.of(context).pushReplacement(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => const NavigationScaffold()),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return MPinScreen(
|
||||
mode: MPinMode.enter,
|
||||
onCompleted: (_) {
|
||||
Navigator.of(context).pushReplacement(
|
||||
MaterialPageRoute(builder: (_) => const NavigationScaffold()),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return MPinScreen(
|
||||
mode: MPinMode.set,
|
||||
onCompleted: (_) async {
|
||||
final storage = getIt<SecureStorage>();
|
||||
final localAuth = LocalAuthentication();
|
||||
|
||||
// 1) Prompt user to opt‐in for biometric
|
||||
final optIn = await showDialog<bool>(
|
||||
context: context,
|
||||
barrierDismissible: false, // force choice
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: const Text('Enable Fingerprint Login?'),
|
||||
content: const Text(
|
||||
'Would you like to enable fingerprint authentication for faster login?',
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(false),
|
||||
child: const Text('No'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(true),
|
||||
child: const Text('Yes'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
// 2) If opted in, perform biometric auth
|
||||
if (optIn == true) {
|
||||
final canCheck = await localAuth.canCheckBiometrics;
|
||||
bool didAuth = false;
|
||||
if (canCheck) {
|
||||
didAuth = await localAuth.authenticate(
|
||||
localizedReason: 'Authenticate to enable fingerprint login',
|
||||
options: const AuthenticationOptions(
|
||||
stickyAuth: true,
|
||||
biometricOnly: true,
|
||||
),
|
||||
);
|
||||
}
|
||||
await storage.write(
|
||||
'biometric_enabled', didAuth ? 'true' : 'false');
|
||||
} else {
|
||||
await storage.write('biometric_enabled', 'false');
|
||||
}
|
||||
|
||||
// 3) Finally go to your main scaffold
|
||||
Navigator.of(context).pushReplacement(
|
||||
MaterialPageRoute(builder: (_) => const NavigationScaffold()),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
return const LoginScreen();
|
||||
}
|
||||
}*/
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -430,124 +293,6 @@ class _AuthGateState extends State<AuthGate> {
|
||||
}
|
||||
}
|
||||
|
||||
/*@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_checking) {
|
||||
return const SplashScreen();
|
||||
}
|
||||
|
||||
if (_isLoggedIn) {
|
||||
if (_hasMPin) {
|
||||
if (_biometricEnabled) {
|
||||
return FutureBuilder<bool>(
|
||||
future: _tryBiometric(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const SplashScreen();
|
||||
}
|
||||
|
||||
if (snapshot.data == true) {
|
||||
return const NavigationScaffold(); // Authenticated
|
||||
}
|
||||
|
||||
// Failed or dismissed biometric → Show MPIN
|
||||
return MPinScreen(
|
||||
mode: MPinMode.enter,
|
||||
onCompleted: (_) {
|
||||
Navigator.of(context).pushReplacement(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => const NavigationScaffold(),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return MPinScreen(
|
||||
mode: MPinMode.enter,
|
||||
onCompleted: (_) {
|
||||
Navigator.of(context).pushReplacement(
|
||||
MaterialPageRoute(builder: (_) => const NavigationScaffold()),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return MPinScreen(
|
||||
mode: MPinMode.set,
|
||||
onCompleted: (_) async {
|
||||
final storage = getIt<SecureStorage>();
|
||||
final localAuth = LocalAuthentication();
|
||||
final optin = await showDialog<bool>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: Text(
|
||||
AppLocalizations.of(context).enableFingerprintLogin,
|
||||
),
|
||||
content: Text(
|
||||
AppLocalizations.of(context).enableFingerprintMessage,
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(false),
|
||||
child: Text(AppLocalizations.of(context).no),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(true),
|
||||
child: Text(AppLocalizations.of(context).yes),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
if (optin == true) {
|
||||
final canCheck = await localAuth.canCheckBiometrics;
|
||||
bool didAuth = false;
|
||||
|
||||
if (canCheck) {
|
||||
didAuth = await localAuth.authenticate(
|
||||
localizedReason: AppLocalizations.of(
|
||||
context,
|
||||
).authenticateToEnable,
|
||||
options: const AuthenticationOptions(
|
||||
stickyAuth: true,
|
||||
biometricOnly: true,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
await storage.write(
|
||||
'biometric_enabled',
|
||||
didAuth ? 'true' : 'false',
|
||||
);
|
||||
} else {
|
||||
await storage.write('biometric_enabled', 'false');
|
||||
}
|
||||
|
||||
Navigator.of(context).pushReplacement(
|
||||
MaterialPageRoute(builder: (_) => const NavigationScaffold()),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 🔻 Show Welcome screen before login if not logged in
|
||||
if (_showWelcome) {
|
||||
return WelcomeScreen(
|
||||
onContinue: () {
|
||||
setState(() {
|
||||
_showWelcome = false;
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
return const LoginScreen();
|
||||
}
|
||||
}*/
|
||||
|
||||
class NavigationScaffold extends StatefulWidget {
|
||||
const NavigationScaffold({super.key});
|
||||
|
||||
@@ -612,8 +357,8 @@ class _NavigationScaffoldState extends State<NavigationScaffold> {
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
currentIndex: _selectedIndex,
|
||||
type: BottomNavigationBarType.fixed,
|
||||
backgroundColor: const Color(0xFFE0F7FA), // Light blue background
|
||||
selectedItemColor: Colors.blue[800],
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor, // Light blue background
|
||||
selectedItemColor: Theme.of(context).primaryColor,
|
||||
unselectedItemColor: Colors.black54,
|
||||
onTap: _onItemTapped,
|
||||
items: [
|
||||
|
6
lib/config/theme_type.dart
Normal file
6
lib/config/theme_type.dart
Normal file
@@ -0,0 +1,6 @@
|
||||
enum ThemeType {
|
||||
violet,
|
||||
green,
|
||||
orange,
|
||||
blue,
|
||||
}
|
@@ -1,266 +1,32 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'theme_type.dart';
|
||||
|
||||
class AppThemes {
|
||||
// Private constructor to prevent instantiation
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// Light theme colors
|
||||
static const Color _primaryColorLight = Color(0xFF1E88E5); // Blue 600
|
||||
static const Color _secondaryColorLight = Color(0xFF26A69A); // Teal 400
|
||||
static const Color _errorColorLight = Color(0xFFE53935); // Red 600
|
||||
static const Color _surfaceColorLight = Colors.white;
|
||||
|
||||
// Dark theme colors
|
||||
static const Color _primaryColorDark = Color(0xFF42A5F5); // Blue 400
|
||||
static const Color _secondaryColorDark = Color(0xFF4DB6AC); // Teal 300
|
||||
static const Color _errorColorDark = Color(0xFFEF5350); // Red 400
|
||||
static const Color _surfaceColorDark = Color(0xFF1E1E1E);
|
||||
|
||||
// Text themes
|
||||
static const TextTheme _textThemeLight = TextTheme(
|
||||
displayLarge: TextStyle(
|
||||
fontSize: 96,
|
||||
fontWeight: FontWeight.w300,
|
||||
color: Color(0xFF212121),
|
||||
fontFamily: 'Rubik',
|
||||
),
|
||||
displayMedium: TextStyle(
|
||||
fontSize: 60,
|
||||
fontWeight: FontWeight.w300,
|
||||
color: Color(0xFF212121),
|
||||
fontFamily: 'Rubik',
|
||||
),
|
||||
displaySmall: TextStyle(
|
||||
fontSize: 48,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Color(0xFF212121),
|
||||
fontFamily: 'Rubik',
|
||||
),
|
||||
headlineMedium: TextStyle(
|
||||
fontSize: 34,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Color(0xFF212121),
|
||||
fontFamily: 'Rubik',
|
||||
),
|
||||
headlineSmall: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Color(0xFF212121),
|
||||
fontFamily: 'Rubik',
|
||||
),
|
||||
titleLarge: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Color(0xFF212121),
|
||||
fontFamily: 'Rubik',
|
||||
),
|
||||
bodyLarge: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Color(0xFF212121),
|
||||
fontFamily: 'Rubik',
|
||||
),
|
||||
bodyMedium: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Color(0xFF212121),
|
||||
fontFamily: 'Rubik',
|
||||
),
|
||||
bodySmall: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Color(0xFF757575),
|
||||
fontFamily: 'Rubik',
|
||||
),
|
||||
labelLarge: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Color(0xFF212121),
|
||||
fontFamily: 'Rubik',
|
||||
),
|
||||
);
|
||||
|
||||
static final TextTheme _textThemeDark = _textThemeLight.copyWith(
|
||||
displayLarge: _textThemeLight.displayLarge?.copyWith(color: Colors.white),
|
||||
displayMedium: _textThemeLight.displayMedium?.copyWith(color: Colors.white),
|
||||
displaySmall: _textThemeLight.displaySmall?.copyWith(color: Colors.white),
|
||||
headlineMedium:
|
||||
_textThemeLight.headlineMedium?.copyWith(color: Colors.white),
|
||||
headlineSmall: _textThemeLight.headlineSmall?.copyWith(color: Colors.white),
|
||||
titleLarge: _textThemeLight.titleLarge?.copyWith(color: Colors.white),
|
||||
bodyLarge: _textThemeLight.bodyLarge?.copyWith(color: Colors.white),
|
||||
bodyMedium: _textThemeLight.bodyMedium?.copyWith(color: Colors.white),
|
||||
bodySmall: _textThemeLight.bodySmall?.copyWith(color: Colors.white70),
|
||||
labelLarge: _textThemeLight.labelLarge?.copyWith(color: Colors.white),
|
||||
);
|
||||
|
||||
// Light theme
|
||||
static final ThemeData lightTheme = ThemeData(
|
||||
useMaterial3: true,
|
||||
fontFamily: 'Rubik',
|
||||
colorScheme: const ColorScheme.light(
|
||||
primary: _primaryColorLight,
|
||||
secondary: _secondaryColorLight,
|
||||
error: _errorColorLight,
|
||||
surface: _surfaceColorLight,
|
||||
onPrimary: Colors.white,
|
||||
onSecondary: Colors.white,
|
||||
onSurface: Colors.black87,
|
||||
onError: Colors.white,
|
||||
brightness: Brightness.light,
|
||||
),
|
||||
textTheme: _textThemeLight,
|
||||
appBarTheme: const AppBarTheme(
|
||||
elevation: 0,
|
||||
backgroundColor: _surfaceColorLight,
|
||||
foregroundColor: Color(0xFF212121),
|
||||
centerTitle: true,
|
||||
),
|
||||
cardTheme: CardTheme(
|
||||
//Earlier CardThemeData
|
||||
elevation: 2,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
),
|
||||
elevatedButtonTheme: ElevatedButtonThemeData(
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: _primaryColorLight,
|
||||
elevation: 2,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
),
|
||||
outlinedButtonTheme: OutlinedButtonThemeData(
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: _primaryColorLight,
|
||||
side: const BorderSide(color: _primaryColorLight),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
),
|
||||
textButtonTheme: TextButtonThemeData(
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: _primaryColorLight,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
),
|
||||
),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
filled: true,
|
||||
fillColor: Colors.grey[100],
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: Colors.grey[300]!),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: const BorderSide(color: _primaryColorLight, width: 2),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: const BorderSide(color: _errorColorLight, width: 2),
|
||||
),
|
||||
labelStyle: const TextStyle(color: Colors.grey),
|
||||
),
|
||||
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
|
||||
selectedItemColor: _primaryColorLight,
|
||||
unselectedItemColor: Colors.grey,
|
||||
),
|
||||
);
|
||||
|
||||
// Dark theme
|
||||
static final ThemeData darkTheme = ThemeData(
|
||||
fontFamily: 'Rubik',
|
||||
useMaterial3: true,
|
||||
colorScheme: const ColorScheme.dark(
|
||||
primary: _primaryColorDark,
|
||||
secondary: _secondaryColorDark,
|
||||
error: _errorColorDark,
|
||||
surface: _surfaceColorDark,
|
||||
onPrimary: Colors.black,
|
||||
onSecondary: Colors.black,
|
||||
onSurface: Colors.white,
|
||||
onError: Colors.black,
|
||||
brightness: Brightness.dark,
|
||||
),
|
||||
textTheme: _textThemeDark,
|
||||
appBarTheme: const AppBarTheme(
|
||||
elevation: 0,
|
||||
backgroundColor: _surfaceColorDark,
|
||||
foregroundColor: Colors.white,
|
||||
centerTitle: true,
|
||||
),
|
||||
cardTheme: CardTheme(
|
||||
//Earlier was CardThemeData
|
||||
elevation: 2,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
color: const Color(0xFF2C2C2C),
|
||||
),
|
||||
elevatedButtonTheme: ElevatedButtonThemeData(
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: Colors.black,
|
||||
backgroundColor: _primaryColorDark,
|
||||
elevation: 2,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
),
|
||||
outlinedButtonTheme: OutlinedButtonThemeData(
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: _primaryColorDark,
|
||||
side: const BorderSide(color: _primaryColorDark),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
),
|
||||
textButtonTheme: TextButtonThemeData(
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: _primaryColorDark,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
),
|
||||
),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
filled: true,
|
||||
fillColor: const Color(0xFF2A2A2A),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: const BorderSide(color: Color(0xFF3A3A3A)),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: const BorderSide(color: _primaryColorDark, width: 2),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: const BorderSide(color: _errorColorDark, width: 2),
|
||||
),
|
||||
labelStyle: const TextStyle(color: Colors.grey),
|
||||
),
|
||||
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
|
||||
selectedItemColor: _primaryColorDark,
|
||||
unselectedItemColor: Colors.grey,
|
||||
backgroundColor: _surfaceColorDark,
|
||||
),
|
||||
);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
52
lib/data/models/beneficiary.dart
Normal file
52
lib/data/models/beneficiary.dart
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
|
||||
class Beneficiary {
|
||||
final String accountNo;
|
||||
final String accountType;
|
||||
final String name;
|
||||
final String ifscCode;
|
||||
final String? bankName;
|
||||
final String? branchName;
|
||||
|
||||
Beneficiary({
|
||||
required this.accountNo,
|
||||
required this.accountType,
|
||||
required this.name,
|
||||
required this.ifscCode,
|
||||
this.bankName,
|
||||
this.branchName,
|
||||
});
|
||||
|
||||
factory Beneficiary.fromJson(Map<String, dynamic> json) {
|
||||
return Beneficiary(
|
||||
accountNo: json['accountNo'] ?? '',
|
||||
accountType: json['accountType'] ?? '',
|
||||
name: json['name'] ?? '',
|
||||
ifscCode: json['ifscCode'] ?? '',
|
||||
bankName: json['bankName'] ?? '',
|
||||
branchName: json['branchName'] ?? '',
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'accountNo': accountNo,
|
||||
'accountType': accountType,
|
||||
'name': name,
|
||||
'ifscCode' : ifscCode,
|
||||
};
|
||||
}
|
||||
|
||||
static List<Beneficiary> listFromJson(List<dynamic> jsonList) {
|
||||
final beneficiaryList = jsonList.map((beneficiary) => Beneficiary.fromJson(beneficiary)).toList();
|
||||
print(beneficiaryList);
|
||||
return beneficiaryList;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Beneficiary(accountNo: $accountNo, accountType: $accountType, ifscCode: $ifscCode, name: $name)';
|
||||
}
|
||||
}
|
45
lib/data/models/beneficiary_recieve.dart
Normal file
45
lib/data/models/beneficiary_recieve.dart
Normal file
@@ -0,0 +1,45 @@
|
||||
class BeneficiaryRecieve {
|
||||
final String accountNo;
|
||||
final String accountType;
|
||||
final String name;
|
||||
final String ifscCode;
|
||||
final String bankName;
|
||||
final String branchName;
|
||||
|
||||
|
||||
BeneficiaryRecieve({
|
||||
required this.accountNo,
|
||||
required this.accountType,
|
||||
required this.name,
|
||||
required this.ifscCode,
|
||||
required this.bankName,
|
||||
required this.branchName,
|
||||
});
|
||||
|
||||
factory BeneficiaryRecieve.fromJson(Map<String, dynamic> json) {
|
||||
return BeneficiaryRecieve(
|
||||
accountNo: json['account_no'] ?? '',
|
||||
accountType: json['account_type'] ?? '',
|
||||
name: json['name'] ?? '',
|
||||
ifscCode: json['ifsc_code'] ?? '',
|
||||
bankName: json['bank_name'] ?? '',
|
||||
branchName: json['branch_name'] ?? '',
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'account_no': accountNo,
|
||||
'account_type': accountType,
|
||||
'name': name,
|
||||
'ifsc_code' : ifscCode,
|
||||
'bank_name' : bankName,
|
||||
'branch_name' : branchName
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ListBeneficiary(accountNo: $accountNo, accountType: $accountType, ifscCode: $ifscCode, name: $name, bankName: $bankName, branchName: $branchName)';
|
||||
}
|
||||
}
|
32
lib/data/models/ifsc.dart
Normal file
32
lib/data/models/ifsc.dart
Normal file
@@ -0,0 +1,32 @@
|
||||
class ifsc {
|
||||
final String ifscCode;
|
||||
final String bankName;
|
||||
final String branchName;
|
||||
|
||||
ifsc({
|
||||
required this.ifscCode,
|
||||
required this.bankName,
|
||||
required this.branchName,
|
||||
});
|
||||
|
||||
factory ifsc.fromJson(Map<String, dynamic> json) {
|
||||
return ifsc(
|
||||
ifscCode: json['ifsc_code'] ?? '',
|
||||
bankName: json['bank_name'] ?? '',
|
||||
branchName: json['branch_name'] ?? '',
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'ifsc_code': ifscCode,
|
||||
'bank_name': bankName,
|
||||
'branch_name': branchName,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'IFSC(ifscCode: $ifscCode, bankName: $bankName, branchName: $branchName)';
|
||||
}
|
||||
}
|
@@ -4,15 +4,22 @@ import 'package:kmobile/api/services/beneficiary_service.dart';
|
||||
import 'package:kmobile/api/services/payment_service.dart';
|
||||
import 'package:kmobile/api/services/user_service.dart';
|
||||
import 'package:kmobile/data/repositories/transaction_repository.dart';
|
||||
import 'package:kmobile/features/auth/controllers/theme_cubit.dart';
|
||||
import '../api/services/auth_service.dart';
|
||||
import '../api/interceptors/auth_interceptor.dart';
|
||||
import '../data/repositories/auth_repository.dart';
|
||||
import '../features/auth/controllers/auth_cubit.dart';
|
||||
import '../security/secure_storage.dart';
|
||||
|
||||
|
||||
final getIt = GetIt.instance;
|
||||
|
||||
Future<void> setupDependencies() async {
|
||||
|
||||
//getIt.registerLazySingleton<ThemeController>(() => ThemeController());
|
||||
//getIt.registerLazySingleton<ThemeModeController>(() => ThemeModeController());
|
||||
getIt.registerSingleton<ThemeCubit>( ThemeCubit());
|
||||
|
||||
// Register Dio client
|
||||
getIt.registerSingleton<Dio>(_createDioClient());
|
||||
|
||||
@@ -44,13 +51,15 @@ Future<void> setupDependencies() async {
|
||||
// Register controllers/cubits
|
||||
getIt.registerFactory<AuthCubit>(
|
||||
() => AuthCubit(getIt<AuthRepository>(), getIt<UserService>()));
|
||||
|
||||
}
|
||||
|
||||
Dio _createDioClient() {
|
||||
final dio = Dio(
|
||||
BaseOptions(
|
||||
baseUrl:
|
||||
'http://lb-test-mobile-banking-app-192209417.ap-south-1.elb.amazonaws.com:8080',
|
||||
//'http://lb-test-mobile-banking-app-192209417.ap-south-1.elb.amazonaws.com:8080',
|
||||
'http://localhost:8081',
|
||||
connectTimeout: const Duration(seconds: 5),
|
||||
receiveTimeout: const Duration(seconds: 3),
|
||||
headers: {
|
||||
|
@@ -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,
|
||||
),
|
||||
),
|
||||
@@ -250,9 +250,9 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
||||
leading: Shimmer.fromColors(
|
||||
baseColor: Colors.grey[300]!,
|
||||
highlightColor: Colors.grey[100]!,
|
||||
child: const CircleAvatar(
|
||||
child: CircleAvatar(
|
||||
radius: 12,
|
||||
backgroundColor: Colors.white,
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
),
|
||||
),
|
||||
title: Shimmer.fromColors(
|
||||
@@ -261,7 +261,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
||||
child: Container(
|
||||
height: 10,
|
||||
width: 100,
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
),
|
||||
),
|
||||
subtitle: Shimmer.fromColors(
|
||||
@@ -270,7 +270,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
||||
child: Container(
|
||||
height: 8,
|
||||
width: 60,
|
||||
color: Colors.white,
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
48
lib/features/auth/controllers/theme_cubit.dart
Normal file
48
lib/features/auth/controllers/theme_cubit.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
import 'dart:developer';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'theme_state.dart';
|
||||
import 'package:kmobile/config/theme_type.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class ThemeCubit extends Cubit<ThemeState> {
|
||||
ThemeCubit(): super(ThemeViolet()) {
|
||||
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];
|
||||
switch(type) {
|
||||
case ThemeType.blue:
|
||||
emit(ThemeBlue());
|
||||
case ThemeType.violet:
|
||||
emit(ThemeViolet());
|
||||
default:
|
||||
emit(ThemeViolet());
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> changeTheme(ThemeType type) async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setInt('theme_type', type.index);
|
||||
log("Mode Change");
|
||||
print("mode changed");
|
||||
switch(type) {
|
||||
case ThemeType.blue:
|
||||
emit(ThemeBlue());
|
||||
print('blue matched');
|
||||
break;
|
||||
case ThemeType.violet:
|
||||
emit(ThemeViolet());
|
||||
print('violet matched');
|
||||
break;
|
||||
default:
|
||||
emit(ThemeBlue());
|
||||
print('default macthed');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
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:equatable/equatable.dart';
|
||||
import 'package:kmobile/config/theme_type.dart';
|
||||
import 'package:kmobile/config/themes.dart';
|
||||
|
||||
|
||||
abstract class ThemeState extends Equatable {
|
||||
getThemeData();
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
class ThemeBlue extends ThemeState {
|
||||
|
||||
@override
|
||||
getThemeData() {
|
||||
print('returning blue theme');
|
||||
return AppThemes.getLightTheme(ThemeType.blue);
|
||||
}
|
||||
}
|
||||
|
||||
class ThemeViolet extends ThemeState {
|
||||
@override
|
||||
getThemeData() {
|
||||
print('returning violet theme');
|
||||
return AppThemes.getLightTheme(ThemeType.violet);
|
||||
}
|
||||
}
|
@@ -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,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@@ -17,10 +17,13 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
// Automatically go to login after 6 seconds
|
||||
Timer(const Duration(seconds: 6), () {
|
||||
// Automatically go to logizn after 4 seconds
|
||||
Timer(const Duration(seconds: 4), () {
|
||||
|
||||
widget.onContinue();
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -43,10 +46,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 +57,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 +68,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),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@@ -1,10 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:kmobile/api/services/beneficiary_service.dart';
|
||||
import 'package:kmobile/data/models/ifsc.dart';
|
||||
import 'package:kmobile/data/models/beneficiary.dart';
|
||||
import 'package:kmobile/data/models/user.dart';
|
||||
import 'beneficiary_result_page.dart';
|
||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||
import '../../../di/injection.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
|
||||
class AddBeneficiaryScreen extends StatefulWidget {
|
||||
const AddBeneficiaryScreen({super.key});
|
||||
final List<User>? users;
|
||||
final int? selectedIndex;
|
||||
|
||||
const AddBeneficiaryScreen({
|
||||
super.key,
|
||||
this.users,
|
||||
this.selectedIndex,
|
||||
});
|
||||
|
||||
@override
|
||||
State<AddBeneficiaryScreen> createState() => _AddBeneficiaryScreen();
|
||||
@@ -13,6 +26,7 @@ class AddBeneficiaryScreen extends StatefulWidget {
|
||||
class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
|
||||
late User selectedUser = (widget.users ?? [])[widget.selectedIndex!];
|
||||
final TextEditingController accountNumberController = TextEditingController();
|
||||
final TextEditingController confirmAccountNumberController =
|
||||
TextEditingController();
|
||||
@@ -22,6 +36,11 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
final TextEditingController ifscController = TextEditingController();
|
||||
final TextEditingController phoneController = TextEditingController();
|
||||
|
||||
String? _beneficiaryName;
|
||||
bool _isValidating = false;
|
||||
bool _isBeneficiaryValidated = false;
|
||||
String? _validationError;
|
||||
|
||||
late String accountType;
|
||||
|
||||
@override
|
||||
@@ -34,94 +53,167 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
});
|
||||
}
|
||||
|
||||
void _submitForm() {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
// Handle successful submission
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
backgroundColor: Colors.grey[900],
|
||||
behavior: SnackBarBehavior.floating,
|
||||
margin: const EdgeInsets.all(12),
|
||||
duration: const Duration(seconds: 5),
|
||||
content: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
AppLocalizations.of(context).beneficiaryAdded,
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
// Navigate to Payment Screen or do something
|
||||
},
|
||||
style: TextButton.styleFrom(foregroundColor: Colors.blue[200]),
|
||||
child: Text(AppLocalizations.of(context).payNow),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.close, color: Colors.white),
|
||||
onPressed: () {
|
||||
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ifsc? _ifscData;
|
||||
bool _isLoading = false; //for validateIFSC()
|
||||
|
||||
void _validateIFSC() async {
|
||||
var beneficiaryService = getIt<BeneficiaryService>();
|
||||
final ifsc = ifscController.text.trim().toUpperCase();
|
||||
if (ifsc.isEmpty) return;
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
_ifscData = null;
|
||||
});
|
||||
|
||||
// 🔹 Format check
|
||||
final isValidFormat = RegExp(r'^[A-Z]{4}0[A-Z0-9]{6}$').hasMatch(ifsc);
|
||||
if (!isValidFormat) {
|
||||
final result = await beneficiaryService.validateIFSC(ifsc);
|
||||
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
_ifscData = result;
|
||||
});
|
||||
|
||||
if (result == null) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(AppLocalizations.of(context).invalidIfsc)),
|
||||
);
|
||||
bankNameController.clear();
|
||||
branchNameController.clear();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(AppLocalizations.of(context).invalidIfscFormat)),
|
||||
} else {
|
||||
print("${AppLocalizations.of(context).validIfsc}: ${result.bankName}, ${result.branchName}");
|
||||
bankNameController.text = result.bankName;
|
||||
branchNameController.text = result.branchName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Future<void> _validateBeneficiary() async {
|
||||
// start spinner / disable button
|
||||
setState(() {
|
||||
_isValidating = true;
|
||||
_validationError = null;
|
||||
_isBeneficiaryValidated = false;
|
||||
nameController.text = ''; // clear previous name
|
||||
});
|
||||
|
||||
final String accountNo = accountNumberController.text.trim();
|
||||
final String ifsc = ifscController.text.trim();
|
||||
final String remitter = selectedUser.name ?? '';
|
||||
|
||||
final service = getIt<BeneficiaryService>();
|
||||
try {
|
||||
// Step 1: call validate API -> get refNo
|
||||
final String? refNo = await service.validateBeneficiary(
|
||||
accountNo: accountNo,
|
||||
ifscCode: ifsc,
|
||||
remitterName: remitter,
|
||||
);
|
||||
|
||||
if (refNo == null || refNo.isEmpty) {
|
||||
setState(() {
|
||||
_validationError = 'Validation request failed. Please check details.';
|
||||
_isBeneficiaryValidated = false;
|
||||
});
|
||||
return;
|
||||
}
|
||||
await Future.delayed(
|
||||
const Duration(seconds: 2),
|
||||
); //Mock delay for 2 sec to imitate api call
|
||||
// 🔹 Mock IFSC lookup (you can replace this with API)
|
||||
const mockIfscData = {
|
||||
'KCCB0001234': {
|
||||
'bank': 'Kangra Central Co-operative Bank',
|
||||
'branch': 'Dharamshala',
|
||||
},
|
||||
'SBIN0004567': {
|
||||
'bank': 'State Bank of India',
|
||||
'branch': 'Connaught Place',
|
||||
},
|
||||
};
|
||||
|
||||
if (mockIfscData.containsKey(ifsc)) {
|
||||
final data = mockIfscData[ifsc]!;
|
||||
bankNameController.text = data['bank']!;
|
||||
branchNameController.text = data['branch']!;
|
||||
// Step 2: poll checkValidationStatus for up to 30 seconds
|
||||
const int timeoutSeconds = 30;
|
||||
const int intervalSeconds = 2;
|
||||
int elapsed = 0;
|
||||
String? foundName;
|
||||
|
||||
while (elapsed < timeoutSeconds) {
|
||||
final String? name = await service.checkValidationStatus(refNo);
|
||||
|
||||
if (name != null && name.trim().isNotEmpty) {
|
||||
foundName = name.trim();
|
||||
break;
|
||||
}
|
||||
|
||||
await Future.delayed(const Duration(seconds: intervalSeconds));
|
||||
elapsed += intervalSeconds;
|
||||
}
|
||||
|
||||
if (foundName != null) {
|
||||
setState(() {
|
||||
nameController.text = foundName!;
|
||||
_isBeneficiaryValidated = true;
|
||||
_validationError = null;
|
||||
});
|
||||
} else {
|
||||
bankNameController.clear();
|
||||
branchNameController.clear();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(AppLocalizations.of(context).noIfscDetails)),
|
||||
setState(() {
|
||||
_validationError = 'Beneficiary not found within timeout.';
|
||||
_isBeneficiaryValidated = false;
|
||||
});
|
||||
}
|
||||
} catch (e, st) {
|
||||
// handle unexpected errors
|
||||
// print or log if you want
|
||||
debugPrint('Error validating beneficiary: $e\n$st');
|
||||
setState(() {
|
||||
_validationError = 'Something went wrong. Please try again.';
|
||||
_isBeneficiaryValidated = false;
|
||||
});
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_isValidating = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
String _selectedAccountType = 'Savings'; // default value
|
||||
|
||||
void validateAndAddBeneficiary() async {
|
||||
// Show spinner and disable UI
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false, // Prevent dismiss on tap outside
|
||||
builder: (BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () async => false, // Disable back button
|
||||
child: const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
final beneficiary = Beneficiary(
|
||||
accountNo: accountNumberController.text.trim(),
|
||||
accountType: _selectedAccountType,
|
||||
name: nameController.text.trim(),
|
||||
ifscCode: ifscController.text.trim(),
|
||||
);
|
||||
|
||||
var service = getIt<BeneficiaryService>();
|
||||
|
||||
try {
|
||||
await service.sendForValidation(beneficiary);
|
||||
bool isFound = await service.checkIfFound(beneficiary.accountNo);
|
||||
|
||||
if (context.mounted) {
|
||||
Navigator.pop(context); // Close the spinner
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => BeneficiaryResultPage(isSuccess: isFound),
|
||||
),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
Navigator.pop(context); // Close the spinner
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(AppLocalizations.of(context).somethingWentWrong)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
🔸 Optional: Use real IFSC API like:
|
||||
final response = await http.get(Uri.parse('https://ifsc.razorpay.com/$ifsc'));
|
||||
if (response.statusCode == 200) {
|
||||
final data = jsonDecode(response.body);
|
||||
bankNameController.text = data['BANK'];
|
||||
branchNameController.text = data['BRANCH'];
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -176,11 +268,11 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.black,
|
||||
width: 2,
|
||||
@@ -211,11 +303,11 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.black,
|
||||
width: 2,
|
||||
@@ -239,148 +331,19 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
TextFormField(
|
||||
controller: nameController,
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).name,
|
||||
// prefixIcon: Icon(Icons.person),
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.black,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
textInputAction: TextInputAction.next,
|
||||
validator: (value) => value == null || value.isEmpty
|
||||
? AppLocalizations.of(context).nameRequired
|
||||
: null,
|
||||
),
|
||||
/*const SizedBox(height: 24),
|
||||
TextFormField(
|
||||
controller: bankNameController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Beneficiary Bank Name',
|
||||
// prefixIcon: Icon(Icons.person),
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||
),
|
||||
),
|
||||
textInputAction: TextInputAction.next,
|
||||
validator: (value) =>
|
||||
value == null || value.isEmpty ? "Bank name is required" : null,
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
TextFormField(
|
||||
controller: branchNameController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Branch Name',
|
||||
// prefixIcon: Icon(Icons.person),
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||
),
|
||||
),
|
||||
textInputAction: TextInputAction.next,
|
||||
validator: (value) =>
|
||||
value == null || value.isEmpty ? "Branch name is required" : null,
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: TextFormField(
|
||||
controller: ifscController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'IFSC Code',
|
||||
// prefixIcon: Icon(Icons.person),
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||
),
|
||||
),
|
||||
textInputAction: TextInputAction.next,
|
||||
validator: (value) => value == null || value.length < 5
|
||||
? "Enter a valid IFSC"
|
||||
: null,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: DropdownButtonFormField<String>(
|
||||
value: accountType,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Account Type',
|
||||
// prefixIcon: Icon(Icons.person),
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||
),
|
||||
),
|
||||
|
||||
items: ['Savings', 'Current']
|
||||
.map((type) => DropdownMenuItem(
|
||||
value: type,
|
||||
child: Text(type),
|
||||
))
|
||||
.toList(),
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
accountType = value!;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),*/
|
||||
const SizedBox(height: 24),
|
||||
// 🔹 IFSC Code Field
|
||||
TextFormField(
|
||||
controller: ifscController,
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).ifscCode,
|
||||
border: OutlineInputBorder(),
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.black,
|
||||
width: 2,
|
||||
@@ -422,14 +385,14 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
enabled: false, // changed from readOnly to disabled
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).bankName,
|
||||
border: OutlineInputBorder(),
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white, // disabled color
|
||||
enabledBorder: OutlineInputBorder(
|
||||
fillColor: Theme.of(context).dialogBackgroundColor, // disabled color
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.black,
|
||||
width: 2,
|
||||
@@ -445,14 +408,14 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
enabled: false, // changed from readOnly to disabled
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).branchName,
|
||||
border: OutlineInputBorder(),
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
fillColor: Theme.of(context).dialogBackgroundColor,
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.black,
|
||||
width: 2,
|
||||
@@ -460,21 +423,73 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
//Validate Beneficiary Name
|
||||
if (!_isBeneficiaryValidated)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 12.0),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: ElevatedButton(
|
||||
onPressed: _isValidating
|
||||
? null
|
||||
: () {
|
||||
if (
|
||||
confirmAccountNumberController.text ==
|
||||
accountNumberController.text) {
|
||||
_validateBeneficiary();
|
||||
} else {
|
||||
setState(() {
|
||||
_validationError =
|
||||
'Please enter a valid and matching account number.';
|
||||
});
|
||||
}
|
||||
},
|
||||
child: _isValidating
|
||||
? const SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: const Text('Validate Beneficiary'),
|
||||
),
|
||||
),
|
||||
),
|
||||
//Beneficiary Name (Disabled)
|
||||
TextFormField(
|
||||
controller: nameController,
|
||||
enabled: false,
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).beneficiaryName,
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Theme.of(context).dialogBackgroundColor,
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||
),
|
||||
),
|
||||
textInputAction: TextInputAction.next,
|
||||
validator: (value) => value == null || value.isEmpty
|
||||
? AppLocalizations.of(context).nameRequired
|
||||
: null,
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
// 🔹 Account Type Dropdown
|
||||
DropdownButtonFormField<String>(
|
||||
value: accountType,
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).accountType,
|
||||
border: OutlineInputBorder(),
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.black,
|
||||
width: 2,
|
||||
@@ -506,15 +521,15 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
keyboardType: TextInputType.phone,
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).phone,
|
||||
prefixIcon: Icon(Icons.phone),
|
||||
border: OutlineInputBorder(),
|
||||
prefixIcon: const Icon(Icons.phone),
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.black),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.black,
|
||||
width: 2,
|
||||
@@ -538,12 +553,13 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
child: SizedBox(
|
||||
width: 250,
|
||||
child: ElevatedButton(
|
||||
onPressed: _submitForm,
|
||||
onPressed:
|
||||
validateAndAddBeneficiary,
|
||||
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),
|
||||
),
|
||||
|
115
lib/features/beneficiaries/screens/beneficiary_result_page.dart
Normal file
115
lib/features/beneficiaries/screens/beneficiary_result_page.dart
Normal file
@@ -0,0 +1,115 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lottie/lottie.dart';
|
||||
import 'package:confetti/confetti.dart';
|
||||
import 'dart:math';
|
||||
import '../../../app.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
|
||||
class BeneficiaryResultPage extends StatefulWidget {
|
||||
final bool isSuccess;
|
||||
|
||||
const BeneficiaryResultPage({super.key, required this.isSuccess});
|
||||
|
||||
@override
|
||||
State<BeneficiaryResultPage> createState() => _BeneficiaryResultPageState();
|
||||
}
|
||||
|
||||
class _BeneficiaryResultPageState extends State<BeneficiaryResultPage> {
|
||||
late ConfettiController _confettiController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_confettiController =
|
||||
ConfettiController(duration: const Duration(seconds: 3));
|
||||
if (widget.isSuccess) {
|
||||
_confettiController.play();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_confettiController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final successAnimation = 'assets/animations/done.json';
|
||||
final errorAnimation = 'assets/animations/error.json';
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: widget.isSuccess ? Colors.green[50] : Colors.red[50],
|
||||
body: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Lottie.asset(
|
||||
widget.isSuccess ? successAnimation : errorAnimation,
|
||||
width: 150,
|
||||
height: 150,
|
||||
repeat: false,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
widget.isSuccess
|
||||
? AppLocalizations.of(context).beneficiaryAddedSuccess
|
||||
: AppLocalizations.of(context).beneficiaryAdditionFailed,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: widget.isSuccess ? Colors.green : Colors.red,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
bottom: 20, // keep it slightly above the very bottom
|
||||
left: 16,
|
||||
right: 16,
|
||||
child: SizedBox(
|
||||
height: 56, // larger button height
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
Navigator.pushReplacement( // ensures back goes to ScaffoldScreen
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const NavigationScaffold(),
|
||||
),
|
||||
);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
shape: const StadiumBorder(),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
backgroundColor: Theme.of(context).primaryColorDark,
|
||||
foregroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
),
|
||||
child: Text(
|
||||
AppLocalizations.of(context).done,
|
||||
style: const TextStyle(fontSize: 18), // slightly bigger text
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (widget.isSuccess)
|
||||
Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: ConfettiWidget(
|
||||
confettiController: _confettiController,
|
||||
blastDirection: pi / 2,
|
||||
maxBlastForce: 10,
|
||||
minBlastForce: 5,
|
||||
emissionFrequency: 0.05,
|
||||
numberOfParticles: 20,
|
||||
gravity: 0.2,
|
||||
shouldLoop: false,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,10 +1,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:kmobile/data/models/beneficiary.dart';
|
||||
import 'package:kmobile/features/beneficiaries/screens/add_beneficiary_screen.dart';
|
||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||
import '../../../data/models/user.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
import '../../../di/injection.dart';
|
||||
import 'package:kmobile/api/services/beneficiary_service.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
//import 'package:kmobile/data/models/user.dart';
|
||||
|
||||
class ManageBeneficiariesScreen extends StatefulWidget {
|
||||
// final List<User> users;
|
||||
// final int selectedIndex;
|
||||
|
||||
const ManageBeneficiariesScreen({super.key});
|
||||
|
||||
@override
|
||||
@@ -13,67 +20,87 @@ class ManageBeneficiariesScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ManageBeneficiariesScreen extends State<ManageBeneficiariesScreen> {
|
||||
final List<Map<String, String>> beneficiaries = [
|
||||
{'bank': 'State Bank Of India', 'name': 'Trina Bakshi'},
|
||||
{'bank': 'State Bank Of India', 'name': 'Sheetal Rao'},
|
||||
{'bank': 'Punjab National Bank', 'name': 'Manoj Kumar'},
|
||||
{'bank': 'State Bank Of India', 'name': 'Rohit Mehra'},
|
||||
];
|
||||
var service = getIt<BeneficiaryService>();
|
||||
// late User selectedUser = widget.users[widget.selectedIndex];
|
||||
//final BeneficiaryService _service = BeneficiaryService();
|
||||
bool _isLoading = true;
|
||||
int selectedAccountIndex = 0;
|
||||
List<Beneficiary> _beneficiaries = [];
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadBeneficiaries();
|
||||
}
|
||||
|
||||
Future<void> _loadBeneficiaries() async {
|
||||
final data = await service.fetchBeneficiaryList();
|
||||
setState(() {
|
||||
_beneficiaries = data ;
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildShimmerList() {
|
||||
return ListView.builder(
|
||||
itemCount: 6,
|
||||
itemBuilder: (context, index) => Shimmer.fromColors(
|
||||
baseColor: Colors.grey.shade300,
|
||||
highlightColor: Colors.grey.shade100,
|
||||
child: ListTile(
|
||||
leading: const CircleAvatar(
|
||||
radius: 24,
|
||||
backgroundColor: Colors.white,
|
||||
),
|
||||
title: Container(
|
||||
height: 16,
|
||||
color: Colors.white,
|
||||
margin: const EdgeInsets.symmetric(vertical: 4),
|
||||
),
|
||||
subtitle: Container(
|
||||
height: 14,
|
||||
color: Colors.white,
|
||||
margin: const EdgeInsets.symmetric(vertical: 4),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBeneficiaryList() {
|
||||
if (_beneficiaries.isEmpty) {
|
||||
return Center(child: Text(AppLocalizations.of(context).noBeneficiaryFound));
|
||||
}
|
||||
return ListView.builder(
|
||||
itemCount: _beneficiaries.length,
|
||||
itemBuilder: (context, index) {
|
||||
final item = _beneficiaries[index];
|
||||
return ListTile(
|
||||
leading: CircleAvatar(
|
||||
radius: 24,
|
||||
backgroundColor: Theme.of(context).primaryColor.withOpacity(0.2),
|
||||
child: Text(
|
||||
item.name.isNotEmpty
|
||||
? item.name[0].toUpperCase()
|
||||
: '?',
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
title: Text(item.name ?? 'Unknown'),
|
||||
subtitle: Text(item.accountNo ?? 'No account number'),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: IconButton(
|
||||
icon: const Icon(Symbols.arrow_back_ios_new),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
title: Text(
|
||||
AppLocalizations.of(context).beneficiaries,
|
||||
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
||||
),
|
||||
centerTitle: false,
|
||||
actions: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 10.0),
|
||||
child: CircleAvatar(
|
||||
backgroundColor: Colors.grey[200],
|
||||
radius: 20,
|
||||
child: SvgPicture.asset(
|
||||
'assets/images/avatar_male.svg',
|
||||
width: 40,
|
||||
height: 40,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: ListView.builder(
|
||||
itemCount: beneficiaries.length,
|
||||
itemBuilder: (context, index) {
|
||||
final beneficiary = beneficiaries[index];
|
||||
return ListTile(
|
||||
leading: const CircleAvatar(
|
||||
backgroundColor: Colors.blue,
|
||||
child: Text('A'),
|
||||
),
|
||||
title: Text(beneficiary['name']!),
|
||||
subtitle: Text(beneficiary['bank']!),
|
||||
trailing: IconButton(
|
||||
icon: const Icon(Symbols.delete_forever, color: Colors.red),
|
||||
onPressed: () {
|
||||
// Delete action
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
title: Text(AppLocalizations.of(context).beneficiaries),
|
||||
),
|
||||
body: _isLoading ? _buildShimmerList() : _buildBeneficiaryList(),
|
||||
floatingActionButton: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8.0),
|
||||
child: FloatingActionButton(
|
||||
@@ -81,12 +108,12 @@ class _ManageBeneficiariesScreen extends State<ManageBeneficiariesScreen> {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const AddBeneficiaryScreen(),
|
||||
builder: (context) => AddBeneficiaryScreen(),
|
||||
),
|
||||
);
|
||||
},
|
||||
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,17 +197,18 @@ 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,
|
||||
AppLocalizations.of(context).kconnect,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).primaryColor,
|
||||
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,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -517,7 +518,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
const ManageBeneficiariesScreen()));
|
||||
}, disable: true),
|
||||
}, disable: false),
|
||||
_buildQuickLink(Symbols.support_agent,
|
||||
AppLocalizations.of(context).contactUs, () {
|
||||
Navigator.push(
|
||||
@@ -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,
|
||||
),
|
||||
@@ -70,7 +70,7 @@ class AccountCard extends StatelessWidget {
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
AppLocalizations.of(context).availableBalance,
|
||||
style: TextStyle(color: Colors.white70, fontSize: 12),
|
||||
style: TextStyle(color: Theme.of(context).dialogBackgroundColor, fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@@ -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),
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
/*import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:kmobile/features/beneficiaries/screens/add_beneficiary_screen.dart';
|
||||
// import 'package:kmobile/features/beneficiaries/screens/add_beneficiary_screen.dart';
|
||||
import 'package:kmobile/features/fund_transfer/screens/fund_transfer_screen.dart';
|
||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
@@ -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']!),
|
||||
@@ -84,23 +84,106 @@ class _FundTransferBeneficiaryScreen
|
||||
},
|
||||
),
|
||||
),
|
||||
floatingActionButton: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8.0),
|
||||
child: FloatingActionButton(
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const AddBeneficiaryScreen(),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: Colors.grey[300],
|
||||
foregroundColor: Colors.blue[900],
|
||||
elevation: 5,
|
||||
child: const Icon(Icons.add),
|
||||
}
|
||||
}*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:kmobile/data/models/beneficiary.dart';
|
||||
//import 'package:kmobile/features/beneficiaries/screens/add_beneficiary_screen.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
import '../../../di/injection.dart';
|
||||
import 'package:kmobile/api/services/beneficiary_service.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
|
||||
|
||||
class FundTransferBeneficiaryScreen extends StatefulWidget {
|
||||
const FundTransferBeneficiaryScreen({super.key});
|
||||
|
||||
@override
|
||||
State<FundTransferBeneficiaryScreen> createState() =>
|
||||
_ManageBeneficiariesScreen();
|
||||
}
|
||||
|
||||
class _ManageBeneficiariesScreen extends State<FundTransferBeneficiaryScreen> {
|
||||
var service = getIt<BeneficiaryService>();
|
||||
//final BeneficiaryService _service = BeneficiaryService();
|
||||
bool _isLoading = true;
|
||||
List<Beneficiary> _beneficiaries = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadBeneficiaries();
|
||||
}
|
||||
|
||||
Future<void> _loadBeneficiaries() async {
|
||||
final data = await service.fetchBeneficiaryList();
|
||||
setState(() {
|
||||
_beneficiaries = data ;
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildShimmerList() {
|
||||
return ListView.builder(
|
||||
itemCount: 6,
|
||||
itemBuilder: (context, index) => Shimmer.fromColors(
|
||||
baseColor: Colors.grey.shade300,
|
||||
highlightColor: Colors.grey.shade100,
|
||||
child: ListTile(
|
||||
leading: CircleAvatar(
|
||||
radius: 24,
|
||||
backgroundColor: Colors.white,
|
||||
),
|
||||
title: Container(
|
||||
height: 16,
|
||||
color: Colors.white,
|
||||
margin: const EdgeInsets.symmetric(vertical: 4),
|
||||
),
|
||||
subtitle: Container(
|
||||
height: 14,
|
||||
color: Colors.white,
|
||||
margin: const EdgeInsets.symmetric(vertical: 4),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBeneficiaryList() {
|
||||
if (_beneficiaries.isEmpty) {
|
||||
return Center(child: Text(AppLocalizations.of(context).noBeneficiaryFound));
|
||||
}
|
||||
return ListView.builder(
|
||||
itemCount: _beneficiaries.length,
|
||||
itemBuilder: (context, index) {
|
||||
final item = _beneficiaries[index];
|
||||
return ListTile(
|
||||
leading: CircleAvatar(
|
||||
radius: 24,
|
||||
backgroundColor: Theme.of(context).primaryColor.withOpacity(0.2),
|
||||
child: Text(
|
||||
item.name.isNotEmpty
|
||||
? item.name[0].toUpperCase()
|
||||
: '?',
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
title: Text(item.name ?? 'Unknown'),
|
||||
subtitle: Text(item.accountNo ?? 'No account number'),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(AppLocalizations.of(context).beneficiaries),
|
||||
),
|
||||
body: _isLoading ? _buildShimmerList() : _buildBeneficiaryList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:kmobile/features/fund_transfer/screens/transaction_pin_screen.dart';
|
||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
|
||||
@@ -135,7 +134,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,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -106,7 +106,7 @@ class _TpinOtpScreenState extends State<TpinOtpScreen> {
|
||||
decoration: InputDecoration(
|
||||
counterText: '',
|
||||
filled: true,
|
||||
fillColor: Colors.blue[50],
|
||||
fillColor: Theme.of(context).primaryColorLight,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(
|
||||
|
@@ -172,7 +172,7 @@ class _TpinSetScreenState extends State<TpinSetScreen> {
|
||||
key == '<' ? '⌫' : key,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
color: key == 'Enter' ? Colors.blue : Colors.black,
|
||||
color: key == 'Enter' ? Theme.of(context).primaryColor : Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -201,7 +201,7 @@ class _TpinSetScreenState extends State<TpinSetScreen> {
|
||||
child: Column(
|
||||
children: [
|
||||
const Spacer(),
|
||||
const Icon(Icons.lock_outline, size: 60, color: Colors.blue),
|
||||
Icon(Icons.lock_outline, size: 60, color: Theme.of(context).primaryColor),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
getTitle(),
|
||||
|
@@ -1,3 +1,5 @@
|
||||
// ignore_for_file: unused_field
|
||||
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -7,7 +9,6 @@ import 'package:kmobile/data/models/transfer.dart';
|
||||
import 'package:kmobile/di/injection.dart';
|
||||
import 'package:kmobile/features/fund_transfer/screens/payment_animation.dart';
|
||||
import 'package:kmobile/features/fund_transfer/screens/tpin_prompt_screen.dart';
|
||||
import 'package:kmobile/features/fund_transfer/screens/transaction_success_screen.dart';
|
||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||
|
||||
class TransactionPinScreen extends StatefulWidget {
|
||||
@@ -73,8 +74,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),
|
||||
),
|
||||
|
51
lib/features/profile/preferences/color_theme_dialog.dart
Normal file
51
lib/features/profile/preferences/color_theme_dialog.dart
Normal file
@@ -0,0 +1,51 @@
|
||||
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 '../../../l10n/app_localizations.dart';
|
||||
|
||||
class ColorThemeDialog extends StatelessWidget {
|
||||
const ColorThemeDialog({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SimpleDialog(
|
||||
title: Text(AppLocalizations.of(context).selectThemeColor),
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const CircleAvatar(backgroundColor: Colors.deepPurple),
|
||||
title: Text(AppLocalizations.of(context).violet),
|
||||
onTap: () {
|
||||
context.read<ThemeCubit>().changeTheme(ThemeType.violet);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
// ListTile(
|
||||
// leading: const CircleAvatar(backgroundColor: Colors.green),
|
||||
// title: const Text('Green'),
|
||||
// onTap: () {
|
||||
// context.read<ThemeCubit>().changeTheme(ThemeType.green);
|
||||
// Navigator.pop(context);
|
||||
// },
|
||||
// ),
|
||||
// ListTile(
|
||||
// leading: const CircleAvatar(backgroundColor: Colors.orange),
|
||||
// title: const Text('Orange'),
|
||||
// onTap: () {
|
||||
// context.read<ThemeCubit>().changeTheme(ThemeType.orange);
|
||||
// Navigator.pop(context);
|
||||
// },
|
||||
// ),
|
||||
ListTile(
|
||||
leading: const CircleAvatar(backgroundColor: Colors.blue),
|
||||
title: Text(AppLocalizations.of(context).blue),
|
||||
onTap: () {
|
||||
context.read<ThemeCubit>().changeTheme(ThemeType.blue);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -3,53 +3,6 @@ import '../../../l10n/app_localizations.dart';
|
||||
import 'package:kmobile/app.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
/*class LanguageDialog extends StatelessWidget {
|
||||
const LanguageDialog({super.key});
|
||||
|
||||
String getLocaleName(AppLocalizations localizations, String code) {
|
||||
final localeCodeMap = {
|
||||
'en': localizations.english,
|
||||
'hi': localizations.hindi,
|
||||
};
|
||||
return localeCodeMap[code] ?? 'Unknown';
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Builder(
|
||||
builder: (context) {
|
||||
final localizations = AppLocalizations.of(context);
|
||||
|
||||
final supportedLocales = [const Locale('en'), const Locale('hi')];
|
||||
|
||||
return AlertDialog(
|
||||
title: Text(localizations.language),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: supportedLocales.map((locale) {
|
||||
return ListTile(
|
||||
leading: const Icon(Icons.language),
|
||||
title: Text(getLocaleName(localizations, locale.languageCode)),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
KMobile.setLocale(context, locale);
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text(localizations.cancel),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
class LanguageDialog extends StatelessWidget {
|
||||
const LanguageDialog({Key? key}) : super(key: key);
|
||||
|
||||
|
@@ -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,21 +15,48 @@ class PreferenceScreen extends StatelessWidget {
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(loc.preferences), // Localized "Preferences"
|
||||
title: Text(loc.preferences),
|
||||
),
|
||||
body: ListView(
|
||||
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.language),
|
||||
title: Text(loc.language), // Localized "Language"
|
||||
leading: const Icon(Icons.color_lens),
|
||||
title: Text(AppLocalizations.of(context).themeColor),
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => LanguageDialog(),
|
||||
builder: (_) => const ColorThemeDialog(),
|
||||
);
|
||||
}
|
||||
),
|
||||
// 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),
|
||||
),
|
||||
|
@@ -219,6 +219,16 @@
|
||||
"setMPIN": "Set your mPIN",
|
||||
"confirmMPIN": "Confirm your mPIN",
|
||||
"kconnect": "Kconnect",
|
||||
"kccBankFull": "Kangra Central Co-operative Bank"
|
||||
"kccBankFull": "Kangra Central Co-operative Bank",
|
||||
"themeColor": "Theme Color",
|
||||
"selectThemeColor": "Select Theme Color",
|
||||
"violet": "Violet",
|
||||
"blue": "Blue",
|
||||
"invalidIfsc": "Invalid IFSC code",
|
||||
"validIfsc": "Valid IFSC",
|
||||
"beneficiaryAddedSuccess": "Beneficiary Added Successfully",
|
||||
"beneficiaryAdditionFailed": "Beneficiary Addition Failed",
|
||||
"noBeneficiaryFound": "No beneficiaries found",
|
||||
"beneficiaryName": "Beneficiary Name"
|
||||
}
|
||||
|
||||
|
@@ -219,5 +219,15 @@
|
||||
"setMPIN": "अपना mPIN सेट करें",
|
||||
"confirmMPIN": "अपना mPIN की पुष्टि करें",
|
||||
"kconnect": "के-कनेक्ट",
|
||||
"kccBankFull": "कांगड़ा सेंट्रल को-ऑपरेटिव बैंक"
|
||||
"kccBankFull": "कांगड़ा सेंट्रल को-ऑपरेटिव बैंक",
|
||||
"themeColor": "थीम रंग",
|
||||
"selectThemeColor": "थीम रंग चुनें",
|
||||
"violet": "बैंगनी",
|
||||
"blue": "नीला",
|
||||
"invalidIfsc": "अमान्य IFSC कोड",
|
||||
"validIfsc": "मान्य IFSC",
|
||||
"beneficiaryAddedSuccess": "लाभार्थी सफलतापूर्वक जोड़ा गया",
|
||||
"beneficiaryAdditionFailed": "लाभार्थी जोड़ने में विफल",
|
||||
"noBeneficiaryFound": "कोई लाभार्थी नहीं मिला",
|
||||
"beneficiaryName": "लाभार्थी नाम"
|
||||
}
|
||||
|
@@ -1342,6 +1342,66 @@ abstract class AppLocalizations {
|
||||
/// In en, this message translates to:
|
||||
/// **'Kangra Central Co-operative Bank'**
|
||||
String get kccBankFull;
|
||||
|
||||
/// No description provided for @themeColor.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Theme Color'**
|
||||
String get themeColor;
|
||||
|
||||
/// No description provided for @selectThemeColor.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Select Theme Color'**
|
||||
String get selectThemeColor;
|
||||
|
||||
/// No description provided for @violet.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Violet'**
|
||||
String get violet;
|
||||
|
||||
/// No description provided for @blue.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Blue'**
|
||||
String get blue;
|
||||
|
||||
/// No description provided for @invalidIfsc.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Invalid IFSC code'**
|
||||
String get invalidIfsc;
|
||||
|
||||
/// No description provided for @validIfsc.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Valid IFSC'**
|
||||
String get validIfsc;
|
||||
|
||||
/// No description provided for @beneficiaryAddedSuccess.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Beneficiary Added Successfully'**
|
||||
String get beneficiaryAddedSuccess;
|
||||
|
||||
/// No description provided for @beneficiaryAdditionFailed.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Beneficiary Addition Failed'**
|
||||
String get beneficiaryAdditionFailed;
|
||||
|
||||
/// No description provided for @noBeneficiaryFound.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'No beneficiaries found'**
|
||||
String get noBeneficiaryFound;
|
||||
|
||||
/// No description provided for @beneficiaryName.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Beneficiary Name'**
|
||||
String get beneficiaryName;
|
||||
}
|
||||
|
||||
class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {
|
||||
|
@@ -631,4 +631,34 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get kccBankFull => 'Kangra Central Co-operative Bank';
|
||||
|
||||
@override
|
||||
String get themeColor => 'Theme Color';
|
||||
|
||||
@override
|
||||
String get selectThemeColor => 'Select Theme Color';
|
||||
|
||||
@override
|
||||
String get violet => 'Violet';
|
||||
|
||||
@override
|
||||
String get blue => 'Blue';
|
||||
|
||||
@override
|
||||
String get invalidIfsc => 'Invalid IFSC code';
|
||||
|
||||
@override
|
||||
String get validIfsc => 'Valid IFSC';
|
||||
|
||||
@override
|
||||
String get beneficiaryAddedSuccess => 'Beneficiary Added Successfully';
|
||||
|
||||
@override
|
||||
String get beneficiaryAdditionFailed => 'Beneficiary Addition Failed';
|
||||
|
||||
@override
|
||||
String get noBeneficiaryFound => 'No beneficiaries found';
|
||||
|
||||
@override
|
||||
String get beneficiaryName => 'Beneficiary Name';
|
||||
}
|
||||
|
@@ -631,4 +631,34 @@ class AppLocalizationsHi extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get kccBankFull => 'कांगड़ा सेंट्रल को-ऑपरेटिव बैंक';
|
||||
|
||||
@override
|
||||
String get themeColor => 'थीम रंग';
|
||||
|
||||
@override
|
||||
String get selectThemeColor => 'थीम रंग चुनें';
|
||||
|
||||
@override
|
||||
String get violet => 'बैंगनी';
|
||||
|
||||
@override
|
||||
String get blue => 'नीला';
|
||||
|
||||
@override
|
||||
String get invalidIfsc => 'अमान्य IFSC कोड';
|
||||
|
||||
@override
|
||||
String get validIfsc => 'मान्य IFSC';
|
||||
|
||||
@override
|
||||
String get beneficiaryAddedSuccess => 'लाभार्थी सफलतापूर्वक जोड़ा गया';
|
||||
|
||||
@override
|
||||
String get beneficiaryAdditionFailed => 'लाभार्थी जोड़ने में विफल';
|
||||
|
||||
@override
|
||||
String get noBeneficiaryFound => 'कोई लाभार्थी नहीं मिला';
|
||||
|
||||
@override
|
||||
String get beneficiaryName => 'लाभार्थी नाम';
|
||||
}
|
||||
|
@@ -14,6 +14,5 @@ void main() async {
|
||||
|
||||
// Initialize dependencies
|
||||
await setupDependencies();
|
||||
|
||||
runApp(const KMobile());
|
||||
}
|
||||
|
247
pubspec.lock
247
pubspec.lock
@@ -1,27 +1,6 @@
|
||||
# Generated by pub
|
||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||
packages:
|
||||
_fe_analyzer_shared:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: _fe_analyzer_shared
|
||||
sha256: f256b0c0ba6c7577c15e2e4e114755640a875e885099367bf6e012b19314c834
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "72.0.0"
|
||||
_macros:
|
||||
dependency: transitive
|
||||
description: dart
|
||||
source: sdk
|
||||
version: "0.3.2"
|
||||
analyzer:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: analyzer
|
||||
sha256: b652861553cd3990d8ed361f7979dc6d7053a9ac8843fa73820ab68ce5410139
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.7.0"
|
||||
archive:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -62,70 +41,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
build:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build
|
||||
sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
build_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_config
|
||||
sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
build_daemon:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_daemon
|
||||
sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.2"
|
||||
build_resolvers:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_resolvers
|
||||
sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.2"
|
||||
build_runner:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: build_runner
|
||||
sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.13"
|
||||
build_runner_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_runner_core
|
||||
sha256: f8126682b87a7282a339b871298cc12009cb67109cfa1614d6436fb0289193e0
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.3.2"
|
||||
built_collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: built_collection
|
||||
sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.1.1"
|
||||
built_value:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: built_value
|
||||
sha256: "0b1b12a0a549605e5f04476031cd0bc91ead1d7c8e830773a18ee54179b3cb62"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.11.0"
|
||||
chalkdart:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -166,14 +81,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
code_builder:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: code_builder
|
||||
sha256: "0ec10bf4a89e4c613960bf1e8b42c64127021740fb21640c29c909826a5eea3e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.10.1"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -182,14 +89,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.18.0"
|
||||
convert:
|
||||
dependency: transitive
|
||||
confetti:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: convert
|
||||
sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68
|
||||
name: confetti
|
||||
sha256: "979aafde2428c53947892c95eb244466c109c129b7eee9011f0a66caaca52267"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.2"
|
||||
version: "0.7.0"
|
||||
cross_file:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -214,14 +121,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.8"
|
||||
dart_style:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dart_style
|
||||
sha256: "7856d364b589d1f08986e140938578ed36ed948581fbc3bc9aef1805039ac5ab"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.7"
|
||||
dio:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -402,14 +301,6 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
frontend_server_client:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: frontend_server_client
|
||||
sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
get_it:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -434,14 +325,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.2.1"
|
||||
graphs:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: graphs
|
||||
sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.2"
|
||||
http:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -450,14 +333,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
http_multi_server:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http_multi_server
|
||||
sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.2"
|
||||
http_parser:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -482,14 +357,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.19.0"
|
||||
io:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: io
|
||||
sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.5"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -578,14 +445,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.11"
|
||||
logging:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: logging
|
||||
sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
lottie:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -594,14 +453,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.7.0"
|
||||
macros:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: macros
|
||||
sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.2-main.4"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -650,14 +501,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
package_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: package_config
|
||||
sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -746,14 +589,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.8"
|
||||
pool:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pool
|
||||
sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.5.1"
|
||||
provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -762,22 +597,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.5"
|
||||
pub_semver:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pub_semver
|
||||
sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
pubspec_parse:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pubspec_parse
|
||||
sha256: "81876843eb50dc2e1e5b151792c9a985c5ed2536914115ed04e9c8528f6647b0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
screenshot:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -858,22 +677,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
shelf:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shelf
|
||||
sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.1"
|
||||
shelf_web_socket:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shelf_web_socket
|
||||
sha256: cc36c297b52866d203dbf9332263c94becc2fe0ceaa9681d07b6ef9807023b67
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
shimmer:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -919,14 +722,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
stream_transform:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stream_transform
|
||||
sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -951,14 +746,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.2"
|
||||
timing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: timing
|
||||
sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1079,14 +866,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "14.2.5"
|
||||
watcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: watcher
|
||||
sha256: "0b7fd4a0bbc4b92641dbf20adfd7e3fd1398fe17102d94b674234563e110088a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.2"
|
||||
web:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1095,22 +874,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
web_socket:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web_socket
|
||||
sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
web_socket_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web_socket_channel
|
||||
sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.3"
|
||||
win32:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@@ -58,11 +58,11 @@ dependencies:
|
||||
shimmer: ^3.0.0
|
||||
lottie: ^2.6.0
|
||||
share_plus: ^7.2.1
|
||||
confetti: ^0.7.0
|
||||
|
||||
|
||||
|
||||
dev_dependencies:
|
||||
build_runner: ^2.4.6
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
|
Reference in New Issue
Block a user