141 lines
4.5 KiB
Dart
141 lines
4.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../widgets/ui_helpers.dart';
|
|
|
|
class ProfilePage extends StatelessWidget {
|
|
final String namaUser;
|
|
final String emailUser;
|
|
final String role;
|
|
final Future<void> Function() onLogout;
|
|
final VoidCallback? onCreateUser;
|
|
|
|
const ProfilePage({
|
|
super.key,
|
|
required this.namaUser,
|
|
required this.emailUser,
|
|
required this.role,
|
|
required this.onLogout,
|
|
this.onCreateUser,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SingleChildScrollView(
|
|
child: Column(
|
|
children: [
|
|
ModernCard(
|
|
child: Column(
|
|
children: [
|
|
Container(
|
|
height: 110,
|
|
width: 110,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
gradient: const LinearGradient(
|
|
colors: [
|
|
Colors.blueAccent,
|
|
Colors.cyan,
|
|
],
|
|
),
|
|
),
|
|
child: const Icon(
|
|
Icons.person,
|
|
size: 55,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
const SizedBox(height: 25),
|
|
Text(
|
|
namaUser,
|
|
style: const TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 28,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
emailUser,
|
|
style: const TextStyle(
|
|
color: Colors.white54,
|
|
fontSize: 16,
|
|
),
|
|
),
|
|
const SizedBox(height: 30),
|
|
InfoTile(
|
|
icon: Icons.verified_user,
|
|
title: 'ACCOUNT STATUS',
|
|
value: 'ACTIVE',
|
|
),
|
|
const SizedBox(height: 15),
|
|
InfoTile(
|
|
icon: Icons.security,
|
|
title: 'SYSTEM',
|
|
value: 'DOOR SECURITY',
|
|
),
|
|
const SizedBox(height: 15),
|
|
InfoTile(
|
|
icon: Icons.shield,
|
|
title: 'ROLE',
|
|
value: role.toUpperCase(),
|
|
),
|
|
const SizedBox(height: 30),
|
|
if (onCreateUser != null) ...[
|
|
SizedBox(
|
|
width: double.infinity,
|
|
child: ElevatedButton.icon(
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: Colors.blueAccent,
|
|
padding: const EdgeInsets.symmetric(
|
|
vertical: 18,
|
|
),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(18),
|
|
),
|
|
),
|
|
onPressed: onCreateUser,
|
|
icon: const Icon(Icons.person_add_alt_1_rounded),
|
|
label: const Text(
|
|
'Create User',
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 16,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 20),
|
|
],
|
|
SizedBox(
|
|
width: double.infinity,
|
|
child: ElevatedButton.icon(
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: Colors.redAccent,
|
|
padding: const EdgeInsets.symmetric(
|
|
vertical: 18,
|
|
),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(18),
|
|
),
|
|
),
|
|
onPressed: onLogout,
|
|
icon: const Icon(
|
|
Icons.logout_rounded,
|
|
),
|
|
label: const Text(
|
|
'LOGOUT',
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 16,
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|