63 Commits

Author SHA1 Message Date
845ce1fe78 Logout Button Implemented 2025-09-04 15:40:18 +05:30
45dbf8464a Theme Mode-System Default, Minor Changes & Logout Button #1 2025-09-04 13:43:52 +05:30
asif
a1ea60841e changed minSdk to 29 and also turned off backup in android manifest 2025-09-04 02:17:19 +05:30
asif
2abc315af9 removed unwanted comments from themes.dart 2025-09-04 01:58:26 +05:30
asif
a44ac67842 removed print statements 2025-09-04 01:57:32 +05:30
asif
1b684af3a8 added root and frida detection 2025-09-04 01:56:59 +05:30
asif
aa5a7877e4 added proguard for code obfuscation in android 2025-09-04 01:24:44 +05:30
asif
d6a99ea295 removed the newline from title bar 2025-09-04 01:24:14 +05:30
asif
cf8964ca36 changed add beneficiary screen to to improve UI 2025-09-04 00:58:30 +05:30
asif
c489bf3895 added SafeArea and changed buttton color in Add Beneficiary Page 2025-09-04 00:33:33 +05:30
asif
ba819f51d7 added safearea to some screens. Also fixed some titlebars from wrap text 2025-09-04 00:16:02 +05:30
asif
48f169d10c applied animations and haptics to TPIN screen 2025-09-04 00:14:36 +05:30
asif
64e80148a3 changed primary color usage to fix the color bug in dark mode
Changed Theme.of(context).primaryColor to Theme.of(contex).colorScheme.primary to make dark mode work properly.
2025-09-03 23:49:30 +05:30
asif
85f58c1e25 added const modifier 2025-09-03 23:46:58 +05:30
asif
3b9b1e507c implemented correct colors and proper animations in mpin screen. 2025-09-03 23:45:52 +05:30
57439f2acb Theme Mode #3 2025-09-03 17:39:57 +05:30
52534f9210 Theme Mode #2 2025-09-03 15:51:44 +05:30
d9f78629d2 Theme Mode #1 2025-09-03 15:15:09 +05:30
3e3465d5e8 Optimization #2 2025-09-03 12:10:28 +05:30
be76465774 Optimization #1 2025-09-03 11:41:41 +05:30
de596aa138 Code Obfuscation #1 2025-09-02 16:05:50 +05:30
720c6ec03a View Cards static page 2025-09-02 15:48:23 +05:30
d081a5433c Localization Changes #5 2025-09-01 16:41:32 +05:30
90f4a6bb81 Removed bugs and duplicates 2025-09-01 12:32:17 +05:30
asif
f71c8d646b removed a bunch of print statements and added a few async checks 2025-08-31 21:44:56 +05:30
asif
6a8f091ac5 changed welcome_screen to splash_screen in app.dart 2025-08-31 21:44:56 +05:30
asif
596f0a96eb replaced print with log in theme_cubit.dart 2025-08-31 21:44:04 +05:30
asif
768d312066 refactored welcome string to splash screen 2025-08-31 21:44:04 +05:30
asif
4277ca9169 replaced print with log in neft_service.dart 2025-08-31 21:44:04 +05:30
asif
53caa5b7ae removed decorations from title bar and chaged constant colors to themes 2025-08-31 21:44:04 +05:30
asif
bfa0721e79 removed unnecessary bg color from avatar 2025-08-31 21:44:04 +05:30
asif
75bcce8201 removed unnecessary decorations from title bar 2025-08-31 21:44:04 +05:30
asif
99f4b1b735 UI changes in customer info screen
Removed unnecessary decorations from title bar.
2025-08-31 21:44:04 +05:30
asif
6ebc96d153 removed some unnecessary code and add some async guards 2025-08-31 21:44:04 +05:30
asif
6496aa95c0 changed greeting font and size 2025-08-31 21:44:04 +05:30
asif
e91efafa0e increased font weight of title bar 2025-08-31 21:44:04 +05:30
asif
61a6e356d9 increased font weight in dashboard card 2025-08-31 21:44:04 +05:30
asif
a48781ad1b changed some wordings in the card 2025-08-31 21:44:04 +05:30
asif
d425af184e updated android ndk version 2025-08-31 21:44:04 +05:30
asif
bc2c460f96 changed the font size of acc no in card 2025-08-31 21:44:04 +05:30
asif
ef3556f207 removed some print statements 2025-08-31 21:44:04 +05:30
asif
6724d8bed0 refactored the balacnce card to remove unnecessary things 2025-08-31 21:44:04 +05:30
asif
83ed973b44 fixed some async gaps warnings 2025-08-31 21:44:04 +05:30
asif
f7dd31fb93 added rubik text theme 2025-08-31 21:44:04 +05:30
asif
9c60dc1c1c changed debit and credit icons colors 2025-08-31 21:44:04 +05:30
asif
c369ad415d added weight and dim color to the dashboard QL icons 2025-08-31 21:44:04 +05:30
asif
f934f0bff6 fixed some warnings and colors in the dashboard screen 2025-08-31 21:44:04 +05:30
asif
da0287ef38 fixed some print, async context warnings in
fund_transfer_amount_screen.dart
2025-08-31 21:44:04 +05:30
asif
f65507a706 fixed a context used across async gap warning and removed comments 2025-08-31 21:41:09 +05:30
9f6b35d3eb Beneficiary Details alignment fixed 2025-08-29 15:08:14 +05:30
a33b4bc1e1 Localization changes #4 2025-08-28 13:28:21 +05:30
0d629226a8 Available Balance in Account Statement #2 2025-08-27 18:21:42 +05:30
6d502a0c81 Available Balance in Account Statement 2025-08-27 17:17:47 +05:30
96d1e37c42 Beneficiary Validation Changes #2 2025-08-27 16:13:49 +05:30
b0610ad84d Beneficiary Validation Changes 2025-08-27 16:08:47 +05:30
ceb29ee7fe Manage Beneficiary delete Confirm 2025-08-27 15:00:46 +05:30
57cb93c124 Fund Transfer page with Own Bank and Outside Bank modified 2025-08-27 14:39:51 +05:30
0ac9a1f319 Merge branch 'uat-2' of https://7o9o-lb-526275444.ap-south-1.elb.amazonaws.com/md.asif5/kmobile into uat-2 2025-08-27 13:18:30 +05:30
d3ad68b25c Fund Transfer page with Own Bank and Outside Bank modified 2025-08-27 13:16:26 +05:30
asif
eb0e1c120e Changed font size in transaction detail screen 2025-08-26 21:03:28 +05:30
a64e68d642 NEFT and RTGS transaction error resolved, 2025-08-26 16:42:30 +05:30
80faa06272 Merge branch 'uat-2' of https://7o9o-lb-526275444.ap-south-1.elb.amazonaws.com/md.asif5/kmobile into uat-2 2025-08-26 16:00:26 +05:30
0bab68a2e6 NEFT and RTGS transaction error resolved 2025-08-26 15:58:31 +05:30
61 changed files with 2553 additions and 1371 deletions

View File

@@ -25,7 +25,7 @@ if (flutterVersionName == null) {
android { android {
namespace "com.example.kmobile" namespace "com.example.kmobile"
compileSdk flutter.compileSdkVersion compileSdk flutter.compileSdkVersion
ndkVersion flutter.ndkVersion ndkVersion "27.0.12077973"
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
@@ -45,7 +45,7 @@ android {
applicationId "com.example.kmobile" applicationId "com.example.kmobile"
// You can update the following values to match your application needs. // You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion minSdkVersion 29
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
@@ -56,6 +56,10 @@ android {
// TODO: Add your own signing config for the release build. // TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works. // Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug signingConfig signingConfigs.debug
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
} }
} }
} }

21
android/app/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,21 @@
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.** { *; }
-keep class io.flutter.util.** { *; }
-keep class io.flutter.view.** { *; }
-keep class io.flutter.embedding.** { *; }
-keep class io.flutter.embedding.engine.plugins.** { *; }
-keep class com.google.firebase.** { *; }
-keep class com.google.android.gms.** { *; }
# Please add these rules to your existing keep rules in order to suppress warnings.
# This is generated automatically by the Android Gradle plugin.
-dontwarn com.google.android.play.core.splitcompat.SplitCompatApplication
-dontwarn com.google.android.play.core.splitinstall.SplitInstallException
-dontwarn com.google.android.play.core.splitinstall.SplitInstallManager
-dontwarn com.google.android.play.core.splitinstall.SplitInstallManagerFactory
-dontwarn com.google.android.play.core.splitinstall.SplitInstallRequest$Builder
-dontwarn com.google.android.play.core.splitinstall.SplitInstallRequest
-dontwarn com.google.android.play.core.splitinstall.SplitInstallSessionState
-dontwarn com.google.android.play.core.splitinstall.SplitInstallStateUpdatedListener
-dontwarn com.google.android.play.core.tasks.OnFailureListener
-dontwarn com.google.android.play.core.tasks.OnSuccessListener
-dontwarn com.google.android.play.core.tasks.Task

View File

@@ -6,6 +6,7 @@
android:label="kmobile" android:label="kmobile"
android:name="${applicationName}" android:name="${applicationName}"
android:usesCleartextTraffic="true" android:usesCleartextTraffic="true"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,5 @@
// ignore_for_file: unused_local_variable
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import '../../data/repositories/auth_repository.dart'; import '../../data/repositories/auth_repository.dart';

View File

@@ -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/ifsc.dart'; import 'package:kmobile/data/models/ifsc.dart';
import 'package:kmobile/data/models/beneficiary.dart'; import 'package:kmobile/data/models/beneficiary.dart';
@@ -105,4 +104,18 @@ class BeneficiaryService {
return []; return [];
} }
} }
Future<void> deleteBeneficiary(String accountNo) async {
try {
final response = await _dio.delete('/api/beneficiary/$accountNo');
if (response.statusCode != 204) {
throw Exception('Failed to delete beneficiary');
}
} on DioException catch (e) {
throw Exception('Network error: ${e.message}');
} catch (e) {
throw Exception('Unexpected error: ${e.toString()}');
}
}
} }

View File

@@ -1,3 +1,5 @@
import 'dart:developer';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:kmobile/data/models/neft_response.dart'; import 'package:kmobile/data/models/neft_response.dart';
import 'package:kmobile/data/models/neft_transaction.dart'; import 'package:kmobile/data/models/neft_transaction.dart';
@@ -23,6 +25,7 @@ class NeftService {
'NEFT transaction failed with status code: ${response.statusCode}'); 'NEFT transaction failed with status code: ${response.statusCode}');
} }
} on DioException { } on DioException {
log('DioException Occured');
rethrow; rethrow;
} catch (e) { } catch (e) {
throw Exception('An unexpected error occurred: ${e.toString()}'); throw Exception('An unexpected error occurred: ${e.toString()}');

View File

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

View File

@@ -2,6 +2,8 @@ import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:kmobile/features/auth/controllers/theme_mode_cubit.dart';
import 'package:kmobile/features/auth/controllers/theme_mode_state.dart';
import 'package:kmobile/security/secure_storage.dart'; import 'package:kmobile/security/secure_storage.dart';
import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart';
import './l10n/app_localizations.dart'; import './l10n/app_localizations.dart';
@@ -11,7 +13,7 @@ import 'config/routes.dart';
import 'di/injection.dart'; import 'di/injection.dart';
import 'features/auth/controllers/auth_cubit.dart'; import 'features/auth/controllers/auth_cubit.dart';
import 'features/card/screens/card_management_screen.dart'; import 'features/card/screens/card_management_screen.dart';
import 'features/auth/screens/welcome_screen.dart'; import 'features/auth/screens/splash_screen.dart';
import 'features/auth/screens/login_screen.dart'; import 'features/auth/screens/login_screen.dart';
import 'features/service/screens/service_screen.dart'; import 'features/service/screens/service_screen.dart';
import 'features/dashboard/screens/dashboard_screen.dart'; import 'features/dashboard/screens/dashboard_screen.dart';
@@ -40,7 +42,7 @@ class _KMobileState extends State<KMobile> {
void initState() { void initState() {
super.initState(); super.initState();
loadPreferences(); loadPreferences();
Future.delayed(const Duration(seconds: 2), () { Future.delayed(const Duration(seconds: 3), () {
setState(() { setState(() {
showSplash = false; showSplash = false;
}); });
@@ -67,7 +69,6 @@ class _KMobileState extends State<KMobile> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// Set status bar color and brightness
SystemChrome.setSystemUIOverlayStyle( SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle( const SystemUiOverlayStyle(
statusBarColor: Colors.transparent, statusBarColor: Colors.transparent,
@@ -79,9 +80,12 @@ class _KMobileState extends State<KMobile> {
providers: [ providers: [
BlocProvider<AuthCubit>(create: (_) => getIt<AuthCubit>()), BlocProvider<AuthCubit>(create: (_) => getIt<AuthCubit>()),
BlocProvider<ThemeCubit>(create: (_) => ThemeCubit()), BlocProvider<ThemeCubit>(create: (_) => ThemeCubit()),
BlocProvider<ThemeModeCubit>(create: (_) => ThemeModeCubit()),
], ],
child: BlocBuilder<ThemeCubit, ThemeState>( child: BlocBuilder<ThemeCubit, ThemeState>(
builder: (context, themeState) { builder: (context, themeState) {
return BlocBuilder<ThemeModeCubit, ThemeModeState>(
builder: (context, modeState) {
return MaterialApp( return MaterialApp(
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
locale: _locale ?? const Locale('en'), locale: _locale ?? const Locale('en'),
@@ -96,14 +100,16 @@ class _KMobileState extends State<KMobile> {
GlobalCupertinoLocalizations.delegate, GlobalCupertinoLocalizations.delegate,
], ],
title: 'kMobile', title: 'kMobile',
theme: themeState.getThemeData(), theme: themeState.getLightThemeData(),
//darkTheme: themeState.getThemeData(), darkTheme: themeState.getDarkThemeData(),
themeMode: ThemeMode.light, themeMode: context.watch<ThemeModeCubit>().state.mode,
onGenerateRoute: AppRoutes.generateRoute, onGenerateRoute: AppRoutes.generateRoute,
initialRoute: AppRoutes.splash, initialRoute: AppRoutes.splash,
home: showSplash ? const SplashScreen() : const AuthGate(), home: showSplash ? const SplashScreen() : const AuthGate(),
); );
}, },
);
},
), ),
); );
} }
@@ -119,7 +125,6 @@ class AuthGate extends StatefulWidget {
class _AuthGateState extends State<AuthGate> { class _AuthGateState extends State<AuthGate> {
bool _checking = true; bool _checking = true;
bool _isLoggedIn = false; bool _isLoggedIn = false;
bool _showWelcome = true;
bool _hasMPin = false; bool _hasMPin = false;
bool _biometricEnabled = false; bool _biometricEnabled = false;
bool _biometricTried = false; bool _biometricTried = false;
@@ -175,18 +180,7 @@ class _AuthGateState extends State<AuthGate> {
if (_checking) { if (_checking) {
return const SplashScreen(); return const SplashScreen();
} }
// ✅ Step 1: Show welcome screen first, only once
if (_showWelcome) {
return WelcomeScreen(
onContinue: () {
setState(() {
_showWelcome = false;
});
},
);
}
// ✅ Step 2: Check login status
if (_isLoggedIn) { if (_isLoggedIn) {
if (_hasMPin) { if (_hasMPin) {
if (_biometricEnabled) { if (_biometricEnabled) {
@@ -201,7 +195,6 @@ class _AuthGateState extends State<AuthGate> {
return const NavigationScaffold(); // Authenticated return const NavigationScaffold(); // Authenticated
} }
// ❌ Biometric failed → Show MPIN screen
return MPinScreen( return MPinScreen(
mode: MPinMode.enter, mode: MPinMode.enter,
onCompleted: (_) { onCompleted: (_) {
@@ -227,7 +220,6 @@ class _AuthGateState extends State<AuthGate> {
); );
} }
} else { } else {
// No MPIN set → show MPIN set screen + biometric dialog
return MPinScreen( return MPinScreen(
mode: MPinMode.set, mode: MPinMode.set,
onCompleted: (_) async { onCompleted: (_) async {
@@ -289,8 +281,6 @@ class _AuthGateState extends State<AuthGate> {
); );
} }
} }
// ✅ Step 3: If not logged in, show login screen
return const LoginScreen(); return const LoginScreen();
} }
} }
@@ -352,10 +342,10 @@ class _NavigationScaffoldState extends State<NavigationScaffold> {
bottomNavigationBar: BottomNavigationBar( bottomNavigationBar: BottomNavigationBar(
currentIndex: _selectedIndex, currentIndex: _selectedIndex,
type: BottomNavigationBarType.fixed, type: BottomNavigationBarType.fixed,
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context).scaffoldBackgroundColor,
.scaffoldBackgroundColor, // Light blue background selectedItemColor: Theme.of(context).colorScheme.primary,
selectedItemColor: Theme.of(context).primaryColor, unselectedItemColor:
unselectedItemColor: Colors.black54, Theme.of(context).colorScheme.onSurface.withOpacity(0.7),
onTap: (index) { onTap: (index) {
setState(() { setState(() {
_selectedIndex = index; _selectedIndex = index;
@@ -382,29 +372,6 @@ class _NavigationScaffoldState extends State<NavigationScaffold> {
} }
} }
class SplashScreen extends StatelessWidget {
const SplashScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const CircularProgressIndicator(),
const SizedBox(height: 20),
Text(
AppLocalizations.of(context).loading,
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
),
);
}
}
// Add this widget at the end of the file // Add this widget at the end of the file
class BiometricPromptScreen extends StatelessWidget { class BiometricPromptScreen extends StatelessWidget {
final VoidCallback onCompleted; final VoidCallback onCompleted;
@@ -466,6 +433,9 @@ class BiometricPromptScreen extends StatelessWidget {
], ],
), ),
); );
if (!context.mounted) {
return;
}
if (result == true) { if (result == true) {
await _handleBiometric(context); await _handleBiometric(context);
} else { } else {

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:kmobile/features/auth/screens/mpin_screen.dart'; import 'package:kmobile/features/auth/screens/mpin_screen.dart';
import 'package:kmobile/features/auth/screens/splash_screen.dart';
import '../app.dart'; import '../app.dart';
import '../features/auth/screens/login_screen.dart'; import '../features/auth/screens/login_screen.dart';
// import '../features/auth/screens/forgot_password_screen.dart'; // import '../features/auth/screens/forgot_password_screen.dart';

View File

@@ -3,4 +3,5 @@ enum ThemeType {
green, green,
orange, orange,
blue, blue,
yellow,
} }

View File

@@ -1,37 +1,52 @@
import 'dart:developer';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'theme_type.dart'; import 'theme_type.dart';
import 'package:google_fonts/google_fonts.dart';
class AppThemes { class AppThemes {
static ThemeData getLightTheme(ThemeType type) { static ThemeData getLightTheme(ThemeType type) {
final Color seedColor; final Color seedColor = _getSeedColor(type);
switch (type) {
case ThemeType.green:
seedColor = Colors.green;
break;
case ThemeType.orange:
seedColor = Colors.orange;
break;
case ThemeType.blue:
seedColor = Colors.blue;
break;
case ThemeType.violet:
seedColor = Colors.deepPurple;
break;
}
final colorScheme = ColorScheme.fromSeed( final colorScheme = ColorScheme.fromSeed(
seedColor: seedColor, seedColor: seedColor,
brightness: Brightness.light, // Explicitly set for a light theme brightness: Brightness.light,
);
return ThemeData.from(
colorScheme: colorScheme,
useMaterial3: true,
textTheme: GoogleFonts.rubikTextTheme(),
);
}
static ThemeData getDarkTheme(ThemeType type) {
final Color seedColor = _getSeedColor(type);
log(seedColor.toString());
final colorScheme = ColorScheme.fromSeed(
seedColor: seedColor,
brightness: Brightness.dark,
); );
return ThemeData.from( return ThemeData.from(
colorScheme: colorScheme, colorScheme: colorScheme,
useMaterial3: true, // Recommended for modern Flutter apps useMaterial3: true,
).copyWith( textTheme: GoogleFonts.rubikTextTheme(
scaffoldBackgroundColor: Colors.white, ThemeData(brightness: Brightness.dark).textTheme,
bottomNavigationBarTheme: BottomNavigationBarThemeData(
backgroundColor: colorScheme.surface,
), ),
); );
} }
static Color _getSeedColor(ThemeType type) {
switch (type) {
case ThemeType.green:
return Colors.green;
case ThemeType.orange:
return Colors.orange;
case ThemeType.blue:
return Colors.blue;
case ThemeType.violet:
return Colors.deepPurple;
case ThemeType.yellow:
return Colors.yellow;
}
}
} }

View File

@@ -1,5 +1,3 @@
// ignore_for_file: non_constant_identifier_names
class Beneficiary { class Beneficiary {
final String accountNo; final String accountNo;
final String accountType; final String accountType;
@@ -53,7 +51,6 @@ class Beneficiary {
final beneficiaryList = jsonList final beneficiaryList = jsonList
.map((beneficiary) => Beneficiary.fromJson(beneficiary)) .map((beneficiary) => Beneficiary.fromJson(beneficiary))
.toList(); .toList();
print(beneficiaryList);
return beneficiaryList; return beneficiaryList;
} }

View File

@@ -49,6 +49,12 @@ class AuthRepository {
_tokenExpiryKey, token.expiresAt.toIso8601String()); _tokenExpiryKey, token.expiresAt.toIso8601String());
} }
Future<void> clearAuthTokens() async {
await _secureStorage.deleteAll();
}
Future<AuthToken?> _getAuthToken() async { Future<AuthToken?> _getAuthToken() async {
final accessToken = await _secureStorage.read(_accessTokenKey); final accessToken = await _secureStorage.read(_accessTokenKey);
final expiryString = await _secureStorage.read(_tokenExpiryKey); final expiryString = await _secureStorage.read(_tokenExpiryKey);

View File

@@ -8,6 +8,7 @@ import 'package:kmobile/api/services/payment_service.dart';
import 'package:kmobile/api/services/user_service.dart'; import 'package:kmobile/api/services/user_service.dart';
import 'package:kmobile/data/repositories/transaction_repository.dart'; import 'package:kmobile/data/repositories/transaction_repository.dart';
import 'package:kmobile/features/auth/controllers/theme_cubit.dart'; import 'package:kmobile/features/auth/controllers/theme_cubit.dart';
import 'package:kmobile/features/auth/controllers/theme_mode_cubit.dart';
import '../api/services/auth_service.dart'; import '../api/services/auth_service.dart';
import '../api/interceptors/auth_interceptor.dart'; import '../api/interceptors/auth_interceptor.dart';
import '../data/repositories/auth_repository.dart'; import '../data/repositories/auth_repository.dart';
@@ -20,6 +21,7 @@ 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());
getIt.registerSingleton<ThemeModeCubit>(ThemeModeCubit());
// Register Dio client // Register Dio client
getIt.registerSingleton<Dio>(_createDioClient()); getIt.registerSingleton<Dio>(_createDioClient());

View File

@@ -1,7 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:kmobile/data/models/user.dart'; import 'package:kmobile/data/models/user.dart';
import 'package:material_symbols_icons/material_symbols_icons.dart';
import '../../../l10n/app_localizations.dart'; import '../../../l10n/app_localizations.dart';
class AccountInfoScreen extends StatefulWidget { class AccountInfoScreen extends StatefulWidget {
@@ -32,35 +30,9 @@ class _AccountInfoScreen extends State<AccountInfoScreen> {
int selectedIndex = widget.selectedIndex; int selectedIndex = widget.selectedIndex;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: IconButton( title: Text(AppLocalizations.of(context)
icon: const Icon(Symbols.arrow_back_ios_new), .accountInfo
onPressed: () { .replaceFirst(RegExp('\n'), '')),
Navigator.pop(context);
},
),
title: Text(
AppLocalizations.of(context).accountInfo,
style: const 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: ListView( body: ListView(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
@@ -70,7 +42,6 @@ class _AccountInfoScreen extends State<AccountInfoScreen> {
style: const TextStyle(fontWeight: FontWeight.w500, fontSize: 14), style: const TextStyle(fontWeight: FontWeight.w500, fontSize: 14),
), ),
/// Dropdown to change account
DropdownButton<User>( DropdownButton<User>(
value: selectedUser, value: selectedUser,
onChanged: (User? newUser) { onChanged: (User? newUser) {
@@ -130,6 +101,7 @@ class InfoRow extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
return Container( return Container(
width: double.infinity, width: double.infinity,
margin: const EdgeInsets.symmetric(vertical: 8), margin: const EdgeInsets.symmetric(vertical: 8),
@@ -138,16 +110,16 @@ class InfoRow extends StatelessWidget {
children: [ children: [
Text( Text(
title, title,
style: const TextStyle( style: TextStyle(
fontSize: 15, fontSize: 15,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Colors.black87, color: theme.colorScheme.onSurfaceVariant,
), ),
), ),
const SizedBox(height: 3), const SizedBox(height: 3),
Text( Text(
value, value,
style: const TextStyle(fontSize: 16, color: Colors.black), style: TextStyle(fontSize: 16, color: theme.colorScheme.onSurface),
), ),
], ],
), ),

View File

@@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.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';
import 'package:shimmer/shimmer.dart'; import 'package:shimmer/shimmer.dart';
import 'package:kmobile/data/models/transaction.dart'; import 'package:kmobile/data/models/transaction.dart';
@@ -10,7 +9,12 @@ import 'transaction_details_screen.dart';
class AccountStatementScreen extends StatefulWidget { class AccountStatementScreen extends StatefulWidget {
final String accountNo; final String accountNo;
const AccountStatementScreen({super.key, required this.accountNo}); final String balance;
const AccountStatementScreen({
super.key,
required this.accountNo,
required this.balance,
});
@override @override
State<AccountStatementScreen> createState() => _AccountStatementScreen(); State<AccountStatementScreen> createState() => _AccountStatementScreen();
@@ -114,31 +118,10 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: IconButton(
icon: const Icon(Symbols.arrow_back_ios_new),
onPressed: () => Navigator.pop(context),
),
title: Text( title: Text(
AppLocalizations.of(context).accountStatement, AppLocalizations.of(context).accountStatement,
style:
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
), ),
centerTitle: false, 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( body: Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
@@ -150,7 +133,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
Text( Text(
"${AppLocalizations.of(context).accountNumber}: ", "${AppLocalizations.of(context).accountNumber}: ",
style: const TextStyle( style: const TextStyle(
fontSize: 19, fontSize: 17,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@@ -158,12 +141,19 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
], ],
), ),
const SizedBox(height: 15), const SizedBox(height: 15),
// Text( Row(
// AppLocalizations.of(context).availableBalance, children: [
// style: const TextStyle(fontSize: 17), Text(
// ), "${AppLocalizations.of(context).availableBalance}: ",
// const SizedBox(height: 15), style: const TextStyle(
// Text(widget.accountNo, style: const TextStyle(fontSize: 17)), fontSize: 17,
),
),
Text('${widget.balance}',
style: const TextStyle(fontSize: 17)),
],
),
const SizedBox(height: 15),
Text( Text(
AppLocalizations.of(context).filters, AppLocalizations.of(context).filters,
style: const TextStyle(fontSize: 17), style: const TextStyle(fontSize: 17),
@@ -198,19 +188,20 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
child: ElevatedButton( child: ElevatedButton(
onPressed: _loadTransactions, onPressed: _loadTransactions,
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: Theme.of(context).primaryColor, backgroundColor:
Theme.of(context).colorScheme.primaryContainer,
padding: const EdgeInsets.symmetric(vertical: 16), padding: const EdgeInsets.symmetric(vertical: 16),
), ),
child: Text( child: Text(
"Search", AppLocalizations.of(context).search,
style: TextStyle( style: TextStyle(
color: Theme.of(context).scaffoldBackgroundColor, color: Theme.of(context).colorScheme.onPrimaryContainer,
fontSize: 16, fontSize: 16,
), ),
), ),
), ),
), ),
const SizedBox(height: 35), const SizedBox(height: 15),
if (!_txLoading && if (!_txLoading &&
_transactions.isNotEmpty && _transactions.isNotEmpty &&
fromDate == null && fromDate == null &&
@@ -222,7 +213,7 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Colors.grey[700], color: Theme.of(context).colorScheme.onSurfaceVariant,
), ),
), ),
), ),
@@ -265,8 +256,9 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
child: Text( child: Text(
AppLocalizations.of(context).noTransactions, AppLocalizations.of(context).noTransactions,
style: TextStyle( style: TextStyle(
fontSize: 16, color: Colors.grey[600]), fontSize: 16,
), color: Theme.of(context).colorScheme.onSurface,
)),
) )
: ListView.separated( : ListView.separated(
itemCount: _transactions.length, itemCount: _transactions.length,
@@ -277,8 +269,9 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
tx.type == 'CR' tx.type == 'CR'
? Symbols.call_received ? Symbols.call_received
: Symbols.call_made, : Symbols.call_made,
color: color: tx.type == 'CR'
tx.type == 'CR' ? Colors.green : Colors.red, ? Colors.green
: Theme.of(context).colorScheme.error,
), ),
title: Text( title: Text(
tx.date ?? '', tx.date ?? '',
@@ -322,7 +315,8 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
return Container( return Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16), padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(color: Colors.grey), border:
Border.all(color: Theme.of(context).colorScheme.onSurfaceVariant),
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
), ),
child: Row( child: Row(
@@ -332,7 +326,9 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
date != null ? _formatDate(date) : label, date != null ? _formatDate(date) : label,
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
color: date != null ? Colors.black : Colors.grey, color: date != null
? Theme.of(context).colorScheme.onSurface
: Theme.of(context).colorScheme.onSurfaceVariant,
), ),
), ),
const Icon(Icons.arrow_drop_down), const Icon(Icons.arrow_drop_down),

View File

@@ -93,14 +93,14 @@ class TransactionDetailsScreen extends StatelessWidget {
"$label: ", "$label: ",
style: const TextStyle( style: const TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 20, fontSize: 17,
), ),
), ),
const SizedBox(height: 30), const SizedBox(height: 30),
Expanded( Expanded(
child: Text( child: Text(
value, value,
style: const TextStyle(fontSize: 20), style: const TextStyle(fontSize: 16),
), ),
), ),
], ],

View File

@@ -1,3 +1,5 @@
import 'dart:developer';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.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';
@@ -17,7 +19,7 @@ class ThemeCubit extends Cubit<ThemeState> {
} }
Future<void> changeTheme(ThemeType type) async { Future<void> changeTheme(ThemeType type) async {
print("Attempting to change theme to: ${type.toString()}"); log("Attempting to change theme...");
final prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
await prefs.setInt('theme_type', type.index); await prefs.setInt('theme_type', type.index);
emit(ThemeState(themeType: type)); emit(ThemeState(themeType: type));

View File

@@ -0,0 +1,23 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'theme_mode_state.dart';
class ThemeModeCubit extends Cubit<ThemeModeState> {
ThemeModeCubit() : super(const ThemeModeState(mode: ThemeMode.system)) {
loadThemeMode();
}
Future<void> loadThemeMode() async {
final prefs = await SharedPreferences.getInstance();
final modeIndex = prefs.getInt('theme_mode') ?? 0; // default system
final mode = ThemeMode.values[modeIndex];
emit(ThemeModeState(mode: mode));
}
Future<void> changeThemeMode(ThemeMode mode) async {
final prefs = await SharedPreferences.getInstance();
await prefs.setInt('theme_mode', mode.index);
emit(ThemeModeState(mode: mode));
}
}

View File

@@ -0,0 +1,11 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
class ThemeModeState extends Equatable {
final ThemeMode mode;
const ThemeModeState({required this.mode});
@override
List<Object?> get props => [mode];
}

View File

@@ -1,4 +1,4 @@
import 'package:equatable/equatable.dart'; /*import 'package:equatable/equatable.dart';
import 'package:flutter/material.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';
@@ -14,4 +14,28 @@ class ThemeState extends Equatable {
@override @override
List<Object?> get props => [themeType]; List<Object?> get props => [themeType];
}*/
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:kmobile/config/theme_type.dart';
import 'package:kmobile/config/themes.dart';
class ThemeState extends Equatable {
final ThemeType themeType;
const ThemeState({required this.themeType});
ThemeData getLightThemeData() {
return AppThemes.getLightTheme(themeType);
} }
ThemeData getDarkThemeData() {
return AppThemes.getDarkTheme(themeType);
}
@override
List<Object?> get props => [themeType];
}

View File

@@ -120,11 +120,11 @@ class LoginScreenState extends State<LoginScreen>
isDense: true, isDense: true,
filled: true, filled: true,
fillColor: Theme.of(context).scaffoldBackgroundColor, fillColor: Theme.of(context).scaffoldBackgroundColor,
enabledBorder: const OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black), borderSide: BorderSide(color: Theme.of(context).colorScheme.outline),
), ),
focusedBorder: const OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black, width: 2), borderSide: BorderSide(color: Theme.of(context).colorScheme.primary, width: 2),
), ),
), ),
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
@@ -149,11 +149,11 @@ class LoginScreenState extends State<LoginScreen>
isDense: true, isDense: true,
filled: true, filled: true,
fillColor: Theme.of(context).scaffoldBackgroundColor, fillColor: Theme.of(context).scaffoldBackgroundColor,
enabledBorder: const OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black), borderSide: BorderSide(color: Theme.of(context).colorScheme.outline),
), ),
focusedBorder: const OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black, width: 2), borderSide: BorderSide(color: Theme.of(context).colorScheme.primary, width: 2),
), ),
suffixIcon: IconButton( suffixIcon: IconButton(
icon: Icon( icon: Icon(
@@ -187,14 +187,14 @@ class LoginScreenState extends State<LoginScreen>
backgroundColor: backgroundColor:
Theme.of(context).scaffoldBackgroundColor, Theme.of(context).scaffoldBackgroundColor,
foregroundColor: Theme.of(context).primaryColorDark, foregroundColor: Theme.of(context).primaryColorDark,
side: const BorderSide(color: Colors.black, width: 1), side: BorderSide(color: Theme.of(context).colorScheme.outline, width: 1),
elevation: 0, elevation: 0,
), ),
child: state is AuthLoading child: state is AuthLoading
? const CircularProgressIndicator() ? const CircularProgressIndicator()
: Text( : Text(
AppLocalizations.of(context).login, AppLocalizations.of(context).login,
style: const TextStyle(fontSize: 16), style: TextStyle(color: Theme.of(context).colorScheme.onPrimaryContainer),
), ),
), ),
), ),
@@ -225,10 +225,11 @@ class LoginScreenState extends State<LoginScreen>
style: OutlinedButton.styleFrom( style: OutlinedButton.styleFrom(
shape: const StadiumBorder(), shape: const StadiumBorder(),
padding: const EdgeInsets.symmetric(vertical: 16), padding: const EdgeInsets.symmetric(vertical: 16),
backgroundColor: Theme.of(context).primaryColorLight, backgroundColor: Theme.of(context).colorScheme.primary,
foregroundColor: Colors.black, foregroundColor: Theme.of(context).colorScheme.onPrimary,
), ),
child: Text(AppLocalizations.of(context).register), child: Text(AppLocalizations.of(context).register,
style: TextStyle(color: Theme.of(context).colorScheme.onPrimary),),
), ),
), ),
], ],

View File

