Fixed context bugs caused by moving to GoRouter

NOTE: Some bugs have not been fixed, and the member screen needs fixing,
but before that can happen, localstore has to be replaced,
because it causes loops on android and linux.
It also seems like it might lead to memory leaks
This commit is contained in:
Jakob Meier 2023-03-28 17:21:35 +02:00
parent b0c1f782bd
commit 90adcc6bb1
No known key found for this signature in database
GPG key ID: 66BDC7E6A01A6152
3 changed files with 8 additions and 18 deletions

View file

@ -132,14 +132,6 @@ class _EditRoomPageState extends State<EditRoomPage> {
: Scaffold(
appBar: AppBar(
title: const Text('Edit Room'),
leading: IconButton(
onPressed: () {
// go back
Navigator.of(context).pop();
},
icon: const Icon(Icons.arrow_back),
tooltip: "Go back",
),
),
body: SingleChildScrollView(
child: Center(
@ -191,9 +183,7 @@ class _EditRoomPageState extends State<EditRoomPage> {
_ctrIcon =
icon;
});
Navigator.of(
context)
.pop();
context.pop();
}));
}).toList())),
));

View file

@ -266,7 +266,7 @@ class _ManageRoomMembersPageState extends State<ManageRoomMembersPage> {
showDialog(
context: context,
builder:
(context) =>
(ctx) =>
AlertDialog(
icon: const Icon(
Icons
@ -283,7 +283,7 @@ class _ManageRoomMembersPageState extends State<ManageRoomMembersPage> {
// NOTE: cancel only closes the dialog
// whilst OK closes both
Navigator.of(context)
Navigator.of(ctx)
.pop();
},
child: const Text(
@ -294,9 +294,9 @@ class _ManageRoomMembersPageState extends State<ManageRoomMembersPage> {
() async {
// send request
final scaffMgr =
ScaffoldMessenger.of(context);
ScaffoldMessenger.of(ctx);
final nav =
Navigator.of(context);
Navigator.of(ctx);
final user =
context.read<User>();

View file

@ -97,7 +97,7 @@ class _AboutRoomPageState extends State<AboutRoomPage> {
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop();
context.pop();
},
child: const Text('Cancel'),
),
@ -272,8 +272,8 @@ class _AboutRoomPageState extends State<AboutRoomPage> {
final scaffMgr =
ScaffoldMessenger.of(ctx);
final nav = Navigator.of(ctx);
final router = GoRouter.of(ctx);
final user = ctx.read<User>();
final router = GoRouter.of(context);
final user = context.read<User>();
doNetworkRequest(scaffMgr,
req: () => postWithCreadentials(