dark Theme and 18 other changes done

This commit is contained in:
2025-11-20 12:33:30 +05:30
parent fda5d075ff
commit 4fe6af4098
15 changed files with 484 additions and 339 deletions

View File

@@ -308,6 +308,8 @@ class _ProfileScreenState extends State<ProfileScreen> {
@override
Widget build(BuildContext context) {
final loc = AppLocalizations.of(context);
final theme = Theme.of(context);
final isDarkMode = theme.brightness == Brightness.dark;
return Scaffold(
appBar: AppBar(
@@ -320,83 +322,75 @@ Widget build(BuildContext context) {
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
children: [
// ===== Profile Header =====
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
blurRadius: 8,
offset: const Offset(0, 4),
),
],
),
child: Row(
children: [
// Avatar
Container(
width: 56,
height: 56,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.grey.shade200,
image: const DecorationImage(
image: AssetImage('assets/images/logo.png'),
fit: BoxFit.cover,
Card(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
children: [
// Avatar
Container(
width: 56,
height: 56,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: theme.colorScheme.surface,
image: const DecorationImage(
image: AssetImage('assets/images/logo.png'),
fit: BoxFit.cover,
),
),
),
),
const SizedBox(width: 12),
// Name + mobile
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
// If you want to show the user's name instead, replace below.
widget.customerName,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
const SizedBox(width: 12),
// Name + mobile
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
// If you want to show the user's name instead, replace below.
widget.customerName,
style: theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
),
),
),
const SizedBox(height: 4),
Text(
widget.customerNo,
style: TextStyle(
fontSize: 14,
color: Colors.grey.shade600,
const SizedBox(height: 4),
Text(
widget.customerNo,
style: theme.textTheme.bodyMedium?.copyWith(
color:
theme.colorScheme.onSurface.withOpacity(0.7),
),
),
),
],
],
),
),
),
// Edit/Profile button (optional)
TextButton.icon(
onPressed: () {
// TODO: Navigate to edit profile if required
},
icon: const Icon(Icons.edit, size: 18),
label: const Text("Edit"),
style: TextButton.styleFrom(
foregroundColor: Colors.blueGrey.shade700,
// Edit/Profile button (optional)
TextButton.icon(
onPressed: () {
// TODO: Navigate to edit profile if required
},
icon: const Icon(Icons.edit, size: 18),
label: const Text("Edit"),
style: TextButton.styleFrom(
foregroundColor: theme.colorScheme.onSurface,
),
),
),
],
],
),
),
),
const SizedBox(height: 16),
// ===== Section: Settings =====
const Text(
"Settings",
style: TextStyle(
fontSize: 13,
fontWeight: FontWeight.w600,
letterSpacing: 0.2,
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Text(
"Settings",
style: theme.textTheme.labelLarge?.copyWith(
fontWeight: FontWeight.w600,
letterSpacing: 0.2,
),
),
),
const SizedBox(height: 8),
@@ -439,18 +433,7 @@ Widget build(BuildContext context) {
);
},
),
Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
blurRadius: 8,
offset: const Offset(0, 4),
),
],
),
Card(
child: SwitchListTile(
title: Text(loc.enableFingerprintLogin),
value: _isBiometricEnabled,
@@ -467,35 +450,27 @@ Widget build(BuildContext context) {
const Divider(height: 24),
// ===== Section: Security & App =====
Text(
loc.appVersion,
style: const TextStyle(
fontSize: 13,
fontWeight: FontWeight.w600,
letterSpacing: 0.2,
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Text(
loc.appVersion,
style: theme.textTheme.labelLarge?.copyWith(
fontWeight: FontWeight.w600,
letterSpacing: 0.2,
),
),
),
const SizedBox(height: 8),
// Fingerprint toggle inside a styled container
Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
blurRadius: 8,
offset: const Offset(0, 4),
),
],
),
Card(
child: ListTile(
leading: const Icon(Icons.smartphone),
title: Text(loc.appVersion),
trailing: FutureBuilder<String>(
future: _getAppVersion(),
builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
builder:
(BuildContext context, AsyncSnapshot<String> snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const SizedBox(
width: 18,
@@ -507,7 +482,6 @@ Widget build(BuildContext context) {
} else {
return Text(
snapshot.data ?? "N/A",
selectionColor: const Color(0xFFFFFFFF),
);
}
},
@@ -524,12 +498,14 @@ Widget build(BuildContext context) {
const Divider(height: 24),
// ===== Section: Actions =====
const Text(
"Exit",
style: TextStyle(
fontSize: 13,
fontWeight: FontWeight.w600,
letterSpacing: 0.2,
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Text(
"Exit",
style: theme.textTheme.labelLarge?.copyWith(
fontWeight: FontWeight.w600,
letterSpacing: 0.2,
),
),
),
const SizedBox(height: 8),
@@ -608,6 +584,7 @@ Widget build(BuildContext context) {
);
}
}
class _SectionTile extends StatelessWidget {
const _SectionTile({
required this.leadingIcon,
@@ -623,23 +600,16 @@ class _SectionTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
final theme = Theme.of(context);
return Card(
margin: const EdgeInsets.only(bottom: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
blurRadius: 8,
offset: const Offset(0, 4),
),
],
),
child: ListTile(
leading: Icon(leadingIcon),
title: Text(title),
trailing: trailChevron ? const Icon(Icons.chevron_right) : null,
leading: Icon(leadingIcon, color: theme.colorScheme.onSurface),
title: Text(title, style: theme.textTheme.bodyLarge),
trailing: trailChevron
? Icon(Icons.chevron_right, color: theme.colorScheme.onSurface)
: null,
onTap: onTap,
contentPadding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 8),