This commit is contained in:
Nick Fisher
2023-10-13 17:22:31 +11:00
parent df4f647333
commit 4ebd5a6645
2 changed files with 22 additions and 17 deletions

View File

@@ -132,7 +132,7 @@ class _FilamentWidgetState extends State<FilamentWidget> {
var size = ((context.findRenderObject()) as RenderBox).size;
try {
widget.controller.createViewer(size.width.toInt(), size.height.toInt());
await widget.controller.createViewer(size.width.toInt(), size.height.toInt());
} catch (err) {
setState(() {
_error = err.toString();
@@ -188,21 +188,21 @@ class _FilamentWidgetState extends State<FilamentWidget> {
_resizeTimer?.cancel();
_resizeTimer = Timer(Duration(milliseconds: 500), () async {
setState(() {
_resizing = true;
});
// setState(() {
// _resizing = true;
// });
// TODO - we could snapshot the widget to display while we resize?
print("Resizing to $newSize");
await widget.controller
.resize(newSize.width.toInt(), newSize.height.toInt());
WidgetsBinding.instance.addPostFrameCallback((_) async {
setState(() {
_resizing = false;
widget.onResize?.call();
});
});
// await widget.controller
// .resize(newSize.width.toInt(), newSize.height.toInt());
// WidgetsBinding.instance.addPostFrameCallback((_) async {
// setState(() {
// _resizing = false;
// widget.onResize?.call();
// });
// });
});
});
},