Leave room support, persist last room, fixes

This commit is contained in:
Henry Hiles 2025-12-03 16:16:30 -05:00
commit 7dfd47a404
No known key found for this signature in database
17 changed files with 312 additions and 136 deletions

View file

@ -20,8 +20,32 @@ class RoomMenu extends StatelessWidget {
child: ListTile(leading: Icon(Icons.link), title: Text("Copy Link")),
),
PopupMenuItem(
onTap: () =>
showDialog(context: context, builder: (context) => AlertDialog()),
onTap: () => showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text("Leave Room"),
content: Text(
"Are you sure you want to leave \"${room.getLocalizedDisplayname()}\"?",
),
actions: [
TextButton(
onPressed: Navigator.of(context).pop,
child: Text("Cancel"),
),
TextButton(
onPressed: () async {
Navigator.of(context).pop();
final snackbar = ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text("Leaving room...")));
await room.leave();
snackbar.close();
},
child: Text("Leave"),
),
],
),
),
child: ListTile(
leading: Icon(Icons.logout, color: danger),
title: Text("Leave", style: TextStyle(color: danger)),