131 lines
4.3 KiB
Dart
131 lines
4.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/svg.dart';
|
|
import 'package:kmobile/data/models/user.dart';
|
|
import '../../../l10n/app_localizations.dart';
|
|
|
|
class CustomerInfoScreen extends StatefulWidget {
|
|
final User user;
|
|
const CustomerInfoScreen({super.key, required this.user});
|
|
|
|
@override
|
|
State<CustomerInfoScreen> createState() => _CustomerInfoScreenState();
|
|
}
|
|
|
|
class _CustomerInfoScreenState extends State<CustomerInfoScreen> {
|
|
late final User user = widget.user;
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text(
|
|
AppLocalizations.of(context).customerInfo,
|
|
),
|
|
),
|
|
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(
|
|
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: TextStyle(
|
|
fontSize: 20,
|
|
color: theme.colorScheme.onSurface,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
),
|
|
Text(
|
|
'${AppLocalizations.of(context).cif}: ${user.cifNumber ?? 'N/A'}',
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
color: theme.colorScheme.onSurfaceVariant),
|
|
),
|
|
const SizedBox(height: 30),
|
|
InfoField(
|
|
label: AppLocalizations.of(context).activeAccounts,
|
|
value: user.activeAccounts?.toString() ?? '6',
|
|
),
|
|
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).branchAddress,
|
|
value: user.address ?? 'N/A',
|
|
), // Replace with Aadhar if available
|
|
InfoField(
|
|
label: AppLocalizations.of(context).primaryId,
|
|
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) {
|
|
final theme = Theme.of(context);
|
|
return Container(
|
|
width: double.infinity,
|
|
margin: const EdgeInsets.symmetric(vertical: 8),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
label,
|
|
style: TextStyle(
|
|
fontSize: 15,
|
|
fontWeight: FontWeight.w500,
|
|
color: theme.colorScheme.onSurfaceVariant,
|
|
),
|
|
),
|
|
const SizedBox(height: 3),
|
|
Text(
|
|
value,
|
|
style: TextStyle(fontSize: 16, color: theme.colorScheme.onSurface),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|