Customerf Info page changed and landing page changed

This commit is contained in:
2025-12-02 13:31:40 +05:30
parent 64fedabd89
commit 992092052a
6 changed files with 156 additions and 89 deletions

View File

@@ -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<CustomerInfoScreen> {
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<CustomerInfoScreen> {
),
),
const SizedBox(height: 16),
// Toggle Buttons for Personal Info and KYC
SizedBox(
width: double.infinity,
child: CupertinoSlidingSegmentedControl<int>(
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<CustomerInfoScreen> {
),
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<CustomerInfoScreen> {
),
));
}
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 {

View File

@@ -403,58 +403,68 @@ class _DashboardScreenState extends State<DashboardScreen>
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<AuthCubit>().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<AuthCubit>().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<AuthCubit, AuthState>(
builder: (context, state) {
@@ -486,6 +496,7 @@ class _DashboardScreenState extends State<DashboardScreen>
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 16), // Added spacing
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(

View File

@@ -128,7 +128,7 @@ class _ATMLocatorScreenState extends State<ATMLocatorScreen> {
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: () {

View File

@@ -137,7 +137,7 @@ class _BranchLocatorScreenState extends State<BranchLocatorScreen> {
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)),

View File

@@ -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"
}

View File

@@ -412,5 +412,7 @@
"quickoutsidesubtitle": "भारत भर में किसी भी बैंक में आसानी से धनराशि स्थानांतरित करें। आपके लेन-देन सुरक्षित और शीघ्रता से संसाधित होते हैं",
"ftselfpaysubtitle": "अपने खातों के बीच आसानी से पैसे ट्रांसफर करें। आपका पैसा, आपकी सुविधानुसार",
"ftownsubtitle": "कांगड़ा बैंक के माध्यम से अपने बचत लाभार्थियों को पैसे भेजें",
"ftoutsidesubtitle": "भारत भर में किसी भी अन्य बैंक में अपने सहेजे गए लाभार्थियों को धनराशि हस्तांतरित करें"
"ftoutsidesubtitle": "भारत भर में किसी भी अन्य बैंक में अपने सहेजे गए लाभार्थियों को धनराशि हस्तांतरित करें",
"personaldetails": "व्यक्तिगत विवरण",
"kycdetails": "केवाईसी विवरण"
}