@@ -1,12 +1,14 @@
import '../../../l10n/app_localizations.dart'; import '../../../l10n/app_localizations.dart';
import 'dart:math';
import 'dart:developer'; // import 'dart:developer';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:kmobile/app.dart'; import 'package:kmobile/app.dart';
import 'package:kmobile/di/injection.dart'; import 'package:kmobile/di/injection.dart';
import 'package:kmobile/security/secure_storage.dart'; import 'package:kmobile/security/secure_storage.dart';
import 'package:local_auth/local_auth.dart'; import 'package:local_auth/local_auth.dart';
import 'package:flutter/services.dart';
enum MPinMode { enter, set, confirm } enum MPinMode { enter, set, confirm }
@@ -26,22 +28,73 @@ class MPinScreen extends StatefulWidget {
State<MPinScreen> createState() => _MPinScreenState(); State<MPinScreen> createState() => _MPinScreenState();
} }
class _MPinScreenState extends State<MPinScreen> { class _MPinScreenState extends State<MPinScreen> with TickerProviderStateMixin {
List<String> mPin = []; List<String> mPin = [];
String? errorText; String? errorText;
// Animation controllers
late final AnimationController _bounceController;
late final Animation<double> _bounceAnimation;
late final AnimationController _shakeController;
late final AnimationController _waveController;
late final Animation<double> _waveAnimation;
// State flags for animations
bool _isError = false;
bool _isSuccess = false;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
// Bounce animation for single dot entry
_bounceController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 150),
);
_bounceAnimation = Tween<double>(begin: 1.0, end: 1.2).animate(
CurvedAnimation(
parent: _bounceController,
curve: Curves.elasticIn,
reverseCurve: Curves.elasticOut,
),
)..addStatusListener((status) {
if (status == AnimationStatus.completed) {
_bounceController.reverse();
}
});
// Shake animation for error
_shakeController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 400),
);
// Wave animation for success
_waveController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 800),
);
_waveAnimation = Tween<double>(begin: 0, end: 1).animate(
CurvedAnimation(parent: _waveController, curve: Curves.easeInOut),
);
if (widget.mode == MPinMode.enter) { if (widget.mode == MPinMode.enter) {
_tryBiometricBeforePin(); _tryBiometricBeforePin();
} }
} }
@override
void dispose() {
_bounceController.dispose();
_shakeController.dispose();
_waveController.dispose();
super.dispose();
}
Future<void> _tryBiometricBeforePin() async { Future<void> _tryBiometricBeforePin() async {
final storage = getIt<SecureStorage>(); final storage = getIt<SecureStorage>();
final enabled = await storage.read('biometric_enabled'); final enabled = await storage.read('biometric_enabled');
log('biometric_enabled: $enabled'); // log('biometric_enabled: $enabled');
if (enabled != null && enabled) { if (enabled != null && enabled) {
final auth = LocalAuthentication(); final auth = LocalAuthentication();
if (await auth.canCheckBiometrics) { if (await auth.canCheckBiometrics) {
@@ -62,11 +115,13 @@ class _MPinScreenState extends State<MPinScreen> {
} }
void addDigit(String digit) { void addDigit(String digit) {
if (_shakeController.isAnimating || _waveController.isAnimating) return;
if (mPin.length < 4) { if (mPin.length < 4) {
setState(() { setState(() {
mPin.add(digit); mPin.add(digit);
errorText = null; errorText = null;
}); });
_bounceController.forward(from: 0);
if (mPin.length == 4) { if (mPin.length == 4) {
_handleComplete(); _handleComplete();
} }
@@ -74,6 +129,7 @@ class _MPinScreenState extends State<MPinScreen> {
} }
void deleteDigit() { void deleteDigit() {
if (_shakeController.isAnimating || _waveController.isAnimating) return;
if (mPin.isNotEmpty) { if (mPin.isNotEmpty) {
setState(() { setState(() {
mPin.removeLast(); mPin.removeLast();
@@ -83,19 +139,36 @@ class _MPinScreenState extends State<MPinScreen> {
} }
Future<void> _handleComplete() async { Future<void> _handleComplete() async {
if (_shakeController.isAnimating || _waveController.isAnimating) return;
final pin = mPin.join(); final pin = mPin.join();
final storage = SecureStorage(); final storage = SecureStorage();
switch (widget.mode) { switch (widget.mode) {
case MPinMode.enter: case MPinMode.enter:
final storedPin = await storage.read('mpin'); final storedPin = await storage.read('mpin');
log('storedPin: $storedPin'); // log('storedPin: $storedPin');
if (storedPin == int.tryParse(pin)) { if (storedPin == int.tryParse(pin)) {
widget.onCompleted?.call(pin); // Correct PIN
} else {
setState(() { setState(() {
_isSuccess = true;
errorText = null;
});
await Future.delayed(const Duration(milliseconds: 100));
_waveController.forward(from: 0).whenComplete(() {
widget.onCompleted?.call(pin);
});
} else {
// Incorrect PIN
setState(() {
_isError = true;
errorText = AppLocalizations.of(context).incorrectMPIN; errorText = AppLocalizations.of(context).incorrectMPIN;
});
await _shakeController.forward(from: 0);
setState(() {
mPin.clear(); mPin.clear();
_isError = false;
// Keep error text until next digit is entered
}); });
} }
break; break;
@@ -126,28 +199,81 @@ class _MPinScreenState extends State<MPinScreen> {
} }
} else { } else {
setState(() { setState(() {
_isError = true;
errorText = AppLocalizations.of(context).pinsDoNotMatch; errorText = AppLocalizations.of(context).pinsDoNotMatch;
});
await _shakeController.forward(from: 0);
setState(() {
mPin.clear(); mPin.clear();
_isError = false;
}); });
} }
break; break;
} }
} }
Widget buildMPinDots() { Widget buildMPinDots(BuildContext context) {
return Row( return AnimatedBuilder(
animation: Listenable.merge(
[_bounceController, _shakeController, _waveController]),
builder: (context, child) {
double shakeOffset = 0;
if (_shakeController.isAnimating) {
// 4 cycles of sine wave for shake
shakeOffset = sin(_shakeController.value * 4 * pi) * 12;
}
return Transform.translate(
offset: Offset(shakeOffset, 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(4, (index) { children: List.generate(4, (index) {
return Container( final isFilled = index < mPin.length;
// Bounce animation for single dot
final isAnimatingBounce =
index == mPin.length - 1 && _bounceController.isAnimating;
double bounceScale =
isAnimatingBounce ? _bounceAnimation.value : 1.0;
// Success wave animation
double waveScale = 1.0;
if (_isSuccess) {
final waveDelay = index * 0.15;
final waveValue =
(_waveAnimation.value - waveDelay).clamp(0.0, 1.0);
// Grow and shrink
waveScale = 1.0 + sin(waveValue * pi) * 0.4;
}
// Determine dot color
Color dotColor;
if (_isError) {
dotColor = Theme.of(context).colorScheme.error;
} else if (_isSuccess) {
dotColor = Colors.green.shade600;
} else {
dotColor = isFilled
? Theme.of(context).colorScheme.onSurfaceVariant
: Theme.of(context).colorScheme.surfaceContainerHighest;
}
return Transform.scale(
scale: bounceScale * waveScale,
child: Container(
margin: const EdgeInsets.all(8), margin: const EdgeInsets.all(8),
width: 15, width: 25,
height: 15, height: 25,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: index < mPin.length ? Colors.black : Colors.grey[400], color: dotColor,
),
), ),
); );
}), }),
),
);
},
); );
} }
@@ -165,9 +291,10 @@ class _MPinScreenState extends State<MPinScreen> {
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: row.map((key) { children: row.map((key) {
return Padding( return Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(1.0),
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
HapticFeedback.lightImpact();
if (key == '<') { if (key == '<') {
deleteDigit(); deleteDigit();
} else if (key == 'Enter') { } else if (key == 'Enter') {
@@ -185,11 +312,10 @@ class _MPinScreenState extends State<MPinScreen> {
} }
}, },
child: Container( child: Container(
width: 70, width: 80,
height: 70, height: 80,
decoration: BoxDecoration( decoration: const BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors.grey[200],
), ),
alignment: Alignment.center, alignment: Alignment.center,
child: key == 'Enter' child: key == 'Enter'
@@ -197,10 +323,10 @@ class _MPinScreenState extends State<MPinScreen> {
: Text( : Text(
key == '<' ? '' : key, key == '<' ? '' : key,
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 30,
color: key == 'Enter' color: key == 'Enter'
? Theme.of(context).primaryColor ? Theme.of(context).primaryColor
: Colors.black, : Theme.of(context).colorScheme.onSurface,
), ),
), ),
), ),
@@ -229,7 +355,7 @@ class _MPinScreenState extends State<MPinScreen> {
body: SafeArea( body: SafeArea(
child: Column( child: Column(
children: [ children: [
const Spacer(), const SizedBox(height: 50),
// Logo // Logo
Image.asset('assets/images/logo.png', height: 100), Image.asset('assets/images/logo.png', height: 100),
const SizedBox(height: 20), const SizedBox(height: 20),
@@ -237,19 +363,18 @@ class _MPinScreenState extends State<MPinScreen> {
getTitle(), getTitle(),
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w500), style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
), ),
const SizedBox(height: 20), const Spacer(),
buildMPinDots(), buildMPinDots(context),
if (errorText != null) if (errorText != null)
Padding( Padding(
padding: const EdgeInsets.only(top: 8.0), padding: const EdgeInsets.only(top: 8.0),
child: Text( child: Text(
errorText!, errorText!,
style: const TextStyle(color: Colors.red), style: TextStyle(color: Theme.of(context).colorScheme.error),
), ),
), ),
const Spacer(), const Spacer(),
buildNumberPad(), buildNumberPad(),
const Spacer(),
], ],
), ),
), ),

View File

@@ -1,77 +1,58 @@
import '../../../l10n/app_localizations.dart'; import '../../../l10n/app_localizations.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'dart:async';
class WelcomeScreen extends StatefulWidget { class SplashScreen extends StatefulWidget {
final VoidCallback onContinue; const SplashScreen({super.key});
const WelcomeScreen({super.key, required this.onContinue});
@override @override
State<WelcomeScreen> createState() => _WelcomeScreenState(); State<SplashScreen> createState() => _SplashScreenState();
}
class _WelcomeScreenState extends State<WelcomeScreen> {
@override
void initState() {
super.initState();
// Automatically go to logizn after 4 seconds
Timer(const Duration(seconds: 4), () {
widget.onContinue();
});
} }
class _SplashScreenState extends State<SplashScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: Stack( body: Stack(
children: [ children: [
/// 🔹 Background Image
Positioned.fill( Positioned.fill(
child: Image.asset( child: Image.asset(
'assets/images/kconnect2.webp', 'assets/images/kconnect2.webp',
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
/// 🔹 Centered Text Overlay
Center( Center(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Text( Text(
AppLocalizations.of(context).kconnect, AppLocalizations.of(context).kconnect,
style: TextStyle( style: const TextStyle(
fontSize: 36, fontSize: 36,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Theme.of(context).dialogBackgroundColor, color: Color(0xFFFFFFFF),
letterSpacing: 1.5,
), ),
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
Text( Text(
AppLocalizations.of(context).kccBankFull, AppLocalizations.of(context).kccBankFull,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: const TextStyle(
fontSize: 18, fontSize: 18,
color: Theme.of(context).dialogBackgroundColor, color: Color(0xFFFFFFFF),
letterSpacing: 1.2, letterSpacing: 1.2,
), ),
), ),
], ],
), ),
), ),
const Positioned(
/// 🔹 Loading Spinner at Bottom
Positioned(
bottom: 40, bottom: 40,
left: 0, left: 0,
right: 0, right: 0,
child: Center( child: Center(
child: CircularProgressIndicator( child: CircularProgressIndicator(
color: Theme.of(context).scaffoldBackgroundColor), color: Color(0xFFFFFFFF)),
), ),
), ),
], ],

View File

@@ -1,11 +1,10 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.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/beneficiary.dart'; import 'package:kmobile/data/models/beneficiary.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 'beneficiary_result_page.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'; import 'package:kmobile/features/fund_transfer/screens/transaction_pin_screen.dart';
@@ -46,7 +45,7 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
super.initState(); super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
setState(() { setState(() {
accountType = AppLocalizations.of(context).savings; accountType = 'Savings';
}); });
}); });
} }
@@ -87,11 +86,17 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
final service = getIt<BeneficiaryService>(); final service = getIt<BeneficiaryService>();
try { try {
final String beneficiaryName = await service.validateBeneficiary( String beneficiaryName;
if (ifsc.toLowerCase().contains('kace')) {
beneficiaryName =
await service.validateBeneficiaryWithinBank(accountNo);
} else {
beneficiaryName = await service.validateBeneficiary(
accountNo: accountNo, accountNo: accountNo,
ifscCode: ifsc, ifscCode: ifsc,
remitterName: remitter, remitterName: remitter,
); );
}
setState(() { setState(() {
nameController.text = beneficiaryName; nameController.text = beneficiaryName;
@@ -121,8 +126,9 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
// Ensure beneficiary is validated before proceeding to TPIN // Ensure beneficiary is validated before proceeding to TPIN
if (!_isBeneficiaryValidated) { if (!_isBeneficiaryValidated) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
const SnackBar( SnackBar(
content: Text('Please validate beneficiary details first.')), content: Text(AppLocalizations.of(context)
.pleaseValidateBeneficiaryDetailsFirst)),
); );
return; return;
} }
@@ -213,33 +219,10 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: IconButton(
icon: const Icon(Symbols.arrow_back_ios_new),
onPressed: () {
Navigator.pop(context);
},
),
title: Text( title: Text(
AppLocalizations.of(context).addBeneficiary, AppLocalizations.of(context).addBeneficiary,
style:
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
), ),
centerTitle: false, 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: SafeArea( body: SafeArea(
child: Form( child: Form(
@@ -262,18 +245,6 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
// prefixIcon: Icon(Icons.person), // prefixIcon: Icon(Icons.person),
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
isDense: true, isDense: true,
filled: true,
fillColor:
Theme.of(context).scaffoldBackgroundColor,
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.black),
),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Colors.black,
width: 2,
),
),
), ),
obscureText: true, obscureText: true,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
@@ -304,18 +275,6 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
// prefixIcon: Icon(Icons.person), // prefixIcon: Icon(Icons.person),
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
isDense: true, isDense: true,
filled: true,
fillColor:
Theme.of(context).scaffoldBackgroundColor,
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.black),
),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Colors.black,
width: 2,
),
),
), ),
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
textInputAction: TextInputAction.next, textInputAction: TextInputAction.next,
@@ -334,7 +293,6 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
}, },
), ),
const SizedBox(height: 24), const SizedBox(height: 24),
// 🔹 IFSC Code Field
TextFormField( TextFormField(
controller: ifscController, controller: ifscController,
maxLength: 11, maxLength: 11,
@@ -345,18 +303,6 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
labelText: AppLocalizations.of(context).ifscCode, labelText: AppLocalizations.of(context).ifscCode,
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
isDense: true, isDense: true,
filled: true,
fillColor:
Theme.of(context).scaffoldBackgroundColor,
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.black),
),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Colors.black,
width: 2,
),
),
), ),
textCapitalization: TextCapitalization.characters, textCapitalization: TextCapitalization.characters,
textInputAction: TextInputAction.next, textInputAction: TextInputAction.next,
@@ -394,18 +340,6 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
labelText: AppLocalizations.of(context).bankName, labelText: AppLocalizations.of(context).bankName,
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
isDense: true, isDense: true,
filled: true,
fillColor: Theme.of(context)
.dialogBackgroundColor, // disabled color
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.black),
),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Colors.black,
width: 2,
),
),
), ),
), ),
const SizedBox(height: 24), const SizedBox(height: 24),
@@ -417,18 +351,37 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
labelText: AppLocalizations.of(context).branchName, labelText: AppLocalizations.of(context).branchName,
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
isDense: true, 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,
), ),
), ),
if (_isBeneficiaryValidated)
Column(
children: [
const SizedBox(height: 24),
TextFormField(
controller: nameController,
enabled: false,
decoration: InputDecoration(
suffixIcon: _isBeneficiaryValidated
? const Icon(
Symbols.verified,
size: 25,
fill: 1,
)
: null,
suffixIconColor:
Theme.of(context).colorScheme.primary,
labelText: AppLocalizations.of(context)
.beneficiaryName,
border: const OutlineInputBorder(),
isDense: true,
), ),
textInputAction: TextInputAction.next,
validator: (value) => value == null ||
value.isEmpty
? AppLocalizations.of(context).nameRequired
: null,
),
],
), ),
const SizedBox(height: 24), const SizedBox(height: 24),
if (!_isBeneficiaryValidated) if (!_isBeneficiaryValidated)
@@ -464,30 +417,6 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
), ),
), ),
//Beneficiary Name (Disabled) //Beneficiary Name (Disabled)
TextFormField(
controller: nameController,
enabled: false,
decoration: InputDecoration(
labelText:
AppLocalizations.of(context).beneficiaryName,
border: const OutlineInputBorder(),
isDense: true,
filled: true,
fillColor: Theme.of(context).dialogBackgroundColor,
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.black),
),
focusedBorder: const OutlineInputBorder(
borderSide:
BorderSide(color: Colors.black, width: 2),
),
),
textInputAction: TextInputAction.next,
validator: (value) => value == null || value.isEmpty
? AppLocalizations.of(context).nameRequired
: null,
),
const SizedBox(height: 24),
// 🔹 Account Type Dropdown // 🔹 Account Type Dropdown
DropdownButtonFormField<String>( DropdownButtonFormField<String>(
value: accountType, value: accountType,
@@ -495,22 +424,10 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
labelText: AppLocalizations.of(context).accountType, labelText: AppLocalizations.of(context).accountType,
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
isDense: true, isDense: true,
filled: true,
fillColor:
Theme.of(context).scaffoldBackgroundColor,
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.black),
),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Colors.black,
width: 2,
),
),
), ),
items: [ items: [
AppLocalizations.of(context).savings, 'Savings',
AppLocalizations.of(context).current, 'Current',
] ]
.map( .map(
(type) => DropdownMenuItem( (type) => DropdownMenuItem(
@@ -535,18 +452,6 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
prefixIcon: const Icon(Icons.phone), prefixIcon: const Icon(Icons.phone),
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
isDense: true, isDense: true,
filled: true,
fillColor:
Theme.of(context).scaffoldBackgroundColor,
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.black),
),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Colors.black,
width: 2,
),
),
), ),
textInputAction: TextInputAction.done, textInputAction: TextInputAction.done,
validator: (value) => validator: (value) =>
@@ -561,7 +466,7 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
), ),
), ),
Padding( Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.symmetric(vertical: 10),
child: SizedBox( child: SizedBox(
width: 250, width: 250,
child: ElevatedButton( child: ElevatedButton(
@@ -569,8 +474,14 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
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).colorScheme.primaryContainer,
foregroundColor:
Theme.of(context).colorScheme.onPrimaryContainer),
child: Text(
AppLocalizations.of(context).validateAndAdd,
style: const TextStyle(fontSize: 16),
), ),
child: Text(AppLocalizations.of(context).validateAndAdd),
), ),
), ),
), ),

View File

@@ -0,0 +1,163 @@
import 'package:flutter/material.dart';
import 'package:kmobile/data/models/beneficiary.dart';
import 'package:kmobile/di/injection.dart';
import 'package:kmobile/widgets/bank_logos.dart';
import 'package:kmobile/api/services/beneficiary_service.dart';
import '../../../l10n/app_localizations.dart';
class BeneficiaryDetailsScreen extends StatelessWidget {
final Beneficiary beneficiary;
BeneficiaryDetailsScreen({super.key, required this.beneficiary});
final service = getIt<BeneficiaryService>();
void _deleteBeneficiary(BuildContext context) async {
try {
await service.deleteBeneficiary(beneficiary.accountNo);
if (!context.mounted) {
return;
}
_showSuccessDialog(context);
} catch (e) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Failed to delete beneficiary: $e')),
);
}
}
void _showSuccessDialog(BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text('Success'),
content: const Text('Beneficiary deleted successfully.'),
actions: <Widget>[
TextButton(
child: const Text('OK'),
onPressed: () {
Navigator.of(context).popUntil((route) => route.isFirst);
},
),
],
);
},
);
}
void _showDeleteConfirmationDialog(BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text('Delete Beneficiary'),
content:
const Text('Are you sure you want to delete this beneficiary?'),
actions: <Widget>[
TextButton(
child: const Text('Cancel'),
onPressed: () {
Navigator.of(context).pop();
},
),
TextButton(
child: const Text('Delete'),
onPressed: () {
//Navigator.of(context).pop();
_deleteBeneficiary(context);
},
),
],
);
},
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(AppLocalizations.of(context).beneficiarydetails),
),
body: SafeArea(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
CircleAvatar(
radius: 24,
backgroundColor: Colors.transparent,
child: getBankLogo(beneficiary.bankName, context),
),
const SizedBox(width: 16),
Text(
beneficiary.name,
style: const TextStyle(
fontSize: 20, fontWeight: FontWeight.bold),
),
],
),
const SizedBox(height: 24),
_buildDetailRow('${AppLocalizations.of(context).bankName} ',
beneficiary.bankName ?? 'N/A'),
_buildDetailRow('${AppLocalizations.of(context).accountNumber} ',
beneficiary.accountNo),
_buildDetailRow('${AppLocalizations.of(context).accountType} ',
beneficiary.accountType),
_buildDetailRow('${AppLocalizations.of(context).ifscCode} ',
beneficiary.ifscCode),
_buildDetailRow('${AppLocalizations.of(context).branchName} ',
beneficiary.branchName ?? 'N/A'),
const Spacer(),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
// ElevatedButton.icon(
// onPressed: () {
// // Set Transaction Limit for this beneficiary
// },
// icon: const Icon(Icons.currency_rupee),
// label: const Text('Set Limit'),
// ),
ElevatedButton.icon(
onPressed: () {
// Delete beneficiary option
_showDeleteConfirmationDialog(context);
},
icon: const Icon(Icons.delete),
label: Text(AppLocalizations.of(context).delete),
),
],
),
],
),
),
),
);
}
Widget _buildDetailRow(String label, String value) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(label, style: const TextStyle(fontWeight: FontWeight.bold)),
const SizedBox(width: 16),
Flexible(
child: Text(
value,
textAlign: TextAlign.end,
),
),
],
),
);
}
}

View File

@@ -90,7 +90,7 @@ class _BeneficiaryResultPageState extends State<BeneficiaryResultPage> {
), ),
child: Text( child: Text(
AppLocalizations.of(context).done, AppLocalizations.of(context).done,
style: const TextStyle(fontSize: 18), // slightly bigger text style: TextStyle(color: Theme.of(context).colorScheme.onPrimaryContainer), // slightly bigger text
), ),
), ),
), ),

View File

@@ -1,6 +1,7 @@
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 'package:kmobile/features/beneficiaries/screens/beneficiary_details_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';
@@ -74,7 +75,7 @@ class _ManageBeneficiariesScreen extends State<ManageBeneficiariesScreen> {
leading: CircleAvatar( leading: CircleAvatar(
radius: 24, radius: 24,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
child: getBankLogo(item.bankName), child: getBankLogo(item.bankName, context),
), ),
title: Text(item.name), title: Text(item.name),
subtitle: Column( subtitle: Column(
@@ -88,6 +89,14 @@ class _ManageBeneficiariesScreen extends State<ManageBeneficiariesScreen> {
), ),
], ],
), ),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => BeneficiaryDetailsScreen(beneficiary: item),
),
);
},
); );
}, },
); );
@@ -113,8 +122,6 @@ class _ManageBeneficiariesScreen extends State<ManageBeneficiariesScreen> {
), ),
); );
}, },
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
foregroundColor: Theme.of(context).primaryColor,
elevation: 5, elevation: 5,
child: const Icon(Icons.add), child: const Icon(Icons.add),
), ),

View File

@@ -1,8 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import '../../../l10n/app_localizations.dart'; import '../../../l10n/app_localizations.dart';
import 'package:material_symbols_icons/material_symbols_icons.dart';
class BlockCardScreen extends StatefulWidget { class BlockCardScreen extends StatefulWidget {
const BlockCardScreen({super.key}); const BlockCardScreen({super.key});
@@ -56,33 +54,12 @@ class _BlockCardScreen extends State<BlockCardScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: IconButton(
icon: const Icon(Symbols.arrow_back_ios_new),
onPressed: () {
Navigator.pop(context);
},
),
title: Text( title: Text(
AppLocalizations.of(context).blockCard, AppLocalizations.of(context).blockCard,
style: style:
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500), const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
), ),
centerTitle: false, 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( body: Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),

View File

@@ -0,0 +1,164 @@
import 'package:flutter/material.dart';
class CardDetailsScreen extends StatelessWidget {
const CardDetailsScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("My Cards"),
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: ListView(
children: const [
CardTile(
cardNumber: "**** **** **** 1234",
cardNetwork: "VISA",
cardType: "Debit Card",
validFrom: "01/22",
validTo: "01/27",
),
SizedBox(height: 16),
CardTile(
cardNumber: "**** **** **** 5678",
cardNetwork: "Mastercard",
cardType: "Debit Card",
validFrom: "07/21",
validTo: "07/26",
),
],
),
),
);
}
}
class CardTile extends StatelessWidget {
final String cardNumber;
final String cardNetwork;
final String cardType;
final String validFrom;
final String validTo;
const CardTile({
super.key,
required this.cardNumber,
required this.cardNetwork,
required this.cardType,
required this.validFrom,
required this.validTo,
});
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
gradient: const LinearGradient(
colors: [Colors.blue, Colors.indigo],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
boxShadow: const [
BoxShadow(
color: Colors.black26,
blurRadius: 8,
spreadRadius: 2,
offset: Offset(2, 4),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Top row: Logo + Bank name
Row(
children: [
Image.asset(
'assets/images/logo.png',
width: 40,
height: 40,
),
const SizedBox(width: 8),
const Text(
"Kangra Central Co-operative Bank",
style: TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.bold,
),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
],
),
const SizedBox(height: 24),
// Card number (masked)
Text(
cardNumber,
style: const TextStyle(
color: Colors.white,
fontSize: 22,
letterSpacing: 3,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 16),
// Validity
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text("VALID FROM",
style: TextStyle(color: Colors.white70, fontSize: 10)),
Text(
validFrom,
style: const TextStyle(color: Colors.white, fontSize: 14),
),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text("VALID UPTO",
style: TextStyle(color: Colors.white70, fontSize: 10)),
Text(
validTo,
style: const TextStyle(color: Colors.white, fontSize: 14),
),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
cardNetwork,
style: const TextStyle(
color: Colors.white,
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
Text(
cardType,
style: const TextStyle(
color: Colors.white70,
fontSize: 12,
),
),
],
),
],
),
],
),
);
}
}

View File

@@ -1,6 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:kmobile/features/card/screens/block_card_screen.dart'; import 'package:kmobile/features/card/screens/block_card_screen.dart';
import 'package:kmobile/features/card/screens/card_details_screen.dart';
import 'package:kmobile/features/card/screens/card_pin_change_details_screen.dart'; import 'package:kmobile/features/card/screens/card_pin_change_details_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'; import '../../../l10n/app_localizations.dart';
@@ -20,25 +20,8 @@ class _CardManagementScreen extends State<CardManagementScreen> {
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
title: Text( title: Text(
AppLocalizations.of(context).cardManagement, AppLocalizations.of(context).cardManagement,
style:
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
), ),
centerTitle: false, 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: ListView( body: ListView(
children: [ children: [
@@ -74,6 +57,19 @@ class _CardManagementScreen extends State<CardManagementScreen> {
}, },
), ),
const Divider(height: 1), const Divider(height: 1),
CardManagementTile(
icon: Symbols.payment_card,
label: AppLocalizations.of(context).viewCardDeatils,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const CardDetailsScreen(),
),
);
},
),
const Divider(height: 1),
], ],
), ),
); );

View File

