correctly complete completer when resizing while unmounted and log any errors on resize
This commit is contained in:
@@ -171,8 +171,10 @@ class _SizedFilamentWidgetState extends State<_SizedFilamentWidget> {
|
|||||||
Duration(milliseconds: (kReleaseMode || Platform.isWindows) ? 10 : 100),
|
Duration(milliseconds: (kReleaseMode || Platform.isWindows) ? 10 : 100),
|
||||||
() async {
|
() async {
|
||||||
if (!mounted) {
|
if (!mounted) {
|
||||||
|
completer.complete();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
while (_resizing) {
|
while (_resizing) {
|
||||||
await Future.delayed(const Duration(milliseconds: 20));
|
await Future.delayed(const Duration(milliseconds: 20));
|
||||||
}
|
}
|
||||||
@@ -183,8 +185,13 @@ class _SizedFilamentWidgetState extends State<_SizedFilamentWidget> {
|
|||||||
_resizeTimer = null;
|
_resizeTimer = null;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
_resizing = false;
|
_resizing = false;
|
||||||
|
} catch (err) {
|
||||||
|
print("Error resizing FilamentWidget: $err");
|
||||||
|
} finally {
|
||||||
completer.complete();
|
completer.complete();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return completer.future;
|
return completer.future;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user