import 'package:flutter/material.dart'; import '../settings.dart'; import '../theme.dart'; class SettingsScreen extends StatefulWidget { final Settings settings; final VoidCallback? onLogout; const SettingsScreen({super.key, required this.settings, this.onLogout}); @override State createState() => _SettingsScreenState(); } class _SettingsScreenState extends State { @override Widget build(BuildContext context) { final name = widget.settings.name; return Scaffold( appBar: AppBar(title: const Text('Settings')), body: ListView( padding: const EdgeInsets.all(20), children: [ if (name != null && name.isNotEmpty) Card( child: ListTile( leading: const CircleAvatar(backgroundColor: AppColors.emerald, child: Icon(Icons.person, color: Colors.white)), title: Text(name, style: const TextStyle(fontWeight: FontWeight.w600)), subtitle: Text(widget.settings.isManager ? 'Manager' : 'Employee'), ), ), if (widget.onLogout != null) ...[ const SizedBox(height: 20), OutlinedButton.icon( onPressed: widget.onLogout, icon: const Icon(Icons.logout, color: AppColors.danger), label: const Text('Sign out', style: TextStyle(color: AppColors.danger)), style: OutlinedButton.styleFrom( minimumSize: const Size.fromHeight(50), side: const BorderSide(color: AppColors.border), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)), ), ), ], ], ), ); } }