@@ -1,8 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:kmobile/features/card/screens/card_pin_set_screen.dart'; import 'package:kmobile/features/card/screens/card_pin_set_screen.dart';
import 'package:material_symbols_icons/material_symbols_icons.dart';
import '../../../l10n/app_localizations.dart'; import '../../../l10n/app_localizations.dart';
class CardPinChangeDetailsScreen extends StatefulWidget { class CardPinChangeDetailsScreen extends StatefulWidget {
@@ -46,33 +44,12 @@ class _CardPinChangeDetailsScreen extends State<CardPinChangeDetailsScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: IconButton(
icon: const Icon(Symbols.arrow_back_ios_new),
onPressed: () {
Navigator.pop(context);
},
),
title: Text( title: Text(
AppLocalizations.of(context).cardDetails, AppLocalizations.of(context).cardDetails,
style: style:
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500), const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
), ),
centerTitle: false, 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( body: Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),

View File

@@ -1,6 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:material_symbols_icons/material_symbols_icons.dart';
import '../../../l10n/app_localizations.dart'; import '../../../l10n/app_localizations.dart';
class CardPinSetScreen extends StatefulWidget { class CardPinSetScreen extends StatefulWidget {
@@ -46,33 +44,12 @@ class _CardPinSetScreen extends State<CardPinSetScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: IconButton(
icon: const Icon(Symbols.arrow_back_ios_new),
onPressed: () {
Navigator.pop(context);
},
),
title: Text( title: Text(
AppLocalizations.of(context).cardPin, AppLocalizations.of(context).cardPin,
style: style:
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500), const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
), ),
centerTitle: false, 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( body: Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),

View File

@@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:kmobile/features/enquiry/screens/enquiry_screen.dart'; import 'package:kmobile/features/enquiry/screens/enquiry_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'; import '../../../l10n/app_localizations.dart';
@@ -16,33 +15,12 @@ class _ChequeManagementScreen extends State<ChequeManagementScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: IconButton(
icon: const Icon(Symbols.arrow_back_ios_new),
onPressed: () {
Navigator.pop(context);
},
),
title: Text( title: Text(
AppLocalizations.of(context).chequeManagement, AppLocalizations.of(context).chequeManagement,
style: style:
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500), const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
), ),
centerTitle: false, 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: ListView( body: ListView(
children: [ children: [

View File

@@ -1,7 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:kmobile/data/models/user.dart'; import 'package:kmobile/data/models/user.dart';
import 'package:material_symbols_icons/material_symbols_icons.dart';
import '../../../l10n/app_localizations.dart'; import '../../../l10n/app_localizations.dart';
class CustomerInfoScreen extends StatefulWidget { class CustomerInfoScreen extends StatefulWidget {
@@ -16,34 +15,14 @@ class _CustomerInfoScreenState extends State<CustomerInfoScreen> {
late final User user = widget.user; late final User user = widget.user;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: IconButton(
icon: const Icon(Symbols.arrow_back_ios_new),
onPressed: () {
Navigator.pop(context);
},
),
title: Text( title: Text(
AppLocalizations.of(context).kMobile, AppLocalizations.of(context)
style: .customerInfo
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500), .replaceFirst(RegExp('\n'), ''),
), ),
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: 100,
height: 100,
fit: BoxFit.cover,
),
),
),
],
), ),
body: SingleChildScrollView( body: SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(), physics: const AlwaysScrollableScrollPhysics(),
@@ -55,7 +34,6 @@ class _CustomerInfoScreenState extends State<CustomerInfoScreen> {
children: [ children: [
const SizedBox(height: 30), const SizedBox(height: 30),
CircleAvatar( CircleAvatar(
backgroundColor: Colors.grey[200],
radius: 50, radius: 50,
child: SvgPicture.asset( child: SvgPicture.asset(
'assets/images/avatar_male.svg', 'assets/images/avatar_male.svg',
@@ -68,16 +46,18 @@ class _CustomerInfoScreenState extends State<CustomerInfoScreen> {
padding: const EdgeInsets.only(top: 10.0), padding: const EdgeInsets.only(top: 10.0),
child: Text( child: Text(
user.name ?? '', user.name ?? '',
style: const TextStyle( style: TextStyle(
fontSize: 20, fontSize: 20,
color: Colors.black, color: theme.colorScheme.onSurface,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
), ),
), ),
Text( Text(
'${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: TextStyle(
fontSize: 16,
color: theme.colorScheme.onSurfaceVariant),
), ),
const SizedBox(height: 30), const SizedBox(height: 30),
InfoField( InfoField(
@@ -125,6 +105,7 @@ class InfoField extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
return Container( return Container(
width: double.infinity, width: double.infinity,
margin: const EdgeInsets.symmetric(vertical: 8), margin: const EdgeInsets.symmetric(vertical: 8),
@@ -133,16 +114,16 @@ class InfoField extends StatelessWidget {
children: [ children: [
Text( Text(
label, label,
style: const TextStyle( style: TextStyle(
fontSize: 15, fontSize: 15,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Colors.black87, color: theme.colorScheme.onSurfaceVariant,
), ),
), ),
const SizedBox(height: 3), const SizedBox(height: 3),
Text( Text(
value, value,
style: const TextStyle(fontSize: 16, color: Colors.black), style: TextStyle(fontSize: 16, color: theme.colorScheme.onSurface),
), ),
], ],
), ),

View File

@@ -1,4 +1,3 @@
// 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';
@@ -13,7 +12,7 @@ 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';
import 'package:kmobile/features/beneficiaries/screens/manage_beneficiaries_screen.dart'; import 'package:kmobile/features/beneficiaries/screens/manage_beneficiaries_screen.dart';
import 'package:kmobile/features/enquiry/screens/enquiry_screen.dart'; import 'package:kmobile/features/enquiry/screens/enquiry_screen.dart';
import 'package:kmobile/features/fund_transfer/screens/fund_transfer_beneficiary_screen.dart'; import 'package:kmobile/features/fund_transfer/screens/fund_transfer_screen.dart';
import 'package:kmobile/features/profile/profile_screen.dart'; import 'package:kmobile/features/profile/profile_screen.dart';
import 'package:kmobile/features/quick_pay/screens/quick_pay_screen.dart'; import 'package:kmobile/features/quick_pay/screens/quick_pay_screen.dart';
import 'package:kmobile/security/secure_storage.dart'; import 'package:kmobile/security/secure_storage.dart';
@@ -82,8 +81,11 @@ class _DashboardScreenState extends State<DashboardScreen> {
// Call your AuthCubit or repository to refresh user/accounts data // Call your AuthCubit or repository to refresh user/accounts data
await context.read<AuthCubit>().refreshUserData(); await context.read<AuthCubit>().refreshUserData();
} catch (e) { } catch (e) {
if (!context.mounted) {
return;
}
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
/*const*/ SnackBar( SnackBar(
content: Text(AppLocalizations.of(context).failedToRefresh), content: Text(AppLocalizations.of(context).failedToRefresh),
), ),
); );
@@ -94,13 +96,12 @@ class _DashboardScreenState extends State<DashboardScreen> {
} }
Widget _buildBalanceShimmer() { Widget _buildBalanceShimmer() {
final theme = Theme.of(context);
return Shimmer.fromColors( return Shimmer.fromColors(
baseColor: Theme.of(context).dialogBackgroundColor, baseColor: theme.colorScheme.primary,
highlightColor: Theme.of(context).dialogBackgroundColor, highlightColor: theme.colorScheme.onPrimary,
child: Container( child: Container(
width: 100, width: 200, height: 42, color: theme.scaffoldBackgroundColor),
height: 32,
color: Theme.of(context).scaffoldBackgroundColor),
); );
} }
@@ -169,6 +170,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
onPressed: () async { onPressed: () async {
final auth = LocalAuthentication(); final auth = LocalAuthentication();
final canCheck = await auth.canCheckBiometrics; final canCheck = await auth.canCheckBiometrics;
if (!mounted) return;
bool ok = false; bool ok = false;
if (canCheck) { if (canCheck) {
ok = await auth.authenticate( ok = await auth.authenticate(
@@ -179,6 +181,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
await storage.write('biometric_enabled', 'true'); await storage.write('biometric_enabled', 'true');
} }
await storage.write('biometric_prompt_shown', 'true'); await storage.write('biometric_prompt_shown', 'true');
if (!mounted) return;
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: Text(AppLocalizations.of(context).enable), child: Text(AppLocalizations.of(context).enable),
@@ -190,6 +193,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
return BlocListener<AuthCubit, AuthState>( return BlocListener<AuthCubit, AuthState>(
listener: (context, state) async { listener: (context, state) async {
if (state is Authenticated && !_biometricPromptShown) { if (state is Authenticated && !_biometricPromptShown) {
@@ -202,15 +206,15 @@ class _DashboardScreenState extends State<DashboardScreen> {
} }
}, },
child: Scaffold( child: Scaffold(
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: theme.scaffoldBackgroundColor,
appBar: AppBar( appBar: AppBar(
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: theme.scaffoldBackgroundColor,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
title: Text( title: Text(
AppLocalizations.of(context).kconnect, AppLocalizations.of(context).kconnect,
style: TextStyle( style: TextStyle(
color: Theme.of(context).primaryColor, color: theme.colorScheme.primary,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w700,
), ),
), ),
centerTitle: true, centerTitle: true,
@@ -268,10 +272,10 @@ class _DashboardScreenState extends State<DashboardScreen> {
Padding( Padding(
padding: const EdgeInsets.only(left: 8.0), padding: const EdgeInsets.only(left: 8.0),
child: Text( child: Text(
"${AppLocalizations.of(context).hi} $firstName", "${AppLocalizations.of(context).hi} $firstName!",
style: GoogleFonts.montserrat().copyWith( style: GoogleFonts.baumans().copyWith(
fontSize: 25, fontSize: 20,
color: Theme.of(context).primaryColor, color: theme.colorScheme.primary,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
), ),
@@ -285,7 +289,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
vertical: 10, vertical: 10,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).primaryColor, color: theme.colorScheme.primary,
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
), ),
child: Column( child: Column(
@@ -294,24 +298,22 @@ class _DashboardScreenState extends State<DashboardScreen> {
Row( Row(
children: [ children: [
Text( Text(
"${AppLocalizations.of(context).accountNumber}: ", "${getFullAccountType(currAccount.accountType)}: ",
style: TextStyle( style: TextStyle(
color: color: theme.colorScheme.onPrimary,
Theme.of(context).dialogBackgroundColor, fontSize: 18,
fontSize: 12, fontWeight: FontWeight.w700,
), ),
), ),
DropdownButton<int>( DropdownButton<int>(
value: selectedAccountIndex, value: selectedAccountIndex,
dropdownColor: Theme.of(context).primaryColor, dropdownColor: theme.colorScheme.primary,
underline: const SizedBox(), underline: const SizedBox(),
icon: const Icon(Icons.keyboard_arrow_down), icon: const Icon(Icons.keyboard_arrow_down),
iconEnabledColor: iconEnabledColor: theme.colorScheme.onPrimary,
Theme.of(context).dialogBackgroundColor,
style: TextStyle( style: TextStyle(
color: color: theme.colorScheme.onPrimary,
Theme.of(context).dialogBackgroundColor, fontSize: 18,
fontSize: 14,
), ),
items: List.generate(users.length, (index) { items: List.generate(users.length, (index) {
return DropdownMenuItem<int>( return DropdownMenuItem<int>(
@@ -319,9 +321,9 @@ 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) color: theme.colorScheme.onPrimary,
.dialogBackgroundColor, fontSize: 18,
fontSize: 14, fontWeight: FontWeight.w700,
), ),
), ),
); );
@@ -360,15 +362,13 @@ class _DashboardScreenState extends State<DashboardScreen> {
width: 20, width: 20,
height: 20, height: 20,
child: CircularProgressIndicator( child: CircularProgressIndicator(
color: Theme.of(context) color: theme.colorScheme.onPrimary,
.dialogBackgroundColor,
strokeWidth: 2, strokeWidth: 2,
), ),
) )
: Icon( : Icon(
Icons.refresh, Symbols.refresh,
color: Theme.of(context) color: theme.colorScheme.onPrimary,
.dialogBackgroundColor,
), ),
onPressed: isRefreshing onPressed: isRefreshing
? null ? null
@@ -377,22 +377,14 @@ class _DashboardScreenState extends State<DashboardScreen> {
), ),
], ],
), ),
Text( const SizedBox(height: 15),
getFullAccountType(currAccount.accountType),
style: TextStyle(
color: Theme.of(context).dialogBackgroundColor,
fontSize: 16,
),
),
const SizedBox(height: 4),
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Text( Text(
"", "",
style: TextStyle( style: TextStyle(
color: color: theme.colorScheme.onPrimary,
Theme.of(context).dialogBackgroundColor,
fontSize: 40, fontSize: 40,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
@@ -403,10 +395,9 @@ class _DashboardScreenState extends State<DashboardScreen> {
isVisible isVisible
? currAccount.currentBalance ?? ? currAccount.currentBalance ??
'0.00' '0.00'
: '********', : '*****',
style: TextStyle( style: TextStyle(
color: Theme.of(context) color: theme.colorScheme.onPrimary,
.dialogBackgroundColor,
fontSize: 40, fontSize: 40,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
@@ -432,12 +423,15 @@ class _DashboardScreenState extends State<DashboardScreen> {
}); });
} }
}, },
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Icon( child: Icon(
isVisible isVisible
? Symbols.visibility_lock ? Symbols.visibility_lock
: Symbols.visibility, : Symbols.visibility,
color: Theme.of(context) color: theme.scaffoldBackgroundColor,
.scaffoldBackgroundColor, weight: 800,
),
), ),
), ),
], ],
@@ -492,8 +486,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) => FundTransferScreen(
FundTransferBeneficiaryScreen(
creditAccountNo: creditAccountNo:
users[selectedAccountIndex] users[selectedAccountIndex]
.accountNo!, .accountNo!,
@@ -526,6 +519,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
AccountStatementScreen( AccountStatementScreen(
accountNo: users[selectedAccountIndex] accountNo: users[selectedAccountIndex]
.accountNo!, .accountNo!,
balance: users[selectedAccountIndex]
.availableBalance!,
))); )));
}), }),
_buildQuickLink(Symbols.checkbook, _buildQuickLink(Symbols.checkbook,
@@ -568,8 +563,9 @@ class _DashboardScreenState extends State<DashboardScreen> {
tx.type == 'CR' tx.type == 'CR'
? Symbols.call_received ? Symbols.call_received
: Symbols.call_made, : Symbols.call_made,
color: color: tx.type == 'CR'
tx.type == 'CR' ? Colors.green : Colors.red, ? const Color(0xFF10BB10)
: theme.colorScheme.error,
), ),
title: Text( title: Text(
tx.date ?? '', tx.date ?? '',
@@ -606,7 +602,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
AppLocalizations.of(context).noTransactions, AppLocalizations.of(context).noTransactions,
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
color: Colors.grey[600], color: Theme.of(context).colorScheme.outline,
), ),
), ),
), ),
@@ -626,30 +622,26 @@ class _DashboardScreenState extends State<DashboardScreen> {
} }
List<Widget> _buildTransactionShimmer() { List<Widget> _buildTransactionShimmer() {
final theme = Theme.of(context);
return List.generate(3, (i) { return List.generate(3, (i) {
return ListTile( return ListTile(
leading: Shimmer.fromColors( leading: Shimmer.fromColors(
baseColor: Colors.grey[300]!, baseColor: Colors.grey[300]!,
highlightColor: Colors.grey[100]!, highlightColor: Colors.grey[100]!,
child: CircleAvatar( child: CircleAvatar(
radius: 12, radius: 12, backgroundColor: theme.scaffoldBackgroundColor),
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( child: Container(
height: 10, height: 10, width: 100, color: theme.scaffoldBackgroundColor),
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( child: Container(
height: 8, height: 8, width: 60, color: theme.scaffoldBackgroundColor),
width: 60,
color: Theme.of(context).scaffoldBackgroundColor),
), ),
); );
}); });
@@ -661,6 +653,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
VoidCallback onTap, { VoidCallback onTap, {
bool disable = false, bool disable = false,
}) { }) {
final theme = Theme.of(context);
return InkWell( return InkWell(
onTap: disable ? null : onTap, onTap: disable ? null : onTap,
child: Column( child: Column(
@@ -669,7 +662,11 @@ class _DashboardScreenState extends State<DashboardScreen> {
Icon( Icon(
icon, icon,
size: 30, size: 30,
color: disable ? Colors.grey : Theme.of(context).primaryColor, color: disable
? theme.colorScheme.onSurface.withOpacity(0.3)
: theme.colorScheme.primary,
grade: 200,
weight: 700,
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
Text( Text(

View File

@@ -13,7 +13,7 @@ class AccountCard extends StatelessWidget {
width: 300, width: 300,
padding: const EdgeInsets.all(20), padding: const EdgeInsets.all(20),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).primaryColor, color: Colors.white,
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
@@ -33,7 +33,7 @@ class AccountCard extends StatelessWidget {
Text( Text(
account.accountType, account.accountType,
style: TextStyle( style: TextStyle(
color: Theme.of(context).scaffoldBackgroundColor, color: Theme.of(context).colorScheme.onPrimary,
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -42,7 +42,7 @@ class AccountCard extends StatelessWidget {
account.accountType == 'Savings' account.accountType == 'Savings'
? Icons.savings ? Icons.savings
: Icons.account_balance, : Icons.account_balance,
color: Theme.of(context).scaffoldBackgroundColor, color: Theme.of(context).colorScheme.onPrimary,
), ),
], ],
), ),
@@ -50,13 +50,13 @@ class AccountCard extends StatelessWidget {
Text( Text(
account.accountNumber, account.accountNumber,
style: TextStyle( style: TextStyle(
color: Theme.of(context).scaffoldBackgroundColor, fontSize: 16), color: Theme.of(context).colorScheme.onPrimary, 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).colorScheme.onPrimary,
fontSize: 22, fontSize: 22,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -65,10 +65,11 @@ class AccountCard extends StatelessWidget {
Text( Text(
AppLocalizations.of(context).availableBalance, AppLocalizations.of(context).availableBalance,
style: TextStyle( style: TextStyle(
color: Theme.of(context).scaffoldBackgroundColor, fontSize: 16), color: Theme.of(context).colorScheme.onPrimary, fontSize: 16),
), ),
], ],
), ),
); );
} }
} }

View File

@@ -1,8 +1,6 @@
// ignore_for_file: use_build_context_synchronously // 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:material_symbols_icons/material_symbols_icons.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import '../../../l10n/app_localizations.dart'; import '../../../l10n/app_localizations.dart';
@@ -36,12 +34,13 @@ class _EnquiryScreen extends State<EnquiryScreen> {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(role, style: const TextStyle(color: Colors.grey)), Text(role,
style: TextStyle(color: Theme.of(context).colorScheme.onSurface)),
const SizedBox(height: 4), const SizedBox(height: 4),
GestureDetector( GestureDetector(
onTap: () => _launchEmailAddress(email), onTap: () => _launchEmailAddress(email),
child: Text(email, child: Text(email,
style: TextStyle(color: Theme.of(context).primaryColor)), style: TextStyle(color: Theme.of(context).colorScheme.primary)),
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
GestureDetector( GestureDetector(
@@ -58,33 +57,8 @@ class _EnquiryScreen extends State<EnquiryScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: IconButton( title: Text(AppLocalizations.of(context).enquiry),
icon: const Icon(Symbols.arrow_back_ios_new),
onPressed: () {
Navigator.pop(context);
},
),
title: Text(
AppLocalizations.of(context).enquiry,
style:
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
),
centerTitle: false, 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( body: Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
@@ -95,12 +69,11 @@ class _EnquiryScreen extends State<EnquiryScreen> {
const SizedBox(height: 20), const SizedBox(height: 20),
Text( Text(
AppLocalizations.of(context).writeToUs, AppLocalizations.of(context).writeToUs,
style: const TextStyle(color: Colors.grey),
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
Text( Text(
"complaint@kccb.in", "complaint@kccb.in",
style: TextStyle(color: Theme.of(context).primaryColor), style: TextStyle(color: Theme.of(context).colorScheme.primary),
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
@@ -108,11 +81,11 @@ class _EnquiryScreen extends State<EnquiryScreen> {
AppLocalizations.of(context).keyContacts, AppLocalizations.of(context).keyContacts,
style: TextStyle( style: TextStyle(
fontSize: 17, fontSize: 17,
color: Theme.of(context).primaryColor, color: Theme.of(context).colorScheme.primary,
), ),
// horizontal line // horizontal line
), ),
Divider(color: Colors.grey[300]), Divider(color: Theme.of(context).colorScheme.outline),
const SizedBox(height: 16), const SizedBox(height: 16),
_buildContactItem( _buildContactItem(
AppLocalizations.of(context).chairman, AppLocalizations.of(context).chairman,

View File

@@ -1,4 +1,3 @@
// ignore_for_file: avoid_print, use_build_context_synchronously, duplicate_ignore
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
@@ -16,6 +15,8 @@ import 'package:kmobile/di/injection.dart';
import 'package:kmobile/features/fund_transfer/screens/payment_animation.dart'; import 'package:kmobile/features/fund_transfer/screens/payment_animation.dart';
import 'package:kmobile/features/fund_transfer/screens/transaction_pin_screen.dart'; import 'package:kmobile/features/fund_transfer/screens/transaction_pin_screen.dart';
import '../../../l10n/app_localizations.dart'; import '../../../l10n/app_localizations.dart';
import 'package:kmobile/api/services/payment_service.dart';
import 'package:kmobile/data/models/transfer.dart';
enum TransactionMode { neft, rtgs, imps } enum TransactionMode { neft, rtgs, imps }
@@ -23,12 +24,14 @@ class FundTransferAmountScreen extends StatefulWidget {
final String debitAccountNo; final String debitAccountNo;
final Beneficiary creditBeneficiary; final Beneficiary creditBeneficiary;
final String remitterName; final String remitterName;
final bool isOwnBank;
const FundTransferAmountScreen({ const FundTransferAmountScreen({
super.key, super.key,
required this.debitAccountNo, required this.debitAccountNo,
required this.creditBeneficiary, required this.creditBeneficiary,
required this.remitterName, required this.remitterName,
this.isOwnBank = false,
}); });
@override @override
@@ -50,7 +53,35 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
void _onProceed() { void _onProceed() {
if (_formKey.currentState!.validate()) { if (_formKey.currentState!.validate()) {
final amount = double.tryParse(_amountController.text) ?? 0; final amount = double.tryParse(_amountController.text) ?? 0;
if (widget.isOwnBank) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => TransactionPinScreen(
onPinCompleted: (pinScreenContext, tpin) async {
final transfer = Transfer(
fromAccount: widget.debitAccountNo,
toAccount: widget.creditBeneficiary.accountNo,
toAccountType: 'Savings', // Assuming 'SB' for savings
amount: _amountController.text,
tpin: tpin,
);
final paymentService = getIt<PaymentService>();
final paymentResponseFuture =
paymentService.processQuickPayWithinBank(transfer);
Navigator.of(pinScreenContext).pushReplacement(
MaterialPageRoute(
builder: (_) => PaymentAnimationScreen(
paymentResponse: paymentResponseFuture),
),
);
},
),
),
);
} else {
if (_selectedMode == TransactionMode.rtgs && amount < 200000) { if (_selectedMode == TransactionMode.rtgs && amount < 200000) {
showDialog( showDialog(
context: context, context: context,
@@ -84,7 +115,6 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
tpin: tpin, tpin: tpin,
); );
final neftService = getIt<NeftService>(); final neftService = getIt<NeftService>();
final completer = Completer<PaymentResponse>(); final completer = Completer<PaymentResponse>();
Navigator.of(pinScreenContext).pushReplacement( Navigator.of(pinScreenContext).pushReplacement(
@@ -98,7 +128,8 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
final neftResponse = final neftResponse =
await neftService.processNeftTransaction(neftTx); await neftService.processNeftTransaction(neftTx);
final paymentResponse = PaymentResponse( final paymentResponse = PaymentResponse(
isSuccess: neftResponse.message.toUpperCase() == 'SUCCESS', isSuccess:
neftResponse.message.toUpperCase() == 'SUCCESS',
date: DateTime.now(), date: DateTime.now(),
creditedAccount: neftTx.toAccount, creditedAccount: neftTx.toAccount,
amount: neftTx.amount, amount: neftTx.amount,
@@ -107,35 +138,38 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
); );
completer.complete(paymentResponse); completer.complete(paymentResponse);
} on DioException catch (e) { } on DioException catch (e) {
print('dio exception'); String errorMessage;
print(e.toString()); if (e.response != null && e.response!.data != null) {
try {
final error = jsonDecode(e.response.toString())['error']; // final error = jsonDecode(e.response!.toString())['error'];
var errorMessage = { final error = e.response?.data['error'];
"INCORRECT_TPIN": errorMessage = {
AppLocalizations.of(context).correctTpin, "INCORRECT_TPIN": "Please Enter the correct TPIN",
"INSUFFICIENT_FUNDS": "INSUFFICIENT_FUNDS":
AppLocalizations.of(context).insufficientFund "Your account does not have sufficient balance"
}[error] ?? }[error] ??
AppLocalizations.of(context).somethingWentWrong; "Something Went Wrong";
} catch (_) {
errorMessage = "Something Went Wrong";
}
} else {
errorMessage = "Something Went Wrong";
}
final paymentResponse = PaymentResponse( final paymentResponse = PaymentResponse(
isSuccess: false, isSuccess: false,
errorMessage: errorMessage, errorMessage: errorMessage,
); );
completer.complete(paymentResponse); completer.complete(paymentResponse);
} catch (e) { } catch (e) {
print('generic exception'); if (!pinScreenContext.mounted) return;
print(e.toString());
final paymentResponse = PaymentResponse( final paymentResponse = PaymentResponse(
isSuccess: false, isSuccess: false,
errorMessage: errorMessage: AppLocalizations.of(pinScreenContext)
AppLocalizations.of(context).somethingWentWrong, .somethingWentWrong,
); );
completer.complete(paymentResponse); completer.complete(paymentResponse);
} }
} }
//IMPS transaction //IMPS transaction
else if (_selectedMode == TransactionMode.imps) { else if (_selectedMode == TransactionMode.imps) {
final impsTx = ImpsTransaction( final impsTx = ImpsTransaction(
@@ -161,7 +195,8 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
final impsResponse = final impsResponse =
await impsService.processImpsTransaction(impsTx); await impsService.processImpsTransaction(impsTx);
final paymentResponse = PaymentResponse( final paymentResponse = PaymentResponse(
isSuccess: impsResponse.message.toUpperCase() == 'SUCCESS', isSuccess:
impsResponse.message.toUpperCase() == 'SUCCESS',
date: DateTime.now(), date: DateTime.now(),
creditedAccount: impsTx.toAccount, creditedAccount: impsTx.toAccount,
amount: impsTx.amount, amount: impsTx.amount,
@@ -170,9 +205,6 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
); );
completer.complete(paymentResponse); completer.complete(paymentResponse);
} on DioException catch (e) { } on DioException catch (e) {
print('dio exception');
print(e.toString());
final error = jsonDecode(e.response.toString())['error']; final error = jsonDecode(e.response.toString())['error'];
var errorMessage = { var errorMessage = {
"INCORRECT_TPIN": "Please Enter the correct TPIN", "INCORRECT_TPIN": "Please Enter the correct TPIN",
@@ -187,15 +219,15 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
); );
completer.complete(paymentResponse); completer.complete(paymentResponse);
} catch (e) { } catch (e) {
print('generic exception');
print(e.toString());
final paymentResponse = PaymentResponse( final paymentResponse = PaymentResponse(
isSuccess: false, isSuccess: false,
errorMessage: "Something went Wrong", errorMessage: "Something went Wrong",
); );
completer.complete(paymentResponse); completer.complete(paymentResponse);
} }
} else { }
//RTGS
else {
final rtgsTx = RtgsTransaction( final rtgsTx = RtgsTransaction(
fromAccount: widget.debitAccountNo, fromAccount: widget.debitAccountNo,
toAccount: widget.creditBeneficiary.accountNo, toAccount: widget.creditBeneficiary.accountNo,
@@ -219,7 +251,8 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
final rtgsResponse = final rtgsResponse =
await rtgsService.processRtgsTransaction(rtgsTx); await rtgsService.processRtgsTransaction(rtgsTx);
final paymentResponse = PaymentResponse( final paymentResponse = PaymentResponse(
isSuccess: rtgsResponse.message.toUpperCase() == 'SUCCESS', isSuccess:
rtgsResponse.message.toUpperCase() == 'SUCCESS',
date: DateTime.now(), date: DateTime.now(),
creditedAccount: rtgsTx.toAccount, creditedAccount: rtgsTx.toAccount,
amount: rtgsTx.amount, amount: rtgsTx.amount,
@@ -228,18 +261,14 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
); );
completer.complete(paymentResponse); completer.complete(paymentResponse);
} on DioException catch (e) { } on DioException catch (e) {
print('dio exception');
print(e.toString());
final error = jsonDecode(e.response.toString())['error']; final error = jsonDecode(e.response.toString())['error'];
var errorMessage = { var errorMessage = {
"INCORRECT_TPIN": "INCORRECT_TPIN": "Please Enter the correct TPIN",
AppLocalizations.of(context).correctTpin,
"INSUFFICIENT_FUNDS": "INSUFFICIENT_FUNDS":
AppLocalizations.of(context).insufficientFund "Your account does not have sufficient balance"
// ignore: use_build_context_synchronously // ignore: use_build_context_synchronously
}[error] ?? }[error] ??
AppLocalizations.of(context).somethingWentWrong; "Something Went Wrong";
final paymentResponse = PaymentResponse( final paymentResponse = PaymentResponse(
isSuccess: false, isSuccess: false,
@@ -247,12 +276,9 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
); );
completer.complete(paymentResponse); completer.complete(paymentResponse);
} catch (e) { } catch (e) {
print('generic exception');
print(e.toString());
final paymentResponse = PaymentResponse( final paymentResponse = PaymentResponse(
isSuccess: false, isSuccess: false,
errorMessage: errorMessage: "Something Went Wrong",
AppLocalizations.of(context).somethingWentWrong,
); );
completer.complete(paymentResponse); completer.complete(paymentResponse);
} }
@@ -263,15 +289,17 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
); );
} }
} }
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final loc = AppLocalizations.of(context); final loc = AppLocalizations.of(context);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(loc.fundTransfer), title: Text(loc.fundTransfer.replaceFirst(RegExp('\n'), '')),
), ),
body: Padding( body: SafeArea(
child: Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: Form( child: Form(
key: _formKey, key: _formKey,
@@ -307,13 +335,15 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
elevation: 0, elevation: 0,
margin: const EdgeInsets.symmetric(vertical: 8.0), margin: const EdgeInsets.symmetric(vertical: 8.0),
child: ListTile( child: ListTile(
leading: getBankLogo(widget.creditBeneficiary.bankName), leading:
getBankLogo(widget.creditBeneficiary.bankName, context),
title: Text(widget.creditBeneficiary.name), title: Text(widget.creditBeneficiary.name),
subtitle: Text(widget.creditBeneficiary.accountNo), subtitle: Text(widget.creditBeneficiary.accountNo),
), ),
), ),
const SizedBox(height: 24), const SizedBox(height: 24),
if (!widget.isOwnBank) ...[
// Transaction Mode Selection // Transaction Mode Selection
Text( Text(
AppLocalizations.of(context).selectTransactionType, AppLocalizations.of(context).selectTransactionType,
@@ -339,13 +369,12 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
}, },
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
selectedColor: Theme.of(context).colorScheme.onPrimary, selectedColor: Theme.of(context).colorScheme.onPrimary,
fillColor: Theme.of(context).primaryColor, fillColor: Theme.of(context).colorScheme.primary,
color: Theme.of(context).colorScheme.onSurface, color: Theme.of(context).colorScheme.onSurface,
borderColor: Colors.transparent, borderColor: Colors.transparent,
selectedBorderColor: Colors.transparent, selectedBorderColor: Colors.transparent,
splashColor: Theme.of(context).primaryColor.withOpacity(0.1), splashColor: Theme.of(context).colorScheme.primary,
highlightColor: highlightColor: Theme.of(context).colorScheme.primary,
Theme.of(context).primaryColor.withOpacity(0.05),
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
@@ -366,7 +395,7 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
), ),
), ),
const SizedBox(height: 24), const SizedBox(height: 24),
],
// Amount // Amount
TextFormField( TextFormField(
controller: _amountController, controller: _amountController,
@@ -400,10 +429,12 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
child: Text(AppLocalizations.of(context).proceed), child: Text(AppLocalizations.of(context).proceed),
), ),
), ),
const SizedBox(height: 10),
], ],
), ),
), ),
), ),
),
); );
} }
} }

View File

@@ -10,8 +10,12 @@ import 'package:shimmer/shimmer.dart';
class FundTransferBeneficiaryScreen extends StatefulWidget { class FundTransferBeneficiaryScreen extends StatefulWidget {
final String creditAccountNo; final String creditAccountNo;
final String remitterName; final String remitterName;
final bool isOwnBank;
const FundTransferBeneficiaryScreen( const FundTransferBeneficiaryScreen(
{super.key, required this.creditAccountNo, required this.remitterName}); {super.key,
required this.creditAccountNo,
required this.remitterName,
required this.isOwnBank});
@override @override
State<FundTransferBeneficiaryScreen> createState() => State<FundTransferBeneficiaryScreen> createState() =>
@@ -33,7 +37,12 @@ class _FundTransferBeneficiaryScreenState
Future<void> _loadBeneficiaries() async { Future<void> _loadBeneficiaries() async {
final data = await service.fetchBeneficiaryList(); final data = await service.fetchBeneficiaryList();
setState(() { setState(() {
_beneficiaries = data; _beneficiaries = data
.where((b) => widget.isOwnBank
? b.bankName ==
'THE KANGRA CENTRAL CO-OP BANK LIMITED' // Assuming 'KCCB' is your bank's name
: b.bankName != 'THE KANGRA CENTRAL CO-OP BANK LIMITED')
.toList();
_isLoading = false; _isLoading = false;
}); });
} }
@@ -77,7 +86,7 @@ class _FundTransferBeneficiaryScreenState
leading: CircleAvatar( leading: CircleAvatar(
radius: 24, radius: 24,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
child: getBankLogo(beneficiary.bankName), child: getBankLogo(beneficiary.bankName, context),
), ),
title: Text(beneficiary.name), title: Text(beneficiary.name),
subtitle: Column( subtitle: Column(
@@ -100,6 +109,7 @@ class _FundTransferBeneficiaryScreenState
debitAccountNo: widget.creditAccountNo, debitAccountNo: widget.creditAccountNo,
creditBeneficiary: beneficiary, creditBeneficiary: beneficiary,
remitterName: widget.remitterName, remitterName: widget.remitterName,
isOwnBank: widget.isOwnBank,
), ),
), ),
); );

View File

@@ -1,153 +1,90 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:material_symbols_icons/material_symbols_icons.dart'; import 'package:kmobile/features/fund_transfer/screens/fund_transfer_beneficiary_screen.dart';
import 'package:material_symbols_icons/symbols.dart';
import '../../../l10n/app_localizations.dart'; import '../../../l10n/app_localizations.dart';
class FundTransferScreen extends StatefulWidget { class FundTransferScreen extends StatelessWidget {
const FundTransferScreen({super.key}); final String creditAccountNo;
final String remitterName;
@override const FundTransferScreen({
State<FundTransferScreen> createState() => _FundTransferScreen(); super.key,
} required this.creditAccountNo,
required this.remitterName,
class _FundTransferScreen extends State<FundTransferScreen> {
String amount = "";
void onKeyTap(String key) {
setState(() {
if (key == 'back') {
if (amount.isNotEmpty) {
amount = amount.substring(0, amount.length - 1);
}
} else if (key == 'done') {
if (kDebugMode) {
print('${AppLocalizations.of(context).amountEntered} $amount');
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => const TransactionPinScreen(
// transactionData: {},
// transactionCode: 'TRANSFER'
// )));
}
} else {
amount += key;
}
}); });
}
Widget buildKey(String value) {
if (value == 'done') {
return GestureDetector(
onTap: () => onKeyTap(value),
child: const Icon(Symbols.check, size: 30),
);
} else if (value == 'back') {
return GestureDetector(
onTap: () => onKeyTap(value),
child: const Icon(Symbols.backspace, size: 30),
);
} else {
return GestureDetector(
onTap: () => onKeyTap(value),
child: Center(
child: Text(
value,
style: const TextStyle(fontSize: 24, color: Colors.black),
),
),
);
}
}
final keys = [
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'done',
'0',
'back',
];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: IconButton( title: Text(AppLocalizations.of(context)
icon: const Icon(Symbols.arrow_back_ios_new), .fundTransfer
onPressed: () { .replaceFirst(RegExp('\n'), '')),
Navigator.pop(context); ),
body: ListView(
children: [
FundTransferManagementTile(
icon: Symbols.input_circle,
label: AppLocalizations.of(context).ownBank,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => FundTransferBeneficiaryScreen(
creditAccountNo: creditAccountNo,
remitterName: remitterName,
isOwnBank: true,
),
),
);
}, },
), ),
title: Text( const Divider(height: 1),
AppLocalizations.of(context).fundTransfer, FundTransferManagementTile(
style: icon: Symbols.output_circle,
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500), label: AppLocalizations.of(context).outsideBank,
), onTap: () {
centerTitle: false, Navigator.push(
actions: const [ context,
Padding( MaterialPageRoute(
padding: EdgeInsets.only(right: 10.0), builder: (context) => FundTransferBeneficiaryScreen(
child: CircleAvatar( creditAccountNo: creditAccountNo,
backgroundImage: AssetImage('assets/images/avatar.jpg'), remitterName: remitterName,
// Replace with your image isOwnBank: false,
radius: 20,
), ),
), ),
], );
), },
body: Column(
children: [
const Spacer(),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(AppLocalizations.of(context).debitFrom),
const Text(
'0300015678903456',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
),
],
),
const SizedBox(height: 20),
Text(
AppLocalizations.of(context).enterAmount,
style: const TextStyle(fontSize: 20),
),
const SizedBox(height: 20),
Container(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
decoration: BoxDecoration(
color: Colors.grey.shade200,
borderRadius: BorderRadius.circular(12),
),
child: Text(
amount.isEmpty ? "0" : amount,
style: const TextStyle(fontSize: 32, fontWeight: FontWeight.bold),
),
),
const Spacer(),
Container(
padding: const EdgeInsets.all(16.0),
color: Theme.of(context).scaffoldBackgroundColor,
child: GridView.count(
crossAxisCount: 3,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
mainAxisSpacing: 12,
crossAxisSpacing: 12,
childAspectRatio: 1.2,
children: keys.map((key) => buildKey(key)).toList(),
),
), ),
const Divider(height: 1),
], ],
), ),
); );
} }
} }
class FundTransferManagementTile extends StatelessWidget {
final IconData icon;
final String label;
final VoidCallback onTap;
final bool disable;
const FundTransferManagementTile({
super.key,
required this.icon,
required this.label,
required this.onTap,
this.disable = false,
});
@override
Widget build(BuildContext context) {
return ListTile(
leading: Icon(icon),
title: Text(label),
trailing: const Icon(Symbols.arrow_right, size: 20),
onTap: onTap,
enabled: !disable,
);
}
}

View File

@@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:kmobile/api/services/auth_service.dart'; import 'package:kmobile/api/services/auth_service.dart';
import 'package:kmobile/di/injection.dart'; import 'package:kmobile/di/injection.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 '../../../l10n/app_localizations.dart'; import '../../../l10n/app_localizations.dart';
@@ -15,15 +15,40 @@ class TransactionPinScreen extends StatefulWidget {
State<TransactionPinScreen> createState() => _TransactionPinScreenState(); State<TransactionPinScreen> createState() => _TransactionPinScreenState();
} }
class _TransactionPinScreenState extends State<TransactionPinScreen> { class _TransactionPinScreenState extends State<TransactionPinScreen>
with SingleTickerProviderStateMixin {
final List<String> _pin = []; final List<String> _pin = [];
bool _loading = true; bool _loading = true;
bool _isSubmitting = false; bool _isSubmitting = false;
late final AnimationController _bounceController;
late final Animation<double> _bounceAnimation;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_checkIfTpinIsSet(); _checkIfTpinIsSet();
_bounceController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 150),
);
_bounceAnimation = Tween<double>(begin: 1.0, end: 1.1).animate(
CurvedAnimation(
parent: _bounceController,
curve: Curves.elasticIn,
reverseCurve: Curves.elasticOut),
)..addStatusListener((status) {
if (status == AnimationStatus.completed) {
_bounceController.reverse();
}
});
}
@override
void dispose() {
_bounceController.dispose();
super.dispose();
} }
Future<void> _checkIfTpinIsSet() async { Future<void> _checkIfTpinIsSet() async {
@@ -58,6 +83,7 @@ class _TransactionPinScreenState extends State<TransactionPinScreen> {
if (_pin.isNotEmpty) _pin.removeLast(); if (_pin.isNotEmpty) _pin.removeLast();
} else if (_pin.length < 6) { } else if (_pin.length < 6) {
_pin.add(value); _pin.add(value);
_bounceController.forward(from: 0);
} }
}); });
} }
@@ -84,29 +110,46 @@ class _TransactionPinScreenState extends State<TransactionPinScreen> {
} }
Widget _buildPinIndicators() { Widget _buildPinIndicators() {
return AnimatedBuilder(
animation: _bounceAnimation,
builder: (context, child) {
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(6, (index) { children: List.generate(6, (index) {
return Container( final isAnimating =
index == _pin.length - 1 && _bounceController.isAnimating;
return Transform.scale(
scale: isAnimating ? _bounceAnimation.value : 1.0,
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 8), margin: const EdgeInsets.symmetric(horizontal: 8),
width: 20, width: 30,
height: 20, height: 30,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
border: Border.all(color: Theme.of(context).primaryColor, width: 2),
color: index < _pin.length color: index < _pin.length
? Theme.of(context).primaryColor ? Theme.of(context).colorScheme.onSurfaceVariant
: Colors.transparent, : Theme.of(context)
.colorScheme
.surfaceContainerHighest),
), ),
); );
}), }),
); );
});
} }
Widget _buildKey(String label, {IconData? icon}) { Widget _buildKey(String label, {IconData? icon}) {
return Expanded( return Expanded(
child: InkWell( child: InkWell(
onTap: () => label == 'done' ? _submitPin() : _onKeyPressed(label), onTap: () {
HapticFeedback.lightImpact();
if (label == 'done') {
_submitPin();
} else {
_onKeyPressed(label);
}
},
borderRadius: BorderRadius.circular(48),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(vertical: 20), padding: const EdgeInsets.symmetric(vertical: 20),
child: Center( child: Center(
@@ -143,22 +186,13 @@ class _TransactionPinScreenState extends State<TransactionPinScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: IconButton( title: Text(AppLocalizations.of(context).tpin),
icon: const Icon(Symbols.arrow_back_ios_new),
onPressed: () {
Navigator.pop(context);
},
),
title: Text(
AppLocalizations.of(context).tpin,
style:
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
),
centerTitle: false, centerTitle: false,
), ),
body: _loading body: _loading
? const Center(child: CircularProgressIndicator()) ? const Center(child: CircularProgressIndicator())
: Padding( : SafeArea(
child: Padding(
padding: const EdgeInsets.only(bottom: 20.0), padding: const EdgeInsets.only(bottom: 20.0),
child: Column( child: Column(
children: [ children: [
@@ -167,13 +201,15 @@ class _TransactionPinScreenState extends State<TransactionPinScreen> {
AppLocalizations.of(context).enterTpin, AppLocalizations.of(context).enterTpin,
style: const TextStyle(fontSize: 18), style: const TextStyle(fontSize: 18),
), ),
const SizedBox(height: 20), const SizedBox(height: 50),
_buildPinIndicators(), _buildPinIndicators(),
const Spacer(), const Spacer(),
_buildKeypad(), _buildKeypad(),
], ],
), ),
), ),
),
); );
} }
} }

View File

@@ -67,13 +67,13 @@ class _TransactionSuccessScreen extends State<TransactionSuccessScreen> {
const SizedBox(height: 6), const SizedBox(height: 6),
Text( Text(
"On $transactionDate", "On $transactionDate",
style: const TextStyle(fontSize: 14, color: Colors.black54), style: TextStyle(fontSize: 14, color: Theme.of(context).colorScheme.onSurface.withOpacity(0.6)),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
Text( Text(
"${AppLocalizations.of(context).toAccountNumber}: $creditAccount", "${AppLocalizations.of(context).toAccountNumber}: $creditAccount",
style: const TextStyle(fontSize: 12, color: Colors.black87), style: TextStyle(fontSize: 12, color: Theme.of(context).colorScheme.onSurface.withOpacity(0.8)),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
], ],
@@ -91,15 +91,15 @@ class _TransactionSuccessScreen extends State<TransactionSuccessScreen> {
child: OutlinedButton.icon( child: OutlinedButton.icon(
onPressed: _shareScreenshot, onPressed: _shareScreenshot,
icon: const Icon(Icons.share, size: 18), icon: const Icon(Icons.share, size: 18),
label: Text(AppLocalizations.of(context).share), label: Text(AppLocalizations.of(context).share,
style: TextStyle(color: Theme.of(context).colorScheme.onPrimaryContainer),
),
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: backgroundColor: Theme.of(context).primaryColorDark,
foregroundColor:
Theme.of(context).scaffoldBackgroundColor, Theme.of(context).scaffoldBackgroundColor,
foregroundColor: Theme.of(context).primaryColorLight,
side: const BorderSide(color: Colors.black, width: 1),
elevation: 0,
), ),
), ),
), ),

View File

