usability fixes
This commit is contained in:
@@ -1,11 +1,61 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../../auth_state.dart';
|
||||
import '../../models/responsive_policy.dart';
|
||||
|
||||
class MoreScreen extends StatelessWidget {
|
||||
class MoreScreen extends StatefulWidget {
|
||||
const MoreScreen({super.key});
|
||||
|
||||
@override
|
||||
State<MoreScreen> createState() => _MoreScreenState();
|
||||
}
|
||||
|
||||
class _MoreScreenState extends State<MoreScreen> {
|
||||
late SharedPreferences _prefs;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_initPrefs();
|
||||
}
|
||||
|
||||
Future<void> _initPrefs() async {
|
||||
_prefs = await SharedPreferences.getInstance();
|
||||
}
|
||||
|
||||
void _showLogoutDialog() {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext dialogContext) {
|
||||
return AlertDialog(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
title: const Text('Confirm Logout'),
|
||||
content: const Text('Are you sure you want to log out?'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: const Text('Cancel'),
|
||||
onPressed: () {
|
||||
Navigator.of(dialogContext).pop();
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('Logout'),
|
||||
onPressed: () {
|
||||
Navigator.of(dialogContext).pop();
|
||||
_prefs.clear();
|
||||
authState.refresh();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -22,6 +72,12 @@ class MoreScreen extends StatelessWidget {
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
_NavOptionTile(
|
||||
icon: Icons.swap_horiz,
|
||||
title: 'Change Workspace',
|
||||
subtitle: 'Switch to a different workspace',
|
||||
onTap: () => context.go('/workspace'),
|
||||
),
|
||||
_NavOptionTile(
|
||||
icon: Icons.people_outline,
|
||||
title: 'Users',
|
||||
@@ -34,6 +90,18 @@ class MoreScreen extends StatelessWidget {
|
||||
subtitle: 'View system uptime and service status',
|
||||
onTap: () => context.push('/uptime'),
|
||||
),
|
||||
_NavOptionTile(
|
||||
icon: Icons.support_agent_rounded,
|
||||
title: 'Contact Us',
|
||||
subtitle: 'Get in touch with our team',
|
||||
onTap: () => context.push('/contact'),
|
||||
),
|
||||
_NavOptionTile(
|
||||
icon: Icons.logout,
|
||||
title: 'Logout',
|
||||
subtitle: 'Sign out of your account',
|
||||
onTap: () => _showLogoutDialog(),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -77,4 +145,4 @@ class _NavOptionTile extends StatelessWidget {
|
||||
onTap: onTap,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user