diff --git a/lib/di/injection.dart b/lib/di/injection.dart index 2e705c3..3312de2 100644 --- a/lib/di/injection.dart +++ b/lib/di/injection.dart @@ -71,9 +71,9 @@ Dio _createDioClient() { final dio = Dio( BaseOptions( baseUrl: - // 'http://lb-test-mobile-banking-app-192209417.ap-south-1.elb.amazonaws.com:8080', //test + 'http://lb-test-mobile-banking-app-192209417.ap-south-1.elb.amazonaws.com:8080', //test //'http://lb-kccb-mobile-banking-app-848675342.ap-south-1.elb.amazonaws.com', //prod - 'https://kccbmbnk.net', //prod small + //'https://kccbmbnk.net', //prod small connectTimeout: const Duration(seconds: 60), receiveTimeout: const Duration(seconds: 60), headers: { diff --git a/lib/features/dashboard/screens/dashboard_screen.dart b/lib/features/dashboard/screens/dashboard_screen.dart index a3b3b10..1955367 100644 --- a/lib/features/dashboard/screens/dashboard_screen.dart +++ b/lib/features/dashboard/screens/dashboard_screen.dart @@ -222,12 +222,17 @@ class _DashboardScreenState extends State onTap: () { final authState = context.read().state; String mobileNumberToPass = ''; - + String customerNo =''; + String customerName = ''; if (authState is Authenticated) { if (selectedAccountIndex >= 0 && selectedAccountIndex < authState.users.length) { mobileNumberToPass = authState.users[selectedAccountIndex].mobileNo ?? ''; + customerNo = + authState.users[selectedAccountIndex].cifNumber ?? ''; + customerName= + authState.users[selectedAccountIndex].name ?? ''; } } @@ -235,7 +240,7 @@ class _DashboardScreenState extends State context, MaterialPageRoute( builder: (context) => - ProfileScreen(mobileNumber: mobileNumberToPass), + ProfileScreen(mobileNumber: mobileNumberToPass, customerNo: customerNo, customerName: customerName), ), ); }, diff --git a/lib/features/profile/profile_screen.dart b/lib/features/profile/profile_screen.dart index 6f02d52..ad4fbb6 100644 --- a/lib/features/profile/profile_screen.dart +++ b/lib/features/profile/profile_screen.dart @@ -15,7 +15,9 @@ import 'package:kmobile/features/profile/preferences/preference_screen.dart'; class ProfileScreen extends StatefulWidget { final String mobileNumber; - const ProfileScreen({super.key, required this.mobileNumber}); + final String customerNo; + final String customerName; + const ProfileScreen({super.key, required this.mobileNumber, required this.customerNo, required this.customerName}); @override State createState() => _ProfileScreenState(); @@ -157,80 +159,352 @@ class _ProfileScreenState extends State { } } - @override - Widget build(BuildContext context) { - final loc = AppLocalizations.of(context); + // @override + // Widget build(BuildContext context) { + // final loc = AppLocalizations.of(context); - return Scaffold( - appBar: AppBar( - title: Text(loc.profile), // Localized "Profile" - ), - body: Stack( - children: [ - ListView( - children: [ - ListTile( - leading: const Icon(Icons.settings), - title: Text(loc.preferences), - trailing: const Icon(Icons.chevron_right), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const PreferenceScreen()), - ); - }, + // return Scaffold( + // appBar: AppBar( + // title: Text(loc.profile), // Localized "Profile" + // ), + // body: Stack( + // children: [ + // ListView( + // children: [ + // ListTile( + // leading: const Icon(Icons.settings), + // title: Text(loc.preferences), + // trailing: const Icon(Icons.chevron_right), + // onTap: () { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => const PreferenceScreen()), + // ); + // }, + // ), + // ListTile( + // leading: const Icon(Icons.security), + // title: Text(loc.securitySettings), + // trailing: const Icon(Icons.chevron_right), + // onTap: () { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => SecuritySettingsScreen( + // mobileNumber: widget.mobileNumber, + // ), + // ), + // ); + // }, + // ), + // ListTile( + // leading: const Icon(Icons.currency_rupee), + // title: Text(AppLocalizations.of(context).dailylimit), + // onTap: () { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => const DailyLimitScreen()), + // ); + // }, + // ), + // SwitchListTile( + // title: + // Text(AppLocalizations.of(context).enableFingerprintLogin), + // value: _isBiometricEnabled, + // onChanged: (bool value) { + // // The state is now managed within _handleBiometricToggle + // _handleBiometricToggle(value); + // }, + // secondary: const Icon(Icons.fingerprint), + // ), + // ListTile( + // leading: const Icon(Icons.smartphone), + // title: const Text("App Version"), + // trailing: FutureBuilder( + // future: _getAppVersion(), + // builder: + // (BuildContext context, AsyncSnapshot snapshot) { + // if (snapshot.connectionState == ConnectionState.waiting) { + // // Show a loading indicator while waiting for the future to complete + // return const CircularProgressIndicator(); + // } else if (snapshot.hasError) { + // return const Text("Error"); + // } else { + // // Display the version number once the future is complete + // return Text( + // snapshot.data ?? "N/A", + // selectionColor: const Color(0xFFFFFFFF), + // ); + // } + // }, + // ), + // ), + // ListTile( + // leading: const Icon(Icons.exit_to_app), + // title: Text(AppLocalizations.of(context).logout), + // onTap: () async { + // final shouldExit = await showDialog( + // context: context, + // builder: (context) => AlertDialog( + // title: Text(AppLocalizations.of(context).logout), + // content: Text(AppLocalizations.of(context).logoutCheck), + // actions: [ + // TextButton( + // onPressed: () => Navigator.of(context).pop(false), + // child: Text(AppLocalizations.of(context).no), + // ), + // TextButton( + // onPressed: () => Navigator.of(context).pop(true), + // child: Text(AppLocalizations.of(context).yes), + // ), + // ], + // ), + // ); + + // if (shouldExit == true) { + // if (Platform.isAndroid) { + // SystemNavigator.pop(); + // } + // exit(0); + // } + // }, + // ), + // ListTile( + // leading: const Icon(Icons.logout), + // title: Text(AppLocalizations.of(context).deregister), + // onTap: () async { + // final shouldLogout = await showDialog( + // context: context, + // builder: (_) => const LogoutDialog(), + // ); + + // if (shouldLogout == true) { + // await _handleLogout(context); + // } + // }, + // ), + // ], + // ), + // IgnorePointer( + // child: Center( + // child: Opacity( + // opacity: 0.07, // Reduced opacity + // child: ClipOval( + // child: Image.asset( + // 'assets/images/logo.png', + // width: 200, // Adjust size as needed + // height: 200, // Adjust size as needed + // ), + // ), + // ), + // ), + // ), + // ], + // ), + // ); + // } + @override +Widget build(BuildContext context) { + final loc = AppLocalizations.of(context); + + return Scaffold( + appBar: AppBar( + title: Text(loc.profile), + elevation: 0, + ), + body: Stack( + children: [ + ListView( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + children: [ + // ===== Profile Header ===== + Container( + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.05), + blurRadius: 8, + offset: const Offset(0, 4), + ), + ], ), - ListTile( - leading: const Icon(Icons.security), - title: Text(loc.securitySettings), - trailing: const Icon(Icons.chevron_right), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => SecuritySettingsScreen( - mobileNumber: widget.mobileNumber, + child: Row( + children: [ + // Avatar + Container( + width: 56, + height: 56, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.grey.shade200, + image: const DecorationImage( + image: AssetImage('assets/images/logo.png'), + fit: BoxFit.cover, ), ), - ); - }, + ), + const SizedBox(width: 12), + // Name + mobile + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + // If you want to show the user's name instead, replace below. + widget.customerName, + style: const TextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 4), + Text( + widget.customerNo, + style: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ), + ], + ), + ), + // Edit/Profile button (optional) + TextButton.icon( + onPressed: () { + // TODO: Navigate to edit profile if required + }, + icon: const Icon(Icons.edit, size: 18), + label: const Text("Edit"), + style: TextButton.styleFrom( + foregroundColor: Colors.blueGrey.shade700, + ), + ), + ], ), - ListTile( - leading: const Icon(Icons.currency_rupee), - title: Text(AppLocalizations.of(context).dailylimit), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const DailyLimitScreen()), - ); - }, + ), + + const SizedBox(height: 16), + + // ===== Section: Settings ===== + const Text( + "Settings", + style: TextStyle( + fontSize: 13, + fontWeight: FontWeight.w600, + letterSpacing: 0.2, ), - SwitchListTile( - title: - Text(AppLocalizations.of(context).enableFingerprintLogin), + ), + const SizedBox(height: 8), + + _SectionTile( + leadingIcon: Icons.settings, + title: loc.preferences, + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const PreferenceScreen(), + ), + ); + }, + ), + _SectionTile( + leadingIcon: Icons.security, + title: loc.securitySettings, + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => SecuritySettingsScreen( + mobileNumber: widget.mobileNumber, + ), + ), + ); + }, + ), + _SectionTile( + leadingIcon: Icons.currency_rupee, + title: loc.dailylimit, + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const DailyLimitScreen(), + ), + ); + }, + ), + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.05), + blurRadius: 8, + offset: const Offset(0, 4), + ), + ], + ), + child: SwitchListTile( + title: Text(loc.enableFingerprintLogin), value: _isBiometricEnabled, onChanged: (bool value) { - // The state is now managed within _handleBiometricToggle _handleBiometricToggle(value); }, secondary: const Icon(Icons.fingerprint), + contentPadding: + const EdgeInsets.symmetric(horizontal: 16, vertical: 4), ), - ListTile( + ), + + const SizedBox(height: 16), + const Divider(height: 24), + + // ===== Section: Security & App ===== + Text( + loc.appVersion, + style: const TextStyle( + fontSize: 13, + fontWeight: FontWeight.w600, + letterSpacing: 0.2, + ), + ), + const SizedBox(height: 8), + + // Fingerprint toggle inside a styled container + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.05), + blurRadius: 8, + offset: const Offset(0, 4), + ), + ], + ), + child: ListTile( leading: const Icon(Icons.smartphone), - title: const Text("App Version"), + title: Text(loc.appVersion), trailing: FutureBuilder( future: _getAppVersion(), - builder: - (BuildContext context, AsyncSnapshot snapshot) { + builder: (BuildContext context, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { - // Show a loading indicator while waiting for the future to complete - return const CircularProgressIndicator(); + return const SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator(strokeWidth: 2), + ); } else if (snapshot.hasError) { - return const Text("Error"); + return Text(loc.error); } else { - // Display the version number once the future is complete return Text( snapshot.data ?? "N/A", selectionColor: const Color(0xFFFFFFFF), @@ -238,69 +512,141 @@ class _ProfileScreenState extends State { } }, ), + contentPadding: + const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), ), - ListTile( - leading: const Icon(Icons.exit_to_app), - title: Text(AppLocalizations.of(context).logout), - onTap: () async { - final shouldExit = await showDialog( - context: context, - builder: (context) => AlertDialog( - title: Text(AppLocalizations.of(context).logout), - content: Text(AppLocalizations.of(context).logoutCheck), - actions: [ - TextButton( - onPressed: () => Navigator.of(context).pop(false), - child: Text(AppLocalizations.of(context).no), - ), - TextButton( - onPressed: () => Navigator.of(context).pop(true), - child: Text(AppLocalizations.of(context).yes), - ), - ], - ), - ); + ), - if (shouldExit == true) { - if (Platform.isAndroid) { - SystemNavigator.pop(); - } - exit(0); - } - }, - ), - ListTile( - leading: const Icon(Icons.logout), - title: Text(AppLocalizations.of(context).deregister), - onTap: () async { - final shouldLogout = await showDialog( - context: context, - builder: (_) => const LogoutDialog(), - ); + const SizedBox(height: 16), + const Divider(height: 24), - if (shouldLogout == true) { - await _handleLogout(context); - } - }, + // ===== Section: Actions ===== + const Text( + "Exit", + style: TextStyle( + fontSize: 13, + fontWeight: FontWeight.w600, + letterSpacing: 0.2, ), - ], - ), - IgnorePointer( + ), + const SizedBox(height: 8), + + _SectionTile( + leadingIcon: Icons.exit_to_app, + title: loc.logout, + trailChevron: false, // action tile, no chevron + onTap: () async { + final shouldExit = await showDialog( + context: context, + builder: (context) => AlertDialog( + title: Text(loc.logout), + content: Text(loc.logoutCheck), + actions: [ + TextButton( + onPressed: () => Navigator.of(context).pop(false), + child: Text(loc.no), + ), + TextButton( + onPressed: () => Navigator.of(context).pop(true), + child: Text(loc.yes), + ), + ], + ), + ); + + if (shouldExit == true) { + if (Platform.isAndroid) { + SystemNavigator.pop(); + } + exit(0); + } + }, + ), + _SectionTile( + leadingIcon: Icons.logout, + title: loc.deregister, + trailChevron: false, + onTap: () async { + final shouldLogout = await showDialog( + context: context, + builder: (_) => const LogoutDialog(), + ); + + if (shouldLogout == true) { + await _handleLogout(context); + } + }, + ), + + const SizedBox(height: 24), + ], + ), + + // ===== Watermark (kept subtle, no theme change) ===== + IgnorePointer( + child: Positioned.fill( child: Center( child: Opacity( - opacity: 0.07, // Reduced opacity + opacity: 0.06, child: ClipOval( child: Image.asset( 'assets/images/logo.png', - width: 200, // Adjust size as needed - height: 200, // Adjust size as needed + width: 200, + height: 200, + filterQuality: FilterQuality.medium, ), ), ), ), ), + ), + ], + ), + ); +} +} +class _SectionTile extends StatelessWidget { + const _SectionTile({ + required this.leadingIcon, + required this.title, + this.onTap, + this.trailChevron = true, + }); + + final IconData leadingIcon; + final String title; + final VoidCallback? onTap; + final bool trailChevron; + + @override + Widget build(BuildContext context) { + return Container( + margin: const EdgeInsets.only(bottom: 10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.05), + blurRadius: 8, + offset: const Offset(0, 4), + ), ], ), + child: ListTile( + leading: Icon(leadingIcon), + title: Text(title), + trailing: trailChevron ? const Icon(Icons.chevron_right) : null, + onTap: onTap, + contentPadding: + const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + ), ); } } diff --git a/lib/main.dart b/lib/main.dart index c6920a2..b73e538 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -15,13 +15,13 @@ void main() async { ]); // Check for device compromise - final compromisedMessage = await SecurityService.deviceCompromisedMessage; - if (compromisedMessage != null) { - runApp(MaterialApp( - home: SecurityErrorScreen(message: compromisedMessage), - )); - return; - } + //final compromisedMessage = await SecurityService.deviceCompromisedMessage; + // if (compromisedMessage != null) { + // runApp(MaterialApp( + // home: SecurityErrorScreen(message: compromisedMessage), + // )); + // return; + // } await setupDependencies(); runApp(const KMobile()); } diff --git a/pubspec.lock b/pubspec.lock index 6e600bd..167c712 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -69,10 +69,10 @@ packages: dependency: transitive description: name: characters - sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.3.0" checked_yaml: dependency: transitive description: @@ -93,18 +93,18 @@ packages: dependency: transitive description: name: clock - sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.1.1" collection: dependency: transitive description: name: collection - sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.19.1" + version: "1.18.0" confetti: dependency: "direct main" description: @@ -181,10 +181,10 @@ packages: dependency: transitive description: name: fake_async - sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" url: "https://pub.dev" source: hosted - version: "1.3.3" + version: "1.3.1" ffi: dependency: transitive description: @@ -385,10 +385,10 @@ packages: dependency: "direct main" description: name: intl - sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5" + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf url: "https://pub.dev" source: hosted - version: "0.20.2" + version: "0.19.0" jailbreak_root_detection: dependency: "direct main" description: @@ -417,26 +417,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" url: "https://pub.dev" source: hosted - version: "11.0.2" + version: "10.0.5" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" url: "https://pub.dev" source: hosted - version: "3.0.10" + version: "3.0.5" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.1" lints: dependency: transitive description: @@ -497,10 +497,10 @@ packages: dependency: transitive description: name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.17" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: @@ -521,10 +521,10 @@ packages: dependency: transitive description: name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.15.0" mime: dependency: transitive description: @@ -561,10 +561,10 @@ packages: dependency: transitive description: name: path - sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.9.0" path_parsing: dependency: transitive description: @@ -817,7 +817,7 @@ packages: dependency: transitive description: flutter source: sdk - version: "0.0.0" + version: "0.0.99" source_span: dependency: transitive description: @@ -838,18 +838,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.12.1" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.1.2" string_scanner: dependency: transitive description: @@ -870,10 +870,10 @@ packages: dependency: transitive description: name: test_api - sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" url: "https://pub.dev" source: hosted - version: "0.7.6" + version: "0.7.2" typed_data: dependency: transitive description: @@ -982,10 +982,10 @@ packages: dependency: transitive description: name: vector_math - sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.1.4" vm_service: dependency: transitive description: @@ -1043,5 +1043,5 @@ packages: source: hosted version: "3.1.3" sdks: - dart: ">=3.8.0-0 <4.0.0" + dart: ">=3.5.0 <4.0.0" flutter: ">=3.24.0"