dart format
This commit is contained in:
@@ -151,15 +151,13 @@ class AuthService {
|
|||||||
if (response.statusCode != 200) {
|
if (response.statusCode != 200) {
|
||||||
throw AuthException('Failed to proceed with T&C');
|
throw AuthException('Failed to proceed with T&C');
|
||||||
}
|
}
|
||||||
}
|
} on DioException catch (e) {
|
||||||
on DioException catch (e) {
|
|
||||||
if (kDebugMode) {
|
if (kDebugMode) {
|
||||||
print(e.toString());
|
print(e.toString());
|
||||||
}
|
}
|
||||||
throw NetworkException('Network error during T&C Setup');
|
throw NetworkException('Network error during T&C Setup');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw UnexpectedException(
|
throw UnexpectedException('Unexpected error: ${e.toString()}');
|
||||||
'Unexpected error: ${e.toString()}');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,8 @@ class AppRoutes {
|
|||||||
case login:
|
case login:
|
||||||
return MaterialPageRoute(builder: (_) => const LoginScreen());
|
return MaterialPageRoute(builder: (_) => const LoginScreen());
|
||||||
case TncRequiredScreen.routeName: // Renamed class
|
case TncRequiredScreen.routeName: // Renamed class
|
||||||
return MaterialPageRoute(builder: (_) => const TncRequiredScreen()); // Renamed class
|
return MaterialPageRoute(
|
||||||
|
builder: (_) => const TncRequiredScreen()); // Renamed class
|
||||||
case mPin:
|
case mPin:
|
||||||
return MaterialPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (_) => const MPinScreen(
|
builder: (_) => const MPinScreen(
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ class Beneficiary {
|
|||||||
return Beneficiary(
|
return Beneficiary(
|
||||||
accountNo: json['account_no'] ?? json['accountNo'] ?? '',
|
accountNo: json['account_no'] ?? json['accountNo'] ?? '',
|
||||||
accountType: json['account_type'] ?? json['accountType'] ?? '',
|
accountType: json['account_type'] ?? json['accountType'] ?? '',
|
||||||
createdAt: json['createdAt'] == null ? null : DateTime.tryParse(json['createdAt']),
|
createdAt: json['createdAt'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.tryParse(json['createdAt']),
|
||||||
name: json['name'] ?? '',
|
name: json['name'] ?? '',
|
||||||
ifscCode: json['ifsc_code'] ?? json['ifscCode'] ?? '',
|
ifscCode: json['ifsc_code'] ?? json['ifscCode'] ?? '',
|
||||||
bankName: json['bank_name'] ?? json['bankName'] ?? '',
|
bankName: json['bank_name'] ?? json['bankName'] ?? '',
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ class AuthRepository {
|
|||||||
|
|
||||||
AuthRepository(this._authService, this._userService, this._secureStorage);
|
AuthRepository(this._authService, this._userService, this._secureStorage);
|
||||||
|
|
||||||
Future<(List<User>, AuthToken)> login(String customerNo, String password) async {
|
Future<(List<User>, AuthToken)> login(
|
||||||
|
String customerNo, String password) async {
|
||||||
// Create credentials and call service
|
// Create credentials and call service
|
||||||
final credentials =
|
final credentials =
|
||||||
AuthCredentials(customerNo: customerNo, password: password);
|
AuthCredentials(customerNo: customerNo, password: password);
|
||||||
@@ -64,7 +65,8 @@ class AuthRepository {
|
|||||||
final authToken = AuthToken(
|
final authToken = AuthToken(
|
||||||
accessToken: accessToken,
|
accessToken: accessToken,
|
||||||
expiresAt: DateTime.parse(expiryString),
|
expiresAt: DateTime.parse(expiryString),
|
||||||
tnc: tncString == 'true', // Parse 'true' string to true, otherwise false
|
tnc:
|
||||||
|
tncString == 'true', // Parse 'true' string to true, otherwise false
|
||||||
);
|
);
|
||||||
return authToken;
|
return authToken;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ Future<void> setupDependencies() async {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Register controllers/cubits
|
// Register controllers/cubits
|
||||||
getIt.registerFactory<AuthCubit>(
|
getIt.registerFactory<AuthCubit>(() => AuthCubit(
|
||||||
() => AuthCubit(getIt<AuthRepository>(), getIt<UserService>(), getIt<SecureStorage>()));
|
getIt<AuthRepository>(), getIt<UserService>(), getIt<SecureStorage>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Dio _createDioClient() {
|
Dio _createDioClient() {
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ class AuthCubit extends Cubit<AuthState> {
|
|||||||
Future<void> login(String customerNo, String password) async {
|
Future<void> login(String customerNo, String password) async {
|
||||||
emit(AuthLoading());
|
emit(AuthLoading());
|
||||||
try {
|
try {
|
||||||
final (users, authToken) = await _authRepository.login(customerNo, password);
|
final (users, authToken) =
|
||||||
|
await _authRepository.login(customerNo, password);
|
||||||
|
|
||||||
if (authToken.tnc == false) {
|
if (authToken.tnc == false) {
|
||||||
emit(ShowTncDialog(authToken, users));
|
emit(ShowTncDialog(authToken, users));
|
||||||
@@ -57,7 +58,6 @@ class AuthCubit extends Cubit<AuthState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Future<void> onTncDialogResult(
|
Future<void> onTncDialogResult(
|
||||||
bool agreed, AuthToken authToken, List<User> users) async {
|
bool agreed, AuthToken authToken, List<User> users) async {
|
||||||
if (agreed) {
|
if (agreed) {
|
||||||
@@ -83,7 +83,6 @@ class AuthCubit extends Cubit<AuthState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Future<void> _checkMpinAndNavigate(List<User> users) async {
|
Future<void> _checkMpinAndNavigate(List<User> users) async {
|
||||||
final mpin = await _secureStorage.read('mpin');
|
final mpin = await _secureStorage.read('mpin');
|
||||||
if (mpin == null) {
|
if (mpin == null) {
|
||||||
@@ -94,5 +93,4 @@ class AuthCubit extends Cubit<AuthState> {
|
|||||||
emit(Authenticated(users));
|
emit(Authenticated(users));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ class AuthToken extends Equatable {
|
|||||||
|
|
||||||
return AuthToken(
|
return AuthToken(
|
||||||
accessToken: token,
|
accessToken: token,
|
||||||
expiresAt: _decodeExpiryFromToken(token), // This method is still valid for JWT expiry
|
expiresAt: _decodeExpiryFromToken(
|
||||||
|
token), // This method is still valid for JWT expiry
|
||||||
tnc: tncMobileValue, // Use the correctly extracted value
|
tnc: tncMobileValue, // Use the correctly extracted value
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -255,7 +255,8 @@ class LoginScreenState extends State<LoginScreen>
|
|||||||
} else if (state is NavigateToTncRequiredScreen) {
|
} else if (state is NavigateToTncRequiredScreen) {
|
||||||
Navigator.of(context).pushNamed(TncRequiredScreen.routeName);
|
Navigator.of(context).pushNamed(TncRequiredScreen.routeName);
|
||||||
} else if (state is NavigateToMpinSetupScreen) {
|
} else if (state is NavigateToMpinSetupScreen) {
|
||||||
Navigator.of(context).push( // Use push, NOT pushReplacement
|
Navigator.of(context).push(
|
||||||
|
// Use push, NOT pushReplacement
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (_) => MPinScreen(
|
builder: (_) => MPinScreen(
|
||||||
mode: MPinMode.set,
|
mode: MPinMode.set,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class TncRequiredScreen extends StatelessWidget { // Renamed class
|
class TncRequiredScreen extends StatelessWidget {
|
||||||
|
// Renamed class
|
||||||
const TncRequiredScreen({Key? key}) : super(key: key);
|
const TncRequiredScreen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
static const routeName = '/tnc-required';
|
static const routeName = '/tnc-required';
|
||||||
|
|||||||
@@ -269,7 +269,9 @@ class _DashboardScreenState extends State<DashboardScreen>
|
|||||||
final users = state.users;
|
final users = state.users;
|
||||||
final currAccount = users[selectedAccountIndex];
|
final currAccount = users[selectedAccountIndex];
|
||||||
final accountType = currAccount.accountType?.toLowerCase();
|
final accountType = currAccount.accountType?.toLowerCase();
|
||||||
final isPaymentDisabled = accountType != 'sa' && accountType != 'sb' && accountType != 'ca';
|
final isPaymentDisabled = accountType != 'sa' &&
|
||||||
|
accountType != 'sb' &&
|
||||||
|
accountType != 'ca';
|
||||||
// first‐time load
|
// first‐time load
|
||||||
if (!_txInitialized) {
|
if (!_txInitialized) {
|
||||||
_txInitialized = true;
|
_txInitialized = true;
|
||||||
@@ -509,8 +511,7 @@ class _DashboardScreenState extends State<DashboardScreen>
|
|||||||
users[selectedAccountIndex]
|
users[selectedAccountIndex]
|
||||||
.accountNo!,
|
.accountNo!,
|
||||||
remitterName:
|
remitterName:
|
||||||
users[selectedAccountIndex]
|
users[selectedAccountIndex].name!,
|
||||||
.name!,
|
|
||||||
// Pass the full list of accounts
|
// Pass the full list of accounts
|
||||||
accounts: users)));
|
accounts: users)));
|
||||||
}, disable: isPaymentDisabled),
|
}, disable: isPaymentDisabled),
|
||||||
|
|||||||
@@ -62,7 +62,8 @@
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (_timeRemaining == Duration.zero) {
|
if (_timeRemaining == Duration.zero) {
|
||||||
return const SizedBox.shrink(); // Or some other widget indicating it's enabled
|
return const SizedBox
|
||||||
|
.shrink(); // Or some other widget indicating it's enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ void initState() {
|
|||||||
_loadLimit(); // Call the new method
|
_loadLimit(); // Call the new method
|
||||||
_amountController.addListener(_checkAmountLimit);
|
_amountController.addListener(_checkAmountLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _loadLimit() async {
|
Future<void> _loadLimit() async {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoadingLimit = true;
|
_isLoadingLimit = true;
|
||||||
@@ -87,7 +88,8 @@ void _checkAmountLimit() {
|
|||||||
if (isOverLimit) {
|
if (isOverLimit) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text('Amount exceeds remaining daily limit of ${_formatCurrency.format(remainingLimit)}'),
|
content: Text(
|
||||||
|
'Amount exceeds remaining daily limit of ${_formatCurrency.format(remainingLimit)}'),
|
||||||
backgroundColor: Colors.red,
|
backgroundColor: Colors.red,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -487,8 +489,7 @@ void _checkAmountLimit() {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
if (_isLoadingLimit)
|
if (_isLoadingLimit) const Text('Fetching daily limit...'),
|
||||||
const Text('Fetching daily limit...'),
|
|
||||||
if (!_isLoadingLimit && _limit != null)
|
if (!_isLoadingLimit && _limit != null)
|
||||||
Text(
|
Text(
|
||||||
'Remaining Daily Limit: ${_formatCurrency.format(_limit!.dailyLimit - _limit!.usedLimit)}',
|
'Remaining Daily Limit: ${_formatCurrency.format(_limit!.dailyLimit - _limit!.usedLimit)}',
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ class _FundTransferBeneficiaryScreenState
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Widget _buildBeneficiaryList() {
|
Widget _buildBeneficiaryList() {
|
||||||
if (_beneficiaries.isEmpty) {
|
if (_beneficiaries.isEmpty) {
|
||||||
return Center(
|
return Center(
|
||||||
@@ -155,7 +154,6 @@ class _FundTransferBeneficiaryScreenState
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
|||||||
@@ -57,8 +57,8 @@
|
|||||||
leading: CircleAvatar(
|
leading: CircleAvatar(
|
||||||
radius: 24,
|
radius: 24,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
child:
|
child: getBankLogo(
|
||||||
getBankLogo('Kangra Central Co-operative Bank', context),
|
'Kangra Central Co-operative Bank', context),
|
||||||
),
|
),
|
||||||
title: Text(account.name ?? 'N/A'),
|
title: Text(account.name ?? 'N/A'),
|
||||||
subtitle: Column(
|
subtitle: Column(
|
||||||
@@ -67,8 +67,7 @@
|
|||||||
Text(account.accountNo ?? 'N/A'),
|
Text(account.accountNo ?? 'N/A'),
|
||||||
Text(
|
Text(
|
||||||
_getFullAccountType(account.accountType),
|
_getFullAccountType(account.accountType),
|
||||||
style:
|
style: TextStyle(fontSize: 12, color: Colors.grey[600]),
|
||||||
TextStyle(fontSize: 12, color: Colors.grey[600]),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -39,12 +39,12 @@ import 'package:kmobile/widgets/bank_logos.dart';
|
|||||||
bool _isAmountOverLimit = false;
|
bool _isAmountOverLimit = false;
|
||||||
final _formatCurrency = NumberFormat.currency(locale: 'en_IN', symbol: '₹');
|
final _formatCurrency = NumberFormat.currency(locale: 'en_IN', symbol: '₹');
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_loadLimit(); // Fetch the daily limit
|
_loadLimit(); // Fetch the daily limit
|
||||||
_amountController.addListener(_checkAmountLimit); // Listen for amount changes
|
_amountController
|
||||||
|
.addListener(_checkAmountLimit); // Listen for amount changes
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -119,8 +119,8 @@ import 'package:kmobile/widgets/bank_logos.dart';
|
|||||||
|
|
||||||
Navigator.of(pinScreenContext).pushReplacement(
|
Navigator.of(pinScreenContext).pushReplacement(
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (_) =>
|
builder: (_) => PaymentAnimationScreen(
|
||||||
PaymentAnimationScreen(paymentResponse: paymentResponseFuture),
|
paymentResponse: paymentResponseFuture),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -173,8 +173,8 @@ import 'package:kmobile/widgets/bank_logos.dart';
|
|||||||
elevation: 0,
|
elevation: 0,
|
||||||
margin: const EdgeInsets.symmetric(vertical: 8.0),
|
margin: const EdgeInsets.symmetric(vertical: 8.0),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
leading:
|
leading: getBankLogo(
|
||||||
getBankLogo('Kangra Central Co-operative Bank', context),
|
'Kangra Central Co-operative Bank', context),
|
||||||
title: Text(widget.creditAccount.name ?? 'N/A'),
|
title: Text(widget.creditAccount.name ?? 'N/A'),
|
||||||
subtitle: Text(widget.creditAccount.accountNo ?? 'N/A'),
|
subtitle: Text(widget.creditAccount.accountNo ?? 'N/A'),
|
||||||
),
|
),
|
||||||
@@ -214,8 +214,7 @@ import 'package:kmobile/widgets/bank_logos.dart';
|
|||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
|
|
||||||
// Daily Limit Display
|
// Daily Limit Display
|
||||||
if (_isLoadingLimit)
|
if (_isLoadingLimit) const Text('Fetching daily limit...'),
|
||||||
const Text('Fetching daily limit...'),
|
|
||||||
if (!_isLoadingLimit && _limit != null)
|
if (!_isLoadingLimit && _limit != null)
|
||||||
Text(
|
Text(
|
||||||
'Remaining Daily Limit: ${_formatCurrency.format(_limit!.dailyLimit - _limit!.usedLimit)}',
|
'Remaining Daily Limit: ${_formatCurrency.format(_limit!.dailyLimit - _limit!.usedLimit)}',
|
||||||
|
|||||||
@@ -81,7 +81,8 @@ Future<void> _showAddOrEditLimitDialog() async {
|
|||||||
if (value > 200000) {
|
if (value > 200000) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: const Text("Limit To be Set must be less than 200000"),
|
content: const Text(
|
||||||
|
"Limit To be Set must be less than 200000"),
|
||||||
behavior: SnackBarBehavior.floating,
|
behavior: SnackBarBehavior.floating,
|
||||||
backgroundColor: theme.colorScheme.error,
|
backgroundColor: theme.colorScheme.error,
|
||||||
),
|
),
|
||||||
@@ -110,7 +111,6 @@ Future<void> _showAddOrEditLimitDialog() async {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void _removeLimit() {
|
void _removeLimit() {
|
||||||
setState(() {
|
setState(() {
|
||||||
_currentLimit = null;
|
_currentLimit = null;
|
||||||
@@ -135,7 +135,8 @@ Future<void> _showAddOrEditLimitDialog() async {
|
|||||||
final localizations = AppLocalizations.of(context);
|
final localizations = AppLocalizations.of(context);
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
final formatCurrency = NumberFormat.currency(locale: 'en_IN', symbol: '₹');
|
final formatCurrency = NumberFormat.currency(locale: 'en_IN', symbol: '₹');
|
||||||
final remainingLimit = _currentLimit != null ? _currentLimit! - _spentAmount! : 0.0;
|
final remainingLimit =
|
||||||
|
_currentLimit != null ? _currentLimit! - _spentAmount! : 0.0;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import 'package:kmobile/features/profile/preferences/preference_screen.dart';
|
|||||||
import 'package:kmobile/api/services/auth_service.dart';
|
import 'package:kmobile/api/services/auth_service.dart';
|
||||||
import 'package:kmobile/features/fund_transfer/screens/tpin_set_screen.dart';
|
import 'package:kmobile/features/fund_transfer/screens/tpin_set_screen.dart';
|
||||||
|
|
||||||
|
|
||||||
class ProfileScreen extends StatefulWidget {
|
class ProfileScreen extends StatefulWidget {
|
||||||
final String mobileNumber;
|
final String mobileNumber;
|
||||||
const ProfileScreen({super.key, required this.mobileNumber});
|
const ProfileScreen({super.key, required this.mobileNumber});
|
||||||
@@ -210,7 +209,8 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Text('TPIN Not Set'),
|
title: Text('TPIN Not Set'),
|
||||||
content: Text('You have not set a TPIN yet. Please set a TPIN to proceed.'),
|
content: Text(
|
||||||
|
'You have not set a TPIN yet. Please set a TPIN to proceed.'),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text('Back'),
|
child: Text('Back'),
|
||||||
@@ -238,7 +238,8 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
// Case 2: TPIN is set
|
// Case 2: TPIN is set
|
||||||
Navigator.of(context).push(
|
Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => ChangeTpinScreen(mobileNumber: widget.mobileNumber),
|
builder: (context) =>
|
||||||
|
ChangeTpinScreen(mobileNumber: widget.mobileNumber),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ class _ChangeTpinScreenState extends State<ChangeTpinScreen> {
|
|||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
// 1. Get OTP for TPIN change.
|
// 1. Get OTP for TPIN change.
|
||||||
await _changePasswordService.getOtpTpin(mobileNumber: widget.mobileNumber);
|
await _changePasswordService.getOtpTpin(
|
||||||
|
mobileNumber: widget.mobileNumber);
|
||||||
|
|
||||||
// 2. Navigate to the OTP screen on success.
|
// 2. Navigate to the OTP screen on success.
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
|
|||||||
@@ -99,7 +99,8 @@ Future<void> _loadLimit() async {
|
|||||||
if (isOverLimit) {
|
if (isOverLimit) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text('Amount exceeds remaining daily limit of ${_formatCurrency.format(remainingLimit)}'),
|
content: Text(
|
||||||
|
'Amount exceeds remaining daily limit of ${_formatCurrency.format(remainingLimit)}'),
|
||||||
backgroundColor: Colors.red,
|
backgroundColor: Colors.red,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -783,7 +784,8 @@ Future<void> _loadLimit() async {
|
|||||||
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: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: Theme.of(context).colorScheme.outline),
|
color: Theme.of(context).colorScheme.outline),
|
||||||
@@ -808,7 +810,8 @@ Future<void> _loadLimit() async {
|
|||||||
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: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: Theme.of(context).colorScheme.outline),
|
color: Theme.of(context).colorScheme.outline),
|
||||||
@@ -824,7 +827,8 @@ Future<void> _loadLimit() async {
|
|||||||
textInputAction: TextInputAction.next,
|
textInputAction: TextInputAction.next,
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value == null || value.isEmpty) {
|
if (value == null || value.isEmpty) {
|
||||||
return AppLocalizations.of(context).amountRequired;
|
return AppLocalizations.of(context)
|
||||||
|
.amountRequired;
|
||||||
}
|
}
|
||||||
final amount = double.tryParse(value);
|
final amount = double.tryParse(value);
|
||||||
if (amount == null || amount <= 0) {
|
if (amount == null || amount <= 0) {
|
||||||
@@ -868,9 +872,12 @@ if (!_isLoadingLimit && _limit != null)
|
|||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: SwipeButton.expand(
|
child: SwipeButton.expand(
|
||||||
thumb: Icon(Icons.arrow_forward,
|
thumb: Icon(Icons.arrow_forward,
|
||||||
color: _isAmountOverLimit ? Colors.grey : Theme.of(context).dialogBackgroundColor),
|
color: _isAmountOverLimit
|
||||||
activeThumbColor: _isAmountOverLimit ? Colors.grey.shade700 :
|
? Colors.grey
|
||||||
Theme.of(context).colorScheme.primary,
|
: Theme.of(context).dialogBackgroundColor),
|
||||||
|
activeThumbColor: _isAmountOverLimit
|
||||||
|
? Colors.grey.shade700
|
||||||
|
: Theme.of(context).colorScheme.primary,
|
||||||
activeTrackColor: _isAmountOverLimit
|
activeTrackColor: _isAmountOverLimit
|
||||||
? Colors.grey.shade300
|
? Colors.grey.shade300
|
||||||
: Theme.of(context).colorScheme.secondary.withAlpha(100),
|
: Theme.of(context).colorScheme.secondary.withAlpha(100),
|
||||||
|
|||||||
@@ -74,7 +74,8 @@ void _checkAmountLimit() {
|
|||||||
if (isOverLimit) {
|
if (isOverLimit) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text('Amount exceeds remaining daily limit of ${_formatCurrency.format(remainingLimit)}'),
|
content: Text(
|
||||||
|
'Amount exceeds remaining daily limit of ${_formatCurrency.format(remainingLimit)}'),
|
||||||
backgroundColor: Colors.red,
|
backgroundColor: Colors.red,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -184,7 +185,8 @@ void _checkAmountLimit() {
|
|||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: Theme.of(context).colorScheme.primary, width: 2),
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
controller: accountNumberController,
|
controller: accountNumberController,
|
||||||
@@ -204,7 +206,8 @@ void _checkAmountLimit() {
|
|||||||
TextFormField(
|
TextFormField(
|
||||||
controller: confirmAccountNumberController,
|
controller: confirmAccountNumberController,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: AppLocalizations.of(context).confirmAccountNumber,
|
labelText:
|
||||||
|
AppLocalizations.of(context).confirmAccountNumber,
|
||||||
// prefixIcon: Icon(Icons.person),
|
// prefixIcon: Icon(Icons.person),
|
||||||
border: const OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
@@ -216,7 +219,8 @@ void _checkAmountLimit() {
|
|||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: Theme.of(context).colorScheme.primary, width: 2),
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
@@ -256,10 +260,11 @@ void _checkAmountLimit() {
|
|||||||
? const SizedBox(
|
? const SizedBox(
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 20,
|
height: 20,
|
||||||
child: CircularProgressIndicator(strokeWidth: 2),
|
child:
|
||||||
|
CircularProgressIndicator(strokeWidth: 2),
|
||||||
)
|
)
|
||||||
: Text(
|
: Text(AppLocalizations.of(context)
|
||||||
AppLocalizations.of(context).validateBeneficiary),
|
.validateBeneficiary),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -302,7 +307,8 @@ void _checkAmountLimit() {
|
|||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: Theme.of(context).colorScheme.primary, width: 2),
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
value: _selectedAccountType,
|
value: _selectedAccountType,
|
||||||
@@ -343,12 +349,12 @@ void _checkAmountLimit() {
|
|||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: Theme.of(context).colorScheme.primary, width: 2),
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 25),
|
const SizedBox(height: 25),
|
||||||
|
|
||||||
TextFormField(
|
TextFormField(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: AppLocalizations.of(context).amount,
|
labelText: AppLocalizations.of(context).amount,
|
||||||
@@ -362,7 +368,8 @@ void _checkAmountLimit() {
|
|||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: Theme.of(context).colorScheme.primary, width: 2),
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
controller: amountController,
|
controller: amountController,
|
||||||
@@ -380,8 +387,7 @@ void _checkAmountLimit() {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
if (_isLoadingLimit)
|
if (_isLoadingLimit) const Text('Fetching daily limit...'),
|
||||||
const Text('Fetching daily limit...'),
|
|
||||||
if (!_isLoadingLimit && _limit != null)
|
if (!_isLoadingLimit && _limit != null)
|
||||||
Text(
|
Text(
|
||||||
'Remaining Daily Limit: ${_formatCurrency.format(_limit!.dailyLimit - _limit!.usedLimit)}',
|
'Remaining Daily Limit: ${_formatCurrency.format(_limit!.dailyLimit - _limit!.usedLimit)}',
|
||||||
@@ -392,9 +398,12 @@ if (!_isLoadingLimit && _limit != null)
|
|||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: SwipeButton.expand(
|
child: SwipeButton.expand(
|
||||||
thumb: Icon(Icons.arrow_forward,
|
thumb: Icon(Icons.arrow_forward,
|
||||||
color: _isAmountOverLimit ? Colors.grey : Theme.of(context).dialogBackgroundColor),
|
color: _isAmountOverLimit
|
||||||
activeThumbColor: _isAmountOverLimit ? Colors.grey.shade700 :
|
? Colors.grey
|
||||||
Theme.of(context).colorScheme.primary,
|
: Theme.of(context).dialogBackgroundColor),
|
||||||
|
activeThumbColor: _isAmountOverLimit
|
||||||
|
? Colors.grey.shade700
|
||||||
|
: Theme.of(context).colorScheme.primary,
|
||||||
activeTrackColor: _isAmountOverLimit
|
activeTrackColor: _isAmountOverLimit
|
||||||
? Colors.grey.shade300
|
? Colors.grey.shade300
|
||||||
: Theme.of(
|
: Theme.of(
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ void main() async {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// Check for device compromise
|
// Check for device compromise
|
||||||
// final compromisedMessage = await SecurityService.deviceCompromisedMessage;
|
final compromisedMessage = await SecurityService.deviceCompromisedMessage;
|
||||||
// if (compromisedMessage != null) {
|
if (compromisedMessage != null) {
|
||||||
// runApp(MaterialApp(
|
runApp(MaterialApp(
|
||||||
// home: SecurityErrorScreen(message: compromisedMessage),
|
home: SecurityErrorScreen(message: compromisedMessage),
|
||||||
// ));
|
));
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
await setupDependencies();
|
await setupDependencies();
|
||||||
runApp(const KMobile());
|
runApp(const KMobile());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user