Compare commits
17 Commits
language-t
...
7527db3d2f
Author | SHA1 | Date | |
---|---|---|---|
7527db3d2f | |||
19d3487552 | |||
|
60a5703c35 | ||
09618db28e | |||
712553e49f | |||
842eef2cc7 | |||
|
e6ea764785 | ||
e2a809d363 | |||
f48bfabb4a | |||
76d5874e19 | |||
913e31a6ab | |||
7f5258b5b7 | |||
|
82951b7919 | ||
8ae26e2f18 | |||
e7bbab13ba | |||
72862492c0 | |||
|
f91d0f739b |
BIN
assets/images/BankofBaroda_logo.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
assets/images/axisbank_logo.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
assets/images/canaraBank_logo.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
assets/images/hdfc_logo.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
assets/images/icici_logo.png
Normal file
After Width: | Height: | Size: 77 KiB |
BIN
assets/images/kotak_logo.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
assets/images/pnb_logo.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
assets/images/sbi_logo.png
Normal file
After Width: | Height: | Size: 6.5 KiB |
@@ -4,7 +4,6 @@ import '../../features/auth/models/auth_token.dart';
|
|||||||
import '../../features/auth/models/auth_credentials.dart';
|
import '../../features/auth/models/auth_credentials.dart';
|
||||||
import '../../core/errors/exceptions.dart';
|
import '../../core/errors/exceptions.dart';
|
||||||
|
|
||||||
|
|
||||||
class AuthService {
|
class AuthService {
|
||||||
final Dio _dio;
|
final Dio _dio;
|
||||||
AuthService(this._dio);
|
AuthService(this._dio);
|
||||||
@@ -30,7 +29,8 @@ class AuthService {
|
|||||||
}
|
}
|
||||||
throw NetworkException('Network error during login');
|
throw NetworkException('Network error during login');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw UnexpectedException('Unexpected error during login: ${e.toString()}');
|
throw UnexpectedException(
|
||||||
|
'Unexpected error during login: ${e.toString()}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +66,8 @@ class AuthService {
|
|||||||
}
|
}
|
||||||
throw NetworkException('Network error during TPIN check');
|
throw NetworkException('Network error during TPIN check');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw UnexpectedException('Unexpected error during TPIN check: ${e.toString()}');
|
throw UnexpectedException(
|
||||||
|
'Unexpected error during TPIN check: ${e.toString()}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,8 +87,8 @@ class AuthService {
|
|||||||
}
|
}
|
||||||
throw NetworkException('Network error during TPIN setup');
|
throw NetworkException('Network error during TPIN setup');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw UnexpectedException('Unexpected error during TPIN setup: ${e.toString()}');
|
throw UnexpectedException(
|
||||||
|
'Unexpected error during TPIN setup: ${e.toString()}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:kmobile/data/models/ifsc.dart';
|
import 'package:kmobile/data/models/ifsc.dart';
|
||||||
import 'package:kmobile/data/models/beneficiary.dart';
|
import 'package:kmobile/data/models/beneficiary.dart';
|
||||||
@@ -9,14 +11,16 @@ class BeneficiaryService {
|
|||||||
|
|
||||||
Future<String> validateBeneficiaryWithinBank(String accountNumber) async {
|
Future<String> validateBeneficiaryWithinBank(String accountNumber) async {
|
||||||
try {
|
try {
|
||||||
final response = await _dio.get('/api/beneficiary/validate/within-bank', queryParameters: {
|
final response = await _dio
|
||||||
|
.get('/api/beneficiary/validate/within-bank', queryParameters: {
|
||||||
'accountNumber': accountNumber,
|
'accountNumber': accountNumber,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
return response.data['name'];
|
return response.data['name'];
|
||||||
} else {
|
} else {
|
||||||
throw Exception(response.data['error'] ?? 'Failed to validate beneficiary');
|
throw Exception(
|
||||||
|
response.data['error'] ?? 'Failed to validate beneficiary');
|
||||||
}
|
}
|
||||||
} on DioException catch (e) {
|
} on DioException catch (e) {
|
||||||
throw Exception('Network error: ${e.message}');
|
throw Exception('Network error: ${e.message}');
|
||||||
@@ -25,137 +29,67 @@ class BeneficiaryService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<Ifsc> validateIFSC(String ifscCode) async {
|
||||||
|
try {
|
||||||
|
final response = await _dio.get('/api/beneficiary/ifsc-details',
|
||||||
|
queryParameters: {"ifscCode": ifscCode});
|
||||||
|
|
||||||
Future<ifsc?> validateIFSC(String ifscCode) async {
|
if (response.statusCode == 200) {
|
||||||
try {
|
return Ifsc.fromJson(response.data);
|
||||||
final response = await _dio.get('/api/beneficiary/ifsc-details', queryParameters: {
|
}
|
||||||
"ifscCode": ifscCode
|
} on DioException catch (e) {
|
||||||
|
if (e.response?.statusCode == 404) {
|
||||||
|
throw Exception('INVALID IFSC CODE');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
rethrow;
|
||||||
}
|
}
|
||||||
);
|
return Ifsc.fromJson({});
|
||||||
|
|
||||||
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;
|
Future<String> validateBeneficiary({
|
||||||
|
|
||||||
}
|
|
||||||
///Step 1: Validate beneficiary (returns refNo)
|
|
||||||
Future<String?> validateBeneficiary({
|
|
||||||
required String accountNo,
|
required String accountNo,
|
||||||
required String ifscCode,
|
required String ifscCode,
|
||||||
required String remitterName,
|
required String remitterName,
|
||||||
}) async {
|
}) async {
|
||||||
|
log('inside validate beneficiary service');
|
||||||
try {
|
final response = await _dio.get(
|
||||||
final response = await _dio.post(
|
'/api/beneficiary/validate/outside-bank',
|
||||||
'/api/beneficiary/validate/outside_bank',
|
queryParameters: {
|
||||||
queryParameters: {
|
'accountNo': accountNo,
|
||||||
'accountNo': accountNo,
|
'ifscCode': ifscCode,
|
||||||
'ifscCode': ifscCode,
|
'remitterName': remitterName,
|
||||||
'remitterName': remitterName,
|
},
|
||||||
},
|
);
|
||||||
);
|
if (response.statusCode != 200) {
|
||||||
|
throw Exception("Invalid Beneficiary Details");
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
return response.data['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send Data for Validation
|
// Send Data for Validation
|
||||||
Future<void> sendForValidation(Beneficiary beneficiary) async {
|
Future<bool> sendForValidation(Beneficiary beneficiary) async {
|
||||||
try {
|
try {
|
||||||
print(beneficiary.toJson());
|
|
||||||
final response = await _dio.post(
|
final response = await _dio.post(
|
||||||
'/api/beneficiary/add',
|
'/api/beneficiary',
|
||||||
data: beneficiary.toJson(),
|
data: beneficiary.toJson(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
print("SENT FOR VALIDATION");
|
return true;
|
||||||
} else {
|
} else {
|
||||||
print("VALIDATION REQUEST FAILED: ${response.statusCode}");
|
return false;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print("ERROR IN SENDING REQUEST: $e");
|
|
||||||
rethrow;
|
rethrow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Poll to check if beneficiary is found
|
Future<List<Beneficiary>> fetchBeneficiaryList() async {
|
||||||
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 {
|
try {
|
||||||
final response = await _dio.get(
|
final response = await _dio.get(
|
||||||
"/api/beneficiary/get",
|
"/api/beneficiary",
|
||||||
options: Options(
|
options: Options(
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
@@ -163,8 +97,7 @@ class BeneficiaryService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
return Beneficiary.listFromJson(response.data);
|
return Beneficiary.listFromJson(response.data);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw Exception("Failed to fetch beneficiaries");
|
throw Exception("Failed to fetch beneficiaries");
|
||||||
}
|
}
|
||||||
@@ -174,6 +107,3 @@ class BeneficiaryService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
31
lib/api/services/imps_service.dart
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:kmobile/data/models/imps_response.dart';
|
||||||
|
import 'package:kmobile/data/models/imps_transaction.dart';
|
||||||
|
|
||||||
|
class ImpsService {
|
||||||
|
final Dio _dio;
|
||||||
|
|
||||||
|
ImpsService(this._dio);
|
||||||
|
|
||||||
|
Future<ImpsResponse> processImpsTransaction(
|
||||||
|
ImpsTransaction transaction) async {
|
||||||
|
try {
|
||||||
|
await Future.delayed(const Duration(seconds: 3));
|
||||||
|
final response = await _dio.post(
|
||||||
|
'/api/payment/rtgs',
|
||||||
|
data: transaction.toJson(),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
return ImpsResponse.fromJson(response.data);
|
||||||
|
} else {
|
||||||
|
throw Exception(
|
||||||
|
'RTGS transaction failed with status code: ${response.statusCode}');
|
||||||
|
}
|
||||||
|
} on DioException {
|
||||||
|
rethrow;
|
||||||
|
} catch (e) {
|
||||||
|
throw Exception('An unexpected error occurred: ${e.toString()}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
31
lib/api/services/neft_service.dart
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:kmobile/data/models/neft_response.dart';
|
||||||
|
import 'package:kmobile/data/models/neft_transaction.dart';
|
||||||
|
|
||||||
|
class NeftService {
|
||||||
|
final Dio _dio;
|
||||||
|
|
||||||
|
NeftService(this._dio);
|
||||||
|
|
||||||
|
Future<NeftResponse> processNeftTransaction(
|
||||||
|
NeftTransaction transaction) async {
|
||||||
|
try {
|
||||||
|
await Future.delayed(const Duration(seconds: 3));
|
||||||
|
final response = await _dio.post(
|
||||||
|
'/api/payment/neft',
|
||||||
|
data: transaction.toJson(),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
return NeftResponse.fromJson(response.data);
|
||||||
|
} else {
|
||||||
|
throw Exception(
|
||||||
|
'NEFT transaction failed with status code: ${response.statusCode}');
|
||||||
|
}
|
||||||
|
} on DioException {
|
||||||
|
rethrow;
|
||||||
|
} catch (e) {
|
||||||
|
throw Exception('An unexpected error occurred: ${e.toString()}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,5 +1,4 @@
|
|||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:kmobile/data/models/payment_response.dart';
|
import 'package:kmobile/data/models/payment_response.dart';
|
||||||
import 'package:kmobile/data/models/transfer.dart';
|
import 'package:kmobile/data/models/transfer.dart';
|
||||||
|
31
lib/api/services/rtgs_service.dart
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:kmobile/data/models/rtgs_response.dart';
|
||||||
|
import 'package:kmobile/data/models/rtgs_transaction.dart';
|
||||||
|
|
||||||
|
class RtgsService {
|
||||||
|
final Dio _dio;
|
||||||
|
|
||||||
|
RtgsService(this._dio);
|
||||||
|
|
||||||
|
Future<RtgsResponse> processRtgsTransaction(
|
||||||
|
RtgsTransaction transaction) async {
|
||||||
|
try {
|
||||||
|
await Future.delayed(const Duration(seconds: 3));
|
||||||
|
final response = await _dio.post(
|
||||||
|
'/api/payment/rtgs',
|
||||||
|
data: transaction.toJson(),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
return RtgsResponse.fromJson(response.data);
|
||||||
|
} else {
|
||||||
|
throw Exception(
|
||||||
|
'RTGS transaction failed with status code: ${response.statusCode}');
|
||||||
|
}
|
||||||
|
} on DioException {
|
||||||
|
rethrow;
|
||||||
|
} catch (e) {
|
||||||
|
throw Exception('An unexpected error occurred: ${e.toString()}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
106
lib/app.dart
@@ -26,7 +26,8 @@ class KMobile extends StatefulWidget {
|
|||||||
State<KMobile> createState() => _KMobileState();
|
State<KMobile> createState() => _KMobileState();
|
||||||
|
|
||||||
static void setLocale(BuildContext context, Locale newLocale) {
|
static void setLocale(BuildContext context, Locale newLocale) {
|
||||||
final _KMobileState? state = context.findAncestorStateOfType<_KMobileState>();
|
final _KMobileState? state =
|
||||||
|
context.findAncestorStateOfType<_KMobileState>();
|
||||||
state?.setLocale(newLocale);
|
state?.setLocale(newLocale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -35,7 +36,6 @@ class _KMobileState extends State<KMobile> {
|
|||||||
bool showSplash = true;
|
bool showSplash = true;
|
||||||
Locale? _locale;
|
Locale? _locale;
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@@ -57,7 +57,6 @@ class _KMobileState extends State<KMobile> {
|
|||||||
_locale = Locale(langCode);
|
_locale = Locale(langCode);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setLocale(Locale locale) {
|
void setLocale(Locale locale) {
|
||||||
@@ -66,54 +65,51 @@ class _KMobileState extends State<KMobile> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// Set status bar color and brightness
|
// Set status bar color and brightness
|
||||||
SystemChrome.setSystemUIOverlayStyle(
|
SystemChrome.setSystemUIOverlayStyle(
|
||||||
const SystemUiOverlayStyle(
|
const SystemUiOverlayStyle(
|
||||||
statusBarColor: Colors.transparent,
|
statusBarColor: Colors.transparent,
|
||||||
statusBarIconBrightness: Brightness.dark,
|
statusBarIconBrightness: Brightness.dark,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
return MultiBlocProvider(
|
return MultiBlocProvider(
|
||||||
providers: [
|
providers: [
|
||||||
BlocProvider<AuthCubit>(create: (_) => getIt<AuthCubit>()),
|
BlocProvider<AuthCubit>(create: (_) => getIt<AuthCubit>()),
|
||||||
BlocProvider<ThemeCubit>(create: (_) => getIt<ThemeCubit>()),
|
BlocProvider<ThemeCubit>(create: (_) => ThemeCubit()),
|
||||||
],
|
],
|
||||||
child: BlocBuilder<ThemeCubit, ThemeState>(
|
child: BlocBuilder<ThemeCubit, ThemeState>(
|
||||||
builder: (context, themeState) {
|
builder: (context, themeState) {
|
||||||
print('global theme state changed');
|
print('global theme state changed');
|
||||||
print(themeState);
|
return MaterialApp(
|
||||||
return MaterialApp(
|
debugShowCheckedModeBanner: false,
|
||||||
debugShowCheckedModeBanner: false,
|
locale: _locale ?? const Locale('en'),
|
||||||
locale: _locale ?? const Locale('en'),
|
supportedLocales: const [
|
||||||
supportedLocales: const [
|
Locale('en'),
|
||||||
Locale('en'),
|
Locale('hi'),
|
||||||
Locale('hi'),
|
],
|
||||||
],
|
localizationsDelegates: const [
|
||||||
localizationsDelegates: const [
|
AppLocalizations.delegate,
|
||||||
AppLocalizations.delegate,
|
GlobalMaterialLocalizations.delegate,
|
||||||
GlobalMaterialLocalizations.delegate,
|
GlobalWidgetsLocalizations.delegate,
|
||||||
GlobalWidgetsLocalizations.delegate,
|
GlobalCupertinoLocalizations.delegate,
|
||||||
GlobalCupertinoLocalizations.delegate,
|
],
|
||||||
],
|
title: 'kMobile',
|
||||||
title: 'kMobile',
|
theme: themeState.getThemeData(),
|
||||||
//theme: AppThemes.getLightTheme(themeState.themeType),
|
darkTheme: themeState.getThemeData(),
|
||||||
theme: themeState.getThemeData(),
|
themeMode: ThemeMode.system,
|
||||||
// darkTheme: AppThemes.getDarkTheme(themeState.themeType),
|
onGenerateRoute: AppRoutes.generateRoute,
|
||||||
themeMode: ThemeMode.system,
|
initialRoute: AppRoutes.splash,
|
||||||
onGenerateRoute: AppRoutes.generateRoute,
|
home: showSplash ? const SplashScreen() : const AuthGate(),
|
||||||
initialRoute: AppRoutes.splash,
|
);
|
||||||
home: showSplash ? const SplashScreen() : const AuthGate(),
|
},
|
||||||
);
|
),
|
||||||
},
|
);
|
||||||
),
|
}
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
class AuthGate extends StatefulWidget {
|
class AuthGate extends StatefulWidget {
|
||||||
const AuthGate({super.key});
|
const AuthGate({super.key});
|
||||||
|
|
||||||
@@ -142,8 +138,7 @@ class _AuthGateState extends State<AuthGate> {
|
|||||||
final mpin = await storage.read('mpin');
|
final mpin = await storage.read('mpin');
|
||||||
final biometric = await storage.read('biometric_enabled');
|
final biometric = await storage.read('biometric_enabled');
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoggedIn =
|
_isLoggedIn = accessToken != null &&
|
||||||
accessToken != null &&
|
|
||||||
accessTokenExpiry != null &&
|
accessTokenExpiry != null &&
|
||||||
DateTime.parse(accessTokenExpiry).isAfter(DateTime.now());
|
DateTime.parse(accessTokenExpiry).isAfter(DateTime.now());
|
||||||
_hasMPin = mpin != null;
|
_hasMPin = mpin != null;
|
||||||
@@ -172,7 +167,6 @@ class _AuthGateState extends State<AuthGate> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (_checking) {
|
if (_checking) {
|
||||||
@@ -319,6 +313,8 @@ class _NavigationScaffoldState extends State<NavigationScaffold> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
print(
|
||||||
|
"--- NavigationScaffold is rebuilding with theme color: ${Theme.of(context).primaryColor}");
|
||||||
return PopScope(
|
return PopScope(
|
||||||
canPop: false,
|
canPop: false,
|
||||||
onPopInvokedWithResult: (didPop, result) async {
|
onPopInvokedWithResult: (didPop, result) async {
|
||||||
@@ -357,10 +353,16 @@ class _NavigationScaffoldState extends State<NavigationScaffold> {
|
|||||||
bottomNavigationBar: BottomNavigationBar(
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
currentIndex: _selectedIndex,
|
currentIndex: _selectedIndex,
|
||||||
type: BottomNavigationBarType.fixed,
|
type: BottomNavigationBarType.fixed,
|
||||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor, // Light blue background
|
backgroundColor: Theme.of(context)
|
||||||
|
.scaffoldBackgroundColor, // Light blue background
|
||||||
selectedItemColor: Theme.of(context).primaryColor,
|
selectedItemColor: Theme.of(context).primaryColor,
|
||||||
unselectedItemColor: Colors.black54,
|
unselectedItemColor: Colors.black54,
|
||||||
onTap: _onItemTapped,
|
onTap: (index) {
|
||||||
|
setState(() {
|
||||||
|
_selectedIndex = index;
|
||||||
|
});
|
||||||
|
_pageController.jumpToPage(index);
|
||||||
|
},
|
||||||
items: [
|
items: [
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: const Icon(Icons.home_filled),
|
icon: const Icon(Icons.home_filled),
|
||||||
|
@@ -35,7 +35,10 @@ class AppRoutes {
|
|||||||
return MaterialPageRoute(builder: (_) => const LoginScreen());
|
return MaterialPageRoute(builder: (_) => const LoginScreen());
|
||||||
|
|
||||||
case mPin:
|
case mPin:
|
||||||
return MaterialPageRoute(builder: (_) => const MPinScreen(mode: MPinMode.enter,));
|
return MaterialPageRoute(
|
||||||
|
builder: (_) => const MPinScreen(
|
||||||
|
mode: MPinMode.enter,
|
||||||
|
));
|
||||||
|
|
||||||
case register:
|
case register:
|
||||||
// Placeholder - create the RegisterScreen class and uncomment
|
// Placeholder - create the RegisterScreen class and uncomment
|
||||||
@@ -68,7 +71,6 @@ class AppRoutes {
|
|||||||
// return MaterialPageRoute(builder: (_) => const PaymentsScreen());
|
// return MaterialPageRoute(builder: (_) => const PaymentsScreen());
|
||||||
return _errorRoute();
|
return _errorRoute();
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return _errorRoute();
|
return _errorRoute();
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
enum ThemeType {
|
enum ThemeType {
|
||||||
violet,
|
violet,
|
||||||
green,
|
green,
|
||||||
orange,
|
orange,
|
||||||
blue,
|
blue,
|
||||||
}
|
}
|
@@ -11,7 +11,7 @@ class NetworkException extends AppException {
|
|||||||
NetworkException(super.message);
|
NetworkException(super.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
class AuthException implements Exception{
|
class AuthException implements Exception {
|
||||||
final String message;
|
final String message;
|
||||||
AuthException(this.message);
|
AuthException(this.message);
|
||||||
|
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
// ignore_for_file: non_constant_identifier_names
|
// ignore_for_file: non_constant_identifier_names
|
||||||
|
|
||||||
class Beneficiary {
|
class Beneficiary {
|
||||||
@@ -9,6 +7,7 @@ class Beneficiary {
|
|||||||
final String ifscCode;
|
final String ifscCode;
|
||||||
final String? bankName;
|
final String? bankName;
|
||||||
final String? branchName;
|
final String? branchName;
|
||||||
|
final String? tpin;
|
||||||
|
|
||||||
Beneficiary({
|
Beneficiary({
|
||||||
required this.accountNo,
|
required this.accountNo,
|
||||||
@@ -17,30 +16,43 @@ class Beneficiary {
|
|||||||
required this.ifscCode,
|
required this.ifscCode,
|
||||||
this.bankName,
|
this.bankName,
|
||||||
this.branchName,
|
this.branchName,
|
||||||
|
this.tpin,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory Beneficiary.fromJson(Map<String, dynamic> json) {
|
factory Beneficiary.fromJson(Map<String, dynamic> json) {
|
||||||
return Beneficiary(
|
return Beneficiary(
|
||||||
accountNo: json['accountNo'] ?? '',
|
accountNo: json['account_no'] ?? json['accountNo'] ?? '',
|
||||||
accountType: json['accountType'] ?? '',
|
accountType: json['account_type'] ?? json['accountType'] ?? '',
|
||||||
name: json['name'] ?? '',
|
name: json['name'] ?? '',
|
||||||
ifscCode: json['ifscCode'] ?? '',
|
ifscCode: json['ifsc_code'] ?? json['ifscCode'] ?? '',
|
||||||
bankName: json['bankName'] ?? '',
|
bankName: json['bank_name'] ?? json['bankName'] ?? '',
|
||||||
branchName: json['branchName'] ?? '',
|
branchName: json['branch_name'] ?? json['branchName'] ?? '',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return {
|
final Map<String, dynamic> json = {
|
||||||
'accountNo': accountNo,
|
'accountNo': accountNo,
|
||||||
'accountType': accountType,
|
'accountType': accountType,
|
||||||
'name': name,
|
'name': name,
|
||||||
'ifscCode' : ifscCode,
|
'ifscCode': ifscCode,
|
||||||
};
|
};
|
||||||
|
if (bankName != null && bankName!.isNotEmpty) {
|
||||||
|
json['bankName'] = bankName;
|
||||||
|
}
|
||||||
|
if (branchName != null && branchName!.isNotEmpty) {
|
||||||
|
json['branchName'] = branchName;
|
||||||
|
}
|
||||||
|
if (tpin != null && tpin!.isNotEmpty) {
|
||||||
|
json['tpin'] = tpin;
|
||||||
|
}
|
||||||
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<Beneficiary> listFromJson(List<dynamic> jsonList) {
|
static List<Beneficiary> listFromJson(List<dynamic> jsonList) {
|
||||||
final beneficiaryList = jsonList.map((beneficiary) => Beneficiary.fromJson(beneficiary)).toList();
|
final beneficiaryList = jsonList
|
||||||
|
.map((beneficiary) => Beneficiary.fromJson(beneficiary))
|
||||||
|
.toList();
|
||||||
print(beneficiaryList);
|
print(beneficiaryList);
|
||||||
return beneficiaryList;
|
return beneficiaryList;
|
||||||
}
|
}
|
||||||
|
@@ -1,45 +0,0 @@
|
|||||||
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)';
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,16 +1,16 @@
|
|||||||
class ifsc {
|
class Ifsc {
|
||||||
final String ifscCode;
|
final String ifscCode;
|
||||||
final String bankName;
|
final String bankName;
|
||||||
final String branchName;
|
final String branchName;
|
||||||
|
|
||||||
ifsc({
|
Ifsc({
|
||||||
required this.ifscCode,
|
required this.ifscCode,
|
||||||
required this.bankName,
|
required this.bankName,
|
||||||
required this.branchName,
|
required this.branchName,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory ifsc.fromJson(Map<String, dynamic> json) {
|
factory Ifsc.fromJson(Map<String, dynamic> json) {
|
||||||
return ifsc(
|
return Ifsc(
|
||||||
ifscCode: json['ifsc_code'] ?? '',
|
ifscCode: json['ifsc_code'] ?? '',
|
||||||
bankName: json['bank_name'] ?? '',
|
bankName: json['bank_name'] ?? '',
|
||||||
branchName: json['branch_name'] ?? '',
|
branchName: json['branch_name'] ?? '',
|
||||||
|
16
lib/data/models/imps_response.dart
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
class ImpsResponse {
|
||||||
|
final String message;
|
||||||
|
final String utr;
|
||||||
|
|
||||||
|
ImpsResponse({
|
||||||
|
required this.message,
|
||||||
|
required this.utr,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory ImpsResponse.fromJson(Map<String, dynamic> json) {
|
||||||
|
return ImpsResponse(
|
||||||
|
message: json['message'] ?? '',
|
||||||
|
utr: json['utr'] ?? '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
32
lib/data/models/imps_transaction.dart
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
class ImpsTransaction {
|
||||||
|
final String fromAccount;
|
||||||
|
final String toAccount;
|
||||||
|
final String amount;
|
||||||
|
final String ifscCode;
|
||||||
|
final String? remitterName;
|
||||||
|
final String beneficiaryName;
|
||||||
|
final String tpin;
|
||||||
|
|
||||||
|
ImpsTransaction({
|
||||||
|
required this.fromAccount,
|
||||||
|
required this.toAccount,
|
||||||
|
required this.amount,
|
||||||
|
required this.ifscCode,
|
||||||
|
this.remitterName,
|
||||||
|
required this.beneficiaryName,
|
||||||
|
required this.tpin,
|
||||||
|
});
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'stFromAccDetails': fromAccount,
|
||||||
|
'stBenAccNo': toAccount,
|
||||||
|
'stTransferAmount': amount,
|
||||||
|
'stBenIFSC': ifscCode,
|
||||||
|
//'remitterName': remitterName,
|
||||||
|
'stBeneName': beneficiaryName,
|
||||||
|
'stRemarks': "Check",
|
||||||
|
'tpin': tpin,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
16
lib/data/models/neft_response.dart
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
class NeftResponse {
|
||||||
|
final String message;
|
||||||
|
final String utr;
|
||||||
|
|
||||||
|
NeftResponse({
|
||||||
|
required this.message,
|
||||||
|
required this.utr,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory NeftResponse.fromJson(Map<String, dynamic> json) {
|
||||||
|
return NeftResponse(
|
||||||
|
message: json['message'] ?? '',
|
||||||
|
utr: json['utr'] ?? '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
31
lib/data/models/neft_transaction.dart
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
class NeftTransaction {
|
||||||
|
final String fromAccount;
|
||||||
|
final String toAccount;
|
||||||
|
final String amount;
|
||||||
|
final String ifscCode;
|
||||||
|
final String remitterName;
|
||||||
|
final String beneficiaryName;
|
||||||
|
final String tpin;
|
||||||
|
|
||||||
|
NeftTransaction({
|
||||||
|
required this.fromAccount,
|
||||||
|
required this.toAccount,
|
||||||
|
required this.amount,
|
||||||
|
required this.ifscCode,
|
||||||
|
required this.remitterName,
|
||||||
|
required this.beneficiaryName,
|
||||||
|
required this.tpin,
|
||||||
|
});
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'fromAccount': fromAccount,
|
||||||
|
'toAccount': toAccount,
|
||||||
|
'amount': amount,
|
||||||
|
'ifscCode': ifscCode,
|
||||||
|
'remitterName': remitterName,
|
||||||
|
'beneficiaryName': beneficiaryName,
|
||||||
|
'tpin': tpin,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@@ -6,6 +6,7 @@ class PaymentResponse {
|
|||||||
final String? currency;
|
final String? currency;
|
||||||
final String? errorMessage;
|
final String? errorMessage;
|
||||||
final String? errorCode;
|
final String? errorCode;
|
||||||
|
final String? utr;
|
||||||
|
|
||||||
PaymentResponse({
|
PaymentResponse({
|
||||||
required this.isSuccess,
|
required this.isSuccess,
|
||||||
@@ -15,5 +16,6 @@ class PaymentResponse {
|
|||||||
this.currency,
|
this.currency,
|
||||||
this.errorMessage,
|
this.errorMessage,
|
||||||
this.errorCode,
|
this.errorCode,
|
||||||
|
this.utr,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
16
lib/data/models/rtgs_response.dart
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
class RtgsResponse {
|
||||||
|
final String message;
|
||||||
|
final String utr;
|
||||||
|
|
||||||
|
RtgsResponse({
|
||||||
|
required this.message,
|
||||||
|
required this.utr,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory RtgsResponse.fromJson(Map<String, dynamic> json) {
|
||||||
|
return RtgsResponse(
|
||||||
|
message: json['message'] ?? '',
|
||||||
|
utr: json['utr'] ?? '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
31
lib/data/models/rtgs_transaction.dart
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
class RtgsTransaction {
|
||||||
|
final String fromAccount;
|
||||||
|
final String toAccount;
|
||||||
|
final String amount;
|
||||||
|
final String ifscCode;
|
||||||
|
final String remitterName;
|
||||||
|
final String beneficiaryName;
|
||||||
|
final String tpin;
|
||||||
|
|
||||||
|
RtgsTransaction({
|
||||||
|
required this.fromAccount,
|
||||||
|
required this.toAccount,
|
||||||
|
required this.amount,
|
||||||
|
required this.ifscCode,
|
||||||
|
required this.remitterName,
|
||||||
|
required this.beneficiaryName,
|
||||||
|
required this.tpin,
|
||||||
|
});
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'fromAccount': fromAccount,
|
||||||
|
'toAccount': toAccount,
|
||||||
|
'amount': amount,
|
||||||
|
'ifscCode': ifscCode,
|
||||||
|
'remitterName': remitterName,
|
||||||
|
'beneficiaryName': beneficiaryName,
|
||||||
|
'tpin': tpin,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@@ -18,7 +18,8 @@ class AuthRepository {
|
|||||||
|
|
||||||
Future<List<User>> login(String customerNo, String password) async {
|
Future<List<User>> login(String customerNo, String password) async {
|
||||||
// Create credentials and call service
|
// Create credentials and call service
|
||||||
final credentials = AuthCredentials(customerNo: customerNo, password: password);
|
final credentials =
|
||||||
|
AuthCredentials(customerNo: customerNo, password: password);
|
||||||
final authToken = await _authService.login(credentials);
|
final authToken = await _authService.login(credentials);
|
||||||
|
|
||||||
// Save token securely
|
// Save token securely
|
||||||
@@ -44,7 +45,8 @@ class AuthRepository {
|
|||||||
// Private helper methods
|
// Private helper methods
|
||||||
Future<void> _saveAuthToken(AuthToken token) async {
|
Future<void> _saveAuthToken(AuthToken token) async {
|
||||||
await _secureStorage.write(_accessTokenKey, token.accessToken);
|
await _secureStorage.write(_accessTokenKey, token.accessToken);
|
||||||
await _secureStorage.write(_tokenExpiryKey, token.expiresAt.toIso8601String());
|
await _secureStorage.write(
|
||||||
|
_tokenExpiryKey, token.expiresAt.toIso8601String());
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<AuthToken?> _getAuthToken() async {
|
Future<AuthToken?> _getAuthToken() async {
|
||||||
|
@@ -1,8 +1,12 @@
|
|||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
import 'package:kmobile/data/models/transaction.dart';
|
import 'package:kmobile/data/models/transaction.dart';
|
||||||
|
|
||||||
abstract class TransactionRepository {
|
abstract class TransactionRepository {
|
||||||
Future<List<Transaction>> fetchTransactions(String accountNo);
|
Future<List<Transaction>> fetchTransactions(String accountNo,
|
||||||
|
{DateTime? fromDate, DateTime? toDate});
|
||||||
}
|
}
|
||||||
|
|
||||||
class TransactionRepositoryImpl implements TransactionRepository {
|
class TransactionRepositoryImpl implements TransactionRepository {
|
||||||
@@ -10,9 +14,23 @@ class TransactionRepositoryImpl implements TransactionRepository {
|
|||||||
TransactionRepositoryImpl(this._dio);
|
TransactionRepositoryImpl(this._dio);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<Transaction>> fetchTransactions(String accountNo) async {
|
Future<List<Transaction>> fetchTransactions(String accountNo,
|
||||||
|
{DateTime? fromDate, DateTime? toDate}) async {
|
||||||
|
final queryParameters = <String, String>{};
|
||||||
|
|
||||||
final resp = await _dio.get('/api/transactions/account/$accountNo');
|
if (fromDate != null) {
|
||||||
|
queryParameters['fromDate'] = DateFormat('ddMMyyyy').format(fromDate);
|
||||||
|
}
|
||||||
|
if (toDate != null) {
|
||||||
|
queryParameters['toDate'] = DateFormat('ddMMyyyy').format(toDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
log('query params below');
|
||||||
|
log(queryParameters.toString());
|
||||||
|
final resp = await _dio.get(
|
||||||
|
'/api/transactions/account/$accountNo',
|
||||||
|
queryParameters: queryParameters.isNotEmpty ? queryParameters : null,
|
||||||
|
);
|
||||||
|
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(
|
throw Exception(
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
import 'package:kmobile/data/models/transfer.dart';
|
import 'package:kmobile/data/models/transfer.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
|
|
||||||
|
|
||||||
abstract class TransferRepository {
|
abstract class TransferRepository {
|
||||||
Future<TransferResponse> transfer(Transfer transfer);
|
Future<TransferResponse> transfer(Transfer transfer);
|
||||||
}
|
}
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
import 'package:kmobile/api/services/rtgs_service.dart';
|
||||||
|
import 'package:kmobile/api/services/neft_service.dart';
|
||||||
import 'package:get_it/get_it.dart';
|
import 'package:get_it/get_it.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:kmobile/api/services/beneficiary_service.dart';
|
import 'package:kmobile/api/services/beneficiary_service.dart';
|
||||||
@@ -11,14 +13,12 @@ import '../data/repositories/auth_repository.dart';
|
|||||||
import '../features/auth/controllers/auth_cubit.dart';
|
import '../features/auth/controllers/auth_cubit.dart';
|
||||||
import '../security/secure_storage.dart';
|
import '../security/secure_storage.dart';
|
||||||
|
|
||||||
|
|
||||||
final getIt = GetIt.instance;
|
final getIt = GetIt.instance;
|
||||||
|
|
||||||
Future<void> setupDependencies() async {
|
Future<void> setupDependencies() async {
|
||||||
|
|
||||||
//getIt.registerLazySingleton<ThemeController>(() => ThemeController());
|
//getIt.registerLazySingleton<ThemeController>(() => ThemeController());
|
||||||
//getIt.registerLazySingleton<ThemeModeController>(() => ThemeModeController());
|
//getIt.registerLazySingleton<ThemeModeController>(() => ThemeModeController());
|
||||||
getIt.registerSingleton<ThemeCubit>( ThemeCubit());
|
getIt.registerSingleton<ThemeCubit>(ThemeCubit());
|
||||||
|
|
||||||
// Register Dio client
|
// Register Dio client
|
||||||
getIt.registerSingleton<Dio>(_createDioClient());
|
getIt.registerSingleton<Dio>(_createDioClient());
|
||||||
@@ -42,6 +42,8 @@ Future<void> setupDependencies() async {
|
|||||||
|
|
||||||
getIt.registerSingleton<PaymentService>(PaymentService(getIt<Dio>()));
|
getIt.registerSingleton<PaymentService>(PaymentService(getIt<Dio>()));
|
||||||
getIt.registerSingleton<BeneficiaryService>(BeneficiaryService(getIt<Dio>()));
|
getIt.registerSingleton<BeneficiaryService>(BeneficiaryService(getIt<Dio>()));
|
||||||
|
getIt.registerSingleton<NeftService>(NeftService(getIt<Dio>()));
|
||||||
|
getIt.registerSingleton<RtgsService>(RtgsService(getIt<Dio>()));
|
||||||
|
|
||||||
// Add auth interceptor after repository is available
|
// Add auth interceptor after repository is available
|
||||||
getIt<Dio>().interceptors.add(
|
getIt<Dio>().interceptors.add(
|
||||||
@@ -51,17 +53,16 @@ Future<void> setupDependencies() async {
|
|||||||
// Register controllers/cubits
|
// Register controllers/cubits
|
||||||
getIt.registerFactory<AuthCubit>(
|
getIt.registerFactory<AuthCubit>(
|
||||||
() => AuthCubit(getIt<AuthRepository>(), getIt<UserService>()));
|
() => AuthCubit(getIt<AuthRepository>(), getIt<UserService>()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Dio _createDioClient() {
|
Dio _createDioClient() {
|
||||||
final dio = Dio(
|
final dio = Dio(
|
||||||
BaseOptions(
|
BaseOptions(
|
||||||
baseUrl:
|
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',
|
//'http://localhost:8081',
|
||||||
connectTimeout: const Duration(seconds: 5),
|
connectTimeout: const Duration(seconds: 5),
|
||||||
receiveTimeout: const Duration(seconds: 3),
|
receiveTimeout: const Duration(seconds: 10),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
|
@@ -88,12 +88,6 @@ class _AccountInfoScreen extends State<AccountInfoScreen> {
|
|||||||
}).toList(),
|
}).toList(),
|
||||||
),
|
),
|
||||||
|
|
||||||
/*InfoRow(
|
|
||||||
title: AppLocalizations.of(context).accountNumber,
|
|
||||||
value: users[selectedIndex].accountNo ?? 'N/A'),
|
|
||||||
// InfoRow(title: 'Nominee Customer No', value: user.nomineeCustomerNo),
|
|
||||||
// InfoRow(title: 'SMS Service', value: user.smsService),
|
|
||||||
// InfoRow(title: 'Missed Call Service', value: user.missedCallService),*/
|
|
||||||
InfoRow(
|
InfoRow(
|
||||||
title: AppLocalizations.of(context).customerNumber,
|
title: AppLocalizations.of(context).customerNumber,
|
||||||
value: selectedUser.cifNumber ?? 'N/A',
|
value: selectedUser.cifNumber ?? 'N/A',
|
||||||
|
@@ -6,6 +6,7 @@ import 'package:kmobile/data/models/transaction.dart';
|
|||||||
import 'package:kmobile/data/repositories/transaction_repository.dart';
|
import 'package:kmobile/data/repositories/transaction_repository.dart';
|
||||||
import 'package:kmobile/di/injection.dart';
|
import 'package:kmobile/di/injection.dart';
|
||||||
import '../../../l10n/app_localizations.dart';
|
import '../../../l10n/app_localizations.dart';
|
||||||
|
import 'transaction_details_screen.dart';
|
||||||
|
|
||||||
class AccountStatementScreen extends StatefulWidget {
|
class AccountStatementScreen extends StatefulWidget {
|
||||||
final String accountNo;
|
final String accountNo;
|
||||||
@@ -36,7 +37,11 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
|||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
final repo = getIt<TransactionRepository>();
|
final repo = getIt<TransactionRepository>();
|
||||||
final txs = await repo.fetchTransactions(widget.accountNo);
|
final txs = await repo.fetchTransactions(
|
||||||
|
widget.accountNo,
|
||||||
|
fromDate: fromDate,
|
||||||
|
toDate: toDate,
|
||||||
|
);
|
||||||
setState(() => _transactions = txs);
|
setState(() => _transactions = txs);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
@@ -115,7 +120,8 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
|||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context).accountStatement,
|
AppLocalizations.of(context).accountStatement,
|
||||||
style: const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
style:
|
||||||
|
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
actions: [
|
actions: [
|
||||||
@@ -181,56 +187,28 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Row(
|
SizedBox(
|
||||||
children: [
|
width: double.infinity,
|
||||||
Expanded(
|
child: ElevatedButton(
|
||||||
child: TextFormField(
|
onPressed: _loadTransactions,
|
||||||
controller: _minAmountController,
|
style: ElevatedButton.styleFrom(
|
||||||
decoration: InputDecoration(
|
backgroundColor: Theme.of(context).primaryColor,
|
||||||
labelText: AppLocalizations.of(context).minAmount,
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
border: const OutlineInputBorder(),
|
),
|
||||||
isDense: true,
|
child: Text(
|
||||||
filled: true,
|
"Search",
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
style: TextStyle(
|
||||||
),
|
color: Theme.of(context).scaffoldBackgroundColor,
|
||||||
keyboardType: TextInputType.number,
|
fontSize: 16,
|
||||||
textInputAction: TextInputAction.next,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
),
|
||||||
Expanded(
|
|
||||||
child: TextFormField(
|
|
||||||
controller: _maxAmountController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: AppLocalizations.of(context).maxAmount,
|
|
||||||
border: const OutlineInputBorder(),
|
|
||||||
isDense: true,
|
|
||||||
filled: true,
|
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
|
||||||
),
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
textInputAction: TextInputAction.done,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
SizedBox(
|
|
||||||
width: 70,
|
|
||||||
child: ElevatedButton(
|
|
||||||
onPressed: _loadTransactions,
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
backgroundColor: Theme.of(context).primaryColor,
|
|
||||||
),
|
|
||||||
child: Icon(
|
|
||||||
Symbols.arrow_forward,
|
|
||||||
color: Theme.of(context).scaffoldBackgroundColor,
|
|
||||||
size: 30,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 35),
|
const SizedBox(height: 35),
|
||||||
if (!_txLoading && _transactions.isNotEmpty)
|
if (!_txLoading &&
|
||||||
|
_transactions.isNotEmpty &&
|
||||||
|
fromDate == null &&
|
||||||
|
toDate == null)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 12.0),
|
padding: const EdgeInsets.only(bottom: 12.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -252,7 +230,8 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
|||||||
highlightColor: Colors.grey[100]!,
|
highlightColor: Colors.grey[100]!,
|
||||||
child: CircleAvatar(
|
child: CircleAvatar(
|
||||||
radius: 12,
|
radius: 12,
|
||||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
backgroundColor:
|
||||||
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
title: Shimmer.fromColors(
|
title: Shimmer.fromColors(
|
||||||
@@ -298,7 +277,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
|||||||
title: Text(
|
title: Text(
|
||||||
tx.name != null
|
tx.name != null
|
||||||
? (tx.name!.length > 18
|
? (tx.name!.length > 18
|
||||||
? tx.name!.substring(0, 20)
|
? tx.name!.substring(0, 22)
|
||||||
: tx.name!)
|
: tx.name!)
|
||||||
: '',
|
: '',
|
||||||
style: const TextStyle(fontSize: 14),
|
style: const TextStyle(fontSize: 14),
|
||||||
@@ -311,6 +290,15 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
|||||||
"₹${tx.amount}",
|
"₹${tx.amount}",
|
||||||
style: const TextStyle(fontSize: 16),
|
style: const TextStyle(fontSize: 16),
|
||||||
),
|
),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (_) => TransactionDetailsScreen(
|
||||||
|
transaction: tx),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
167
lib/features/accounts/screens/transaction_details_screen.dart
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:kmobile/l10n/app_localizations.dart';
|
||||||
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
|
|
||||||
|
class TransactionDetailsScreen extends StatelessWidget {
|
||||||
|
final dynamic transaction;
|
||||||
|
|
||||||
|
const TransactionDetailsScreen({super.key, required this.transaction});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final bool isCredit = transaction.type?.toUpperCase() == 'CR';
|
||||||
|
|
||||||
|
// 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',
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
appBar:
|
||||||
|
AppBar(title: Text(AppLocalizations.of(context).transactionDetails)),
|
||||||
|
body: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
// Absolute center for amount + icon + date + details
|
||||||
|
Expanded(
|
||||||
|
flex: 3,
|
||||||
|
child: Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
// Amount + icon + Share Button
|
||||||
|
Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"₹ ${transaction.amount}",
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 40,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Icon(
|
||||||
|
isCredit ? Symbols.call_received : Symbols.call_made,
|
||||||
|
color: isCredit ? Colors.green : Colors.red,
|
||||||
|
size: 28,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
// Date centered
|
||||||
|
Text(
|
||||||
|
transaction.date ?? "",
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
const Divider(),
|
||||||
|
|
||||||
|
// All details
|
||||||
|
Expanded(
|
||||||
|
flex: 5,
|
||||||
|
child: ListView(
|
||||||
|
children: [
|
||||||
|
// ignore: unnecessary_cast
|
||||||
|
_buildDetailRow(
|
||||||
|
AppLocalizations.of(context).transactionType as String,
|
||||||
|
transaction.type ?? ""),
|
||||||
|
_buildDetailRow(AppLocalizations.of(context).transferType,
|
||||||
|
transaction.name.split("/").first ?? ""),
|
||||||
|
if (transaction.name.length > 12) ...[
|
||||||
|
_buildDetailRow(AppLocalizations.of(context).utrNo,
|
||||||
|
transaction.name.split("= ")[1].split(" ")[0] ?? ""),
|
||||||
|
_buildDetailRow(
|
||||||
|
AppLocalizations.of(context).beneficiaryAccountNo,
|
||||||
|
transaction.name.split("A/C ").last ?? "")
|
||||||
|
]
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// 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,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildDetailRow(String label, String value) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"$label: ",
|
||||||
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 20,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
value,
|
||||||
|
style: const TextStyle(fontSize: 20),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@@ -1,48 +1,25 @@
|
|||||||
import 'dart:developer';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'theme_state.dart';
|
|
||||||
import 'package:kmobile/config/theme_type.dart';
|
import 'package:kmobile/config/theme_type.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
|
import 'theme_state.dart';
|
||||||
|
|
||||||
class ThemeCubit extends Cubit<ThemeState> {
|
class ThemeCubit extends Cubit<ThemeState> {
|
||||||
ThemeCubit(): super(ThemeViolet()) {
|
ThemeCubit() : super(const ThemeState(themeType: ThemeType.violet)) {
|
||||||
loadTheme();
|
loadTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> loadTheme() async {
|
Future<void> loadTheme() async {
|
||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
final themeIndex = prefs.getInt('theme_type') ?? 0;
|
final themeIndex = prefs.getInt('theme_type') ?? 0;
|
||||||
// final isDark = prefs.getBool('is_dark_mode') ?? false;
|
|
||||||
|
|
||||||
final type = ThemeType.values[themeIndex];
|
final type = ThemeType.values[themeIndex];
|
||||||
switch(type) {
|
emit(ThemeState(themeType: type));
|
||||||
case ThemeType.blue:
|
|
||||||
emit(ThemeBlue());
|
|
||||||
case ThemeType.violet:
|
|
||||||
emit(ThemeViolet());
|
|
||||||
default:
|
|
||||||
emit(ThemeViolet());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> changeTheme(ThemeType type) async {
|
Future<void> changeTheme(ThemeType type) async {
|
||||||
|
print("Attempting to change theme to: ${type.toString()}");
|
||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
await prefs.setInt('theme_type', type.index);
|
await prefs.setInt('theme_type', type.index);
|
||||||
log("Mode Change");
|
emit(ThemeState(themeType: type));
|
||||||
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');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,27 +1,17 @@
|
|||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:kmobile/config/theme_type.dart';
|
import 'package:kmobile/config/theme_type.dart';
|
||||||
import 'package:kmobile/config/themes.dart';
|
import 'package:kmobile/config/themes.dart';
|
||||||
|
|
||||||
|
class ThemeState extends Equatable {
|
||||||
|
final ThemeType themeType;
|
||||||
|
|
||||||
abstract class ThemeState extends Equatable {
|
const ThemeState({required this.themeType});
|
||||||
getThemeData();
|
|
||||||
@override
|
|
||||||
List<Object?> get props => [];
|
|
||||||
}
|
|
||||||
|
|
||||||
class ThemeBlue extends ThemeState {
|
ThemeData getThemeData() {
|
||||||
|
return AppThemes.getLightTheme(themeType);
|
||||||
@override
|
|
||||||
getThemeData() {
|
|
||||||
print('returning blue theme');
|
|
||||||
return AppThemes.getLightTheme(ThemeType.blue);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
class ThemeViolet extends ThemeState {
|
|
||||||
@override
|
@override
|
||||||
getThemeData() {
|
List<Object?> get props => [themeType];
|
||||||
print('returning violet theme');
|
|
||||||
return AppThemes.getLightTheme(ThemeType.violet);
|
|
||||||
}
|
|
||||||
}
|
}
|
@@ -29,7 +29,8 @@ class AuthToken extends Equatable {
|
|||||||
// Pad the payload if necessary
|
// Pad the payload if necessary
|
||||||
String normalized = base64Url.normalize(payload);
|
String normalized = base64Url.normalize(payload);
|
||||||
final payloadMap = json.decode(utf8.decode(base64Url.decode(normalized)));
|
final payloadMap = json.decode(utf8.decode(base64Url.decode(normalized)));
|
||||||
if (payloadMap is! Map<String, dynamic> || !payloadMap.containsKey('exp')) {
|
if (payloadMap is! Map<String, dynamic> ||
|
||||||
|
!payloadMap.containsKey('exp')) {
|
||||||
throw Exception('Invalid payload');
|
throw Exception('Invalid payload');
|
||||||
}
|
}
|
||||||
final exp = payloadMap['exp'];
|
final exp = payloadMap['exp'];
|
||||||
|
@@ -48,9 +48,9 @@ class LoginScreenState extends State<LoginScreen>
|
|||||||
void _submitForm() {
|
void _submitForm() {
|
||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
context.read<AuthCubit>().login(
|
context.read<AuthCubit>().login(
|
||||||
_customerNumberController.text.trim(),
|
_customerNumberController.text.trim(),
|
||||||
_passwordController.text,
|
_passwordController.text,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,6 +64,7 @@ class LoginScreenState extends State<LoginScreen>
|
|||||||
final storage = getIt<SecureStorage>();
|
final storage = getIt<SecureStorage>();
|
||||||
final mpin = await storage.read('mpin');
|
final mpin = await storage.read('mpin');
|
||||||
if (mpin == null) {
|
if (mpin == null) {
|
||||||
|
// ignore: use_build_context_synchronously
|
||||||
Navigator.of(context).pushReplacement(
|
Navigator.of(context).pushReplacement(
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (_) => MPinScreen(
|
builder: (_) => MPinScreen(
|
||||||
@@ -82,6 +83,7 @@ class LoginScreenState extends State<LoginScreen>
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
// ignore: use_build_context_synchronously
|
||||||
Navigator.of(context).pushReplacement(
|
Navigator.of(context).pushReplacement(
|
||||||
MaterialPageRoute(builder: (_) => const NavigationScaffold()),
|
MaterialPageRoute(builder: (_) => const NavigationScaffold()),
|
||||||
);
|
);
|
||||||
@@ -133,14 +135,14 @@ class LoginScreenState extends State<LoginScreen>
|
|||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: AppLocalizations.of(context).customerNumber,
|
labelText: AppLocalizations.of(context).customerNumber,
|
||||||
// prefixIcon: Icon(Icons.person),
|
// prefixIcon: Icon(Icons.person),
|
||||||
border: OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -202,7 +204,8 @@ class LoginScreenState extends State<LoginScreen>
|
|||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
shape: const StadiumBorder(),
|
shape: const StadiumBorder(),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
backgroundColor:
|
||||||
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
foregroundColor: Theme.of(context).primaryColorDark,
|
foregroundColor: Theme.of(context).primaryColorDark,
|
||||||
side: const BorderSide(color: Colors.black, width: 1),
|
side: const BorderSide(color: Colors.black, width: 1),
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
@@ -211,22 +214,22 @@ class LoginScreenState extends State<LoginScreen>
|
|||||||
? const CircularProgressIndicator()
|
? const CircularProgressIndicator()
|
||||||
: Text(
|
: Text(
|
||||||
AppLocalizations.of(context).login,
|
AppLocalizations.of(context).login,
|
||||||
style: TextStyle(fontSize: 16),
|
style: const TextStyle(fontSize: 16),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.symmetric(vertical: 16),
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: Divider()),
|
const Expanded(child: Divider()),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
child: Text(AppLocalizations.of(context).or),
|
child: Text(AppLocalizations.of(context).or),
|
||||||
),
|
),
|
||||||
Expanded(child: Divider()),
|
const Expanded(child: Divider()),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -257,227 +260,3 @@ class LoginScreenState extends State<LoginScreen>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
import 'package:kmobile/di/injection.dart';
|
|
||||||
import 'package:kmobile/features/auth/screens/mpin_screen.dart';
|
|
||||||
import 'package:kmobile/security/secure_storage.dart';
|
|
||||||
import '../../../app.dart';
|
|
||||||
import '../controllers/auth_cubit.dart';
|
|
||||||
import '../controllers/auth_state.dart';
|
|
||||||
|
|
||||||
class LoginScreen extends StatefulWidget {
|
|
||||||
const LoginScreen({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
LoginScreenState createState() => LoginScreenState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class LoginScreenState extends State<LoginScreen> {
|
|
||||||
final _formKey = GlobalKey<FormState>();
|
|
||||||
final _customerNumberController = TextEditingController();
|
|
||||||
final _passwordController = TextEditingController();
|
|
||||||
bool _obscurePassword = true;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_customerNumberController.dispose();
|
|
||||||
_passwordController.dispose();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
void _submitForm() {
|
|
||||||
if (_formKey.currentState!.validate()) {
|
|
||||||
context.read<AuthCubit>().login(
|
|
||||||
_customerNumberController.text.trim(),
|
|
||||||
_passwordController.text,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
// appBar: AppBar(title: const Text('Login')),
|
|
||||||
body: BlocConsumer<AuthCubit, AuthState>(
|
|
||||||
listener: (context, state) async {
|
|
||||||
if (state is Authenticated) {
|
|
||||||
final storage = getIt<SecureStorage>();
|
|
||||||
final mpin = await storage.read('mpin');
|
|
||||||
if (mpin == null) {
|
|
||||||
Navigator.of(context).pushReplacement(
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (_) => MPinScreen(
|
|
||||||
mode: MPinMode.set,
|
|
||||||
onCompleted: (_) {
|
|
||||||
Navigator.of(context, rootNavigator: true)
|
|
||||||
.pushReplacement(
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (_) => const NavigationScaffold()),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
Navigator.of(context).pushReplacement(
|
|
||||||
MaterialPageRoute(builder: (_) => const NavigationScaffold()),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else if (state is AuthError) {
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
SnackBar(content: Text(state.message)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
builder: (context, state) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.all(24.0),
|
|
||||||
child: Form(
|
|
||||||
key: _formKey,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Image.asset('assets/images/logo.png', width: 150, height: 150,
|
|
||||||
errorBuilder: (context, error, stackTrace) {
|
|
||||||
return const Icon(Icons.account_balance,
|
|
||||||
size: 100, color: Colors.blue);
|
|
||||||
}),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
// Title
|
|
||||||
const Text(
|
|
||||||
'KCCB',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 32,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: Colors.blue),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 48),
|
|
||||||
|
|
||||||
TextFormField(
|
|
||||||
controller: _customerNumberController,
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
labelText: 'Customer Number',
|
|
||||||
// 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),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
textInputAction: TextInputAction.next,
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return 'Please enter your username';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(height: 24),
|
|
||||||
|
|
||||||
TextFormField(
|
|
||||||
controller: _passwordController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'Password',
|
|
||||||
// prefixIcon: const Icon(Icons.lock),
|
|
||||||
border: const OutlineInputBorder(),
|
|
||||||
isDense: true,
|
|
||||||
filled: true,
|
|
||||||
fillColor: Colors.white,
|
|
||||||
enabledBorder: const OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Colors.black),
|
|
||||||
),
|
|
||||||
focusedBorder: const OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
|
||||||
),
|
|
||||||
suffixIcon: IconButton(
|
|
||||||
icon: Icon(
|
|
||||||
_obscurePassword
|
|
||||||
? Icons.visibility
|
|
||||||
: Icons.visibility_off,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
setState(() {
|
|
||||||
_obscurePassword = !_obscurePassword;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
textInputAction: TextInputAction.done,
|
|
||||||
obscureText: _obscurePassword,
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return 'Please enter your password';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(height: 24),
|
|
||||||
|
|
||||||
SizedBox(
|
|
||||||
width: 250,
|
|
||||||
child: ElevatedButton(
|
|
||||||
onPressed: state is AuthLoading ? null : _submitForm,
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
shape: const StadiumBorder(),
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
|
||||||
backgroundColor: Colors.white,
|
|
||||||
foregroundColor: Colors.blueAccent,
|
|
||||||
side: const BorderSide(color: Colors.black, width: 1),
|
|
||||||
elevation: 0),
|
|
||||||
child: state is AuthLoading
|
|
||||||
? const CircularProgressIndicator()
|
|
||||||
: const Text(
|
|
||||||
'Login',
|
|
||||||
style: TextStyle(fontSize: 16),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
|
|
||||||
const Padding(
|
|
||||||
padding: EdgeInsets.symmetric(vertical: 16),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Expanded(child: Divider()),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
|
||||||
child: Text('OR'),
|
|
||||||
),
|
|
||||||
Expanded(child: Divider()),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
|
|
||||||
// Register Button
|
|
||||||
SizedBox(
|
|
||||||
width: 250,
|
|
||||||
child: ElevatedButton(
|
|
||||||
//disable until registration is implemented
|
|
||||||
onPressed: null,
|
|
||||||
style: OutlinedButton.styleFrom(
|
|
||||||
shape: const StadiumBorder(),
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
|
||||||
backgroundColor: Colors.lightBlue[100],
|
|
||||||
foregroundColor: Colors.black),
|
|
||||||
child: const Text('Register'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
@@ -46,6 +46,7 @@ class _MPinScreenState extends State<MPinScreen> {
|
|||||||
final auth = LocalAuthentication();
|
final auth = LocalAuthentication();
|
||||||
if (await auth.canCheckBiometrics) {
|
if (await auth.canCheckBiometrics) {
|
||||||
final didAuth = await auth.authenticate(
|
final didAuth = await auth.authenticate(
|
||||||
|
// ignore: use_build_context_synchronously
|
||||||
localizedReason: AppLocalizations.of(context).authenticateToAccess,
|
localizedReason: AppLocalizations.of(context).authenticateToAccess,
|
||||||
options: const AuthenticationOptions(biometricOnly: true),
|
options: const AuthenticationOptions(biometricOnly: true),
|
||||||
);
|
);
|
||||||
@@ -197,7 +198,9 @@ class _MPinScreenState extends State<MPinScreen> {
|
|||||||
key == '<' ? '⌫' : key,
|
key == '<' ? '⌫' : key,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
color: key == 'Enter' ? Theme.of(context).primaryColor : Colors.black,
|
color: key == 'Enter'
|
||||||
|
? Theme.of(context).primaryColor
|
||||||
|
: Colors.black,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@@ -19,11 +19,8 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
|||||||
|
|
||||||
// Automatically go to logizn after 4 seconds
|
// Automatically go to logizn after 4 seconds
|
||||||
Timer(const Duration(seconds: 4), () {
|
Timer(const Duration(seconds: 4), () {
|
||||||
|
|
||||||
widget.onContinue();
|
widget.onContinue();
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -73,7 +70,8 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
|||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: CircularProgressIndicator(color: Theme.of(context).scaffoldBackgroundColor),
|
child: CircularProgressIndicator(
|
||||||
|
color: Theme.of(context).scaffoldBackgroundColor),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -81,61 +79,3 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class WelcomeScreen extends StatelessWidget {
|
|
||||||
final VoidCallback onContinue;
|
|
||||||
|
|
||||||
const WelcomeScreen({super.key, required this.onContinue});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: Colors.white,
|
|
||||||
body: Center(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(32.0),
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
const Spacer(),
|
|
||||||
const Text(
|
|
||||||
'Welcome to',
|
|
||||||
style: TextStyle(fontSize: 28, color: Colors.black87),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
const Text(
|
|
||||||
'KCCB',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 42,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: Colors.indigo,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 40),
|
|
||||||
Image.asset(
|
|
||||||
'assets/images/logo.png',
|
|
||||||
width: 150,
|
|
||||||
height: 150,
|
|
||||||
),
|
|
||||||
const Spacer(),
|
|
||||||
ElevatedButton(
|
|
||||||
onPressed: onContinue,
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
backgroundColor: Colors.indigo,
|
|
||||||
foregroundColor: Colors.white,
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.symmetric(horizontal: 28, vertical: 20),
|
|
||||||
),
|
|
||||||
child: const Text('Proceed to Login'),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 24),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
@@ -1,22 +1,21 @@
|
|||||||
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:kmobile/api/services/beneficiary_service.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/beneficiary.dart';
|
||||||
import 'package:kmobile/data/models/user.dart';
|
|
||||||
import 'beneficiary_result_page.dart';
|
import 'beneficiary_result_page.dart';
|
||||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||||
import '../../../di/injection.dart';
|
import '../../../di/injection.dart';
|
||||||
import '../../../l10n/app_localizations.dart';
|
import '../../../l10n/app_localizations.dart';
|
||||||
|
import 'package:kmobile/features/fund_transfer/screens/transaction_pin_screen.dart';
|
||||||
|
|
||||||
class AddBeneficiaryScreen extends StatefulWidget {
|
class AddBeneficiaryScreen extends StatefulWidget {
|
||||||
final List<User>? users;
|
final String customerName;
|
||||||
final int? selectedIndex;
|
|
||||||
|
|
||||||
const AddBeneficiaryScreen({
|
const AddBeneficiaryScreen({
|
||||||
super.key,
|
super.key,
|
||||||
this.users,
|
required this.customerName,
|
||||||
this.selectedIndex,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -26,7 +25,6 @@ class AddBeneficiaryScreen extends StatefulWidget {
|
|||||||
class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
late User selectedUser = (widget.users ?? [])[widget.selectedIndex!];
|
|
||||||
final TextEditingController accountNumberController = TextEditingController();
|
final TextEditingController accountNumberController = TextEditingController();
|
||||||
final TextEditingController confirmAccountNumberController =
|
final TextEditingController confirmAccountNumberController =
|
||||||
TextEditingController();
|
TextEditingController();
|
||||||
@@ -35,12 +33,12 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
|||||||
final TextEditingController branchNameController = TextEditingController();
|
final TextEditingController branchNameController = TextEditingController();
|
||||||
final TextEditingController ifscController = TextEditingController();
|
final TextEditingController ifscController = TextEditingController();
|
||||||
final TextEditingController phoneController = TextEditingController();
|
final TextEditingController phoneController = TextEditingController();
|
||||||
|
final service = getIt<BeneficiaryService>();
|
||||||
|
|
||||||
String? _beneficiaryName;
|
|
||||||
bool _isValidating = false;
|
bool _isValidating = false;
|
||||||
bool _isBeneficiaryValidated = false;
|
bool _isBeneficiaryValidated = false;
|
||||||
|
// ignore: unused_field
|
||||||
String? _validationError;
|
String? _validationError;
|
||||||
|
|
||||||
late String accountType;
|
late String accountType;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -53,167 +51,163 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _validateIFSC() async {
|
||||||
|
var beneficiaryService = getIt<BeneficiaryService>();
|
||||||
ifsc? _ifscData;
|
final ifsc = ifscController.text.trim().toUpperCase();
|
||||||
bool _isLoading = false; //for validateIFSC()
|
if (ifsc.isEmpty) return;
|
||||||
|
|
||||||
void _validateIFSC() async {
|
|
||||||
var beneficiaryService = getIt<BeneficiaryService>();
|
|
||||||
final ifsc = ifscController.text.trim().toUpperCase();
|
|
||||||
if (ifsc.isEmpty) return;
|
|
||||||
setState(() {
|
|
||||||
_isLoading = true;
|
|
||||||
_ifscData = null;
|
|
||||||
});
|
|
||||||
|
|
||||||
final result = await beneficiaryService.validateIFSC(ifsc);
|
final result = await beneficiaryService.validateIFSC(ifsc);
|
||||||
|
|
||||||
setState(() {
|
if (mounted) {
|
||||||
_isLoading = false;
|
if (result.bankName == '') {
|
||||||
_ifscData = result;
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
});
|
SnackBar(content: Text(AppLocalizations.of(context).invalidIfsc)),
|
||||||
|
);
|
||||||
if (result == null) {
|
bankNameController.clear();
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
branchNameController.clear();
|
||||||
SnackBar(content: Text(AppLocalizations.of(context).invalidIfsc)),
|
} else {
|
||||||
);
|
bankNameController.text = result.bankName;
|
||||||
bankNameController.clear();
|
branchNameController.text = result.branchName;
|
||||||
branchNameController.clear();
|
|
||||||
} 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _validateBeneficiary() async {
|
||||||
|
FocusScope.of(context).unfocus();
|
||||||
|
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 = widget.customerName;
|
||||||
|
|
||||||
|
final service = getIt<BeneficiaryService>();
|
||||||
|
try {
|
||||||
|
final String beneficiaryName = await service.validateBeneficiary(
|
||||||
|
accountNo: accountNo,
|
||||||
|
ifscCode: ifsc,
|
||||||
|
remitterName: remitter,
|
||||||
|
);
|
||||||
|
|
||||||
if (foundName != null) {
|
|
||||||
setState(() {
|
setState(() {
|
||||||
nameController.text = foundName!;
|
nameController.text = beneficiaryName;
|
||||||
_isBeneficiaryValidated = true;
|
_isBeneficiaryValidated = true;
|
||||||
_validationError = null;
|
_validationError = null;
|
||||||
});
|
});
|
||||||
} else {
|
} catch (e) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_validationError = 'Beneficiary not found within timeout.';
|
_validationError = e.toString();
|
||||||
_isBeneficiaryValidated = false;
|
_isBeneficiaryValidated = false;
|
||||||
});
|
});
|
||||||
}
|
} finally {
|
||||||
} catch (e, st) {
|
if (mounted) {
|
||||||
// handle unexpected errors
|
setState(() {
|
||||||
// print or log if you want
|
_isValidating = false;
|
||||||
debugPrint('Error validating beneficiary: $e\n$st');
|
});
|
||||||
setState(() {
|
}
|
||||||
_validationError = 'Something went wrong. Please try again.';
|
|
||||||
_isBeneficiaryValidated = false;
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
if (mounted) {
|
|
||||||
setState(() {
|
|
||||||
_isValidating = false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
void validateAndAddBeneficiary() async {
|
||||||
|
// First, validate the form fields (account number, confirm account, ifsc, etc.)
|
||||||
String _selectedAccountType = 'Savings'; // default value
|
if (!_formKey.currentState!.validate()) {
|
||||||
|
return;
|
||||||
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
|
// Ensure beneficiary is validated before proceeding to TPIN
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
if (!_isBeneficiaryValidated) {
|
||||||
SnackBar(content: Text(AppLocalizations.of(context).somethingWentWrong)),
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(
|
||||||
|
content: Text('Please validate beneficiary details first.')),
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the beneficiary object without TPIN for now
|
||||||
|
final beneficiaryWithoutTpin = Beneficiary(
|
||||||
|
accountNo: accountNumberController.text.trim(),
|
||||||
|
accountType: accountType,
|
||||||
|
name: nameController.text.trim(),
|
||||||
|
ifscCode: ifscController.text.trim(),
|
||||||
|
bankName: bankNameController.text.trim(),
|
||||||
|
branchName: branchNameController.text.trim(),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Navigate to TPIN screen
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => TransactionPinScreen(
|
||||||
|
onPinCompleted: (pinScreenContext, tpin) async {
|
||||||
|
// Show loading spinner while processing
|
||||||
|
showDialog(
|
||||||
|
context: pinScreenContext,
|
||||||
|
barrierDismissible: false,
|
||||||
|
builder: (BuildContext ctx) {
|
||||||
|
// ignore: deprecated_member_use
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async => false,
|
||||||
|
child: const Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
// Create a new Beneficiary object with the TPIN
|
||||||
|
final beneficiaryWithTpin = Beneficiary(
|
||||||
|
accountNo: beneficiaryWithoutTpin.accountNo,
|
||||||
|
accountType: beneficiaryWithoutTpin.accountType,
|
||||||
|
name: beneficiaryWithoutTpin.name,
|
||||||
|
ifscCode: beneficiaryWithoutTpin.ifscCode,
|
||||||
|
bankName: beneficiaryWithoutTpin.bankName,
|
||||||
|
branchName: beneficiaryWithoutTpin.branchName,
|
||||||
|
tpin: tpin,
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
final isSuccess =
|
||||||
|
await service.sendForValidation(beneficiaryWithTpin);
|
||||||
|
|
||||||
|
if (pinScreenContext.mounted) {
|
||||||
|
Navigator.pop(pinScreenContext); // Close the spinner
|
||||||
|
Navigator.pushReplacement(
|
||||||
|
pinScreenContext,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (ctx) =>
|
||||||
|
BeneficiaryResultPage(isSuccess: isSuccess),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} on DioException catch (e) {
|
||||||
|
if (pinScreenContext.mounted) {
|
||||||
|
Navigator.pop(pinScreenContext); // Close the spinner
|
||||||
|
ScaffoldMessenger.of(pinScreenContext).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
content: Text(e.response?.statusCode == 409
|
||||||
|
? 'Beneficiary already exists'
|
||||||
|
: 'Something went Wrong')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
if (pinScreenContext.mounted) {
|
||||||
|
Navigator.pop(pinScreenContext); // Close the spinner
|
||||||
|
ScaffoldMessenger.of(pinScreenContext).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
content: Text(
|
||||||
|
AppLocalizations.of(context).somethingWentWrong)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -227,7 +221,8 @@ void validateAndAddBeneficiary() async {
|
|||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context).addBeneficiary,
|
AppLocalizations.of(context).addBeneficiary,
|
||||||
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
style:
|
||||||
|
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
actions: [
|
actions: [
|
||||||
@@ -265,10 +260,11 @@ void validateAndAddBeneficiary() async {
|
|||||||
context,
|
context,
|
||||||
).accountNumber,
|
).accountNumber,
|
||||||
// prefixIcon: Icon(Icons.person),
|
// prefixIcon: Icon(Icons.person),
|
||||||
border: OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor:
|
||||||
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: const OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
@@ -282,6 +278,12 @@ void validateAndAddBeneficiary() async {
|
|||||||
obscureText: true,
|
obscureText: true,
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
textInputAction: TextInputAction.next,
|
textInputAction: TextInputAction.next,
|
||||||
|
onChanged: (value) {
|
||||||
|
nameController.clear();
|
||||||
|
setState(() {
|
||||||
|
_isBeneficiaryValidated = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value == null || value.length < 10) {
|
if (value == null || value.length < 10) {
|
||||||
return AppLocalizations.of(
|
return AppLocalizations.of(
|
||||||
@@ -300,10 +302,11 @@ void validateAndAddBeneficiary() async {
|
|||||||
context,
|
context,
|
||||||
).confirmAccountNumber,
|
).confirmAccountNumber,
|
||||||
// prefixIcon: Icon(Icons.person),
|
// prefixIcon: Icon(Icons.person),
|
||||||
border: OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor:
|
||||||
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: const OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
@@ -334,12 +337,17 @@ void validateAndAddBeneficiary() async {
|
|||||||
// 🔹 IFSC Code Field
|
// 🔹 IFSC Code Field
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: ifscController,
|
controller: ifscController,
|
||||||
|
maxLength: 11,
|
||||||
|
inputFormatters: [
|
||||||
|
LengthLimitingTextInputFormatter(11),
|
||||||
|
],
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: AppLocalizations.of(context).ifscCode,
|
labelText: AppLocalizations.of(context).ifscCode,
|
||||||
border: const OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor:
|
||||||
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: const OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
@@ -377,7 +385,6 @@ void validateAndAddBeneficiary() async {
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
// 🔹 Bank Name (Disabled)
|
// 🔹 Bank Name (Disabled)
|
||||||
TextFormField(
|
TextFormField(
|
||||||
@@ -388,7 +395,8 @@ void validateAndAddBeneficiary() async {
|
|||||||
border: const OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).dialogBackgroundColor, // disabled color
|
fillColor: Theme.of(context)
|
||||||
|
.dialogBackgroundColor, // disabled color
|
||||||
enabledBorder: const OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
@@ -400,7 +408,6 @@ void validateAndAddBeneficiary() async {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
// 🔹 Branch Name (Disabled)
|
// 🔹 Branch Name (Disabled)
|
||||||
TextFormField(
|
TextFormField(
|
||||||
@@ -423,59 +430,63 @@ void validateAndAddBeneficiary() async {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
//Validate Beneficiary Name
|
const SizedBox(height: 24),
|
||||||
if (!_isBeneficiaryValidated)
|
if (!_isBeneficiaryValidated)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 12.0),
|
padding: const EdgeInsets.only(bottom: 24),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: _isValidating
|
onPressed: _isValidating
|
||||||
? null
|
? null
|
||||||
: () {
|
: () {
|
||||||
if (
|
if (confirmAccountNumberController
|
||||||
confirmAccountNumberController.text ==
|
.text ==
|
||||||
accountNumberController.text) {
|
accountNumberController.text) {
|
||||||
_validateBeneficiary();
|
_validateBeneficiary();
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
_validationError =
|
_validationError =
|
||||||
'Please enter a valid and matching account number.';
|
'Please enter a valid and matching account number.';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: _isValidating
|
child: _isValidating
|
||||||
? const SizedBox(
|
? const SizedBox(
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 20,
|
height: 20,
|
||||||
child: CircularProgressIndicator(strokeWidth: 2),
|
child: CircularProgressIndicator(
|
||||||
)
|
strokeWidth: 2),
|
||||||
: const Text('Validate Beneficiary'),
|
)
|
||||||
),
|
: Text(AppLocalizations.of(context)
|
||||||
),
|
.validateBeneficiary),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
//Beneficiary Name (Disabled)
|
//Beneficiary Name (Disabled)
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: nameController,
|
controller: nameController,
|
||||||
enabled: false,
|
enabled: false,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: AppLocalizations.of(context).beneficiaryName,
|
labelText:
|
||||||
border: const OutlineInputBorder(),
|
AppLocalizations.of(context).beneficiaryName,
|
||||||
isDense: true,
|
border: const OutlineInputBorder(),
|
||||||
filled: true,
|
isDense: true,
|
||||||
fillColor: Theme.of(context).dialogBackgroundColor,
|
filled: true,
|
||||||
enabledBorder: const OutlineInputBorder(
|
fillColor: Theme.of(context).dialogBackgroundColor,
|
||||||
borderSide: BorderSide(color: Colors.black),
|
enabledBorder: const OutlineInputBorder(
|
||||||
),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
focusedBorder: const OutlineInputBorder(
|
),
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
focusedBorder: const OutlineInputBorder(
|
||||||
),
|
borderSide:
|
||||||
),
|
BorderSide(color: Colors.black, width: 2),
|
||||||
textInputAction: TextInputAction.next,
|
),
|
||||||
validator: (value) => value == null || value.isEmpty
|
),
|
||||||
? AppLocalizations.of(context).nameRequired
|
textInputAction: TextInputAction.next,
|
||||||
: null,
|
validator: (value) => value == null || value.isEmpty
|
||||||
),
|
? AppLocalizations.of(context).nameRequired
|
||||||
|
: null,
|
||||||
|
),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
// 🔹 Account Type Dropdown
|
// 🔹 Account Type Dropdown
|
||||||
DropdownButtonFormField<String>(
|
DropdownButtonFormField<String>(
|
||||||
@@ -485,7 +496,8 @@ if (!_isBeneficiaryValidated)
|
|||||||
border: const OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor:
|
||||||
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: const OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
@@ -496,18 +508,17 @@ if (!_isBeneficiaryValidated)
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
items:
|
items: [
|
||||||
[
|
AppLocalizations.of(context).savings,
|
||||||
AppLocalizations.of(context).savings,
|
AppLocalizations.of(context).current,
|
||||||
AppLocalizations.of(context).current,
|
]
|
||||||
]
|
.map(
|
||||||
.map(
|
(type) => DropdownMenuItem(
|
||||||
(type) => DropdownMenuItem(
|
value: type,
|
||||||
value: type,
|
child: Text(type),
|
||||||
child: Text(type),
|
),
|
||||||
),
|
)
|
||||||
)
|
.toList(),
|
||||||
.toList(),
|
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
accountType = value!;
|
accountType = value!;
|
||||||
@@ -525,7 +536,8 @@ if (!_isBeneficiaryValidated)
|
|||||||
border: const OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor:
|
||||||
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: const OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
@@ -539,8 +551,8 @@ if (!_isBeneficiaryValidated)
|
|||||||
textInputAction: TextInputAction.done,
|
textInputAction: TextInputAction.done,
|
||||||
validator: (value) =>
|
validator: (value) =>
|
||||||
value == null || value.length != 10
|
value == null || value.length != 10
|
||||||
? AppLocalizations.of(context).enterValidPhone
|
? AppLocalizations.of(context).enterValidPhone
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 35),
|
const SizedBox(height: 35),
|
||||||
],
|
],
|
||||||
@@ -553,13 +565,13 @@ if (!_isBeneficiaryValidated)
|
|||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 250,
|
width: 250,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed:
|
onPressed: validateAndAddBeneficiary,
|
||||||
validateAndAddBeneficiary,
|
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
shape: const StadiumBorder(),
|
shape: const StadiumBorder(),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
backgroundColor: Theme.of(context).primaryColorDark,
|
backgroundColor: Theme.of(context).primaryColorDark,
|
||||||
foregroundColor: Theme.of(context).scaffoldBackgroundColor,
|
foregroundColor:
|
||||||
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
),
|
),
|
||||||
child: Text(AppLocalizations.of(context).validateAndAdd),
|
child: Text(AppLocalizations.of(context).validateAndAdd),
|
||||||
),
|
),
|
||||||
|
@@ -35,8 +35,8 @@ class _BeneficiaryResultPageState extends State<BeneficiaryResultPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final successAnimation = 'assets/animations/done.json';
|
const successAnimation = 'assets/animations/done.json';
|
||||||
final errorAnimation = 'assets/animations/error.json';
|
const errorAnimation = 'assets/animations/error.json';
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: widget.isSuccess ? Colors.green[50] : Colors.red[50],
|
backgroundColor: widget.isSuccess ? Colors.green[50] : Colors.red[50],
|
||||||
@@ -66,34 +66,35 @@ class _BeneficiaryResultPageState extends State<BeneficiaryResultPage> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
bottom: 20, // keep it slightly above the very bottom
|
bottom: 20, // keep it slightly above the very bottom
|
||||||
left: 16,
|
left: 16,
|
||||||
right: 16,
|
right: 16,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 56, // larger button height
|
height: 56, // larger button height
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pushReplacement( // ensures back goes to ScaffoldScreen
|
Navigator.pushReplacement(
|
||||||
context,
|
// ensures back goes to ScaffoldScreen
|
||||||
MaterialPageRoute(
|
context,
|
||||||
builder: (context) => const NavigationScaffold(),
|
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
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
|
||||||
},
|
|
||||||
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)
|
if (widget.isSuccess)
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
|
@@ -1,18 +1,15 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:kmobile/data/models/beneficiary.dart';
|
import 'package:kmobile/data/models/beneficiary.dart';
|
||||||
import 'package:kmobile/features/beneficiaries/screens/add_beneficiary_screen.dart';
|
import 'package:kmobile/features/beneficiaries/screens/add_beneficiary_screen.dart';
|
||||||
import '../../../data/models/user.dart';
|
|
||||||
import '../../../l10n/app_localizations.dart';
|
import '../../../l10n/app_localizations.dart';
|
||||||
import '../../../di/injection.dart';
|
import '../../../di/injection.dart';
|
||||||
import 'package:kmobile/api/services/beneficiary_service.dart';
|
import 'package:kmobile/api/services/beneficiary_service.dart';
|
||||||
import 'package:shimmer/shimmer.dart';
|
import 'package:shimmer/shimmer.dart';
|
||||||
//import 'package:kmobile/data/models/user.dart';
|
import 'package:kmobile/widgets/bank_logos.dart';
|
||||||
|
|
||||||
class ManageBeneficiariesScreen extends StatefulWidget {
|
class ManageBeneficiariesScreen extends StatefulWidget {
|
||||||
// final List<User> users;
|
final String customerName;
|
||||||
// final int selectedIndex;
|
const ManageBeneficiariesScreen({super.key, required this.customerName});
|
||||||
|
|
||||||
const ManageBeneficiariesScreen({super.key});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ManageBeneficiariesScreen> createState() =>
|
State<ManageBeneficiariesScreen> createState() =>
|
||||||
@@ -21,13 +18,9 @@ class ManageBeneficiariesScreen extends StatefulWidget {
|
|||||||
|
|
||||||
class _ManageBeneficiariesScreen extends State<ManageBeneficiariesScreen> {
|
class _ManageBeneficiariesScreen extends State<ManageBeneficiariesScreen> {
|
||||||
var service = getIt<BeneficiaryService>();
|
var service = getIt<BeneficiaryService>();
|
||||||
// late User selectedUser = widget.users[widget.selectedIndex];
|
|
||||||
//final BeneficiaryService _service = BeneficiaryService();
|
|
||||||
bool _isLoading = true;
|
bool _isLoading = true;
|
||||||
int selectedAccountIndex = 0;
|
|
||||||
List<Beneficiary> _beneficiaries = [];
|
List<Beneficiary> _beneficiaries = [];
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@@ -37,7 +30,7 @@ class _ManageBeneficiariesScreen extends State<ManageBeneficiariesScreen> {
|
|||||||
Future<void> _loadBeneficiaries() async {
|
Future<void> _loadBeneficiaries() async {
|
||||||
final data = await service.fetchBeneficiaryList();
|
final data = await service.fetchBeneficiaryList();
|
||||||
setState(() {
|
setState(() {
|
||||||
_beneficiaries = data ;
|
_beneficiaries = data;
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -70,7 +63,8 @@ class _ManageBeneficiariesScreen extends State<ManageBeneficiariesScreen> {
|
|||||||
|
|
||||||
Widget _buildBeneficiaryList() {
|
Widget _buildBeneficiaryList() {
|
||||||
if (_beneficiaries.isEmpty) {
|
if (_beneficiaries.isEmpty) {
|
||||||
return Center(child: Text(AppLocalizations.of(context).noBeneficiaryFound));
|
return Center(
|
||||||
|
child: Text(AppLocalizations.of(context).noBeneficiaryFound));
|
||||||
}
|
}
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
itemCount: _beneficiaries.length,
|
itemCount: _beneficiaries.length,
|
||||||
@@ -79,16 +73,21 @@ class _ManageBeneficiariesScreen extends State<ManageBeneficiariesScreen> {
|
|||||||
return ListTile(
|
return ListTile(
|
||||||
leading: CircleAvatar(
|
leading: CircleAvatar(
|
||||||
radius: 24,
|
radius: 24,
|
||||||
backgroundColor: Theme.of(context).primaryColor.withOpacity(0.2),
|
backgroundColor: Colors.transparent,
|
||||||
child: Text(
|
child: getBankLogo(item.bankName),
|
||||||
item.name.isNotEmpty
|
),
|
||||||
? item.name[0].toUpperCase()
|
title: Text(item.name),
|
||||||
: '?',
|
subtitle: Column(
|
||||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
),
|
children: [
|
||||||
|
Text(item.accountNo),
|
||||||
|
if (item.bankName != null && item.bankName!.isNotEmpty)
|
||||||
|
Text(
|
||||||
|
item.bankName!,
|
||||||
|
style: TextStyle(fontSize: 12, color: Colors.grey[600]),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
title: Text(item.name ?? 'Unknown'),
|
|
||||||
subtitle: Text(item.accountNo ?? 'No account number'),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -96,6 +95,7 @@ class _ManageBeneficiariesScreen extends State<ManageBeneficiariesScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
String customerName = widget.customerName;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(AppLocalizations.of(context).beneficiaries),
|
title: Text(AppLocalizations.of(context).beneficiaries),
|
||||||
@@ -108,7 +108,8 @@ class _ManageBeneficiariesScreen extends State<ManageBeneficiariesScreen> {
|
|||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => AddBeneficiaryScreen(),
|
builder: (context) =>
|
||||||
|
AddBeneficiaryScreen(customerName: customerName),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@@ -64,7 +64,8 @@ class _BlockCardScreen extends State<BlockCardScreen> {
|
|||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context).blockCard,
|
AppLocalizations.of(context).blockCard,
|
||||||
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
style:
|
||||||
|
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
actions: [
|
actions: [
|
||||||
@@ -94,14 +95,14 @@ class _BlockCardScreen extends State<BlockCardScreen> {
|
|||||||
controller: _cardController,
|
controller: _cardController,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: AppLocalizations.of(context).cardNumber,
|
labelText: AppLocalizations.of(context).cardNumber,
|
||||||
border: OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -119,14 +120,14 @@ class _BlockCardScreen extends State<BlockCardScreen> {
|
|||||||
controller: _cvvController,
|
controller: _cvvController,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: AppLocalizations.of(context).cvv,
|
labelText: AppLocalizations.of(context).cvv,
|
||||||
border: OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -146,15 +147,15 @@ class _BlockCardScreen extends State<BlockCardScreen> {
|
|||||||
onTap: _pickExpiryDate,
|
onTap: _pickExpiryDate,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: AppLocalizations.of(context).expiryDate,
|
labelText: AppLocalizations.of(context).expiryDate,
|
||||||
suffixIcon: Icon(Icons.calendar_today),
|
suffixIcon: const Icon(Icons.calendar_today),
|
||||||
border: OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -170,15 +171,15 @@ class _BlockCardScreen extends State<BlockCardScreen> {
|
|||||||
controller: _phoneController,
|
controller: _phoneController,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: AppLocalizations.of(context).phone,
|
labelText: AppLocalizations.of(context).phone,
|
||||||
prefixIcon: Icon(Icons.phone),
|
prefixIcon: const Icon(Icons.phone),
|
||||||
border: OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -199,7 +200,8 @@ class _BlockCardScreen extends State<BlockCardScreen> {
|
|||||||
shape: const StadiumBorder(),
|
shape: const StadiumBorder(),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
backgroundColor: Theme.of(context).primaryColor,
|
backgroundColor: Theme.of(context).primaryColor,
|
||||||
foregroundColor: Theme.of(context).scaffoldBackgroundColor,
|
foregroundColor:
|
||||||
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
),
|
),
|
||||||
child: Text(AppLocalizations.of(context).block),
|
child: Text(AppLocalizations.of(context).block),
|
||||||
),
|
),
|
||||||
|
@@ -20,7 +20,8 @@ class _CardManagementScreen extends State<CardManagementScreen> {
|
|||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context).cardManagement,
|
AppLocalizations.of(context).cardManagement,
|
||||||
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
style:
|
||||||
|
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
actions: [
|
actions: [
|
||||||
|
@@ -54,7 +54,8 @@ class _CardPinChangeDetailsScreen extends State<CardPinChangeDetailsScreen> {
|
|||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context).cardDetails,
|
AppLocalizations.of(context).cardDetails,
|
||||||
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
style:
|
||||||
|
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
actions: [
|
actions: [
|
||||||
@@ -84,14 +85,14 @@ class _CardPinChangeDetailsScreen extends State<CardPinChangeDetailsScreen> {
|
|||||||
controller: _cardController,
|
controller: _cardController,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: AppLocalizations.of(context).cardNumber,
|
labelText: AppLocalizations.of(context).cardNumber,
|
||||||
border: OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -109,14 +110,14 @@ class _CardPinChangeDetailsScreen extends State<CardPinChangeDetailsScreen> {
|
|||||||
controller: _cvvController,
|
controller: _cvvController,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: AppLocalizations.of(context).cvv,
|
labelText: AppLocalizations.of(context).cvv,
|
||||||
border: OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -136,15 +137,15 @@ class _CardPinChangeDetailsScreen extends State<CardPinChangeDetailsScreen> {
|
|||||||
onTap: _pickExpiryDate,
|
onTap: _pickExpiryDate,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: AppLocalizations.of(context).expiryDate,
|
labelText: AppLocalizations.of(context).expiryDate,
|
||||||
suffixIcon: Icon(Icons.calendar_today),
|
suffixIcon: const Icon(Icons.calendar_today),
|
||||||
border: OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -160,15 +161,15 @@ class _CardPinChangeDetailsScreen extends State<CardPinChangeDetailsScreen> {
|
|||||||
controller: _phoneController,
|
controller: _phoneController,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: AppLocalizations.of(context).phone,
|
labelText: AppLocalizations.of(context).phone,
|
||||||
prefixIcon: Icon(Icons.phone),
|
prefixIcon: const Icon(Icons.phone),
|
||||||
border: OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -189,7 +190,8 @@ class _CardPinChangeDetailsScreen extends State<CardPinChangeDetailsScreen> {
|
|||||||
shape: const StadiumBorder(),
|
shape: const StadiumBorder(),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
backgroundColor: Theme.of(context).primaryColor,
|
backgroundColor: Theme.of(context).primaryColor,
|
||||||
foregroundColor: Theme.of(context).scaffoldBackgroundColor,
|
foregroundColor:
|
||||||
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
),
|
),
|
||||||
child: Text(AppLocalizations.of(context).next),
|
child: Text(AppLocalizations.of(context).next),
|
||||||
),
|
),
|
||||||
|
@@ -54,7 +54,8 @@ class _CardPinSetScreen extends State<CardPinSetScreen> {
|
|||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context).cardPin,
|
AppLocalizations.of(context).cardPin,
|
||||||
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
style:
|
||||||
|
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
actions: [
|
actions: [
|
||||||
@@ -84,14 +85,14 @@ class _CardPinSetScreen extends State<CardPinSetScreen> {
|
|||||||
obscureText: true,
|
obscureText: true,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: AppLocalizations.of(context).enterNewPin,
|
labelText: AppLocalizations.of(context).enterNewPin,
|
||||||
border: OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -113,14 +114,14 @@ class _CardPinSetScreen extends State<CardPinSetScreen> {
|
|||||||
obscureText: true,
|
obscureText: true,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: AppLocalizations.of(context).enterAgain,
|
labelText: AppLocalizations.of(context).enterAgain,
|
||||||
border: OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -144,7 +145,8 @@ class _CardPinSetScreen extends State<CardPinSetScreen> {
|
|||||||
shape: const StadiumBorder(),
|
shape: const StadiumBorder(),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
backgroundColor: Theme.of(context).primaryColor,
|
backgroundColor: Theme.of(context).primaryColor,
|
||||||
foregroundColor: Theme.of(context).scaffoldBackgroundColor,
|
foregroundColor:
|
||||||
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
),
|
),
|
||||||
child: Text(AppLocalizations.of(context).submit),
|
child: Text(AppLocalizations.of(context).submit),
|
||||||
),
|
),
|
||||||
|
@@ -24,7 +24,8 @@ class _ChequeManagementScreen extends State<ChequeManagementScreen> {
|
|||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context).chequeManagement,
|
AppLocalizations.of(context).chequeManagement,
|
||||||
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
style:
|
||||||
|
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
actions: [
|
actions: [
|
||||||
|
@@ -26,7 +26,8 @@ class _CustomerInfoScreenState extends State<CustomerInfoScreen> {
|
|||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context).kMobile,
|
AppLocalizations.of(context).kMobile,
|
||||||
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
style:
|
||||||
|
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
Padding(
|
Padding(
|
||||||
@@ -78,7 +79,7 @@ class _CustomerInfoScreenState extends State<CustomerInfoScreen> {
|
|||||||
'${AppLocalizations.of(context).cif}: ${user.cifNumber ?? 'N/A'}',
|
'${AppLocalizations.of(context).cif}: ${user.cifNumber ?? 'N/A'}',
|
||||||
style: const TextStyle(fontSize: 16, color: Colors.grey),
|
style: const TextStyle(fontSize: 16, color: Colors.grey),
|
||||||
),
|
),
|
||||||
SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
InfoField(
|
InfoField(
|
||||||
label: AppLocalizations.of(context).activeAccounts,
|
label: AppLocalizations.of(context).activeAccounts,
|
||||||
value: user.activeAccounts?.toString() ?? '6',
|
value: user.activeAccounts?.toString() ?? '6',
|
||||||
@@ -89,8 +90,7 @@ class _CustomerInfoScreenState extends State<CustomerInfoScreen> {
|
|||||||
),
|
),
|
||||||
InfoField(
|
InfoField(
|
||||||
label: AppLocalizations.of(context).dateOfBirth,
|
label: AppLocalizations.of(context).dateOfBirth,
|
||||||
value:
|
value: (user.dateOfBirth != null &&
|
||||||
(user.dateOfBirth != null &&
|
|
||||||
user.dateOfBirth!.length == 8)
|
user.dateOfBirth!.length == 8)
|
||||||
? '${user.dateOfBirth!.substring(0, 2)}-${user.dateOfBirth!.substring(2, 4)}-${user.dateOfBirth!.substring(4, 8)}'
|
? '${user.dateOfBirth!.substring(0, 2)}-${user.dateOfBirth!.substring(2, 4)}-${user.dateOfBirth!.substring(4, 8)}'
|
||||||
: 'N/A',
|
: 'N/A',
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
// ignore_for_file: use_build_context_synchronously
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
@@ -6,6 +7,7 @@ import 'package:kmobile/data/repositories/transaction_repository.dart';
|
|||||||
import 'package:kmobile/di/injection.dart';
|
import 'package:kmobile/di/injection.dart';
|
||||||
import 'package:kmobile/features/accounts/screens/account_info_screen.dart';
|
import 'package:kmobile/features/accounts/screens/account_info_screen.dart';
|
||||||
import 'package:kmobile/features/accounts/screens/account_statement_screen.dart';
|
import 'package:kmobile/features/accounts/screens/account_statement_screen.dart';
|
||||||
|
import 'package:kmobile/features/accounts/screens/transaction_details_screen.dart';
|
||||||
import 'package:kmobile/features/auth/controllers/auth_cubit.dart';
|
import 'package:kmobile/features/auth/controllers/auth_cubit.dart';
|
||||||
import 'package:kmobile/features/auth/controllers/auth_state.dart';
|
import 'package:kmobile/features/auth/controllers/auth_state.dart';
|
||||||
import 'package:kmobile/features/customer_info/screens/customer_info_screen.dart';
|
import 'package:kmobile/features/customer_info/screens/customer_info_screen.dart';
|
||||||
@@ -95,7 +97,10 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
return Shimmer.fromColors(
|
return Shimmer.fromColors(
|
||||||
baseColor: Theme.of(context).dialogBackgroundColor,
|
baseColor: Theme.of(context).dialogBackgroundColor,
|
||||||
highlightColor: Theme.of(context).dialogBackgroundColor,
|
highlightColor: Theme.of(context).dialogBackgroundColor,
|
||||||
child: Container(width: 100, height: 32, color: Theme.of(context).scaffoldBackgroundColor),
|
child: Container(
|
||||||
|
width: 100,
|
||||||
|
height: 32,
|
||||||
|
color: Theme.of(context).scaffoldBackgroundColor),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,7 +204,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
backgroundColor:Theme.of(context).scaffoldBackgroundColor,
|
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context).kconnect,
|
AppLocalizations.of(context).kconnect,
|
||||||
@@ -291,7 +296,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
Text(
|
Text(
|
||||||
"${AppLocalizations.of(context).accountNumber}: ",
|
"${AppLocalizations.of(context).accountNumber}: ",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).dialogBackgroundColor,
|
color:
|
||||||
|
Theme.of(context).dialogBackgroundColor,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -300,9 +306,11 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
dropdownColor: Theme.of(context).primaryColor,
|
dropdownColor: Theme.of(context).primaryColor,
|
||||||
underline: const SizedBox(),
|
underline: const SizedBox(),
|
||||||
icon: const Icon(Icons.keyboard_arrow_down),
|
icon: const Icon(Icons.keyboard_arrow_down),
|
||||||
iconEnabledColor:Theme.of(context).dialogBackgroundColor,
|
iconEnabledColor:
|
||||||
|
Theme.of(context).dialogBackgroundColor,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).dialogBackgroundColor,
|
color:
|
||||||
|
Theme.of(context).dialogBackgroundColor,
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
),
|
),
|
||||||
items: List.generate(users.length, (index) {
|
items: List.generate(users.length, (index) {
|
||||||
@@ -311,7 +319,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
users[index].accountNo ?? 'N/A',
|
users[index].accountNo ?? 'N/A',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).dialogBackgroundColor,
|
color: Theme.of(context)
|
||||||
|
.dialogBackgroundColor,
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -351,13 +360,15 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
width: 20,
|
width: 20,
|
||||||
height: 20,
|
height: 20,
|
||||||
child: CircularProgressIndicator(
|
child: CircularProgressIndicator(
|
||||||
color: Theme.of(context).dialogBackgroundColor,
|
color: Theme.of(context)
|
||||||
|
.dialogBackgroundColor,
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Icon(
|
: Icon(
|
||||||
Icons.refresh,
|
Icons.refresh,
|
||||||
color: Theme.of(context).dialogBackgroundColor,
|
color: Theme.of(context)
|
||||||
|
.dialogBackgroundColor,
|
||||||
),
|
),
|
||||||
onPressed: isRefreshing
|
onPressed: isRefreshing
|
||||||
? null
|
? null
|
||||||
@@ -380,7 +391,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
Text(
|
Text(
|
||||||
"₹ ",
|
"₹ ",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).dialogBackgroundColor,
|
color:
|
||||||
|
Theme.of(context).dialogBackgroundColor,
|
||||||
fontSize: 40,
|
fontSize: 40,
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
),
|
),
|
||||||
@@ -393,7 +405,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
'0.00'
|
'0.00'
|
||||||
: '********',
|
: '********',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).dialogBackgroundColor,
|
color: Theme.of(context)
|
||||||
|
.dialogBackgroundColor,
|
||||||
fontSize: 40,
|
fontSize: 40,
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
),
|
),
|
||||||
@@ -423,7 +436,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
isVisible
|
isVisible
|
||||||
? Symbols.visibility_lock
|
? Symbols.visibility_lock
|
||||||
: Symbols.visibility,
|
: Symbols.visibility,
|
||||||
color: Theme.of(context).scaffoldBackgroundColor,
|
color: Theme.of(context)
|
||||||
|
.scaffoldBackgroundColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -473,21 +487,27 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
_buildQuickLink(Symbols.send_money,
|
||||||
|
AppLocalizations.of(context).fundTransfer, () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
FundTransferBeneficiaryScreen(
|
||||||
|
creditAccountNo:
|
||||||
|
users[selectedAccountIndex]
|
||||||
|
.accountNo!,
|
||||||
|
remitterName:
|
||||||
|
users[selectedAccountIndex]
|
||||||
|
.name!)));
|
||||||
|
}, disable: false),
|
||||||
_buildQuickLink(
|
_buildQuickLink(
|
||||||
Symbols.send_money,
|
Symbols.server_person,
|
||||||
AppLocalizations.of(context).fundTransfer,
|
AppLocalizations.of(context).accountInfo,
|
||||||
() {
|
() {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
|
||||||
const FundTransferBeneficiaryScreen()));
|
|
||||||
}, disable: true),
|
|
||||||
_buildQuickLink(Symbols.server_person,
|
|
||||||
AppLocalizations.of(context).accountInfo, () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => AccountInfoScreen(
|
builder: (context) => AccountInfoScreen(
|
||||||
users: users,
|
users: users,
|
||||||
selectedIndex: selectedAccountIndex,
|
selectedIndex: selectedAccountIndex,
|
||||||
@@ -496,39 +516,42 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
_buildQuickLink(
|
_buildQuickLink(Symbols.receipt_long,
|
||||||
Symbols.receipt_long,
|
AppLocalizations.of(context).accountStatement,
|
||||||
AppLocalizations.of(context).accountStatement,
|
() {
|
||||||
() {
|
Navigator.push(
|
||||||
Navigator.push(
|
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => AccountStatementScreen(
|
builder: (context) =>
|
||||||
accountNo: users[selectedAccountIndex]
|
AccountStatementScreen(
|
||||||
.accountNo!,
|
accountNo: users[selectedAccountIndex]
|
||||||
)));
|
.accountNo!,
|
||||||
}),
|
)));
|
||||||
_buildQuickLink(Symbols.checkbook,
|
}),
|
||||||
AppLocalizations.of(context).handleCheque, () {},
|
_buildQuickLink(Symbols.checkbook,
|
||||||
disable: true),
|
AppLocalizations.of(context).handleCheque, () {},
|
||||||
_buildQuickLink(Icons.group,
|
disable: true),
|
||||||
AppLocalizations.of(context).manageBeneficiary, () {
|
_buildQuickLink(Icons.group,
|
||||||
Navigator.push(
|
AppLocalizations.of(context).manageBeneficiary,
|
||||||
context,
|
() {
|
||||||
MaterialPageRoute(
|
Navigator.push(
|
||||||
builder: (context) =>
|
context,
|
||||||
const ManageBeneficiariesScreen()));
|
MaterialPageRoute(
|
||||||
}, disable: false),
|
builder: (context) =>
|
||||||
_buildQuickLink(Symbols.support_agent,
|
ManageBeneficiariesScreen(
|
||||||
AppLocalizations.of(context).contactUs, () {
|
customerName: currAccount.name!)));
|
||||||
Navigator.push(
|
}, disable: false),
|
||||||
context,
|
_buildQuickLink(Symbols.support_agent,
|
||||||
MaterialPageRoute(
|
AppLocalizations.of(context).contactUs, () {
|
||||||
builder: (context) => const EnquiryScreen()));
|
Navigator.push(
|
||||||
}),
|
context,
|
||||||
],
|
MaterialPageRoute(
|
||||||
),
|
builder: (context) =>
|
||||||
const SizedBox(height: 5),
|
const EnquiryScreen()));
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 5),
|
||||||
|
|
||||||
// Recent Transactions
|
// Recent Transactions
|
||||||
Text(
|
Text(
|
||||||
@@ -551,7 +574,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
title: Text(
|
title: Text(
|
||||||
tx.name != null
|
tx.name != null
|
||||||
? (tx.name!.length > 18
|
? (tx.name!.length > 18
|
||||||
? tx.name!.substring(0, 20)
|
? tx.name!.substring(0, 22)
|
||||||
: tx.name!)
|
: tx.name!)
|
||||||
: '',
|
: '',
|
||||||
style: const TextStyle(fontSize: 14),
|
style: const TextStyle(fontSize: 14),
|
||||||
@@ -564,6 +587,15 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
"₹${tx.amount}",
|
"₹${tx.amount}",
|
||||||
style: const TextStyle(fontSize: 16),
|
style: const TextStyle(fontSize: 16),
|
||||||
),
|
),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (_) =>
|
||||||
|
TransactionDetailsScreen(transaction: tx),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
@@ -599,17 +631,25 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
leading: Shimmer.fromColors(
|
leading: Shimmer.fromColors(
|
||||||
baseColor: Colors.grey[300]!,
|
baseColor: Colors.grey[300]!,
|
||||||
highlightColor: Colors.grey[100]!,
|
highlightColor: Colors.grey[100]!,
|
||||||
child: CircleAvatar(radius: 12, backgroundColor: Theme.of(context).scaffoldBackgroundColor),
|
child: CircleAvatar(
|
||||||
|
radius: 12,
|
||||||
|
backgroundColor: Theme.of(context).scaffoldBackgroundColor),
|
||||||
),
|
),
|
||||||
title: Shimmer.fromColors(
|
title: Shimmer.fromColors(
|
||||||
baseColor: Colors.grey[300]!,
|
baseColor: Colors.grey[300]!,
|
||||||
highlightColor: Colors.grey[100]!,
|
highlightColor: Colors.grey[100]!,
|
||||||
child: Container(height: 10, width: 100, color: Theme.of(context).scaffoldBackgroundColor),
|
child: Container(
|
||||||
|
height: 10,
|
||||||
|
width: 100,
|
||||||
|
color: Theme.of(context).scaffoldBackgroundColor),
|
||||||
),
|
),
|
||||||
subtitle: Shimmer.fromColors(
|
subtitle: Shimmer.fromColors(
|
||||||
baseColor: Colors.grey[300]!,
|
baseColor: Colors.grey[300]!,
|
||||||
highlightColor: Colors.grey[100]!,
|
highlightColor: Colors.grey[100]!,
|
||||||
child: Container(height: 8, width: 60, color: Theme.of(context).scaffoldBackgroundColor),
|
child: Container(
|
||||||
|
height: 8,
|
||||||
|
width: 60,
|
||||||
|
color: Theme.of(context).scaffoldBackgroundColor),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@@ -13,14 +13,15 @@ class AccountCard extends StatelessWidget {
|
|||||||
width: 300,
|
width: 300,
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.all(20),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
gradient: LinearGradient(
|
// gradient: LinearGradient(
|
||||||
begin: Alignment.topLeft,
|
// begin: Alignment.topLeft,
|
||||||
end: Alignment.bottomRight,
|
// end: Alignment.bottomRight,
|
||||||
colors: [
|
// colors: [
|
||||||
Theme.of(context).primaryColor,
|
// Theme.of(context).primaryColor,
|
||||||
Theme.of(context).primaryColor.withBlue(200),
|
// Theme.of(context).primaryColor.withBlue(200),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
@@ -56,12 +57,13 @@ class AccountCard extends StatelessWidget {
|
|||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Text(
|
Text(
|
||||||
account.accountNumber,
|
account.accountNumber,
|
||||||
style: TextStyle(color: Theme.of(context).dialogBackgroundColor, fontSize: 16),
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).dialogBackgroundColor, fontSize: 16),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
Text(
|
Text(
|
||||||
'${account.currency} ${account.balance.toStringAsFixed(2)}',
|
'${account.currency} ${account.balance.toStringAsFixed(2)}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).scaffoldBackgroundColor,
|
color: Theme.of(context).scaffoldBackgroundColor,
|
||||||
fontSize: 22,
|
fontSize: 22,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@@ -70,7 +72,8 @@ class AccountCard extends StatelessWidget {
|
|||||||
const SizedBox(height: 5),
|
const SizedBox(height: 5),
|
||||||
Text(
|
Text(
|
||||||
AppLocalizations.of(context).availableBalance,
|
AppLocalizations.of(context).availableBalance,
|
||||||
style: TextStyle(color: Theme.of(context).dialogBackgroundColor, fontSize: 12),
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).dialogBackgroundColor, fontSize: 12),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@@ -25,7 +25,8 @@ class TransactionListItem extends StatelessWidget {
|
|||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.all(10),
|
padding: const EdgeInsets.all(10),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _getCategoryColor(transaction.category).withAlpha((0.1 * 255).toInt()),
|
color: _getCategoryColor(transaction.category)
|
||||||
|
.withAlpha((0.1 * 255).toInt()),
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
@@ -48,7 +49,8 @@ class TransactionListItem extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
DateFormat('MMM dd, yyyy • h:mm a').format(transaction.date),
|
DateFormat('MMM dd, yyyy • h:mm a')
|
||||||
|
.format(transaction.date),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.grey[600],
|
color: Colors.grey[600],
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
// ignore_for_file: use_build_context_synchronously
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||||
@@ -38,12 +40,15 @@ class _EnquiryScreen extends State<EnquiryScreen> {
|
|||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => _launchEmailAddress(email),
|
onTap: () => _launchEmailAddress(email),
|
||||||
child: Text(email, style: TextStyle(color: Theme.of(context).primaryColor)),
|
child: Text(email,
|
||||||
|
style: TextStyle(color: Theme.of(context).primaryColor)),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () => _launchPhoneNumber(phone),
|
onTap: () => _launchPhoneNumber(phone),
|
||||||
child: Text(phone, style: TextStyle(color: Theme.of(context).scaffoldBackgroundColor)),
|
child: Text(phone,
|
||||||
|
style:
|
||||||
|
TextStyle(color: Theme.of(context).scaffoldBackgroundColor)),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -61,7 +66,8 @@ class _EnquiryScreen extends State<EnquiryScreen> {
|
|||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context).enquiry,
|
AppLocalizations.of(context).enquiry,
|
||||||
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
style:
|
||||||
|
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
actions: [
|
actions: [
|
||||||
@@ -89,7 +95,7 @@ class _EnquiryScreen extends State<EnquiryScreen> {
|
|||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Text(
|
Text(
|
||||||
AppLocalizations.of(context).writeToUs,
|
AppLocalizations.of(context).writeToUs,
|
||||||
style: TextStyle(color: Colors.grey),
|
style: const TextStyle(color: Colors.grey),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
Text(
|
Text(
|
||||||
@@ -97,7 +103,7 @@ class _EnquiryScreen extends State<EnquiryScreen> {
|
|||||||
style: TextStyle(color: Theme.of(context).primaryColor),
|
style: TextStyle(color: Theme.of(context).primaryColor),
|
||||||
),
|
),
|
||||||
|
|
||||||
SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Text(
|
Text(
|
||||||
AppLocalizations.of(context).keyContacts,
|
AppLocalizations.of(context).keyContacts,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
@@ -0,0 +1,403 @@
|
|||||||
|
// ignore_for_file: avoid_print
|
||||||
|
import 'dart:async';
|
||||||
|
import 'dart:convert';
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:kmobile/api/services/neft_service.dart';
|
||||||
|
import 'package:kmobile/api/services/rtgs_service.dart';
|
||||||
|
import 'package:kmobile/widgets/bank_logos.dart';
|
||||||
|
import 'package:kmobile/data/models/beneficiary.dart';
|
||||||
|
import 'package:kmobile/data/models/neft_transaction.dart';
|
||||||
|
import 'package:kmobile/data/models/payment_response.dart';
|
||||||
|
import 'package:kmobile/data/models/rtgs_transaction.dart';
|
||||||
|
import 'package:kmobile/di/injection.dart';
|
||||||
|
import 'package:kmobile/features/fund_transfer/screens/payment_animation.dart';
|
||||||
|
import 'package:kmobile/features/fund_transfer/screens/transaction_pin_screen.dart';
|
||||||
|
import '../../../l10n/app_localizations.dart';
|
||||||
|
|
||||||
|
enum TransactionMode { neft, rtgs }
|
||||||
|
|
||||||
|
class FundTransferAmountScreen extends StatefulWidget {
|
||||||
|
final String debitAccountNo;
|
||||||
|
final Beneficiary creditBeneficiary;
|
||||||
|
final String remitterName;
|
||||||
|
|
||||||
|
const FundTransferAmountScreen({
|
||||||
|
super.key,
|
||||||
|
required this.debitAccountNo,
|
||||||
|
required this.creditBeneficiary,
|
||||||
|
required this.remitterName,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<FundTransferAmountScreen> createState() =>
|
||||||
|
_FundTransferAmountScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
|
||||||
|
final _amountController = TextEditingController();
|
||||||
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
TransactionMode _selectedMode = TransactionMode.neft;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_amountController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _onProceed() {
|
||||||
|
if (_formKey.currentState!.validate()) {
|
||||||
|
final amount = double.tryParse(_amountController.text) ?? 0;
|
||||||
|
|
||||||
|
if (_selectedMode == TransactionMode.rtgs && amount < 200000) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (ctx) => AlertDialog(
|
||||||
|
title: Text(AppLocalizations.of(context).invalidRtgs),
|
||||||
|
content: Text(AppLocalizations.of(context).invalidRtgsPopUp),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(ctx).pop(),
|
||||||
|
child: Text(AppLocalizations.of(context).ok),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return; // Stop further execution
|
||||||
|
}
|
||||||
|
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => TransactionPinScreen(
|
||||||
|
onPinCompleted: (pinScreenContext, tpin) async {
|
||||||
|
if (_selectedMode == TransactionMode.neft) {
|
||||||
|
final neftTx = NeftTransaction(
|
||||||
|
fromAccount: widget.debitAccountNo,
|
||||||
|
toAccount: widget.creditBeneficiary.accountNo,
|
||||||
|
amount: _amountController.text,
|
||||||
|
ifscCode: widget.creditBeneficiary.ifscCode,
|
||||||
|
remitterName: widget.remitterName,
|
||||||
|
beneficiaryName: widget.creditBeneficiary.name,
|
||||||
|
tpin: tpin,
|
||||||
|
);
|
||||||
|
final neftService = getIt<NeftService>();
|
||||||
|
|
||||||
|
final completer = Completer<PaymentResponse>();
|
||||||
|
|
||||||
|
Navigator.of(pinScreenContext).pushReplacement(
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (_) => PaymentAnimationScreen(
|
||||||
|
paymentResponse: completer.future),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
final neftResponse =
|
||||||
|
await neftService.processNeftTransaction(neftTx);
|
||||||
|
final paymentResponse = PaymentResponse(
|
||||||
|
isSuccess: neftResponse.message.toUpperCase() == 'SUCCESS',
|
||||||
|
date: DateTime.now(),
|
||||||
|
creditedAccount: neftTx.toAccount,
|
||||||
|
amount: neftTx.amount,
|
||||||
|
currency: 'INR',
|
||||||
|
utr: neftResponse.utr,
|
||||||
|
);
|
||||||
|
completer.complete(paymentResponse);
|
||||||
|
} on DioException catch (e) {
|
||||||
|
print('dio exception');
|
||||||
|
print(e.toString());
|
||||||
|
|
||||||
|
final error = jsonDecode(e.response.toString())['error'];
|
||||||
|
var errorMessage = {
|
||||||
|
"INCORRECT_TPIN":
|
||||||
|
AppLocalizations.of(context).correctTpin,
|
||||||
|
"INSUFFICIENT_FUNDS":
|
||||||
|
AppLocalizations.of(context).insufficientFund
|
||||||
|
}[error] ??
|
||||||
|
AppLocalizations.of(context).somethingWentWrong;
|
||||||
|
|
||||||
|
final paymentResponse = PaymentResponse(
|
||||||
|
isSuccess: false,
|
||||||
|
errorMessage: errorMessage,
|
||||||
|
);
|
||||||
|
completer.complete(paymentResponse);
|
||||||
|
} catch (e) {
|
||||||
|
print('generic exception');
|
||||||
|
print(e.toString());
|
||||||
|
final paymentResponse = PaymentResponse(
|
||||||
|
isSuccess: false,
|
||||||
|
errorMessage:
|
||||||
|
AppLocalizations.of(context).somethingWentWrong,
|
||||||
|
);
|
||||||
|
completer.complete(paymentResponse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// else if (_selectedMode == TransactionMode.imps){
|
||||||
|
// final rtgsTx = RtgsTransaction(
|
||||||
|
// fromAccount: widget.debitAccountNo,
|
||||||
|
// toAccount: widget.creditBeneficiary.accountNo,
|
||||||
|
// amount: _amountController.text,
|
||||||
|
// ifscCode: widget.creditBeneficiary.ifscCode,
|
||||||
|
// remitterName: widget.remitterName,
|
||||||
|
// beneficiaryName: widget.creditBeneficiary.name,
|
||||||
|
// tpin: tpin,
|
||||||
|
// );
|
||||||
|
// final rtgsService = getIt<RtgsService>();
|
||||||
|
// final completer = Completer<PaymentResponse>();
|
||||||
|
|
||||||
|
// Navigator.of(pinScreenContext).pushReplacement(
|
||||||
|
// MaterialPageRoute(
|
||||||
|
// builder: (_) => PaymentAnimationScreen(
|
||||||
|
// paymentResponse: completer.future),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
|
||||||
|
// try {
|
||||||
|
// final rtgsResponse =
|
||||||
|
// await rtgsService.processRtgsTransaction(rtgsTx);
|
||||||
|
// final paymentResponse = PaymentResponse(
|
||||||
|
// isSuccess: rtgsResponse.message.toUpperCase() == 'SUCCESS',
|
||||||
|
// date: DateTime.now(),
|
||||||
|
// creditedAccount: rtgsTx.toAccount,
|
||||||
|
// amount: rtgsTx.amount,
|
||||||
|
// currency: 'INR',
|
||||||
|
// utr: rtgsResponse.utr,
|
||||||
|
// );
|
||||||
|
// completer.complete(paymentResponse);
|
||||||
|
// } on DioException catch(e) {
|
||||||
|
// print('dio exception');
|
||||||
|
// print(e.toString());
|
||||||
|
|
||||||
|
// final error = jsonDecode(e.response.toString())['error'];
|
||||||
|
// var errorMessage =
|
||||||
|
// {
|
||||||
|
// "INCORRECT_TPIN" : "Please Enter the correct TPIN",
|
||||||
|
// "INSUFFICIENT_FUNDS": "Your account does not have sufficient balance"
|
||||||
|
// }[error] ?? "Something Went Wrong";
|
||||||
|
|
||||||
|
// final paymentResponse = PaymentResponse(
|
||||||
|
// isSuccess: false,
|
||||||
|
// errorMessage: errorMessage,
|
||||||
|
// );
|
||||||
|
// completer.complete(paymentResponse);
|
||||||
|
// } catch (e) {
|
||||||
|
// print('generic exception');
|
||||||
|
// print(e.toString());
|
||||||
|
// final paymentResponse = PaymentResponse(
|
||||||
|
// isSuccess: false,
|
||||||
|
// errorMessage: "Something went Wrong",
|
||||||
|
// );
|
||||||
|
// completer.complete(paymentResponse);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
else {
|
||||||
|
final rtgsTx = RtgsTransaction(
|
||||||
|
fromAccount: widget.debitAccountNo,
|
||||||
|
toAccount: widget.creditBeneficiary.accountNo,
|
||||||
|
amount: _amountController.text,
|
||||||
|
ifscCode: widget.creditBeneficiary.ifscCode,
|
||||||
|
remitterName: widget.remitterName,
|
||||||
|
beneficiaryName: widget.creditBeneficiary.name,
|
||||||
|
tpin: tpin,
|
||||||
|
);
|
||||||
|
final rtgsService = getIt<RtgsService>();
|
||||||
|
final completer = Completer<PaymentResponse>();
|
||||||
|
|
||||||
|
Navigator.of(pinScreenContext).pushReplacement(
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (_) => PaymentAnimationScreen(
|
||||||
|
paymentResponse: completer.future),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
final rtgsResponse =
|
||||||
|
await rtgsService.processRtgsTransaction(rtgsTx);
|
||||||
|
final paymentResponse = PaymentResponse(
|
||||||
|
isSuccess: rtgsResponse.message.toUpperCase() == 'SUCCESS',
|
||||||
|
date: DateTime.now(),
|
||||||
|
creditedAccount: rtgsTx.toAccount,
|
||||||
|
amount: rtgsTx.amount,
|
||||||
|
currency: 'INR',
|
||||||
|
utr: rtgsResponse.utr,
|
||||||
|
);
|
||||||
|
completer.complete(paymentResponse);
|
||||||
|
} on DioException catch (e) {
|
||||||
|
print('dio exception');
|
||||||
|
print(e.toString());
|
||||||
|
|
||||||
|
final error = jsonDecode(e.response.toString())['error'];
|
||||||
|
var errorMessage = {
|
||||||
|
"INCORRECT_TPIN":
|
||||||
|
AppLocalizations.of(context).correctTpin,
|
||||||
|
"INSUFFICIENT_FUNDS":
|
||||||
|
AppLocalizations.of(context).insufficientFund
|
||||||
|
// ignore: use_build_context_synchronously
|
||||||
|
}[error] ??
|
||||||
|
AppLocalizations.of(context).somethingWentWrong;
|
||||||
|
|
||||||
|
final paymentResponse = PaymentResponse(
|
||||||
|
isSuccess: false,
|
||||||
|
errorMessage: errorMessage,
|
||||||
|
);
|
||||||
|
completer.complete(paymentResponse);
|
||||||
|
} catch (e) {
|
||||||
|
print('generic exception');
|
||||||
|
print(e.toString());
|
||||||
|
final paymentResponse = PaymentResponse(
|
||||||
|
isSuccess: false,
|
||||||
|
errorMessage:
|
||||||
|
AppLocalizations.of(context).somethingWentWrong,
|
||||||
|
);
|
||||||
|
completer.complete(paymentResponse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final loc = AppLocalizations.of(context);
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text(loc.fundTransfer),
|
||||||
|
),
|
||||||
|
body: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Form(
|
||||||
|
key: _formKey,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
// Debit Account (User)
|
||||||
|
Text(
|
||||||
|
loc.debitFrom,
|
||||||
|
style: Theme.of(context).textTheme.titleSmall,
|
||||||
|
),
|
||||||
|
Card(
|
||||||
|
elevation: 0,
|
||||||
|
margin: const EdgeInsets.symmetric(vertical: 8.0),
|
||||||
|
child: ListTile(
|
||||||
|
leading: Image.asset(
|
||||||
|
'assets/images/logo.png',
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
),
|
||||||
|
title: Text(widget.remitterName),
|
||||||
|
subtitle: Text(widget.debitAccountNo),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
|
||||||
|
// Credit Account (Beneficiary)
|
||||||
|
Text(
|
||||||
|
AppLocalizations.of(context).creditedTo,
|
||||||
|
style: Theme.of(context).textTheme.titleSmall,
|
||||||
|
),
|
||||||
|
Card(
|
||||||
|
elevation: 0,
|
||||||
|
margin: const EdgeInsets.symmetric(vertical: 8.0),
|
||||||
|
child: ListTile(
|
||||||
|
leading: getBankLogo(widget.creditBeneficiary.bankName),
|
||||||
|
title: Text(widget.creditBeneficiary.name),
|
||||||
|
subtitle: Text(widget.creditBeneficiary.accountNo),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
|
||||||
|
// Transaction Mode Selection
|
||||||
|
Text(
|
||||||
|
AppLocalizations.of(context).selectTransactionType,
|
||||||
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).cardColor,
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
border: Border.all(color: Colors.grey.shade300),
|
||||||
|
),
|
||||||
|
child: ToggleButtons(
|
||||||
|
isSelected: [
|
||||||
|
_selectedMode == TransactionMode.neft,
|
||||||
|
_selectedMode == TransactionMode.rtgs
|
||||||
|
],
|
||||||
|
onPressed: (index) {
|
||||||
|
setState(() {
|
||||||
|
_selectedMode = TransactionMode.values[index];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
selectedColor: Theme.of(context).colorScheme.onPrimary,
|
||||||
|
fillColor: Theme.of(context).primaryColor,
|
||||||
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
|
borderColor: Colors.transparent,
|
||||||
|
selectedBorderColor: Colors.transparent,
|
||||||
|
splashColor: Theme.of(context).primaryColor.withOpacity(0.1),
|
||||||
|
highlightColor:
|
||||||
|
Theme.of(context).primaryColor.withOpacity(0.05),
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 24.0, vertical: 12.0),
|
||||||
|
child: Text(AppLocalizations.of(context).neft),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 24.0, vertical: 12.0),
|
||||||
|
child: Text(AppLocalizations.of(context).rtgs),
|
||||||
|
),
|
||||||
|
// Padding(
|
||||||
|
// padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
|
||||||
|
// child: Text(AppLocalizations.of(context).imps),
|
||||||
|
// ),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
|
||||||
|
// Amount
|
||||||
|
TextFormField(
|
||||||
|
controller: _amountController,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: loc.amount,
|
||||||
|
border: const OutlineInputBorder(),
|
||||||
|
prefixIcon: const Icon(Icons.currency_rupee),
|
||||||
|
),
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return loc.amountRequired;
|
||||||
|
}
|
||||||
|
if (double.tryParse(value) == null ||
|
||||||
|
double.parse(value) <= 0) {
|
||||||
|
return loc.validAmount;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
|
||||||
|
// Proceed Button
|
||||||
|
SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: _onProceed,
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
|
),
|
||||||
|
child: Text(AppLocalizations.of(context).proceed),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@@ -1,113 +1,26 @@
|
|||||||
/*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/fund_transfer/screens/fund_transfer_screen.dart';
|
|
||||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
|
||||||
import '../../../l10n/app_localizations.dart';
|
|
||||||
|
|
||||||
class FundTransferBeneficiaryScreen extends StatefulWidget {
|
|
||||||
const FundTransferBeneficiaryScreen({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<FundTransferBeneficiaryScreen> createState() =>
|
|
||||||
_FundTransferBeneficiaryScreen();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _FundTransferBeneficiaryScreen
|
|
||||||
extends State<FundTransferBeneficiaryScreen> {
|
|
||||||
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'},
|
|
||||||
];
|
|
||||||
|
|
||||||
@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).fundTransferBeneficiary,
|
|
||||||
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: CircleAvatar(
|
|
||||||
backgroundColor: Theme.of(context).primaryColor,
|
|
||||||
child: Text('A'),
|
|
||||||
),
|
|
||||||
title: Text(beneficiary['name']!),
|
|
||||||
subtitle: Text(beneficiary['bank']!),
|
|
||||||
trailing: IconButton(
|
|
||||||
icon: const Icon(Symbols.arrow_right, size: 20),
|
|
||||||
onPressed: () {
|
|
||||||
// Delete action
|
|
||||||
},
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => const FundTransferScreen(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:kmobile/widgets/bank_logos.dart';
|
||||||
import 'package:kmobile/data/models/beneficiary.dart';
|
import 'package:kmobile/data/models/beneficiary.dart';
|
||||||
//import 'package:kmobile/features/beneficiaries/screens/add_beneficiary_screen.dart';
|
import 'package:kmobile/features/fund_transfer/screens/fund_transfer_amount_screen.dart';
|
||||||
import '../../../l10n/app_localizations.dart';
|
import '../../../l10n/app_localizations.dart';
|
||||||
import '../../../di/injection.dart';
|
import '../../../di/injection.dart';
|
||||||
import 'package:kmobile/api/services/beneficiary_service.dart';
|
import 'package:kmobile/api/services/beneficiary_service.dart';
|
||||||
import 'package:shimmer/shimmer.dart';
|
import 'package:shimmer/shimmer.dart';
|
||||||
|
|
||||||
|
|
||||||
class FundTransferBeneficiaryScreen extends StatefulWidget {
|
class FundTransferBeneficiaryScreen extends StatefulWidget {
|
||||||
const FundTransferBeneficiaryScreen({super.key});
|
final String creditAccountNo;
|
||||||
|
final String remitterName;
|
||||||
|
const FundTransferBeneficiaryScreen(
|
||||||
|
{super.key, required this.creditAccountNo, required this.remitterName});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<FundTransferBeneficiaryScreen> createState() =>
|
State<FundTransferBeneficiaryScreen> createState() =>
|
||||||
_ManageBeneficiariesScreen();
|
_FundTransferBeneficiaryScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ManageBeneficiariesScreen extends State<FundTransferBeneficiaryScreen> {
|
class _FundTransferBeneficiaryScreenState
|
||||||
|
extends State<FundTransferBeneficiaryScreen> {
|
||||||
var service = getIt<BeneficiaryService>();
|
var service = getIt<BeneficiaryService>();
|
||||||
//final BeneficiaryService _service = BeneficiaryService();
|
|
||||||
bool _isLoading = true;
|
bool _isLoading = true;
|
||||||
List<Beneficiary> _beneficiaries = [];
|
List<Beneficiary> _beneficiaries = [];
|
||||||
|
|
||||||
@@ -120,7 +33,7 @@ class _ManageBeneficiariesScreen extends State<FundTransferBeneficiaryScreen> {
|
|||||||
Future<void> _loadBeneficiaries() async {
|
Future<void> _loadBeneficiaries() async {
|
||||||
final data = await service.fetchBeneficiaryList();
|
final data = await service.fetchBeneficiaryList();
|
||||||
setState(() {
|
setState(() {
|
||||||
_beneficiaries = data ;
|
_beneficiaries = data;
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -132,7 +45,7 @@ class _ManageBeneficiariesScreen extends State<FundTransferBeneficiaryScreen> {
|
|||||||
baseColor: Colors.grey.shade300,
|
baseColor: Colors.grey.shade300,
|
||||||
highlightColor: Colors.grey.shade100,
|
highlightColor: Colors.grey.shade100,
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
leading: CircleAvatar(
|
leading: const CircleAvatar(
|
||||||
radius: 24,
|
radius: 24,
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
),
|
),
|
||||||
@@ -153,25 +66,44 @@ class _ManageBeneficiariesScreen extends State<FundTransferBeneficiaryScreen> {
|
|||||||
|
|
||||||
Widget _buildBeneficiaryList() {
|
Widget _buildBeneficiaryList() {
|
||||||
if (_beneficiaries.isEmpty) {
|
if (_beneficiaries.isEmpty) {
|
||||||
return Center(child: Text(AppLocalizations.of(context).noBeneficiaryFound));
|
return Center(
|
||||||
|
child: Text(AppLocalizations.of(context).noBeneficiaryFound));
|
||||||
}
|
}
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
itemCount: _beneficiaries.length,
|
itemCount: _beneficiaries.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final item = _beneficiaries[index];
|
final beneficiary = _beneficiaries[index];
|
||||||
return ListTile(
|
return ListTile(
|
||||||
leading: CircleAvatar(
|
leading: CircleAvatar(
|
||||||
radius: 24,
|
radius: 24,
|
||||||
backgroundColor: Theme.of(context).primaryColor.withOpacity(0.2),
|
backgroundColor: Colors.transparent,
|
||||||
child: Text(
|
child: getBankLogo(beneficiary.bankName),
|
||||||
item.name.isNotEmpty
|
|
||||||
? item.name[0].toUpperCase()
|
|
||||||
: '?',
|
|
||||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
title: Text(item.name ?? 'Unknown'),
|
title: Text(beneficiary.name),
|
||||||
subtitle: Text(item.accountNo ?? 'No account number'),
|
subtitle: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(beneficiary.accountNo),
|
||||||
|
if (beneficiary.bankName != null &&
|
||||||
|
beneficiary.bankName!.isNotEmpty)
|
||||||
|
Text(
|
||||||
|
beneficiary.bankName!,
|
||||||
|
style: TextStyle(fontSize: 12, color: Colors.grey[600]),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => FundTransferAmountScreen(
|
||||||
|
debitAccountNo: widget.creditAccountNo,
|
||||||
|
creditBeneficiary: beneficiary,
|
||||||
|
remitterName: widget.remitterName,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@@ -87,7 +87,8 @@ class _FundTransferScreen extends State<FundTransferScreen> {
|
|||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context).fundTransfer,
|
AppLocalizations.of(context).fundTransfer,
|
||||||
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
style:
|
||||||
|
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
actions: const [
|
actions: const [
|
||||||
@@ -108,7 +109,7 @@ class _FundTransferScreen extends State<FundTransferScreen> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(AppLocalizations.of(context).debitFrom),
|
Text(AppLocalizations.of(context).debitFrom),
|
||||||
Text(
|
const Text(
|
||||||
'0300015678903456',
|
'0300015678903456',
|
||||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
|
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
@@ -117,7 +118,7 @@ class _FundTransferScreen extends State<FundTransferScreen> {
|
|||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Text(
|
Text(
|
||||||
AppLocalizations.of(context).enterAmount,
|
AppLocalizations.of(context).enterAmount,
|
||||||
style: TextStyle(fontSize: 20),
|
style: const TextStyle(fontSize: 20),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Container(
|
Container(
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
// ignore_for_file: use_build_context_synchronously
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
import 'dart:ui' as ui;
|
import 'dart:ui' as ui;
|
||||||
@@ -10,222 +11,6 @@ import 'package:path_provider/path_provider.dart';
|
|||||||
import '../../../l10n/app_localizations.dart';
|
import '../../../l10n/app_localizations.dart';
|
||||||
import 'package:confetti/confetti.dart';
|
import 'package:confetti/confetti.dart';
|
||||||
|
|
||||||
/*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();
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
return Stack(
|
|
||||||
children: [
|
|
||||||
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),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// Buttons at the bottom
|
|
||||||
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);
|
|
||||||
},
|
|
||||||
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,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
class PaymentAnimationScreen extends StatefulWidget {
|
class PaymentAnimationScreen extends StatefulWidget {
|
||||||
final Future<PaymentResponse> paymentResponse;
|
final Future<PaymentResponse> paymentResponse;
|
||||||
|
|
||||||
@@ -242,7 +27,8 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_confettiController = ConfettiController(duration: const Duration(seconds: 2));
|
_confettiController =
|
||||||
|
ConfettiController(duration: const Duration(seconds: 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -256,7 +42,8 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
|
|||||||
RenderRepaintBoundary boundary =
|
RenderRepaintBoundary boundary =
|
||||||
_shareKey.currentContext!.findRenderObject() as RenderRepaintBoundary;
|
_shareKey.currentContext!.findRenderObject() as RenderRepaintBoundary;
|
||||||
ui.Image image = await boundary.toImage(pixelRatio: 3.0);
|
ui.Image image = await boundary.toImage(pixelRatio: 3.0);
|
||||||
ByteData? byteData = await image.toByteData(format: ui.ImageByteFormat.png);
|
ByteData? byteData =
|
||||||
|
await image.toByteData(format: ui.ImageByteFormat.png);
|
||||||
Uint8List pngBytes = byteData!.buffer.asUint8List();
|
Uint8List pngBytes = byteData!.buffer.asUint8List();
|
||||||
|
|
||||||
final tempDir = await getTemporaryDirectory();
|
final tempDir = await getTemporaryDirectory();
|
||||||
@@ -344,7 +131,8 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
|
|||||||
? Column(
|
? Column(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
AppLocalizations.of(context).paymentSuccessful,
|
AppLocalizations.of(context)
|
||||||
|
.paymentSuccessful,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 22,
|
fontSize: 22,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@@ -375,6 +163,15 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
|
|||||||
"Date: ${response.date!.toLocal().toIso8601String()}",
|
"Date: ${response.date!.toLocal().toIso8601String()}",
|
||||||
style: const TextStyle(fontSize: 16),
|
style: const TextStyle(fontSize: 16),
|
||||||
),
|
),
|
||||||
|
if (response.utr != null &&
|
||||||
|
response.utr!.isNotEmpty)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 8.0),
|
||||||
|
child: Text(
|
||||||
|
'UTR: ${response.utr}',
|
||||||
|
style: const TextStyle(fontSize: 16),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: Column(
|
: Column(
|
||||||
@@ -390,7 +187,7 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
|
|||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
if (response.errorMessage != null)
|
if (response.errorMessage != null)
|
||||||
Text(
|
Text(
|
||||||
response.errorMessage!,
|
response.errorMessage ?? '',
|
||||||
style: const TextStyle(fontSize: 16),
|
style: const TextStyle(fontSize: 16),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -419,10 +216,13 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
|
|||||||
style: TextStyle(color: Theme.of(context).primaryColor),
|
style: TextStyle(color: Theme.of(context).primaryColor),
|
||||||
),
|
),
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
backgroundColor:
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 12),
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 32, vertical: 12),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
side: BorderSide(color: Theme.of(context).primaryColor, width: 1),
|
side: BorderSide(
|
||||||
|
color: Theme.of(context).primaryColor, width: 1),
|
||||||
borderRadius: BorderRadius.circular(30),
|
borderRadius: BorderRadius.circular(30),
|
||||||
),
|
),
|
||||||
textStyle: const TextStyle(
|
textStyle: const TextStyle(
|
||||||
@@ -434,12 +234,14 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
|
|||||||
),
|
),
|
||||||
ElevatedButton.icon(
|
ElevatedButton.icon(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).popUntil((route) => route.isFirst);
|
Navigator.of(context)
|
||||||
|
.popUntil((route) => route.isFirst);
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.check),
|
icon: const Icon(Icons.check),
|
||||||
label: Text(AppLocalizations.of(context).done),
|
label: Text(AppLocalizations.of(context).done),
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 45, vertical: 12),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 45, vertical: 12),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(30),
|
borderRadius: BorderRadius.circular(30),
|
||||||
),
|
),
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
import '../../../l10n/app_localizations.dart';
|
import '../../../l10n/app_localizations.dart';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:kmobile/features/fund_transfer/screens/tpin_set_screen.dart';
|
import 'package:kmobile/features/fund_transfer/screens/tpin_set_screen.dart';
|
||||||
|
|
||||||
@@ -132,7 +131,8 @@ class _TpinOtpScreenState extends State<TpinOtpScreen> {
|
|||||||
icon: const Icon(Icons.verified_user_rounded),
|
icon: const Icon(Icons.verified_user_rounded),
|
||||||
label: Text(
|
label: Text(
|
||||||
AppLocalizations.of(context).verifyOtp,
|
AppLocalizations.of(context).verifyOtp,
|
||||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
|
style: const TextStyle(
|
||||||
|
fontSize: 18, fontWeight: FontWeight.w600),
|
||||||
),
|
),
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: theme.colorScheme.primary,
|
backgroundColor: theme.colorScheme.primary,
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
import '../../../l10n/app_localizations.dart';
|
import '../../../l10n/app_localizations.dart';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:kmobile/features/fund_transfer/screens/tpin_otp_screen.dart';
|
import 'package:kmobile/features/fund_transfer/screens/tpin_otp_screen.dart';
|
||||||
|
|
||||||
@@ -42,7 +41,8 @@ class TpinSetupPromptScreen extends StatelessWidget {
|
|||||||
icon: const Icon(Icons.arrow_forward_rounded),
|
icon: const Icon(Icons.arrow_forward_rounded),
|
||||||
label: Text(
|
label: Text(
|
||||||
AppLocalizations.of(context).setTpin,
|
AppLocalizations.of(context).setTpin,
|
||||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
|
style:
|
||||||
|
const TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
|
||||||
),
|
),
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: theme.colorScheme.primary,
|
backgroundColor: theme.colorScheme.primary,
|
||||||
|
@@ -55,6 +55,7 @@ class _TpinSetScreenState extends State<TpinSetScreen> {
|
|||||||
await authService.setTpin(pin);
|
await authService.setTpin(pin);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
// ignore: unnecessary_string_interpolations
|
||||||
_errorText = "${AppLocalizations.of(context).tpinFailed}";
|
_errorText = "${AppLocalizations.of(context).tpinFailed}";
|
||||||
_tpin.clear();
|
_tpin.clear();
|
||||||
});
|
});
|
||||||
@@ -71,11 +72,11 @@ class _TpinSetScreenState extends State<TpinSetScreen> {
|
|||||||
),
|
),
|
||||||
title: Column(
|
title: Column(
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.check_circle, color: Colors.green, size: 60),
|
const Icon(Icons.check_circle, color: Colors.green, size: 60),
|
||||||
SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
Text(
|
Text(
|
||||||
AppLocalizations.of(context).success,
|
AppLocalizations.of(context).success,
|
||||||
style: TextStyle(fontWeight: FontWeight.bold),
|
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -90,7 +91,7 @@ class _TpinSetScreenState extends State<TpinSetScreen> {
|
|||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
AppLocalizations.of(context).ok,
|
AppLocalizations.of(context).ok,
|
||||||
style: TextStyle(fontSize: 16),
|
style: const TextStyle(fontSize: 16),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -172,7 +173,9 @@ class _TpinSetScreenState extends State<TpinSetScreen> {
|
|||||||
key == '<' ? '⌫' : key,
|
key == '<' ? '⌫' : key,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
color: key == 'Enter' ? Theme.of(context).primaryColor : Colors.black,
|
color: key == 'Enter'
|
||||||
|
? Theme.of(context).primaryColor
|
||||||
|
: Colors.black,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -201,7 +204,8 @@ class _TpinSetScreenState extends State<TpinSetScreen> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Icon(Icons.lock_outline, size: 60, color: Theme.of(context).primaryColor),
|
Icon(Icons.lock_outline,
|
||||||
|
size: 60, color: Theme.of(context).primaryColor),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Text(
|
Text(
|
||||||
getTitle(),
|
getTitle(),
|
||||||
|
@@ -1,27 +1,24 @@
|
|||||||
// ignore_for_file: unused_field
|
|
||||||
|
|
||||||
import '../../../l10n/app_localizations.dart';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:kmobile/api/services/auth_service.dart';
|
import 'package:kmobile/api/services/auth_service.dart';
|
||||||
import 'package:kmobile/api/services/payment_service.dart';
|
|
||||||
import 'package:kmobile/data/models/transfer.dart';
|
|
||||||
import 'package:kmobile/di/injection.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/tpin_prompt_screen.dart';
|
||||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||||
|
|
||||||
|
import '../../../l10n/app_localizations.dart';
|
||||||
|
|
||||||
class TransactionPinScreen extends StatefulWidget {
|
class TransactionPinScreen extends StatefulWidget {
|
||||||
final Transfer transactionData;
|
final Future<void> Function(BuildContext, String) onPinCompleted;
|
||||||
const TransactionPinScreen({super.key, required this.transactionData});
|
|
||||||
|
const TransactionPinScreen({super.key, required this.onPinCompleted});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<TransactionPinScreen> createState() => _TransactionPinScreen();
|
State<TransactionPinScreen> createState() => _TransactionPinScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _TransactionPinScreen extends State<TransactionPinScreen> {
|
class _TransactionPinScreenState extends State<TransactionPinScreen> {
|
||||||
final List<String> _pin = [];
|
final List<String> _pin = [];
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
|
bool _isSubmitting = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -55,6 +52,7 @@ class _TransactionPinScreen extends State<TransactionPinScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _onKeyPressed(String value) {
|
void _onKeyPressed(String value) {
|
||||||
|
if (_isSubmitting) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
if (value == 'back') {
|
if (value == 'back') {
|
||||||
if (_pin.isNotEmpty) _pin.removeLast();
|
if (_pin.isNotEmpty) _pin.removeLast();
|
||||||
@@ -64,6 +62,27 @@ class _TransactionPinScreen extends State<TransactionPinScreen> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _submitPin() async {
|
||||||
|
if (_isSubmitting) return;
|
||||||
|
|
||||||
|
if (_pin.length == 6) {
|
||||||
|
setState(() => _isSubmitting = true);
|
||||||
|
try {
|
||||||
|
await widget.onPinCompleted(context, _pin.join());
|
||||||
|
} finally {
|
||||||
|
if (mounted) {
|
||||||
|
setState(() => _isSubmitting = false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
content: Text(AppLocalizations.of(context).enter6DigitTpin),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildPinIndicators() {
|
Widget _buildPinIndicators() {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@@ -75,7 +94,9 @@ class _TransactionPinScreen extends State<TransactionPinScreen> {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
border: Border.all(color: Theme.of(context).primaryColor, width: 2),
|
border: Border.all(color: Theme.of(context).primaryColor, width: 2),
|
||||||
color: index < _pin.length ? Theme.of(context).primaryColor : Colors.transparent,
|
color: index < _pin.length
|
||||||
|
? Theme.of(context).primaryColor
|
||||||
|
: Colors.transparent,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
@@ -85,30 +106,15 @@ class _TransactionPinScreen extends State<TransactionPinScreen> {
|
|||||||
Widget _buildKey(String label, {IconData? icon}) {
|
Widget _buildKey(String label, {IconData? icon}) {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () => label == 'done' ? _submitPin() : _onKeyPressed(label),
|
||||||
if (label == 'back') {
|
|
||||||
_onKeyPressed('back');
|
|
||||||
} else if (label == 'done') {
|
|
||||||
// Handle submit if needed
|
|
||||||
if (_pin.length == 6) {
|
|
||||||
await sendTransaction();
|
|
||||||
} else {
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
SnackBar(
|
|
||||||
content: Text(AppLocalizations.of(context).enter6DigitTpin),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
_onKeyPressed(label);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 20),
|
padding: const EdgeInsets.symmetric(vertical: 20),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: icon != null
|
child: _isSubmitting && label == 'done'
|
||||||
? Icon(icon, size: 28)
|
? const CircularProgressIndicator()
|
||||||
: Text(label, style: const TextStyle(fontSize: 24)),
|
: icon != null
|
||||||
|
? Icon(icon, size: 28)
|
||||||
|
: Text(label, style: const TextStyle(fontSize: 24)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -133,30 +139,6 @@ class _TransactionPinScreen extends State<TransactionPinScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> sendTransaction() async {
|
|
||||||
final paymentService = getIt<PaymentService>();
|
|
||||||
final transfer = widget.transactionData;
|
|
||||||
transfer.tpin = _pin.join();
|
|
||||||
try {
|
|
||||||
final paymentResponse = paymentService.processQuickPayWithinBank(
|
|
||||||
transfer,
|
|
||||||
);
|
|
||||||
|
|
||||||
Navigator.of(context).pushReplacement(
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (_) =>
|
|
||||||
PaymentAnimationScreen(paymentResponse: paymentResponse),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
if (mounted) {
|
|
||||||
ScaffoldMessenger.of(
|
|
||||||
context,
|
|
||||||
).showSnackBar(SnackBar(content: Text(e.toString())));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@@ -169,26 +151,29 @@ class _TransactionPinScreen extends State<TransactionPinScreen> {
|
|||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context).tpin,
|
AppLocalizations.of(context).tpin,
|
||||||
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
style:
|
||||||
|
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
),
|
),
|
||||||
body: Padding(
|
body: _loading
|
||||||
padding: const EdgeInsets.only(bottom: 20.0),
|
? const Center(child: CircularProgressIndicator())
|
||||||
child: Column(
|
: Padding(
|
||||||
children: [
|
padding: const EdgeInsets.only(bottom: 20.0),
|
||||||
const Spacer(),
|
child: Column(
|
||||||
Text(
|
children: [
|
||||||
AppLocalizations.of(context).enterTpin,
|
const Spacer(),
|
||||||
style: TextStyle(fontSize: 18),
|
Text(
|
||||||
|
AppLocalizations.of(context).enterTpin,
|
||||||
|
style: const TextStyle(fontSize: 18),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
_buildPinIndicators(),
|
||||||
|
const Spacer(),
|
||||||
|
_buildKeypad(),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
|
||||||
_buildPinIndicators(),
|
|
||||||
const Spacer(),
|
|
||||||
_buildKeypad(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -36,8 +36,8 @@ class _TransactionSuccessScreen extends State<TransactionSuccessScreen> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final String transactionDate = DateTime.now().toLocal().toString().split(
|
final String transactionDate = DateTime.now().toLocal().toString().split(
|
||||||
' ',
|
' ',
|
||||||
)[0];
|
)[0];
|
||||||
final String creditAccount = widget.creditAccount;
|
final String creditAccount = widget.creditAccount;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@@ -53,12 +53,15 @@ class _TransactionSuccessScreen extends State<TransactionSuccessScreen> {
|
|||||||
CircleAvatar(
|
CircleAvatar(
|
||||||
radius: 50,
|
radius: 50,
|
||||||
backgroundColor: Theme.of(context).primaryColor,
|
backgroundColor: Theme.of(context).primaryColor,
|
||||||
child: Icon(Icons.check, color: Theme.of(context).scaffoldBackgroundColor, size: 60),
|
child: Icon(Icons.check,
|
||||||
|
color: Theme.of(context).scaffoldBackgroundColor,
|
||||||
|
size: 60),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
Text(
|
Text(
|
||||||
AppLocalizations.of(context).transactionSuccess,
|
AppLocalizations.of(context).transactionSuccess,
|
||||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
|
style: const TextStyle(
|
||||||
|
fontSize: 18, fontWeight: FontWeight.w600),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 6),
|
const SizedBox(height: 6),
|
||||||
@@ -92,7 +95,8 @@ class _TransactionSuccessScreen extends State<TransactionSuccessScreen> {
|
|||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
shape: const StadiumBorder(),
|
shape: const StadiumBorder(),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
backgroundColor:
|
||||||
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
foregroundColor: Theme.of(context).primaryColorLight,
|
foregroundColor: Theme.of(context).primaryColorLight,
|
||||||
side: const BorderSide(color: Colors.black, width: 1),
|
side: const BorderSide(color: Colors.black, width: 1),
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
@@ -115,7 +119,8 @@ class _TransactionSuccessScreen extends State<TransactionSuccessScreen> {
|
|||||||
shape: const StadiumBorder(),
|
shape: const StadiumBorder(),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
backgroundColor: Theme.of(context).primaryColorDark,
|
backgroundColor: Theme.of(context).primaryColorDark,
|
||||||
foregroundColor: Theme.of(context).scaffoldBackgroundColor,
|
foregroundColor:
|
||||||
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
),
|
),
|
||||||
child: Text(AppLocalizations.of(context).done),
|
child: Text(AppLocalizations.of(context).done),
|
||||||
),
|
),
|
||||||
|
@@ -20,22 +20,22 @@ class ColorThemeDialog extends StatelessWidget {
|
|||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
// ListTile(
|
ListTile(
|
||||||
// leading: const CircleAvatar(backgroundColor: Colors.green),
|
leading: const CircleAvatar(backgroundColor: Colors.green),
|
||||||
// title: const Text('Green'),
|
title: const Text('Green'),
|
||||||
// onTap: () {
|
onTap: () {
|
||||||
// context.read<ThemeCubit>().changeTheme(ThemeType.green);
|
context.read<ThemeCubit>().changeTheme(ThemeType.green);
|
||||||
// Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
// },
|
},
|
||||||
// ),
|
),
|
||||||
// ListTile(
|
ListTile(
|
||||||
// leading: const CircleAvatar(backgroundColor: Colors.orange),
|
leading: const CircleAvatar(backgroundColor: Colors.orange),
|
||||||
// title: const Text('Orange'),
|
title: const Text('Orange'),
|
||||||
// onTap: () {
|
onTap: () {
|
||||||
// context.read<ThemeCubit>().changeTheme(ThemeType.orange);
|
context.read<ThemeCubit>().changeTheme(ThemeType.orange);
|
||||||
// Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
// },
|
},
|
||||||
// ),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const CircleAvatar(backgroundColor: Colors.blue),
|
leading: const CircleAvatar(backgroundColor: Colors.blue),
|
||||||
title: Text(AppLocalizations.of(context).blue),
|
title: Text(AppLocalizations.of(context).blue),
|
||||||
@@ -48,4 +48,3 @@ class ColorThemeDialog extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,9 +1,12 @@
|
|||||||
|
// ignore_for_file: use_build_context_synchronously
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import '../../../l10n/app_localizations.dart';
|
import '../../../l10n/app_localizations.dart';
|
||||||
import 'package:kmobile/app.dart';
|
import 'package:kmobile/app.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
class LanguageDialog extends StatelessWidget {
|
class LanguageDialog extends StatelessWidget {
|
||||||
|
// ignore: use_super_parameters
|
||||||
const LanguageDialog({Key? key}) : super(key: key);
|
const LanguageDialog({Key? key}) : super(key: key);
|
||||||
|
|
||||||
Future<void> _setLocale(BuildContext context, String langCode) async {
|
Future<void> _setLocale(BuildContext context, String langCode) async {
|
||||||
|
@@ -21,28 +21,6 @@ class PreferenceScreen extends StatelessWidget {
|
|||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return ListView(
|
return ListView(
|
||||||
children: [
|
children: [
|
||||||
// Theme Mode Switch (Light/Dark)
|
|
||||||
// ListTile(
|
|
||||||
// leading: const Icon(Icons.brightness_6),
|
|
||||||
// title: const Text("Theme Mode"),
|
|
||||||
// trailing: Switch(
|
|
||||||
// value: state.isDarkMode,
|
|
||||||
// onChanged: (val) {
|
|
||||||
// context.read<ThemeCubit>().toggleDarkMode(val);
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
//Color_Theme_Selection
|
|
||||||
ListTile(
|
|
||||||
leading: const Icon(Icons.color_lens),
|
|
||||||
title: Text(AppLocalizations.of(context).themeColor),
|
|
||||||
onTap: () {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (_) => const ColorThemeDialog(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
),
|
|
||||||
// Language Selection
|
// Language Selection
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.language),
|
leading: const Icon(Icons.language),
|
||||||
@@ -50,10 +28,34 @@ class PreferenceScreen extends StatelessWidget {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => const LanguageDialog(), // your custom language dialog
|
builder: (_) =>
|
||||||
|
const LanguageDialog(), // your custom language dialog
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
//Theme Mode Switch (Light/Dark)
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Icons.brightness_6),
|
||||||
|
title: Text(AppLocalizations.of(context).themeMode),
|
||||||
|
enabled: false,
|
||||||
|
//trailing: Switch(
|
||||||
|
// value: state.isDarkMode,
|
||||||
|
// onChanged: (val) {
|
||||||
|
// context.read<ThemeCubit>().toggleDarkMode(val);
|
||||||
|
// },
|
||||||
|
//),
|
||||||
|
),
|
||||||
|
//Color_Theme_Selection
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Icons.color_lens),
|
||||||
|
title: Text(AppLocalizations.of(context).themeColor),
|
||||||
|
//enabled: false,
|
||||||
|
onTap: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (_) => const ColorThemeDialog(),
|
||||||
|
);
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@@ -21,7 +21,8 @@ class ProfileScreen extends StatelessWidget {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) => const PreferenceScreen()),
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const PreferenceScreen()),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@@ -1,9 +1,19 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:kmobile/api/services/neft_service.dart';
|
||||||
|
import 'package:kmobile/api/services/rtgs_service.dart';
|
||||||
|
import 'package:kmobile/data/models/neft_transaction.dart';
|
||||||
|
import 'package:kmobile/data/models/payment_response.dart';
|
||||||
|
import 'package:kmobile/data/models/rtgs_transaction.dart';
|
||||||
|
import 'package:kmobile/features/fund_transfer/screens/payment_animation.dart';
|
||||||
|
import 'package:kmobile/features/fund_transfer/screens/transaction_pin_screen.dart';
|
||||||
import '../../../l10n/app_localizations.dart';
|
import '../../../l10n/app_localizations.dart';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:flutter_swipe_button/flutter_swipe_button.dart';
|
import 'package:flutter_swipe_button/flutter_swipe_button.dart';
|
||||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||||
|
import '../../../../di/injection.dart';
|
||||||
|
import '../../../../api/services/beneficiary_service.dart';
|
||||||
|
|
||||||
class QuickPayOutsideBankScreen extends StatefulWidget {
|
class QuickPayOutsideBankScreen extends StatefulWidget {
|
||||||
final String debitAccount;
|
final String debitAccount;
|
||||||
@@ -26,9 +36,12 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
final ifscController = TextEditingController();
|
final ifscController = TextEditingController();
|
||||||
final phoneController = TextEditingController();
|
final phoneController = TextEditingController();
|
||||||
final amountController = TextEditingController();
|
final amountController = TextEditingController();
|
||||||
|
final service = getIt<BeneficiaryService>();
|
||||||
|
|
||||||
//String accountType = 'Savings';
|
|
||||||
late String accountType;
|
late String accountType;
|
||||||
|
bool _isValidating = false;
|
||||||
|
bool _isBeneficiaryValidated = false;
|
||||||
|
String? _validationError;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -40,12 +53,71 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//final List<String> transactionModes = ['NEFT', 'RTGS', 'IMPS'];
|
void _validateIFSC() async {
|
||||||
|
final ifsc = ifscController.text.trim().toUpperCase();
|
||||||
|
if (ifsc.isEmpty) return;
|
||||||
|
|
||||||
|
final result = await service.validateIFSC(ifsc);
|
||||||
|
|
||||||
|
if (mounted) {
|
||||||
|
if (result.bankName == '') {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(content: Text(AppLocalizations.of(context).invalidIfsc)),
|
||||||
|
);
|
||||||
|
bankNameController.clear();
|
||||||
|
branchNameController.clear();
|
||||||
|
} else {
|
||||||
|
bankNameController.text = result.bankName;
|
||||||
|
branchNameController.text = result.branchName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _validateBeneficiary() async {
|
||||||
|
FocusScope.of(context).unfocus();
|
||||||
|
setState(() {
|
||||||
|
_isValidating = true;
|
||||||
|
_validationError = null;
|
||||||
|
_isBeneficiaryValidated = false;
|
||||||
|
nameController.text = ''; // clear previous name
|
||||||
|
});
|
||||||
|
|
||||||
|
final String accountNo = accountNumberController.text.trim();
|
||||||
|
final String ifsc = ifscController.text.trim();
|
||||||
|
// ignore: prefer_const_declarations
|
||||||
|
final String remitter = "Unknown";
|
||||||
|
|
||||||
|
final service = getIt<BeneficiaryService>();
|
||||||
|
try {
|
||||||
|
final String beneficiaryName = await service.validateBeneficiary(
|
||||||
|
accountNo: accountNo,
|
||||||
|
ifscCode: ifsc,
|
||||||
|
remitterName: remitter,
|
||||||
|
);
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
nameController.text = beneficiaryName;
|
||||||
|
_isBeneficiaryValidated = true;
|
||||||
|
_validationError = null;
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
setState(() {
|
||||||
|
_validationError = e.toString();
|
||||||
|
_isBeneficiaryValidated = false;
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
if (mounted) {
|
||||||
|
setState(() {
|
||||||
|
_isValidating = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<String> transactionModes(BuildContext context) {
|
List<String> transactionModes(BuildContext context) {
|
||||||
return [
|
return [
|
||||||
AppLocalizations.of(context).neft,
|
AppLocalizations.of(context).neft,
|
||||||
AppLocalizations.of(context).rtgs,
|
AppLocalizations.of(context).rtgs,
|
||||||
AppLocalizations.of(context).imps,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,6 +137,131 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _onProceedToPay() {
|
||||||
|
if (_formKey.currentState!.validate()) {
|
||||||
|
if (!_isBeneficiaryValidated) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
content:
|
||||||
|
Text(AppLocalizations.of(context).plsValidateBeneficiary)),
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final amount = double.tryParse(amountController.text) ?? 0;
|
||||||
|
final selectedMode = transactionModes(context)[selectedTransactionIndex];
|
||||||
|
final isRtgs = selectedMode == AppLocalizations.of(context).rtgs;
|
||||||
|
|
||||||
|
if (isRtgs && amount < 200000) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (ctx) => AlertDialog(
|
||||||
|
title: Text(AppLocalizations.of(context).invalidRtgs),
|
||||||
|
content: Text(AppLocalizations.of(context).invalidRtgsPopUp),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(ctx).pop(),
|
||||||
|
child: Text(AppLocalizations.of(context).ok),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => TransactionPinScreen(
|
||||||
|
onPinCompleted: (pinScreenContext, tpin) async {
|
||||||
|
if (!isRtgs) {
|
||||||
|
// NEFT
|
||||||
|
final neftTx = NeftTransaction(
|
||||||
|
fromAccount: widget.debitAccount,
|
||||||
|
toAccount: accountNumberController.text,
|
||||||
|
amount: amountController.text,
|
||||||
|
ifscCode: ifscController.text,
|
||||||
|
remitterName: "Unknown", // TODO: Get actual remitter name
|
||||||
|
beneficiaryName: nameController.text,
|
||||||
|
tpin: tpin,
|
||||||
|
);
|
||||||
|
final neftService = getIt<NeftService>();
|
||||||
|
final completer = Completer<PaymentResponse>();
|
||||||
|
|
||||||
|
Navigator.of(pinScreenContext).pushReplacement(
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (_) => PaymentAnimationScreen(
|
||||||
|
paymentResponse: completer.future),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
final neftResponse =
|
||||||
|
await neftService.processNeftTransaction(neftTx);
|
||||||
|
final paymentResponse = PaymentResponse(
|
||||||
|
isSuccess: neftResponse.message.toUpperCase() == 'SUCCESS',
|
||||||
|
date: DateTime.now(),
|
||||||
|
creditedAccount: neftTx.toAccount,
|
||||||
|
amount: neftTx.amount,
|
||||||
|
currency: 'INR',
|
||||||
|
utr: neftResponse.utr,
|
||||||
|
);
|
||||||
|
completer.complete(paymentResponse);
|
||||||
|
} catch (e) {
|
||||||
|
final paymentResponse = PaymentResponse(
|
||||||
|
isSuccess: false,
|
||||||
|
errorMessage: e.toString(),
|
||||||
|
);
|
||||||
|
completer.complete(paymentResponse);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// RTGS
|
||||||
|
final rtgsTx = RtgsTransaction(
|
||||||
|
fromAccount: widget.debitAccount,
|
||||||
|
toAccount: accountNumberController.text,
|
||||||
|
amount: amountController.text,
|
||||||
|
ifscCode: ifscController.text,
|
||||||
|
remitterName: "Unknown", // TODO: Get actual remitter name
|
||||||
|
beneficiaryName: nameController.text,
|
||||||
|
tpin: tpin,
|
||||||
|
);
|
||||||
|
final rtgsService = getIt<RtgsService>();
|
||||||
|
final completer = Completer<PaymentResponse>();
|
||||||
|
|
||||||
|
Navigator.of(pinScreenContext).pushReplacement(
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (_) => PaymentAnimationScreen(
|
||||||
|
paymentResponse: completer.future),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
final rtgsResponse =
|
||||||
|
await rtgsService.processRtgsTransaction(rtgsTx);
|
||||||
|
final paymentResponse = PaymentResponse(
|
||||||
|
isSuccess: rtgsResponse.message.toUpperCase() == 'SUCCESS',
|
||||||
|
date: DateTime.now(),
|
||||||
|
creditedAccount: rtgsTx.toAccount,
|
||||||
|
amount: rtgsTx.amount,
|
||||||
|
currency: 'INR',
|
||||||
|
utr: rtgsResponse.utr,
|
||||||
|
);
|
||||||
|
completer.complete(paymentResponse);
|
||||||
|
} catch (e) {
|
||||||
|
final paymentResponse = PaymentResponse(
|
||||||
|
isSuccess: false,
|
||||||
|
errorMessage: e.toString(),
|
||||||
|
);
|
||||||
|
completer.complete(paymentResponse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@@ -77,7 +274,8 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context).quickPayOutsideBank,
|
AppLocalizations.of(context).quickPayOutsideBank,
|
||||||
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
style:
|
||||||
|
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
actions: [
|
actions: [
|
||||||
@@ -103,30 +301,35 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
Row(
|
Text(
|
||||||
children: [
|
AppLocalizations.of(context).debitFrom,
|
||||||
Text(AppLocalizations.of(context).debitFrom),
|
style: Theme.of(context).textTheme.titleSmall,
|
||||||
Text(
|
|
||||||
widget.debitAccount,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 18,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
Card(
|
||||||
|
elevation: 0,
|
||||||
|
margin: const EdgeInsets.symmetric(vertical: 8.0),
|
||||||
|
child: ListTile(
|
||||||
|
leading: Image.asset(
|
||||||
|
'assets/images/logo.png',
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
),
|
||||||
|
title: Text(widget.debitAccount),
|
||||||
|
subtitle: Text(AppLocalizations.of(context).ownBank),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 24),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: AppLocalizations.of(context).accountNumber,
|
labelText: AppLocalizations.of(context).accountNumber,
|
||||||
border: OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -134,11 +337,17 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
textInputAction: TextInputAction.next,
|
textInputAction: TextInputAction.next,
|
||||||
|
onChanged: (value) {
|
||||||
|
nameController.clear();
|
||||||
|
setState(() {
|
||||||
|
_isBeneficiaryValidated = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value == null || value.isEmpty) {
|
if (value == null || value.isEmpty) {
|
||||||
return AppLocalizations.of(context).accountNumberRequired;
|
return AppLocalizations.of(context).accountNumberRequired;
|
||||||
} else if (value.length != 11) {
|
} else if (value.length < 7 || value.length > 20) {
|
||||||
return AppLocalizations.of(context).validAccountNumber;
|
return AppLocalizations.of(context).accno7to20;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
@@ -149,14 +358,14 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: AppLocalizations.of(context).confirmAccountNumber,
|
labelText: AppLocalizations.of(context).confirmAccountNumber,
|
||||||
// prefixIcon: Icon(Icons.person),
|
// prefixIcon: Icon(Icons.person),
|
||||||
border: OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -173,101 +382,50 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 25),
|
const SizedBox(height: 25),
|
||||||
TextFormField(
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: AppLocalizations.of(context).name,
|
|
||||||
border: OutlineInputBorder(),
|
|
||||||
isDense: true,
|
|
||||||
filled: true,
|
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
|
||||||
enabledBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Colors.black),
|
|
||||||
),
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
controller: nameController,
|
|
||||||
keyboardType: TextInputType.name,
|
|
||||||
textInputAction: TextInputAction.next,
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return AppLocalizations.of(context).nameRequired;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
TextFormField(
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: AppLocalizations.of(context).bankName,
|
|
||||||
border: OutlineInputBorder(),
|
|
||||||
isDense: true,
|
|
||||||
filled: true,
|
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
|
||||||
enabledBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Colors.black),
|
|
||||||
),
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
controller: bankNameController,
|
|
||||||
textInputAction: TextInputAction.next,
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return AppLocalizations.of(context).bankNameRequired;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
TextFormField(
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: AppLocalizations.of(context).branchName,
|
|
||||||
border: OutlineInputBorder(),
|
|
||||||
isDense: true,
|
|
||||||
filled: true,
|
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
|
||||||
enabledBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Colors.black),
|
|
||||||
),
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
controller: branchNameController,
|
|
||||||
textInputAction: TextInputAction.next,
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return AppLocalizations.of(context).branchNameRequired;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
|
maxLength: 11,
|
||||||
|
inputFormatters: [
|
||||||
|
LengthLimitingTextInputFormatter(11),
|
||||||
|
],
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: AppLocalizations.of(context).ifscCode,
|
labelText: AppLocalizations.of(context).ifscCode,
|
||||||
border: OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
controller: ifscController,
|
controller: ifscController,
|
||||||
textInputAction: TextInputAction.next,
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
_validateIFSC();
|
||||||
|
},
|
||||||
|
onChanged: (value) {
|
||||||
|
final trimmed = value.trim().toUpperCase();
|
||||||
|
if (trimmed.length < 11) {
|
||||||
|
// clear bank/branch if backspace or changed
|
||||||
|
bankNameController.clear();
|
||||||
|
branchNameController.clear();
|
||||||
|
}
|
||||||
|
},
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value == null || value.isEmpty) {
|
final pattern = RegExp(r'^[A-Z]{4}0[A-Z0-9]{6}$');
|
||||||
return AppLocalizations.of(context).ifscRequired;
|
if (value == null || value.trim().isEmpty) {
|
||||||
|
return AppLocalizations.of(context).enterIfsc;
|
||||||
|
} else if (!pattern.hasMatch(
|
||||||
|
value.trim().toUpperCase(),
|
||||||
|
)) {
|
||||||
|
return AppLocalizations.of(
|
||||||
|
context,
|
||||||
|
).invalidIfscFormat;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
@@ -279,27 +437,25 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
value: accountType,
|
value: accountType,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: AppLocalizations.of(context).accountType,
|
labelText: AppLocalizations.of(context).accountType,
|
||||||
border: OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
items:
|
items: [
|
||||||
[
|
AppLocalizations.of(context).savings,
|
||||||
AppLocalizations.of(context).savings,
|
AppLocalizations.of(context).current,
|
||||||
AppLocalizations.of(context).current,
|
]
|
||||||
]
|
.map(
|
||||||
.map(
|
(e) => DropdownMenuItem(value: e, child: Text(e)),
|
||||||
(e) =>
|
)
|
||||||
DropdownMenuItem(value: e, child: Text(e)),
|
.toList(),
|
||||||
)
|
|
||||||
.toList(),
|
|
||||||
onChanged: (value) => setState(() {
|
onChanged: (value) => setState(() {
|
||||||
accountType = value!;
|
accountType = value!;
|
||||||
}),
|
}),
|
||||||
@@ -308,6 +464,111 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 25),
|
const SizedBox(height: 25),
|
||||||
|
TextFormField(
|
||||||
|
controller: bankNameController,
|
||||||
|
enabled: false,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: AppLocalizations.of(context).bankName,
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 25),
|
||||||
|
TextFormField(
|
||||||
|
controller: branchNameController,
|
||||||
|
enabled: false,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: AppLocalizations.of(context).branchName,
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
if (!_isBeneficiaryValidated)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 24),
|
||||||
|
child: SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: _isValidating
|
||||||
|
? null
|
||||||
|
: () {
|
||||||
|
if (confirmAccountNumberController.text ==
|
||||||
|
accountNumberController.text) {
|
||||||
|
_validateBeneficiary();
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
_validationError =
|
||||||
|
AppLocalizations.of(context)
|
||||||
|
.accountMismatch;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: _isValidating
|
||||||
|
? const SizedBox(
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
child: CircularProgressIndicator(strokeWidth: 2),
|
||||||
|
)
|
||||||
|
: Text(
|
||||||
|
AppLocalizations.of(context).validateBeneficiary),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (_validationError != null)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 24.0),
|
||||||
|
child: Text(
|
||||||
|
_validationError!,
|
||||||
|
style: const TextStyle(color: Colors.red),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: nameController,
|
||||||
|
enabled: false,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: AppLocalizations.of(context).name,
|
||||||
|
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),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return AppLocalizations.of(context).nameRequired;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 25),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -316,15 +577,15 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
keyboardType: TextInputType.phone,
|
keyboardType: TextInputType.phone,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: AppLocalizations.of(context).phone,
|
labelText: AppLocalizations.of(context).phone,
|
||||||
prefixIcon: Icon(Icons.phone),
|
prefixIcon: const Icon(Icons.phone),
|
||||||
border: OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -339,14 +600,14 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: AppLocalizations.of(context).amount,
|
labelText: AppLocalizations.of(context).amount,
|
||||||
border: OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
fillColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black),
|
borderSide: BorderSide(color: Colors.black),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: const OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -372,7 +633,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
AppLocalizations.of(context).transactionMode,
|
AppLocalizations.of(context).transactionMode,
|
||||||
style: TextStyle(fontWeight: FontWeight.w500),
|
style: const TextStyle(fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
Expanded(child: buildTransactionModeSelector()),
|
Expanded(child: buildTransactionModeSelector()),
|
||||||
@@ -382,38 +643,19 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
Align(
|
Align(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: SwipeButton.expand(
|
child: SwipeButton.expand(
|
||||||
thumb: Icon(Icons.arrow_forward, color: Theme.of(context).scaffoldBackgroundColor),
|
thumb: Icon(Icons.arrow_forward,
|
||||||
activeThumbColor: Theme.of(context).primaryColorDark,
|
color: Theme.of(context).dialogBackgroundColor),
|
||||||
activeTrackColor: Theme.of(context).primaryColorLight,
|
activeThumbColor: Theme.of(context).primaryColor,
|
||||||
|
activeTrackColor:
|
||||||
|
Theme.of(context).colorScheme.secondary.withAlpha(100),
|
||||||
borderRadius: BorderRadius.circular(30),
|
borderRadius: BorderRadius.circular(30),
|
||||||
height: 56,
|
height: 56,
|
||||||
|
onSwipe: _onProceedToPay,
|
||||||
child: Text(
|
child: Text(
|
||||||
AppLocalizations.of(context).swipeToPay,
|
AppLocalizations.of(context).swipeToPay,
|
||||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
style: const TextStyle(
|
||||||
|
fontSize: 16, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
onSwipe: () {
|
|
||||||
if (_formKey.currentState!.validate()) {
|
|
||||||
// Perform payment logic
|
|
||||||
final selectedMode = transactionModes(
|
|
||||||
context,
|
|
||||||
)[selectedTransactionIndex];
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
SnackBar(
|
|
||||||
content: Text(
|
|
||||||
'${AppLocalizations.of(context).payingVia} $selectedMode...',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
// Navigator.push(
|
|
||||||
// context,
|
|
||||||
// MaterialPageRoute(
|
|
||||||
// builder: (context) =>
|
|
||||||
// const TransactionPinScreen(
|
|
||||||
// transactionData: {},
|
|
||||||
// transactionCode: 'PAYMENT',
|
|
||||||
// )));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -438,10 +680,14 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
margin: const EdgeInsets.symmetric(horizontal: 4),
|
margin: const EdgeInsets.symmetric(horizontal: 4),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 5),
|
padding: const EdgeInsets.symmetric(vertical: 5),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: isSelected ? Theme.of(context).primaryColor : Theme.of(context).scaffoldBackgroundColor,
|
color: isSelected
|
||||||
|
? Theme.of(context).primaryColor
|
||||||
|
: Theme.of(context).scaffoldBackgroundColor,
|
||||||
borderRadius: BorderRadius.circular(5),
|
borderRadius: BorderRadius.circular(5),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: isSelected ? Theme.of(context).primaryColor : Theme.of(context).scaffoldBackgroundColor,
|
color: isSelected
|
||||||
|
? Theme.of(context).primaryColor
|
||||||
|
: Theme.of(context).scaffoldBackgroundColor,
|
||||||
width: isSelected ? 0 : 1.2,
|
width: isSelected ? 0 : 1.2,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@@ -64,7 +64,6 @@ class _QuickPayScreen extends State<QuickPayScreen> {
|
|||||||
),
|
),
|
||||||
const Divider(height: 1),
|
const Divider(height: 1),
|
||||||
QuickPayManagementTile(
|
QuickPayManagementTile(
|
||||||
disable: true,
|
|
||||||
icon: Symbols.output_circle,
|
icon: Symbols.output_circle,
|
||||||
label: AppLocalizations.of(context).outsideBank,
|
label: AppLocalizations.of(context).outsideBank,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
@@ -1,13 +1,15 @@
|
|||||||
|
import 'dart:async';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:flutter_swipe_button/flutter_swipe_button.dart';
|
import 'package:flutter_swipe_button/flutter_swipe_button.dart';
|
||||||
import 'package:kmobile/api/services/beneficiary_service.dart';
|
import 'package:kmobile/api/services/beneficiary_service.dart';
|
||||||
|
import 'package:kmobile/api/services/payment_service.dart';
|
||||||
import 'package:kmobile/data/models/transfer.dart';
|
import 'package:kmobile/data/models/transfer.dart';
|
||||||
import 'package:kmobile/di/injection.dart';
|
import 'package:kmobile/di/injection.dart';
|
||||||
|
import 'package:kmobile/features/fund_transfer/screens/payment_animation.dart';
|
||||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||||
import '../../../l10n/app_localizations.dart';
|
import '../../../l10n/app_localizations.dart';
|
||||||
import '../../fund_transfer/screens/transaction_pin_screen.dart';
|
import '../../fund_transfer/screens/transaction_pin_screen.dart';
|
||||||
//import 'package:flutter_neumorphic/flutter_neumorphic.dart';
|
|
||||||
|
|
||||||
class QuickPayWithinBankScreen extends StatefulWidget {
|
class QuickPayWithinBankScreen extends StatefulWidget {
|
||||||
final String debitAccount;
|
final String debitAccount;
|
||||||
@@ -165,15 +167,6 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
// const Align(
|
|
||||||
// alignment: Alignment.topLeft,
|
|
||||||
// child: Padding(
|
|
||||||
// padding: EdgeInsets.only(left: 15.0, top: 5),
|
|
||||||
// child: Text(
|
|
||||||
// 'Beneficiary Account Number',
|
|
||||||
// style: TextStyle(color: Colors.black54),
|
|
||||||
// ),
|
|
||||||
// )),
|
|
||||||
const SizedBox(height: 25),
|
const SizedBox(height: 25),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: confirmAccountNumberController,
|
controller: confirmAccountNumberController,
|
||||||
@@ -219,7 +212,8 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
|||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
_validationError =
|
_validationError =
|
||||||
'Please enter a valid and matching account number.';
|
AppLocalizations.of(context)
|
||||||
|
.accountMismatch;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -229,7 +223,8 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
|||||||
height: 20,
|
height: 20,
|
||||||
child: CircularProgressIndicator(strokeWidth: 2),
|
child: CircularProgressIndicator(strokeWidth: 2),
|
||||||
)
|
)
|
||||||
: const Text('Validate Beneficiary'),
|
: Text(
|
||||||
|
AppLocalizations.of(context).validateBeneficiary),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -241,7 +236,7 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
|||||||
const Icon(Icons.check_circle, color: Colors.green),
|
const Icon(Icons.check_circle, color: Colors.green),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Text(
|
Text(
|
||||||
'Beneficiary: $_beneficiaryName',
|
'${AppLocalizations.of(context).beneficiaryName}: $_beneficiaryName',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.green, fontWeight: FontWeight.bold),
|
color: Colors.green, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
@@ -296,15 +291,6 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
// const Align(
|
|
||||||
// alignment: Alignment.topLeft,
|
|
||||||
// child: Padding(
|
|
||||||
// padding: EdgeInsets.only(left: 15.0, top: 5),
|
|
||||||
// child: Text(
|
|
||||||
// 'Beneficiary Account Type',
|
|
||||||
// style: TextStyle(color: Colors.black54),
|
|
||||||
// ),
|
|
||||||
// )),
|
|
||||||
const SizedBox(height: 25),
|
const SizedBox(height: 25),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
@@ -338,7 +324,8 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
|||||||
Align(
|
Align(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: SwipeButton.expand(
|
child: SwipeButton.expand(
|
||||||
thumb: Icon(Icons.arrow_forward, color: Theme.of(context).dialogBackgroundColor),
|
thumb: Icon(Icons.arrow_forward,
|
||||||
|
color: Theme.of(context).dialogBackgroundColor),
|
||||||
activeThumbColor: Theme.of(context).primaryColor,
|
activeThumbColor: Theme.of(context).primaryColor,
|
||||||
activeTrackColor: Theme.of(
|
activeTrackColor: Theme.of(
|
||||||
context,
|
context,
|
||||||
@@ -353,8 +340,8 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
|||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
if (!_isBeneficiaryValidated) {
|
if (!_isBeneficiaryValidated) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_validationError =
|
_validationError = AppLocalizations.of(context)
|
||||||
'Please validate beneficiary before proceeding.';
|
.validateBeneficiaryproceeding;
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -363,12 +350,26 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
|||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => TransactionPinScreen(
|
builder: (context) => TransactionPinScreen(
|
||||||
transactionData: Transfer(
|
onPinCompleted: (pinScreenContext, tpin) async {
|
||||||
fromAccount: widget.debitAccount,
|
final transfer = Transfer(
|
||||||
toAccount: accountNumberController.text,
|
fromAccount: widget.debitAccount,
|
||||||
toAccountType: _selectedAccountType!,
|
toAccount: accountNumberController.text,
|
||||||
amount: amountController.text,
|
toAccountType: _selectedAccountType!,
|
||||||
),
|
amount: amountController.text,
|
||||||
|
tpin: tpin,
|
||||||
|
);
|
||||||
|
|
||||||
|
final paymentService = getIt<PaymentService>();
|
||||||
|
final paymentResponseFuture = paymentService
|
||||||
|
.processQuickPayWithinBank(transfer);
|
||||||
|
|
||||||
|
Navigator.of(pinScreenContext).pushReplacement(
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (_) => PaymentAnimationScreen(
|
||||||
|
paymentResponse: paymentResponseFuture),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -376,69 +377,6 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
/*Align(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: NeumorphicButton(
|
|
||||||
onPressed: () {
|
|
||||||
if (_formKey.currentState!.validate()) {
|
|
||||||
if (!_isBeneficiaryValidated) {
|
|
||||||
setState(() {
|
|
||||||
_validationError =
|
|
||||||
'Please validate beneficiary before proceeding.';
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Perform payment logic
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => TransactionPinScreen(
|
|
||||||
transactionData: Transfer(
|
|
||||||
fromAccount: widget.debitAccount,
|
|
||||||
toAccount: accountNumberController.text,
|
|
||||||
toAccountType: _selectedAccountType!,
|
|
||||||
amount: amountController.text,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
style: NeumorphicStyle(
|
|
||||||
color: Theme.of(context).primaryColor,
|
|
||||||
depth: 4,
|
|
||||||
intensity: 0.8,
|
|
||||||
boxShape: NeumorphicBoxShape.roundRect(BorderRadius.circular(30)),
|
|
||||||
),
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
|
||||||
AppLocalizations.of(context).swipeToPay,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
color: Colors.white,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),*/
|
|
||||||
// SliderButton(
|
|
||||||
// action: () async {
|
|
||||||
// ///Do something here OnSlide
|
|
||||||
// return true;
|
|
||||||
// },
|
|
||||||
// label: const Text(
|
|
||||||
// "Slide to pay",
|
|
||||||
// style: TextStyle(
|
|
||||||
// color: Color(0xff4a4a4a),
|
|
||||||
// fontWeight: FontWeight.w500,
|
|
||||||
// fontSize: 17),
|
|
||||||
// ),
|
|
||||||
// icon: Icon(Symbols.arrow_forward,
|
|
||||||
// color: Theme.of(context).primaryColor, weight: 200),
|
|
||||||
// )
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@@ -18,7 +18,8 @@ class _ServiceScreen extends State<ServiceScreen> {
|
|||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context).services,
|
AppLocalizations.of(context).services,
|
||||||
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
style:
|
||||||
|
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
actions: [
|
actions: [
|
||||||
|
@@ -229,6 +229,23 @@
|
|||||||
"beneficiaryAddedSuccess": "Beneficiary Added Successfully",
|
"beneficiaryAddedSuccess": "Beneficiary Added Successfully",
|
||||||
"beneficiaryAdditionFailed": "Beneficiary Addition Failed",
|
"beneficiaryAdditionFailed": "Beneficiary Addition Failed",
|
||||||
"noBeneficiaryFound": "No beneficiaries found",
|
"noBeneficiaryFound": "No beneficiaries found",
|
||||||
"beneficiaryName": "Beneficiary Name"
|
"beneficiaryName": "Beneficiary Name",
|
||||||
|
"validateBeneficiary": "Validate Beneficiary",
|
||||||
|
"themeMode": "Theme Mode",
|
||||||
|
"transactionDetails": "Transaction Details",
|
||||||
|
"transactionType": "Transaction Type",
|
||||||
|
"transferType": "Transfer Type",
|
||||||
|
"utrNo": "UTR No.",
|
||||||
|
"beneficiaryAccountNo": "Beneficiary Account No.",
|
||||||
|
"invalidRtgs": "Invalid Amount for RTGS",
|
||||||
|
"invalidRtgsPopUp": "RTGS transactions require a minimum amount of 200,000. Please enter a higher amount or select NEFT as the transaction mode.",
|
||||||
|
"correctTpin": "Please Enter the correct TPIN",
|
||||||
|
"insufficientFund": "Your account does not have sufficient balance",
|
||||||
|
"creditedTo": "Credited To",
|
||||||
|
"selectTransactionType": "Select transaction Type",
|
||||||
|
"proceed": "Proceed",
|
||||||
|
"plsValidateBeneficiary": "Please validate beneficiary details first",
|
||||||
|
"accno7to20": "Account number must be between 7 and 20 digits",
|
||||||
|
"validateBeneficiaryproceeding": "Please validate beneficiary before proceeding"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -229,5 +229,22 @@
|
|||||||
"beneficiaryAddedSuccess": "लाभार्थी सफलतापूर्वक जोड़ा गया",
|
"beneficiaryAddedSuccess": "लाभार्थी सफलतापूर्वक जोड़ा गया",
|
||||||
"beneficiaryAdditionFailed": "लाभार्थी जोड़ने में विफल",
|
"beneficiaryAdditionFailed": "लाभार्थी जोड़ने में विफल",
|
||||||
"noBeneficiaryFound": "कोई लाभार्थी नहीं मिला",
|
"noBeneficiaryFound": "कोई लाभार्थी नहीं मिला",
|
||||||
"beneficiaryName": "लाभार्थी नाम"
|
"beneficiaryName": "लाभार्थी नाम",
|
||||||
|
"validateBeneficiary": "लाभार्थी को सत्यापित करें",
|
||||||
|
"themeMode": "थीम मोड",
|
||||||
|
"transactionDetails": "लेन-देन विवरण",
|
||||||
|
"transactionType": "लेनदेन प्रकार",
|
||||||
|
"transferType": "स्थानांतरण प्रकार",
|
||||||
|
"utrNo": "यूटीआर नंबर",
|
||||||
|
"beneficiaryAccountNo": "लाभार्थी खाता संख्या",
|
||||||
|
"invalidRtgs": "RTGS के लिए अमान्य राशि",
|
||||||
|
"invalidRtgsPopUp": "RTGS लेनदेन के लिए न्यूनतम 2,00,000 रुपये की राशि की आवश्यकता होती है। कृपया अधिक राशि दर्ज करें या लेनदेन मोड के रूप में NEFT चुनें",
|
||||||
|
"correctTpin": "कृपया सही टी-पिन दर्ज करें",
|
||||||
|
"insufficientFund": "आपके खाते में पर्याप्त शेष राशि नहीं है",
|
||||||
|
"creditedTo": "को श्रेय दिया गया",
|
||||||
|
"selectTransactionType": "लेन-देन का प्रकार चुनें",
|
||||||
|
"proceed": "आगे बढ़ना",
|
||||||
|
"plsValidateBeneficiary": "कृपया पहले लाभार्थी विवरण सत्यापित करें",
|
||||||
|
"accno7to20": "खाता संख्या सात से बीस अंकों के बीच होनी चाहिए",
|
||||||
|
"validateBeneficiaryproceeding": "कृपया आगे बढ़ने से पहले लाभार्थी को पट्टे पर मान्य करें"
|
||||||
}
|
}
|
||||||
|
@@ -62,7 +62,8 @@ import 'app_localizations_hi.dart';
|
|||||||
/// be consistent with the languages listed in the AppLocalizations.supportedLocales
|
/// be consistent with the languages listed in the AppLocalizations.supportedLocales
|
||||||
/// property.
|
/// property.
|
||||||
abstract class AppLocalizations {
|
abstract class AppLocalizations {
|
||||||
AppLocalizations(String locale) : localeName = intl.Intl.canonicalizedLocale(locale.toString());
|
AppLocalizations(String locale)
|
||||||
|
: localeName = intl.Intl.canonicalizedLocale(locale.toString());
|
||||||
|
|
||||||
final String localeName;
|
final String localeName;
|
||||||
|
|
||||||
@@ -70,7 +71,8 @@ abstract class AppLocalizations {
|
|||||||
return Localizations.of<AppLocalizations>(context, AppLocalizations)!;
|
return Localizations.of<AppLocalizations>(context, AppLocalizations)!;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const LocalizationsDelegate<AppLocalizations> delegate = _AppLocalizationsDelegate();
|
static const LocalizationsDelegate<AppLocalizations> delegate =
|
||||||
|
_AppLocalizationsDelegate();
|
||||||
|
|
||||||
/// A list of this localizations delegate along with the default localizations
|
/// A list of this localizations delegate along with the default localizations
|
||||||
/// delegates.
|
/// delegates.
|
||||||
@@ -82,7 +84,8 @@ abstract class AppLocalizations {
|
|||||||
/// Additional delegates can be added by appending to this list in
|
/// Additional delegates can be added by appending to this list in
|
||||||
/// MaterialApp. This list does not have to be used at all if a custom list
|
/// MaterialApp. This list does not have to be used at all if a custom list
|
||||||
/// of delegates is preferred or required.
|
/// of delegates is preferred or required.
|
||||||
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates = <LocalizationsDelegate<dynamic>>[
|
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates =
|
||||||
|
<LocalizationsDelegate<dynamic>>[
|
||||||
delegate,
|
delegate,
|
||||||
GlobalMaterialLocalizations.delegate,
|
GlobalMaterialLocalizations.delegate,
|
||||||
GlobalCupertinoLocalizations.delegate,
|
GlobalCupertinoLocalizations.delegate,
|
||||||
@@ -1402,9 +1405,112 @@ abstract class AppLocalizations {
|
|||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Beneficiary Name'**
|
/// **'Beneficiary Name'**
|
||||||
String get beneficiaryName;
|
String get beneficiaryName;
|
||||||
|
|
||||||
|
/// No description provided for @validateBeneficiary.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Validate Beneficiary'**
|
||||||
|
String get validateBeneficiary;
|
||||||
|
|
||||||
|
/// No description provided for @themeMode.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Theme Mode'**
|
||||||
|
String get themeMode;
|
||||||
|
|
||||||
|
/// No description provided for @transactionDetails.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Transaction Details'**
|
||||||
|
String get transactionDetails;
|
||||||
|
|
||||||
|
/// No description provided for @transactionType.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Transaction Type'**
|
||||||
|
String get transactionType;
|
||||||
|
|
||||||
|
/// No description provided for @transferType.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Transfer Type'**
|
||||||
|
String get transferType;
|
||||||
|
|
||||||
|
/// No description provided for @utrNo.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'UTR No.'**
|
||||||
|
String get utrNo;
|
||||||
|
|
||||||
|
/// No description provided for @beneficiaryAccountNo.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Beneficiary Account No.'**
|
||||||
|
String get beneficiaryAccountNo;
|
||||||
|
|
||||||
|
/// No description provided for @invalidRtgs.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Invalid Amount for RTGS'**
|
||||||
|
String get invalidRtgs;
|
||||||
|
|
||||||
|
/// No description provided for @invalidRtgsPopUp.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'RTGS transactions require a minimum amount of 200,000. Please enter a higher amount or select NEFT as the transaction mode.'**
|
||||||
|
String get invalidRtgsPopUp;
|
||||||
|
|
||||||
|
/// No description provided for @correctTpin.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Please Enter the correct TPIN'**
|
||||||
|
String get correctTpin;
|
||||||
|
|
||||||
|
/// No description provided for @insufficientFund.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Your account does not have sufficient balance'**
|
||||||
|
String get insufficientFund;
|
||||||
|
|
||||||
|
/// No description provided for @creditedTo.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Credited To'**
|
||||||
|
String get creditedTo;
|
||||||
|
|
||||||
|
/// No description provided for @selectTransactionType.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Select transaction Type'**
|
||||||
|
String get selectTransactionType;
|
||||||
|
|
||||||
|
/// No description provided for @proceed.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Proceed'**
|
||||||
|
String get proceed;
|
||||||
|
|
||||||
|
/// No description provided for @plsValidateBeneficiary.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Please validate beneficiary details first'**
|
||||||
|
String get plsValidateBeneficiary;
|
||||||
|
|
||||||
|
/// No description provided for @accno7to20.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Account number must be between 7 and 20 digits'**
|
||||||
|
String get accno7to20;
|
||||||
|
|
||||||
|
/// No description provided for @validateBeneficiaryproceeding.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Please validate beneficiary before proceeding'**
|
||||||
|
String get validateBeneficiaryproceeding;
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {
|
class _AppLocalizationsDelegate
|
||||||
|
extends LocalizationsDelegate<AppLocalizations> {
|
||||||
const _AppLocalizationsDelegate();
|
const _AppLocalizationsDelegate();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -1413,25 +1519,25 @@ class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool isSupported(Locale locale) => <String>['en', 'hi'].contains(locale.languageCode);
|
bool isSupported(Locale locale) =>
|
||||||
|
<String>['en', 'hi'].contains(locale.languageCode);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool shouldReload(_AppLocalizationsDelegate old) => false;
|
bool shouldReload(_AppLocalizationsDelegate old) => false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLocalizations lookupAppLocalizations(Locale locale) {
|
AppLocalizations lookupAppLocalizations(Locale locale) {
|
||||||
|
|
||||||
|
|
||||||
// Lookup logic when only language code is specified.
|
// Lookup logic when only language code is specified.
|
||||||
switch (locale.languageCode) {
|
switch (locale.languageCode) {
|
||||||
case 'en': return AppLocalizationsEn();
|
case 'en':
|
||||||
case 'hi': return AppLocalizationsHi();
|
return AppLocalizationsEn();
|
||||||
|
case 'hi':
|
||||||
|
return AppLocalizationsHi();
|
||||||
}
|
}
|
||||||
|
|
||||||
throw FlutterError(
|
throw FlutterError(
|
||||||
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
|
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
|
||||||
'an issue with the localizations generation tool. Please file an issue '
|
'an issue with the localizations generation tool. Please file an issue '
|
||||||
'on GitHub with a reproducible sample app and the gen-l10n configuration '
|
'on GitHub with a reproducible sample app and the gen-l10n configuration '
|
||||||
'that was used.'
|
'that was used.');
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
@@ -486,7 +486,8 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||||||
String get otpVerification => 'OTP Verification';
|
String get otpVerification => 'OTP Verification';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get otpSentMessage => 'Enter the 4-digit OTP sent to your mobile number';
|
String get otpSentMessage =>
|
||||||
|
'Enter the 4-digit OTP sent to your mobile number';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get verifyOtp => 'Verify OTP';
|
String get verifyOtp => 'Verify OTP';
|
||||||
@@ -504,13 +505,15 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||||||
String get tpinRequired => 'TPIN Required';
|
String get tpinRequired => 'TPIN Required';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get tpinRequiredMessage => 'You need to set your TPIN to continue with secure transactions';
|
String get tpinRequiredMessage =>
|
||||||
|
'You need to set your TPIN to continue with secure transactions';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get setTpinTitle => 'Set TPIN';
|
String get setTpinTitle => 'Set TPIN';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get tpinInfo => 'Your TPIN is a 6-digit code used to authorize transactions. Keep it safe and do not share it with anyone.';
|
String get tpinInfo =>
|
||||||
|
'Your TPIN is a 6-digit code used to authorize transactions. Keep it safe and do not share it with anyone.';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get tpinFailed => 'Failed to set TPIN. Please try again.';
|
String get tpinFailed => 'Failed to set TPIN. Please try again.';
|
||||||
@@ -564,7 +567,8 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||||||
String get enableFingerprintLogin => 'Enable Fingerprint Login?';
|
String get enableFingerprintLogin => 'Enable Fingerprint Login?';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get enableFingerprintMessage => 'Would you like to enable fingerprint authentication for faster login?';
|
String get enableFingerprintMessage =>
|
||||||
|
'Would you like to enable fingerprint authentication for faster login?';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get no => 'No';
|
String get no => 'No';
|
||||||
@@ -585,7 +589,8 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||||||
String get loading => 'Loading......';
|
String get loading => 'Loading......';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get enableFingerprintQuick => 'Enable fingerprint authentication for quick login?';
|
String get enableFingerprintQuick =>
|
||||||
|
'Enable fingerprint authentication for quick login?';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get kccb => 'KCCB';
|
String get kccb => 'KCCB';
|
||||||
@@ -661,4 +666,59 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String get beneficiaryName => 'Beneficiary Name';
|
String get beneficiaryName => 'Beneficiary Name';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get validateBeneficiary => 'Validate Beneficiary';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get themeMode => 'Theme Mode';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get transactionDetails => 'Transaction Details';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get transactionType => 'Transaction Type';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get transferType => 'Transfer Type';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get utrNo => 'UTR No.';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get beneficiaryAccountNo => 'Beneficiary Account No.';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get invalidRtgs => 'Invalid Amount for RTGS';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get invalidRtgsPopUp =>
|
||||||
|
'RTGS transactions require a minimum amount of 200,000. Please enter a higher amount or select NEFT as the transaction mode.';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get correctTpin => 'Please Enter the correct TPIN';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get insufficientFund =>
|
||||||
|
'Your account does not have sufficient balance';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get creditedTo => 'Credited To';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get selectTransactionType => 'Select transaction Type';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get proceed => 'Proceed';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get plsValidateBeneficiary =>
|
||||||
|
'Please validate beneficiary details first';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get accno7to20 => 'Account number must be between 7 and 20 digits';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get validateBeneficiaryproceeding =>
|
||||||
|
'Please validate beneficiary before proceeding';
|
||||||
}
|
}
|
||||||
|
@@ -52,7 +52,8 @@ class AppLocalizationsHi extends AppLocalizations {
|
|||||||
String get enableBiometric => 'बायोमेट्रिक प्रमाणीकरण सक्षम करें';
|
String get enableBiometric => 'बायोमेट्रिक प्रमाणीकरण सक्षम करें';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get useBiometricPrompt => 'तेज़ लॉगिन के लिए फिंगरप्रिंट/फेस आईडी का उपयोग करें?';
|
String get useBiometricPrompt =>
|
||||||
|
'तेज़ लॉगिन के लिए फिंगरप्रिंट/फेस आईडी का उपयोग करें?';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get later => 'बाद में';
|
String get later => 'बाद में';
|
||||||
@@ -486,7 +487,8 @@ class AppLocalizationsHi extends AppLocalizations {
|
|||||||
String get otpVerification => 'ओटीपी सत्यापन';
|
String get otpVerification => 'ओटीपी सत्यापन';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get otpSentMessage => 'अपने मोबाइल नंबर पर भेजा गया 4-अंकों का ओटीपी दर्ज करें';
|
String get otpSentMessage =>
|
||||||
|
'अपने मोबाइल नंबर पर भेजा गया 4-अंकों का ओटीपी दर्ज करें';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get verifyOtp => 'ओटीपी सत्यापित करें';
|
String get verifyOtp => 'ओटीपी सत्यापित करें';
|
||||||
@@ -504,13 +506,15 @@ class AppLocalizationsHi extends AppLocalizations {
|
|||||||
String get tpinRequired => 'टी-पिन आवश्यक है';
|
String get tpinRequired => 'टी-पिन आवश्यक है';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get tpinRequiredMessage => 'सुरक्षित लेनदेन के लिए टी-पिन सेट करना आवश्यक है';
|
String get tpinRequiredMessage =>
|
||||||
|
'सुरक्षित लेनदेन के लिए टी-पिन सेट करना आवश्यक है';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get setTpinTitle => 'टी-पिन सेट करें';
|
String get setTpinTitle => 'टी-पिन सेट करें';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get tpinInfo => 'आपका टी-पिन 6 अंकों का कोड है जिसका उपयोग लेन-देन को प्रमाणित करने के लिए किया जाता है। इसे सुरक्षित रखें और किसी से साझा न करें।';
|
String get tpinInfo =>
|
||||||
|
'आपका टी-पिन 6 अंकों का कोड है जिसका उपयोग लेन-देन को प्रमाणित करने के लिए किया जाता है। इसे सुरक्षित रखें और किसी से साझा न करें।';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get tpinFailed => 'टी-पिन सेट करने में विफल। कृपया पुनः प्रयास करें।';
|
String get tpinFailed => 'टी-पिन सेट करने में विफल। कृपया पुनः प्रयास करें।';
|
||||||
@@ -564,7 +568,8 @@ class AppLocalizationsHi extends AppLocalizations {
|
|||||||
String get enableFingerprintLogin => 'फिंगरप्रिंट लॉगिन सक्षम करें?';
|
String get enableFingerprintLogin => 'फिंगरप्रिंट लॉगिन सक्षम करें?';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get enableFingerprintMessage => 'क्या आप तेज लॉगिन के लिए फिंगरप्रिंट प्रमाणीकरण सक्षम करना चाहेंगे?';
|
String get enableFingerprintMessage =>
|
||||||
|
'क्या आप तेज लॉगिन के लिए फिंगरप्रिंट प्रमाणीकरण सक्षम करना चाहेंगे?';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get no => 'नहीं';
|
String get no => 'नहीं';
|
||||||
@@ -573,7 +578,8 @@ class AppLocalizationsHi extends AppLocalizations {
|
|||||||
String get yes => 'हाँ';
|
String get yes => 'हाँ';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get authenticateToEnable => 'फिंगरप्रिंट लॉगिन सक्षम करने के लिए प्रमाणीकरण करें';
|
String get authenticateToEnable =>
|
||||||
|
'फिंगरप्रिंट लॉगिन सक्षम करने के लिए प्रमाणीकरण करें';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get exitApp => 'ऐप बंद करें';
|
String get exitApp => 'ऐप बंद करें';
|
||||||
@@ -585,7 +591,8 @@ class AppLocalizationsHi extends AppLocalizations {
|
|||||||
String get loading => 'लोड हो रहा है......';
|
String get loading => 'लोड हो रहा है......';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get enableFingerprintQuick => 'तेज़ लॉगिन के लिए फिंगरप्रिंट प्रमाणीकरण सक्षम करें?';
|
String get enableFingerprintQuick =>
|
||||||
|
'तेज़ लॉगिन के लिए फिंगरप्रिंट प्रमाणीकरण सक्षम करें?';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get kccb => 'केसीसीबी';
|
String get kccb => 'केसीसीबी';
|
||||||
@@ -661,4 +668,58 @@ class AppLocalizationsHi extends AppLocalizations {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String get beneficiaryName => 'लाभार्थी नाम';
|
String get beneficiaryName => 'लाभार्थी नाम';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get validateBeneficiary => 'लाभार्थी को सत्यापित करें';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get themeMode => 'थीम मोड';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get transactionDetails => 'लेन-देन विवरण';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get transactionType => 'लेनदेन प्रकार';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get transferType => 'स्थानांतरण प्रकार';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get utrNo => 'यूटीआर नंबर';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get beneficiaryAccountNo => 'लाभार्थी खाता संख्या';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get invalidRtgs => 'RTGS के लिए अमान्य राशि';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get invalidRtgsPopUp =>
|
||||||
|
'RTGS लेनदेन के लिए न्यूनतम 2,00,000 रुपये की राशि की आवश्यकता होती है। कृपया अधिक राशि दर्ज करें या लेनदेन मोड के रूप में NEFT चुनें';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get correctTpin => 'कृपया सही टी-पिन दर्ज करें';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get insufficientFund => 'आपके खाते में पर्याप्त शेष राशि नहीं है';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get creditedTo => 'को श्रेय दिया गया';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get selectTransactionType => 'लेन-देन का प्रकार चुनें';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get proceed => 'आगे बढ़ना';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get plsValidateBeneficiary =>
|
||||||
|
'कृपया पहले लाभार्थी विवरण सत्यापित करें';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get accno7to20 => 'खाता संख्या सात से बीस अंकों के बीच होनी चाहिए';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get validateBeneficiaryproceeding =>
|
||||||
|
'कृपया आगे बढ़ने से पहले लाभार्थी को पट्टे पर मान्य करें';
|
||||||
}
|
}
|
||||||
|
@@ -4,12 +4,10 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
|||||||
class SecureStorage {
|
class SecureStorage {
|
||||||
final FlutterSecureStorage _storage;
|
final FlutterSecureStorage _storage;
|
||||||
|
|
||||||
SecureStorage(): _storage = const FlutterSecureStorage();
|
SecureStorage() : _storage = const FlutterSecureStorage();
|
||||||
|
|
||||||
Future<void> write(String key, dynamic value) async {
|
Future<void> write(String key, dynamic value) async {
|
||||||
final stringValue = value is String
|
final stringValue = value is String ? value : json.encode(value);
|
||||||
? value
|
|
||||||
: json.encode(value);
|
|
||||||
await _storage.write(key: key, value: stringValue);
|
await _storage.write(key: key, value: stringValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
74
lib/widgets/bank_logos.dart
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
Widget getBankLogo(String? bankName) {
|
||||||
|
if (bankName != null && bankName.toLowerCase().contains('state bank of')) {
|
||||||
|
return Image.asset(
|
||||||
|
'assets/images/sbi_logo.png',
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (bankName != null && bankName.toLowerCase().contains('kangra central')) {
|
||||||
|
return Image.asset(
|
||||||
|
'assets/images/icon.png',
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (bankName != null && bankName.toLowerCase().contains('hdfc bank ltd')) {
|
||||||
|
return Image.asset(
|
||||||
|
'assets/images/hdfc_logo.png',
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (bankName != null && bankName.toLowerCase().contains('icici bank ltd')) {
|
||||||
|
return Image.asset(
|
||||||
|
'assets/images/icici_logo.png',
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (bankName != null &&
|
||||||
|
bankName.toLowerCase().contains('punjab national bank')) {
|
||||||
|
return Image.asset(
|
||||||
|
'assets/images/pnb_logo.png',
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (bankName != null && bankName.toLowerCase().contains('axis')) {
|
||||||
|
return Image.asset(
|
||||||
|
'assets/images/axisBank_logo.png',
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (bankName != null && bankName.toLowerCase().contains('baroda')) {
|
||||||
|
return Image.asset(
|
||||||
|
'assets/images/bankofBaroda_logo.png',
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (bankName != null && bankName.toLowerCase().contains('canara bank')) {
|
||||||
|
return Image.asset(
|
||||||
|
'assets/images/canaraBank_logo.png',
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (bankName != null && bankName.toLowerCase().contains('kotak')) {
|
||||||
|
return Image.asset(
|
||||||
|
'assets/images/kotak_logo.png',
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return const Icon(
|
||||||
|
Icons.account_balance,
|
||||||
|
size: 40,
|
||||||
|
color: Colors.grey,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@@ -91,6 +91,11 @@ flutter:
|
|||||||
- assets/images/kccb_logo.svg
|
- assets/images/kccb_logo.svg
|
||||||
- assets/images/avatar.jpg
|
- assets/images/avatar.jpg
|
||||||
- assets/images/logo.png
|
- assets/images/logo.png
|
||||||
|
- assets/images/sbi_logo.png
|
||||||
|
- assets/images/axisbank_logo.png
|
||||||
|
- assets/images/BankofBaroda_logo.png
|
||||||
|
- assets/images/canaraBank_logo.png
|
||||||
|
- assets/images/kotak_logo.png
|
||||||
- assets/images/kmobile_splash.jpg
|
- assets/images/kmobile_splash.jpg
|
||||||
- assets/images/kmobile_splash2.png
|
- assets/images/kmobile_splash2.png
|
||||||
- assets/images/icon.svg
|
- assets/images/icon.svg
|
||||||
@@ -98,10 +103,14 @@ flutter:
|
|||||||
- assets/images/avatar_male.svg
|
- assets/images/avatar_male.svg
|
||||||
- assets/images/avatar_female.svg
|
- assets/images/avatar_female.svg
|
||||||
- assets/images/kconnect2.webp
|
- assets/images/kconnect2.webp
|
||||||
|
- assets/images/icici_logo.png
|
||||||
|
- assets/images/hdfc_logo.png
|
||||||
|
- assets/images/pnb_logo.png
|
||||||
- assets/animations/rupee.json
|
- assets/animations/rupee.json
|
||||||
- assets/animations/error.json
|
- assets/animations/error.json
|
||||||
- assets/animations/done.json
|
- assets/animations/done.json
|
||||||
|
|
||||||
|
|
||||||
# An image asset can refer to one or more resolution-specific "variants", see
|
# An image asset can refer to one or more resolution-specific "variants", see
|
||||||
# https://flutter.dev/assets-and-images/#resolution-aware
|
# https://flutter.dev/assets-and-images/#resolution-aware
|
||||||
|
|
||||||
|
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
|