Fix: #22 - Explictly pop to conversations after AddContact
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
Also a few checks to prevent post-acceptence onChange events from breaking context.
This commit is contained in:
parent
9c9ea38456
commit
b832f71569
|
@ -152,9 +152,14 @@ class _AddContactViewState extends State<AddContactView> {
|
||||||
|
|
||||||
Future.delayed(const Duration(milliseconds: 500), () {
|
Future.delayed(const Duration(milliseconds: 500), () {
|
||||||
if (globalErrorHandler.importBundleSuccess) {
|
if (globalErrorHandler.importBundleSuccess) {
|
||||||
final snackBar = SnackBar(content: Text(AppLocalizations.of(context)!.successfullAddedContact + importBundle));
|
// TODO: This isn't ideal, but because onChange can be fired during this future check
|
||||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
// and because the context can change after being popped we have this kind of double assertion...
|
||||||
Navigator.pop(context);
|
// There is probably a better pattern to handle this...
|
||||||
|
if (AppLocalizations.of(context) != null) {
|
||||||
|
final snackBar = SnackBar(content: Text(AppLocalizations.of(context)!.successfullAddedContact + importBundle));
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||||
|
Navigator.popUntil(context, (route) => route.settings.name == "conversations");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue