From 992092052a2aceb42b6962c62cb0b2c11d33d339 Mon Sep 17 00:00:00 2001 From: asif Date: Tue, 2 Dec 2025 13:31:40 +0530 Subject: [PATCH] Customerf Info page changed and landing page changed --- .../screens/customer_info_screen.dart | 132 ++++++++++++------ .../dashboard/screens/dashboard_screen.dart | 99 +++++++------ .../service/screens/atm_locator_screen.dart | 2 +- .../screens/branch_locator_screen.dart | 2 +- lib/l10n/app_en.arb | 6 +- lib/l10n/app_hi.arb | 4 +- 6 files changed, 156 insertions(+), 89 deletions(-) diff --git a/lib/features/customer_info/screens/customer_info_screen.dart b/lib/features/customer_info/screens/customer_info_screen.dart index b5631ff..1a3ead5 100644 --- a/lib/features/customer_info/screens/customer_info_screen.dart +++ b/lib/features/customer_info/screens/customer_info_screen.dart @@ -1,3 +1,4 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:kmobile/data/models/user.dart'; @@ -13,6 +14,7 @@ class CustomerInfoScreen extends StatefulWidget { class _CustomerInfoScreenState extends State { late final User user = widget.user; + int _selectedCard = 0; // 0 for Personal Info, 1 for KYC String _maskPrimaryId(String? primaryId) { if (primaryId == null || primaryId.length <= 4) { @@ -97,6 +99,33 @@ class _CustomerInfoScreenState extends State { ), ), const SizedBox(height: 16), + // Toggle Buttons for Personal Info and KYC + SizedBox( + width: double.infinity, + child: CupertinoSlidingSegmentedControl( + groupValue: _selectedCard, + thumbColor: Theme.of(context).colorScheme.onPrimary, // Set selected switch color to theme primary color + onValueChanged: (int? newValue) { + if (newValue != null) { + setState(() { + _selectedCard = newValue; + }); + } + }, + children: { + 0: Padding( + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), + child: Text(AppLocalizations.of(context).personaldetails), + ), + 1: Padding( + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), + child: Text(AppLocalizations.of(context).kycdetails), + ), + }, + ), + ), + const SizedBox(height: 16), + // Card that shows content based on the toggle Card( elevation: 0, shape: RoundedRectangleBorder( @@ -108,46 +137,11 @@ class _CustomerInfoScreenState extends State { ), child: Padding( padding: const EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Personal Information', - style: theme.textTheme.titleMedium?.copyWith( - fontWeight: FontWeight.w600, - ), - ), - const SizedBox(height: 16), - InfoField( - label: - AppLocalizations.of(context).activeAccounts, - value: user.activeAccounts?.toString() ?? 'N/A', - ), - InfoField( - label: - AppLocalizations.of(context).mobileNumber, - value: user.mobileNo ?? 'N/A', - ), - InfoField( - label: AppLocalizations.of(context).dateOfBirth, - value: (user.dateOfBirth != null && - user.dateOfBirth!.length == 8) - ? '${user.dateOfBirth!.substring(0, 2)}-${user.dateOfBirth!.substring(2, 4)}-${user.dateOfBirth!.substring(4, 8)}' - : 'N/A', - ), // Replace with DOB if available - InfoField( - label: AppLocalizations.of(context).branchCode, - value: user.branchId ?? 'N/A', - ), - InfoField( - label: AppLocalizations.of(context).address, - value: user.address ?? 'N/A', - ), // Replace with Aadhar if available - InfoField( - label: AppLocalizations.of(context).primaryId, - value: _maskPrimaryId(user.primaryId), - ), - ], + child: AnimatedSwitcher( + duration: const Duration(milliseconds: 300), + child: _selectedCard == 0 + ? _buildPersonalInfo(theme) + : _buildKycDetails(theme), ), ), ), @@ -173,6 +167,64 @@ class _CustomerInfoScreenState extends State { ), )); } + + Widget _buildPersonalInfo(ThemeData theme) { + return Column( + key: const ValueKey('personal_info'), + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + AppLocalizations.of(context).personaldetails, + style: theme.textTheme.titleMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 16), + InfoField( + label: AppLocalizations.of(context).activeAccounts, + value: user.activeAccounts?.toString() ?? 'N/A', + ), + InfoField( + label: AppLocalizations.of(context).mobileNumber, + value: user.mobileNo ?? 'N/A', + ), + InfoField( + label: AppLocalizations.of(context).dateOfBirth, + value: (user.dateOfBirth != null && user.dateOfBirth!.length == 8) + ? '${user.dateOfBirth!.substring(0, 2)}-${user.dateOfBirth!.substring(2, 4)}-${user.dateOfBirth!.substring(4, 8)}' + : 'N/A', + ), + InfoField( + label: AppLocalizations.of(context).branchCode, + value: user.branchId ?? 'N/A', + ), + InfoField( + label: AppLocalizations.of(context).address, + value: user.address ?? 'N/A', + ), + ], + ); + } + + Widget _buildKycDetails(ThemeData theme) { + return Column( + key: const ValueKey('kyc_details'), + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + AppLocalizations.of(context).kycdetails, + style: theme.textTheme.titleMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 16), + InfoField( + label: AppLocalizations.of(context).primaryId, + value: _maskPrimaryId(user.primaryId), + ), + ], + ); + } } class InfoField extends StatelessWidget { diff --git a/lib/features/dashboard/screens/dashboard_screen.dart b/lib/features/dashboard/screens/dashboard_screen.dart index ec48a5f..94647ae 100644 --- a/lib/features/dashboard/screens/dashboard_screen.dart +++ b/lib/features/dashboard/screens/dashboard_screen.dart @@ -403,58 +403,68 @@ class _DashboardScreenState extends State backgroundColor: theme.scaffoldBackgroundColor, appBar: AppBar( backgroundColor: theme.scaffoldBackgroundColor, - leading: Padding( - padding: const EdgeInsets.only(left: 10.0), - child: InkWell( - borderRadius: BorderRadius.circular(20), - 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 ?? ''; - } - } - - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ProfileScreen( - mobileNumber: mobileNumberToPass, - customerNo: customerNo, - customerName: customerName), - ), - ); - }, - child: CircleAvatar( - backgroundColor: Colors.grey[200], - radius: 20, - child: SvgPicture.asset( - 'assets/images/avatar_male.svg', - width: 40, - height: 40, - fit: BoxFit.cover, - ), - ), + leading: const Padding( + padding: EdgeInsets.only(left: 10.0), + child: CircleAvatar( + radius: 15, + backgroundImage: AssetImage('assets/images/logo.png'), ), ), title: Text( - AppLocalizations.of(context).kccbMobile, - textAlign: TextAlign.left, + AppLocalizations.of(context).kccBankFull.replaceAll('-', '\u2011'), + textAlign: TextAlign.center, + softWrap: true, // Explicitly allow wrapping + maxLines: 2, // Allow text to wrap to a maximum of 2 lines style: TextStyle( color: theme.colorScheme.primary, fontWeight: FontWeight.w700, + fontSize: 20, ), ), - centerTitle: true, + // Removed centerTitle: true to give more space for text wrapping + + actions: [ + Padding( + padding: const EdgeInsets.only(right: 10.0), + child: InkWell( + borderRadius: BorderRadius.circular(20), + 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 ?? ''; + } + } + + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ProfileScreen( + mobileNumber: mobileNumberToPass, + customerNo: customerNo, + customerName: customerName), + ), + ); + }, + child: CircleAvatar( + backgroundColor: Colors.grey[200], + radius: 21, + child: SvgPicture.asset( + 'assets/images/avatar_male.svg', + ), + ), + ), + ), + ], ), body: BlocBuilder( builder: (context, state) { @@ -486,6 +496,7 @@ class _DashboardScreenState extends State child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + const SizedBox(height: 16), // Added spacing Padding( padding: const EdgeInsets.only(left: 8.0), child: Text( diff --git a/lib/features/service/screens/atm_locator_screen.dart b/lib/features/service/screens/atm_locator_screen.dart index 9d4092b..f52cf2f 100644 --- a/lib/features/service/screens/atm_locator_screen.dart +++ b/lib/features/service/screens/atm_locator_screen.dart @@ -128,7 +128,7 @@ class _ATMLocatorScreenState extends State { return Card( margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 6), child: ListTile( - leading: const Icon(Icons.currency_rupee), // Icon for ATM + leading: const Icon(Icons.credit_card), // Icon for ATM title: Text(atm.name, // Display the ATM's name style: const TextStyle(fontWeight: FontWeight.bold)), onTap: () { diff --git a/lib/features/service/screens/branch_locator_screen.dart b/lib/features/service/screens/branch_locator_screen.dart index 5cbb5d4..592d4e7 100644 --- a/lib/features/service/screens/branch_locator_screen.dart +++ b/lib/features/service/screens/branch_locator_screen.dart @@ -137,7 +137,7 @@ class _BranchLocatorScreenState extends State { margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 6), child: ListTile( leading: const CircleAvatar( - child: Icon(Icons.location_city), + child: Icon(Icons.account_balance), ), title: Text(branch.branch_name, style: const TextStyle(fontWeight: FontWeight.bold)), diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index c07e713..264ec70 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -225,7 +225,7 @@ "pinMismatch": "PINs do not match", "securitySettings": "Security Settings", "kconnect": "Kconnect", - "kccBankFull": "Kangra Central Co-operative Bank", + "kccBankFull": "The Kangra Central Co-operative Bank Ltd.", "themeColor": "Theme Color", "selectThemeColor": "Select Theme Color", "violet": "Violet", @@ -411,5 +411,7 @@ "quickoutsidesubtitle": "Transfer funds to any bank across India with ease. Your transactions are secure and processed quickly", "ftselfpaysubtitle": "Move money between your own accounts with ease. Your funds, your way", "ftownsubtitle": "Send money to your saved beneficiaries within Kangra Bank", -"ftoutsidesubtitle": "Transfer funds to your saved beneficiaries in any other bank across India" +"ftoutsidesubtitle": "Transfer funds to your saved beneficiaries in any other bank across India", +"personaldetails": "Personal Details", +"kycdetails": "KYC Details" } diff --git a/lib/l10n/app_hi.arb b/lib/l10n/app_hi.arb index 320199c..c556450 100644 --- a/lib/l10n/app_hi.arb +++ b/lib/l10n/app_hi.arb @@ -412,5 +412,7 @@ "quickoutsidesubtitle": "भारत भर में किसी भी बैंक में आसानी से धनराशि स्थानांतरित करें। आपके लेन-देन सुरक्षित और शीघ्रता से संसाधित होते हैं", "ftselfpaysubtitle": "अपने खातों के बीच आसानी से पैसे ट्रांसफर करें। आपका पैसा, आपकी सुविधानुसार", "ftownsubtitle": "कांगड़ा बैंक के माध्यम से अपने बचत लाभार्थियों को पैसे भेजें", -"ftoutsidesubtitle": "भारत भर में किसी भी अन्य बैंक में अपने सहेजे गए लाभार्थियों को धनराशि हस्तांतरित करें" +"ftoutsidesubtitle": "भारत भर में किसी भी अन्य बैंक में अपने सहेजे गए लाभार्थियों को धनराशि हस्तांतरित करें", +"personaldetails": "व्यक्तिगत विवरण", +"kycdetails": "केवाईसी विवरण" }