correctly complete completer when resizing while unmounted and log any errors on resize

This commit is contained in:
Nick Fisher
2023-11-01 14:05:49 +08:00
parent 214510b595
commit a366867d91

View File

@@ -171,8 +171,10 @@ class _SizedFilamentWidgetState extends State<_SizedFilamentWidget> {
Duration(milliseconds: (kReleaseMode || Platform.isWindows) ? 10 : 100),
() async {
if (!mounted) {
completer.complete();
return;
}
try {
while (_resizing) {
await Future.delayed(const Duration(milliseconds: 20));
}
@@ -183,8 +185,13 @@ class _SizedFilamentWidgetState extends State<_SizedFilamentWidget> {
_resizeTimer = null;
setState(() {});
_resizing = false;
} catch (err) {
print("Error resizing FilamentWidget: $err");
} finally {
completer.complete();
}
});
return completer.future;
}