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:
parent
b0c1f782bd
commit
90adcc6bb1
3 changed files with 8 additions and 18 deletions
|
@ -132,14 +132,6 @@ class _EditRoomPageState extends State<EditRoomPage> {
|
||||||
: Scaffold(
|
: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('Edit Room'),
|
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(
|
body: SingleChildScrollView(
|
||||||
child: Center(
|
child: Center(
|
||||||
|
@ -191,9 +183,7 @@ class _EditRoomPageState extends State<EditRoomPage> {
|
||||||
_ctrIcon =
|
_ctrIcon =
|
||||||
icon;
|
icon;
|
||||||
});
|
});
|
||||||
Navigator.of(
|
context.pop();
|
||||||
context)
|
|
||||||
.pop();
|
|
||||||
}));
|
}));
|
||||||
}).toList())),
|
}).toList())),
|
||||||
));
|
));
|
||||||
|
|
|
@ -266,7 +266,7 @@ class _ManageRoomMembersPageState extends State<ManageRoomMembersPage> {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder:
|
builder:
|
||||||
(context) =>
|
(ctx) =>
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons
|
Icons
|
||||||
|
@ -283,7 +283,7 @@ class _ManageRoomMembersPageState extends State<ManageRoomMembersPage> {
|
||||||
// NOTE: cancel only closes the dialog
|
// NOTE: cancel only closes the dialog
|
||||||
// whilst OK closes both
|
// whilst OK closes both
|
||||||
|
|
||||||
Navigator.of(context)
|
Navigator.of(ctx)
|
||||||
.pop();
|
.pop();
|
||||||
},
|
},
|
||||||
child: const Text(
|
child: const Text(
|
||||||
|
@ -294,9 +294,9 @@ class _ManageRoomMembersPageState extends State<ManageRoomMembersPage> {
|
||||||
() async {
|
() async {
|
||||||
// send request
|
// send request
|
||||||
final scaffMgr =
|
final scaffMgr =
|
||||||
ScaffoldMessenger.of(context);
|
ScaffoldMessenger.of(ctx);
|
||||||
final nav =
|
final nav =
|
||||||
Navigator.of(context);
|
Navigator.of(ctx);
|
||||||
final user =
|
final user =
|
||||||
context.read<User>();
|
context.read<User>();
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ class _AboutRoomPageState extends State<AboutRoomPage> {
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
context.pop();
|
||||||
},
|
},
|
||||||
child: const Text('Cancel'),
|
child: const Text('Cancel'),
|
||||||
),
|
),
|
||||||
|
@ -272,8 +272,8 @@ class _AboutRoomPageState extends State<AboutRoomPage> {
|
||||||
final scaffMgr =
|
final scaffMgr =
|
||||||
ScaffoldMessenger.of(ctx);
|
ScaffoldMessenger.of(ctx);
|
||||||
final nav = Navigator.of(ctx);
|
final nav = Navigator.of(ctx);
|
||||||
final router = GoRouter.of(ctx);
|
final router = GoRouter.of(context);
|
||||||
final user = ctx.read<User>();
|
final user = context.read<User>();
|
||||||
|
|
||||||
doNetworkRequest(scaffMgr,
|
doNetworkRequest(scaffMgr,
|
||||||
req: () => postWithCreadentials(
|
req: () => postWithCreadentials(
|
||||||
|
|
Loading…
Reference in a new issue