api integration
This commit is contained in:
@@ -1,69 +1,109 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:kmobile/data/models/user.dart';
|
||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||
|
||||
class CustomerInfoScreen extends StatefulWidget {
|
||||
const CustomerInfoScreen({super.key});
|
||||
final User user;
|
||||
const CustomerInfoScreen({super.key, required this.user});
|
||||
|
||||
@override
|
||||
State<CustomerInfoScreen> createState() => _CustomerInfoScreen();
|
||||
State<CustomerInfoScreen> createState() => _CustomerInfoScreenState();
|
||||
}
|
||||
|
||||
class _CustomerInfoScreen extends State<CustomerInfoScreen>{
|
||||
class _CustomerInfoScreenState extends State<CustomerInfoScreen> {
|
||||
late final User user = widget.user;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: IconButton(icon: const Icon(Symbols.arrow_back_ios_new),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},),
|
||||
title: const Text('kMobile', style: TextStyle(color: Colors.black,
|
||||
fontWeight: FontWeight.w500),),
|
||||
actions: const [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 10.0),
|
||||
child: CircleAvatar(
|
||||
backgroundImage: AssetImage('assets/images/avatar.jpg'), // Replace with your image
|
||||
radius: 20,
|
||||
),
|
||||
appBar: AppBar(
|
||||
leading: IconButton(
|
||||
icon: const Icon(Symbols.arrow_back_ios_new),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
body: const SingleChildScrollView(
|
||||
physics: AlwaysScrollableScrollPhysics(),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: SafeArea(
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 30),
|
||||
CircleAvatar(
|
||||
backgroundImage: AssetImage('assets/images/avatar.jpg'), // Replace with your image
|
||||
radius: 50,
|
||||
title: const Text(
|
||||
'kMobile',
|
||||
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
||||
),
|
||||
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,
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 10.0),
|
||||
child: Text('Trina Bakshi', style: TextStyle(fontSize: 20,
|
||||
color: Colors.black, fontWeight: FontWeight.w500),),
|
||||
),
|
||||
|
||||
Text('CIF: 2553677487774', style: TextStyle(fontSize: 16, color: Colors.grey),),
|
||||
SizedBox(height: 30,),
|
||||
InfoField(label: 'Number of Active Accounts', value: '3'),
|
||||
InfoField(label: 'Mobile Number', value: '987XXXXX78'),
|
||||
InfoField(label: 'Date of Birth', value: '12-07-1984'),
|
||||
InfoField(label: 'Branch', value: 'Krishnapur'),
|
||||
InfoField(label: 'Aadhar Number', value: '7665 XXXX 1276'),
|
||||
InfoField(label: 'PAN Number', value: '700127638009871'),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)),
|
||||
);
|
||||
],
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: SafeArea(
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 30),
|
||||
CircleAvatar(
|
||||
backgroundColor: Colors.grey[200],
|
||||
radius: 50,
|
||||
child: SvgPicture.asset(
|
||||
'assets/images/avatar_male.svg',
|
||||
width: 150,
|
||||
height: 150,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 10.0),
|
||||
child: Text(
|
||||
user.name ?? '',
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'CIF: ${user.cifNumber ?? 'N/A'}',
|
||||
style:
|
||||
const TextStyle(fontSize: 16, color: Colors.grey),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
InfoField(
|
||||
label: 'Number of Active Accounts',
|
||||
value: user.activeAccounts?.toString() ?? '6'),
|
||||
InfoField(
|
||||
label: 'Mobile Number',
|
||||
value: user.mobileNo ?? 'N/A'),
|
||||
InfoField(
|
||||
label: 'Date of Birth',
|
||||
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: 'Branch', value: user.branchId ?? 'N/A'),
|
||||
InfoField(
|
||||
label: 'Address',
|
||||
value: user.address ??
|
||||
'N/A'), // Replace with Aadhar if available
|
||||
InfoField(
|
||||
label: 'Primary Id',
|
||||
value: user.primaryId ??
|
||||
'N/A'), // Replace with PAN if available
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +111,7 @@ class InfoField extends StatelessWidget {
|
||||
final String label;
|
||||
final String value;
|
||||
|
||||
const InfoField({Key? key, required this.label, required this.value}) : super(key: key);
|
||||
const InfoField({super.key, required this.label, required this.value});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -101,4 +141,4 @@ class InfoField extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user