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 { final User user; const CustomerInfoScreen({super.key, required this.user}); @override State createState() => _CustomerInfoScreenState(); } class _CustomerInfoScreenState extends State { 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: [ 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( 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 ], ), ), ), ))); } } class InfoField extends StatelessWidget { final String label; final String value; const InfoField({super.key, required this.label, required this.value}); @override Widget build(BuildContext context) { return Container( width: double.infinity, margin: const EdgeInsets.symmetric(vertical: 8), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( label, style: const TextStyle( fontSize: 15, fontWeight: FontWeight.w500, color: Colors.black87, ), ), const SizedBox(height: 3), Text( value, style: const TextStyle( fontSize: 16, color: Colors.black, ), ), ], ), ); } }