@@ -22,7 +22,7 @@ class ColorThemeDialog extends StatelessWidget {
), ),
ListTile( ListTile(
leading: const CircleAvatar(backgroundColor: Colors.green), leading: const CircleAvatar(backgroundColor: Colors.green),
title: const Text('Green'), title: Text(AppLocalizations.of(context).green),
onTap: () { onTap: () {
context.read<ThemeCubit>().changeTheme(ThemeType.green); context.read<ThemeCubit>().changeTheme(ThemeType.green);
Navigator.pop(context); Navigator.pop(context);
@@ -30,7 +30,7 @@ class ColorThemeDialog extends StatelessWidget {
), ),
ListTile( ListTile(
leading: const CircleAvatar(backgroundColor: Colors.orange), leading: const CircleAvatar(backgroundColor: Colors.orange),
title: const Text('Orange'), title: Text(AppLocalizations.of(context).orange),
onTap: () { onTap: () {
context.read<ThemeCubit>().changeTheme(ThemeType.orange); context.read<ThemeCubit>().changeTheme(ThemeType.orange);
Navigator.pop(context); Navigator.pop(context);

View File

@@ -0,0 +1,23 @@
import 'package:flutter/material.dart';
class LogoutDialog extends StatelessWidget {
const LogoutDialog({super.key});
@override
Widget build(BuildContext context) {
return AlertDialog(
title: const Text("Logout"),
content: const Text("Are you sure you want to logout?"),
actions: [
TextButton(
onPressed: () => Navigator.pop(context, false), // dismiss
child: const Text("No"),
),
TextButton(
onPressed: () => Navigator.pop(context, true), // confirm
child: const Text("Yes"),
),
],
);
}
}

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:kmobile/features/profile/preferences/theme_mode_dialog.dart';
import 'language_dialog.dart'; import 'language_dialog.dart';
import 'color_theme_dialog.dart'; import 'color_theme_dialog.dart';
import '../../../l10n/app_localizations.dart'; import '../../../l10n/app_localizations.dart';
@@ -28,8 +29,7 @@ class PreferenceScreen extends StatelessWidget {
onTap: () { onTap: () {
showDialog( showDialog(
context: context, context: context,
builder: (_) => builder: (_) => const LanguageDialog(),
const LanguageDialog(), // your custom language dialog
); );
}, },
), ),
@@ -37,19 +37,14 @@ class PreferenceScreen extends StatelessWidget {
ListTile( ListTile(
leading: const Icon(Icons.brightness_6), leading: const Icon(Icons.brightness_6),
title: Text(AppLocalizations.of(context).themeMode), title: Text(AppLocalizations.of(context).themeMode),
enabled: false, onTap: () {
//trailing: Switch( showThemeModeDialog(context);
// value: state.isDarkMode, },
// onChanged: (val) {
// context.read<ThemeCubit>().toggleDarkMode(val);
// },
//),
), ),
//Color_Theme_Selection //Color_Theme_Selection
ListTile( ListTile(
leading: const Icon(Icons.color_lens), leading: const Icon(Icons.color_lens),
title: Text(AppLocalizations.of(context).themeColor), title: Text(AppLocalizations.of(context).themeColor),
//enabled: false,
onTap: () { onTap: () {
showDialog( showDialog(
context: context, context: context,

View File

@@ -0,0 +1,33 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:kmobile/features/auth/controllers/theme_mode_cubit.dart';
Future<void> showThemeModeDialog(BuildContext context) async {
final cubit = context.read<ThemeModeCubit>();
final currentMode = context.read<ThemeModeCubit>().state.mode;
await showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: const Text("Select Theme Mode"),
content: Column(
mainAxisSize: MainAxisSize.min,
children: ThemeMode.values.map((mode) {
return RadioListTile<ThemeMode>(
title: Text(mode.toString().split('.').last.toUpperCase()),
value: mode,
groupValue: currentMode,
onChanged: (value) {
if (value != null) {
cubit.changeThemeMode(value);
Navigator.pop(context);
}
},
);
}).toList(),
),
);
},
);
}

View File

@@ -1,10 +1,24 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:kmobile/data/repositories/auth_repository.dart';
import 'package:kmobile/features/profile/preferences/logout_dialog.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../di/injection.dart';
import '../../l10n/app_localizations.dart'; import '../../l10n/app_localizations.dart';
import 'package:kmobile/features/profile/preferences/preference_screen.dart'; import 'package:kmobile/features/profile/preferences/preference_screen.dart';
class ProfileScreen extends StatelessWidget { class ProfileScreen extends StatelessWidget {
const ProfileScreen({super.key}); const ProfileScreen({super.key});
Future<void> _handleLogout(BuildContext context) async {
final auth = getIt<AuthRepository>();
final prefs = await SharedPreferences.getInstance();
await prefs.clear(); // clear saved session/token
await auth.clearAuthTokens();
// Navigate to login and remove all previous routes
Navigator.pushNamedAndRemoveUntil(context, '/login', (route) => false);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final loc = AppLocalizations.of(context); final loc = AppLocalizations.of(context);
@@ -17,7 +31,7 @@ class ProfileScreen extends StatelessWidget {
children: [ children: [
ListTile( ListTile(
leading: const Icon(Icons.settings), leading: const Icon(Icons.settings),
title: Text(loc.preferences), // Localized "Preferences" title: Text(loc.preferences),
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
@@ -27,6 +41,20 @@ class ProfileScreen extends StatelessWidget {
}, },
), ),
// You can add more profile options here later // You can add more profile options here later
ListTile(
leading: const Icon(Icons.logout),
title: const Text("Logout"),
onTap: () async {
final shouldLogout = await showDialog<bool>(
context: context,
builder: (_) => const LogoutDialog(),
);
if (shouldLogout == true) {
await _handleLogout(context);
}
},
),
], ],
), ),
); );

View File

@@ -1,6 +1,6 @@
// ignore_for_file: use_build_context_synchronously
import 'dart:async'; import 'dart:async';
import 'dart:developer';
import 'package:dio/dio.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:kmobile/api/services/imps_service.dart'; import 'package:kmobile/api/services/imps_service.dart';
import 'package:kmobile/api/services/neft_service.dart'; import 'package:kmobile/api/services/neft_service.dart';
@@ -13,9 +13,7 @@ import 'package:kmobile/features/fund_transfer/screens/payment_animation.dart';
import 'package:kmobile/features/fund_transfer/screens/transaction_pin_screen.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_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 '../../../../di/injection.dart'; import '../../../../di/injection.dart';
import '../../../../api/services/beneficiary_service.dart'; import '../../../../api/services/beneficiary_service.dart';
@@ -52,7 +50,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
super.initState(); super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
setState(() { setState(() {
accountType = AppLocalizations.of(context).savings; accountType = 'Savings';
}); });
}); });
} }
@@ -214,6 +212,29 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
utr: neftResponse.utr, utr: neftResponse.utr,
); );
completer.complete(paymentResponse); completer.complete(paymentResponse);
} on DioException catch (e) {
String errorMessage;
if (e.response != null && e.response!.data != null) {
try {
// final error = jsonDecode(e.response!.toString())['error'];
final error = e.response?.data['error'];
errorMessage = {
"INCORRECT_TPIN": "Please Enter the correct TPIN",
"INSUFFICIENT_FUNDS":
"Your account does not have sufficient balance"
}[error] ??
"Something Went Wrong";
} catch (_) {
errorMessage = "Something Went Wrong";
}
} else {
errorMessage = "Something Went Wrong";
}
final paymentResponse = PaymentResponse(
isSuccess: false,
errorMessage: errorMessage,
);
completer.complete(paymentResponse);
} catch (e) { } catch (e) {
final paymentResponse = PaymentResponse( final paymentResponse = PaymentResponse(
isSuccess: false, isSuccess: false,
@@ -236,6 +257,9 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
); );
final impsService = getIt<ImpsService>(); final impsService = getIt<ImpsService>();
final completer = Completer<PaymentResponse>(); final completer = Completer<PaymentResponse>();
if (!pinScreenContext.mounted) {
return;
}
Navigator.of(pinScreenContext).pushReplacement( Navigator.of(pinScreenContext).pushReplacement(
MaterialPageRoute( MaterialPageRoute(
@@ -245,15 +269,29 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
); );
try { try {
final neftResponse = final impsResponse =
await impsService.processImpsTransaction(impsTx); await impsService.processImpsTransaction(impsTx);
final paymentResponse = PaymentResponse( final paymentResponse = PaymentResponse(
isSuccess: neftResponse.message.toUpperCase() == 'SUCCESS', isSuccess: impsResponse.message.toUpperCase() == 'SUCCESS',
date: DateTime.now(), date: DateTime.now(),
creditedAccount: impsTx.toAccount, creditedAccount: impsTx.toAccount,
amount: impsTx.amount, amount: impsTx.amount,
currency: 'INR', currency: 'INR',
utr: neftResponse.utr, utr: impsResponse.utr,
);
completer.complete(paymentResponse);
} on DioException catch (e) {
final error = e.response?.data['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); completer.complete(paymentResponse);
} catch (e) { } catch (e) {
@@ -278,7 +316,9 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
); );
final rtgsService = getIt<RtgsService>(); final rtgsService = getIt<RtgsService>();
final completer = Completer<PaymentResponse>(); final completer = Completer<PaymentResponse>();
if (!pinScreenContext.mounted) {
return;
}
Navigator.of(pinScreenContext).pushReplacement( Navigator.of(pinScreenContext).pushReplacement(
MaterialPageRoute( MaterialPageRoute(
builder: (_) => PaymentAnimationScreen( builder: (_) => PaymentAnimationScreen(
@@ -298,6 +338,22 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
utr: rtgsResponse.utr, utr: rtgsResponse.utr,
); );
completer.complete(paymentResponse); completer.complete(paymentResponse);
} on DioException catch (e) {
log('dio exception');
final error = e.response?.data['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) { } catch (e) {
final paymentResponse = PaymentResponse( final paymentResponse = PaymentResponse(
isSuccess: false, isSuccess: false,
@@ -317,33 +373,10 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: IconButton(
icon: const Icon(Symbols.arrow_back_ios_new),
onPressed: () {
Navigator.pop(context);
},
),
title: Text( title: Text(
AppLocalizations.of(context).quickPayOutsideBank, AppLocalizations.of(context).quickPayOutsideBank,
style:
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
), ),
centerTitle: false, 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( body: Padding(
padding: const EdgeInsets.all(12), padding: const EdgeInsets.all(12),
@@ -377,11 +410,13 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
isDense: true, isDense: true,
filled: true, filled: true,
fillColor: Theme.of(context).scaffoldBackgroundColor, fillColor: Theme.of(context).scaffoldBackgroundColor,
enabledBorder: const OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black), borderSide: BorderSide(
color: Theme.of(context).colorScheme.outline),
), ),
focusedBorder: const OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black, width: 2), borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary, width: 2),
), ),
), ),
controller: accountNumberController, controller: accountNumberController,
@@ -413,11 +448,13 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
isDense: true, isDense: true,
filled: true, filled: true,
fillColor: Theme.of(context).scaffoldBackgroundColor, fillColor: Theme.of(context).scaffoldBackgroundColor,
enabledBorder: const OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black), borderSide: BorderSide(
color: Theme.of(context).colorScheme.outline),
), ),
focusedBorder: const OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black, width: 2), borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary, width: 2),
), ),
), ),
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
@@ -434,6 +471,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
), ),
const SizedBox(height: 25), const SizedBox(height: 25),
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: TextFormField( child: TextFormField(
@@ -447,11 +485,14 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
isDense: true, isDense: true,
filled: true, filled: true,
fillColor: Theme.of(context).scaffoldBackgroundColor, fillColor: Theme.of(context).scaffoldBackgroundColor,
enabledBorder: const OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black), borderSide: BorderSide(
color: Theme.of(context).colorScheme.outline),
), ),
focusedBorder: const OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black, width: 2), borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary,
width: 2),
), ),
), ),
controller: ifscController, controller: ifscController,
@@ -482,7 +523,9 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
}, },
), ),
), ),
const SizedBox(width: 10), const SizedBox(
width: 10,
),
Expanded( Expanded(
child: DropdownButtonFormField<String>( child: DropdownButtonFormField<String>(
value: accountType, value: accountType,
@@ -492,16 +535,19 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
isDense: true, isDense: true,
filled: true, filled: true,
fillColor: Theme.of(context).scaffoldBackgroundColor, fillColor: Theme.of(context).scaffoldBackgroundColor,
enabledBorder: const OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black), borderSide: BorderSide(
color: Theme.of(context).colorScheme.outline),
), ),
focusedBorder: const OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black, width: 2), borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary,
width: 2),
), ),
), ),
items: [ items: [
AppLocalizations.of(context).savings, 'Savings',
AppLocalizations.of(context).current, 'Current',
] ]
.map( .map(
(e) => DropdownMenuItem(value: e, child: Text(e)), (e) => DropdownMenuItem(value: e, child: Text(e)),
@@ -524,14 +570,13 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
isDense: true, isDense: true,
filled: true, filled: true,
fillColor: Theme.of(context).dialogBackgroundColor, fillColor: Theme.of(context).dialogBackgroundColor,
enabledBorder: const OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black),
),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: Colors.black, color: Theme.of(context).colorScheme.outline),
width: 2,
), ),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary, width: 2),
), ),
), ),
), ),
@@ -545,12 +590,13 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
isDense: true, isDense: true,
filled: true, filled: true,
fillColor: Theme.of(context).dialogBackgroundColor, fillColor: Theme.of(context).dialogBackgroundColor,
enabledBorder: const OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black),
),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: Colors.black, color: Theme.of(context).colorScheme.outline),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary,
width: 2, width: 2,
), ),
), ),
@@ -593,7 +639,8 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
padding: const EdgeInsets.only(bottom: 24.0), padding: const EdgeInsets.only(bottom: 24.0),
child: Text( child: Text(
_validationError!, _validationError!,
style: const TextStyle(color: Colors.red), style:
TextStyle(color: Theme.of(context).colorScheme.error),
), ),
), ),
TextFormField( TextFormField(
@@ -605,11 +652,13 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
isDense: true, isDense: true,
filled: true, filled: true,
fillColor: Theme.of(context).dialogBackgroundColor, fillColor: Theme.of(context).dialogBackgroundColor,
enabledBorder: const OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black), borderSide: BorderSide(
color: Theme.of(context).colorScheme.outline),
), ),
focusedBorder: const OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black, width: 2), borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary, width: 2),
), ),
), ),
validator: (value) { validator: (value) {
@@ -633,11 +682,14 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
isDense: true, isDense: true,
filled: true, filled: true,
fillColor: Theme.of(context).scaffoldBackgroundColor, fillColor: Theme.of(context).scaffoldBackgroundColor,
enabledBorder: const OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black), borderSide: BorderSide(
color: Theme.of(context).colorScheme.outline),
), ),
focusedBorder: const OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black, width: 2), borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary,
width: 2),
), ),
), ),
textInputAction: TextInputAction.next, textInputAction: TextInputAction.next,
@@ -655,11 +707,14 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
isDense: true, isDense: true,
filled: true, filled: true,
fillColor: Theme.of(context).scaffoldBackgroundColor, fillColor: Theme.of(context).scaffoldBackgroundColor,
enabledBorder: const OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black), borderSide: BorderSide(
color: Theme.of(context).colorScheme.outline),
), ),
focusedBorder: const OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black, width: 2), borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary,
width: 2),
), ),
), ),
controller: amountController, controller: amountController,
@@ -696,7 +751,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
child: SwipeButton.expand( child: SwipeButton.expand(
thumb: Icon(Icons.arrow_forward, thumb: Icon(Icons.arrow_forward,
color: Theme.of(context).dialogBackgroundColor), color: Theme.of(context).dialogBackgroundColor),
activeThumbColor: Theme.of(context).primaryColor, activeThumbColor: Theme.of(context).colorScheme.primary,
activeTrackColor: activeTrackColor:
Theme.of(context).colorScheme.secondary.withAlpha(100), Theme.of(context).colorScheme.secondary.withAlpha(100),
borderRadius: BorderRadius.circular(30), borderRadius: BorderRadius.circular(30),
@@ -732,12 +787,12 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
padding: const EdgeInsets.symmetric(vertical: 5), padding: const EdgeInsets.symmetric(vertical: 5),
decoration: BoxDecoration( decoration: BoxDecoration(
color: isSelected color: isSelected
? Theme.of(context).primaryColor ? Theme.of(context).colorScheme.primary
: Theme.of(context).scaffoldBackgroundColor, : Theme.of(context).scaffoldBackgroundColor,
borderRadius: BorderRadius.circular(5), borderRadius: BorderRadius.circular(5),
border: Border.all( border: Border.all(
color: isSelected color: isSelected
? Theme.of(context).primaryColor ? Theme.of(context).colorScheme.primary
: Theme.of(context).scaffoldBackgroundColor, : Theme.of(context).scaffoldBackgroundColor,
width: isSelected ? 0 : 1.2, width: isSelected ? 0 : 1.2,
), ),
@@ -745,7 +800,8 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
alignment: Alignment.center, alignment: Alignment.center,
child: Text( child: Text(
transactionModes(context)[index], transactionModes(context)[index],
style: const TextStyle(color: Colors.black), style:
TextStyle(color: Theme.of(context).colorScheme.onSurface),
), ),
), ),
), ),

View File

