- Login reworked to the Brand panel layout with a dark-theme switch; 'Scalar Presence' two-line wordmark - Android project now tracked (was gitignored); pins shared_preferences_android 2.4.27 (2.5.0 crashed with a black screen) - API base URL fixed per build (--dart-define=API_BASE_URL), no in-app server setting Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
49 lines
1.7 KiB
Dart
49 lines
1.7 KiB
Dart
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<SettingsScreen> createState() => _SettingsScreenState();
|
|
}
|
|
|
|
class _SettingsScreenState extends State<SettingsScreen> {
|
|
@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)),
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|