@@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:kmobile/features/quick_pay/screens/quick_pay_outside_bank_screen.dart'; import 'package:kmobile/features/quick_pay/screens/quick_pay_outside_bank_screen.dart';
import 'package:kmobile/features/quick_pay/screens/quick_pay_within_bank_screen.dart'; import 'package:kmobile/features/quick_pay/screens/quick_pay_within_bank_screen.dart';
import 'package:material_symbols_icons/material_symbols_icons.dart'; import 'package:material_symbols_icons/material_symbols_icons.dart';
@@ -18,33 +17,9 @@ class _QuickPayScreen extends State<QuickPayScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: IconButton(
icon: const Icon(Symbols.arrow_back_ios_new),
onPressed: () {
Navigator.pop(context);
},
),
title: Text( title: Text(
AppLocalizations.of(context).quickPay.replaceAll('\n', ''), AppLocalizations.of(context).quickPay.replaceAll('\n', ''),
style:
const 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: ListView( body: ListView(
children: [ children: [

View File

@@ -1,13 +1,11 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.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/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:kmobile/features/fund_transfer/screens/payment_animation.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';
@@ -90,33 +88,13 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: IconButton(
icon: const Icon(Symbols.arrow_back_ios_new),
onPressed: () {
Navigator.pop(context);
},
),
title: Text( title: Text(
AppLocalizations.of(context).quickPayOwnBank, AppLocalizations.of(context).quickPayOwnBank,
style: style: TextStyle(
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500), color: Theme.of(context).colorScheme.onSurface,
fontWeight: FontWeight.w500),
), ),
centerTitle: false, 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( body: Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
@@ -147,11 +125,13 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
isDense: true, isDense: true,
filled: true, filled: true,
fillColor: Theme.of(context).scaffoldBackgroundColor, fillColor: Theme.of(context).scaffoldBackgroundColor,
enabledBorder: const OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black), borderSide: BorderSide(
color: Theme.of(context).colorScheme.outline),
), ),
focusedBorder: const OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black, width: 2), borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary, width: 2),
), ),
), ),
controller: accountNumberController, controller: accountNumberController,
@@ -177,11 +157,13 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
isDense: true, isDense: true,
filled: true, filled: true,
fillColor: Theme.of(context).scaffoldBackgroundColor, fillColor: Theme.of(context).scaffoldBackgroundColor,
enabledBorder: const OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black), borderSide: BorderSide(
color: Theme.of(context).colorScheme.outline),
), ),
focusedBorder: const OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black, width: 2), borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary, width: 2),
), ),
), ),
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
@@ -261,11 +243,13 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
isDense: true, isDense: true,
filled: true, filled: true,
fillColor: Theme.of(context).scaffoldBackgroundColor, fillColor: Theme.of(context).scaffoldBackgroundColor,
enabledBorder: const OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black), borderSide: BorderSide(
color: Theme.of(context).colorScheme.outline),
), ),
focusedBorder: const OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black, width: 2), borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary, width: 2),
), ),
), ),
value: _selectedAccountType, value: _selectedAccountType,
@@ -299,11 +283,13 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
isDense: true, isDense: true,
filled: true, filled: true,
fillColor: Theme.of(context).scaffoldBackgroundColor, fillColor: Theme.of(context).scaffoldBackgroundColor,
enabledBorder: const OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black), borderSide: BorderSide(
color: Theme.of(context).colorScheme.outline),
), ),
focusedBorder: const OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black, width: 2), borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary, width: 2),
), ),
), ),
controller: amountController, controller: amountController,
@@ -326,7 +312,7 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
child: SwipeButton.expand( child: SwipeButton.expand(
thumb: Icon(Icons.arrow_forward, thumb: Icon(Icons.arrow_forward,
color: Theme.of(context).dialogBackgroundColor), color: Theme.of(context).dialogBackgroundColor),
activeThumbColor: Theme.of(context).primaryColor, activeThumbColor: Theme.of(context).colorScheme.primary,
activeTrackColor: Theme.of( activeTrackColor: Theme.of(
context, context,
).colorScheme.secondary.withAlpha(100), ).colorScheme.secondary.withAlpha(100),
@@ -400,11 +386,12 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
isDense: true, isDense: true,
filled: true, filled: true,
fillColor: Theme.of(context).dialogBackgroundColor, fillColor: Theme.of(context).dialogBackgroundColor,
enabledBorder: const OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black), borderSide: BorderSide(color: Theme.of(context).colorScheme.outline),
), ),
focusedBorder: const OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black, width: 2), borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary, width: 2),
), ),
), ),
); );

View File

@@ -0,0 +1,35 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:lottie/lottie.dart';
class SecurityErrorScreen extends StatelessWidget {
final String message;
const SecurityErrorScreen({Key? key, required this.message}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Lottie.asset('assets/animations/error.json', height: 200),
const SizedBox(height: 20),
Text(
message,
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
),
const SizedBox(height: 40),
ElevatedButton(
onPressed: () => SystemChannels.platform.invokeMethod('SystemNavigator.pop'),
child: const Text('Okay'),
),
],
),
),
);
}
}

View File

@@ -20,34 +20,8 @@ class _ServiceScreen extends State<ServiceScreen> {
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
title: Text( title: Text(
AppLocalizations.of(context).services, AppLocalizations.of(context).services,
style:
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
), ),
centerTitle: false, centerTitle: false,
actions: [
// IconButton(
// icon: const Icon(Icons.notifications_outlined),
// onPressed: () {
// // Navigate to notifications
// },
// ),
Padding(
padding: const EdgeInsets.only(right: 10.0),
child: InkWell(
borderRadius: BorderRadius.circular(20),
onTap: () {
// Navigator.push(context, MaterialPageRoute(
// builder: (context) => const CustomerInfoScreen()));
},
child: const CircleAvatar(
backgroundImage: AssetImage(
'assets/images/avatar.jpg',
), // Replace with your image
radius: 20,
),
),
),
],
), ),
body: ListView( body: ListView(
children: [ children: [

View File

@@ -25,10 +25,10 @@
"hi": "Hi", "hi": "Hi",
"kMobile": "kMobile", "kMobile": "kMobile",
"scanBiometric": "Scan to enable Biometric login", "scanBiometric": "Scan to enable Biometric login",
"savingsAccount": "Savings Account", "savingsAccount": "Savings",
"loanAccount": "Loan Account", "loanAccount": "Loan",
"termDeposit": "Term Deposit Account", "termDeposit": "Term Deposit",
"recurringDeposit": "Recurring Deposit Account", "recurringDeposit": "Recurring Deposit",
"unknownAccount": "Unknown Account Type", "unknownAccount": "Unknown Account Type",
"customerInfo": "Customer \n Info", "customerInfo": "Customer \n Info",
"fundTransfer": "Fund \n Transfer", "fundTransfer": "Fund \n Transfer",
@@ -109,9 +109,8 @@
"gmNorth": "General Manager (North)", "gmNorth": "General Manager (North)",
"enquiry": "Enquiry", "enquiry": "Enquiry",
"fundTransferBeneficiary": "Fund Transfer - Beneficiary", "fundTransferBeneficiary": "Fund Transfer - Beneficiary",
"fundTransfer": "Fund Transfer",
"enterAmount": "Enter Amount", "enterAmount": "Enter Amount",
"accountInfo": "Account Info", "accountInfo": "Account \n Info",
"customerNumber": "Customer Number", "customerNumber": "Customer Number",
"productName": "Product Name", "productName": "Product Name",
"accountStatus": "Account Status", "accountStatus": "Account Status",
@@ -241,7 +240,7 @@
"invalidRtgsPopUp": "RTGS transactions require a minimum amount of 200,000. Please enter a higher amount or select NEFT as the transaction mode.", "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", "correctTpin": "Please Enter the correct TPIN",
"insufficientFund": "Your account does not have sufficient balance", "insufficientFund": "Your account does not have sufficient balance",
"creditedTo": "Credited To", "creditedTo": "Credit To",
"selectTransactionType": "Select transaction Type", "selectTransactionType": "Select transaction Type",
"proceed": "Proceed", "proceed": "Proceed",
"plsValidateBeneficiary": "Please validate beneficiary details first", "plsValidateBeneficiary": "Please validate beneficiary details first",
@@ -250,6 +249,45 @@
"findnearbybranched": "Find nearby branches", "findnearbybranched": "Find nearby branches",
"searchbranch": "Search Branch", "searchbranch": "Search Branch",
"searchbranchby": "Search by Branch Name / Code / IFSC", "searchbranchby": "Search by Branch Name / Code / IFSC",
"branchsearchsoon": "Branch search coming soon..." "branchsearchsoon": "Branch search coming soon...",
"loginFailed": "Login failed",
"invalidCredentials": "Invalid credentials",
"networkErrorDuringLogin": "Network error during login",
"unexpectedErrorDuringLogin": "Unexpected error during login",
"tokenRefreshFailed": "Token refresh failed",
"failedToRefreshToken": "Failed to refresh token",
"failedToCheckTpinStatus": "Failed to check TPIN status",
"networkErrorDuringTpinCheck": "Network error during TPIN check",
"unexpectedErrorDuringTpinCheck": "Unexpected error during TPIN check",
"failedToSetTpin": "Failed to set TPIN",
"networkErrorDuringTpinSetup": "Network error during TPIN setup",
"unexpectedErrorDuringTpinSetup": "Unexpected error during TPIN setup",
"failedToValidateBeneficiary": "Failed to validate beneficiary",
"networkError": "Network error",
"unexpectedError": "Unexpected error: ",
"invalidIfscCode": "INVALID IFSC CODE",
"invalidBeneficiaryDetails": "Invalid Beneficiary Details",
"failedToFetchBeneficiaries": "Failed to fetch beneficiaries",
"failedToDeleteBeneficiary": "Failed to delete beneficiary",
"impsTransactionFailedWithStatusCode": "IMPS transaction failed with status code: ",
"anUnexpectedErrorOccurred": "An unexpected error occurred: ",
"neftTransactionFailedWithStatusCode": "NEFT transaction failed with status code: ",
"unknownError": "Unknown error",
"failedToProcessQuickPayWithinBank": "Failed to process quick pay within bank: ",
"rtgsTransactionFailedWithStatusCode": "RTGS transaction failed with status code: ",
"failedToLoadCustomerDetails": "Failed to load customer details",
"routeNotFound": "Route not found!",
"pleaseValidateBeneficiaryDetailsFirst": "Please validate beneficiary details first.",
"beneficiaryAlreadyExists": "Beneficiary already exists",
"pleaseEnterAValidAndMatchingAccountNumber": "Please enter a valid and matching account number.",
"beneficiaryDeletedSuccessfully": "Beneficiary deleted successfully",
"areYouSureYouWantToDeleteThisBeneficiary": "Are you sure you want to delete this beneficiary?",
"yourAccountDoesNotHaveSufficientBalance": "Your account does not have sufficient balance",
"green": "Green",
"orange": "Orange",
"deleteBeneficiary": "Delete Beneficiary",
"beneficiarydetails": "Beneficiary Details",
"delete": "Delete",
"search": "Search",
"viewCardDeatils": "View Card Details"
} }

View File

@@ -241,7 +241,7 @@
"invalidRtgsPopUp": "RTGS लेनदेन के लिए न्यूनतम 2,00,000 रुपये की राशि की आवश्यकता होती है। कृपया अधिक राशि दर्ज करें या लेनदेन मोड के रूप में NEFT चुनें", "invalidRtgsPopUp": "RTGS लेनदेन के लिए न्यूनतम 2,00,000 रुपये की राशि की आवश्यकता होती है। कृपया अधिक राशि दर्ज करें या लेनदेन मोड के रूप में NEFT चुनें",
"correctTpin": "कृपया सही टी-पिन दर्ज करें", "correctTpin": "कृपया सही टी-पिन दर्ज करें",
"insufficientFund": "आपके खाते में पर्याप्त शेष राशि नहीं है", "insufficientFund": "आपके खाते में पर्याप्त शेष राशि नहीं है",
"creditedTo": "को श्रेय दिया गया", "creditedTo": "को श्रेय",
"selectTransactionType": "लेन-देन का प्रकार चुनें", "selectTransactionType": "लेन-देन का प्रकार चुनें",
"proceed": "आगे बढ़ना", "proceed": "आगे बढ़ना",
"plsValidateBeneficiary": "कृपया पहले लाभार्थी विवरण सत्यापित करें", "plsValidateBeneficiary": "कृपया पहले लाभार्थी विवरण सत्यापित करें",
@@ -250,5 +250,45 @@
"findnearbybranched": "आस-पास की शाखाएँ खोजें", "findnearbybranched": "आस-पास की शाखाएँ खोजें",
"searchbranch": "शाखा खोजें", "searchbranch": "शाखा खोजें",
"searchbranchby": "शाखा खोजें नाम / बैंक कोड / आईएफएससी द्वारा", "searchbranchby": "शाखा खोजें नाम / बैंक कोड / आईएफएससी द्वारा",
"branchsearchsoon": "शाखा खोज सुविधा जल्द ही आ रही है..." "branchsearchsoon": "शाखा खोज सुविधा जल्द ही आ रही है...",
"loginFailed": "लॉगिन विफल",
"invalidCredentials": "अवैध प्रत्यय पत्र",
"networkErrorDuringLogin": "लॉगिन के दौरान नेटवर्क त्रुटि",
"unexpectedErrorDuringLogin": "लॉगिन के दौरान अप्रत्याशित त्रुटि",
"tokenRefreshFailed": "टोकन ताज़ा विफल रहा",
"failedToRefreshToken": "टोकन रीफ़्रेश करने में विफल",
"failedToCheckTpinStatus": "टी-पिन स्थिति की जाँच करने में विफल",
"networkErrorDuringTpinCheck": "टी-पिन जाँच के दौरान नेटवर्क त्रुटि",
"unexpectedErrorDuringTpinCheck": "TPIN जाँच के दौरान अप्रत्याशित त्रुटि",
"failedToSetTpin": "Tpin सेट करने में विफल",
"networkErrorDuringTpinSetup": "Tpin सेटअप के दौरान नेटवर्क त्रुटि",
"unexpectedErrorDuringTpinSetup": "TPIN सेटअप के दौरान अप्रत्याशित त्रुटि",
"failedToValidateBeneficiary": "लाभार्थी को सत्यापित करने में विफल",
"networkError": "नेटवर्क त्रुटि",
"unexpectedError": "अप्रत्याशित त्रुटि:",
"invalidIfscCode": "अमान्य IFSC कोड",
"invalidBeneficiaryDetails": "अमान्य लाभार्थी विवरण",
"failedToFetchBeneficiaries": "लाभार्थियों को प्राप्त करने में विफल",
"failedToDeleteBeneficiary": "लाभार्थी को हटाने में विफल",
"impsTransactionFailedWithStatusCode": "IMPS लेन-देन स्थिति कोड के साथ विफल:",
"anUnexpectedErrorOccurred": "एक अप्रत्याशित त्रुटि हुई:",
"neftTransactionFailedWithStatusCode": "NEFT लेन-देन स्थिति कोड के साथ विफल:",
"unknownError": "अज्ञात त्रुटि",
"failedToProcessQuickPayWithinBank": "बैंक के भीतर क्विक पे संसाधित करने में विफल:",
"rtgsTransactionFailedWithStatusCode": "RTGS लेन-देन स्थिति कोड के साथ विफल:",
"failedToLoadCustomerDetails": "ग्राहक विवरण लोड करने में विफल",
"routeNotFound": "रूट नहीं मिला!",
"pleaseValidateBeneficiaryDetailsFirst": "कृपया पहले लाभार्थी विवरण सत्यापित करें।",
"beneficiaryAlreadyExists": "लाभार्थी पहले से मौजूद है",
"pleaseEnterAValidAndMatchingAccountNumber": "कृपया एक मान्य और मिलान करने वाला खाता संख्या दर्ज करें।",
"beneficiaryDeletedSuccessfully": "लाभार्थी सफलतापूर्वक हटाया गया।",
"areYouSureYouWantToDeleteThisBeneficiary": "क्या आप वाकई इस लाभार्थी को हटाना चाहते हैं?",
"yourAccountDoesNotHaveSufficientBalance": "आपके खाते में पर्याप्त शेष राशि नहीं है",
"green": "हरा",
"orange": "नारंगी",
"deleteBeneficiary": "लाभार्थी हटाएं",
"beneficiarydetails": "लाभार्थी विवरण",
"delete": "मिटाओ",
"search": "खोजें",
"viewCardDeatils": "कार्ड विवरण देखें"
} }

View File

@@ -1,5 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:kmobile/features/security/security_error_screen.dart';
import 'package:kmobile/security/security_service.dart';
import 'di/injection.dart'; import 'di/injection.dart';
import 'app.dart'; import 'app.dart';
@@ -12,6 +14,15 @@ void main() async {
DeviceOrientation.portraitDown, DeviceOrientation.portraitDown,
]); ]);
// Check for device compromise
final compromisedMessage = await SecurityService.deviceCompromisedMessage;
// if (compromisedMessage != null) {
// runApp(MaterialApp(
// home: SecurityErrorScreen(message: compromisedMessage),
// ));
// return;
// }
// Initialize dependencies // Initialize dependencies
await setupDependencies(); await setupDependencies();
runApp(const KMobile()); runApp(const KMobile());

View File

@@ -0,0 +1,31 @@
import 'dart:io';
import 'package:jailbreak_root_detection/jailbreak_root_detection.dart';
class SecurityService {
static Future<String?> get deviceCompromisedMessage async {
final isNotTrust = await JailbreakRootDetection.instance.isNotTrust;
if (isNotTrust) {
return 'Your device is rooted or jailbroken. For security reasons, you cannot access our services on a compromised device.';
}
final isRealDevice = await JailbreakRootDetection.instance.isRealDevice;
if (!isRealDevice) {
return 'Emulators are not allowed to access our services. Please use a real device.';
}
if (Platform.isAndroid) {
try {
final isOnExternalStorage =
await JailbreakRootDetection.instance.isOnExternalStorage;
if (isOnExternalStorage) {
return 'The application cannot be run from external storage.';
}
} catch (e) {
// Ignore
}
}
return null;
}
}

View File

@@ -1,6 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
Widget getBankLogo(String? bankName) { Widget getBankLogo(String? bankName, BuildContext context) {
if (bankName != null && bankName.toLowerCase().contains('state bank of')) { if (bankName != null && bankName.toLowerCase().contains('state bank of')) {
return Image.asset( return Image.asset(
'assets/images/sbi_logo.png', 'assets/images/sbi_logo.png',
@@ -10,7 +10,7 @@ Widget getBankLogo(String? bankName) {
} }
if (bankName != null && bankName.toLowerCase().contains('kangra central')) { if (bankName != null && bankName.toLowerCase().contains('kangra central')) {
return Image.asset( return Image.asset(
'assets/images/icon.png', 'assets/images/logo.png',
width: 40, width: 40,
height: 40, height: 40,
); );
@@ -72,10 +72,10 @@ Widget getBankLogo(String? bankName) {
height: 40, height: 40,
); );
} else { } else {
return const Icon( return Icon(
Icons.account_balance, Icons.account_balance,
size: 40, size: 40,
color: Colors.grey, color: Theme.of(context).colorScheme.outline,
); );
} }
} }

View File

@@ -357,6 +357,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.19.0" version: "0.19.0"
jailbreak_root_detection:
dependency: "direct main"
description:
name: jailbreak_root_detection
sha256: c611229940a09785bd686364e92a40b07724926d2496c931527805101eb3da86
url: "https://pub.dev"
source: hosted
version: "1.1.6"
js: js:
dependency: transitive dependency: transitive
description: description:

View File

@@ -36,6 +36,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.6 cupertino_icons: ^1.0.6
jailbreak_root_detection: ^1.1.6
equatable: ^2.0.7 equatable: ^2.0.7
dio: ^5.8.0+1 dio: ^5.8.0+1
flutter_secure_storage: ^9.2.4 flutter_secure_storage: ^9.2.4