jjzjj

AnimatedSize

全部标签

Flutter - 将起始高度设置为 MediaQuery 高度时,AnimatedSize 不设置动画

我不知道怎么回事...当我使用0.0的静态高度时,AnimatedSize小部件将进行动画处理。但是当我设置topLayoutHeight=MediaQuery.of(context).size.height没有任何反应。这是我的代码:doubletopLayoutHeight=0.0;setHeight(){topLayoutHeight=MediaQuery.of(context).size.height-200;}我的小部件:@overrideWidgetbuild(BuildContextcontext){setHeight();......newAnimatedSize(cu

Flutter - 将起始高度设置为 MediaQuery 高度时,AnimatedSize 不设置动画

我不知道怎么回事...当我使用0.0的静态高度时,AnimatedSize小部件将进行动画处理。但是当我设置topLayoutHeight=MediaQuery.of(context).size.height没有任何反应。这是我的代码:doubletopLayoutHeight=0.0;setHeight(){topLayoutHeight=MediaQuery.of(context).size.height-200;}我的小部件:@overrideWidgetbuild(BuildContextcontext){setHeight();......newAnimatedSize(cu

flutter - 如何在 Flutter AnimatedSize 小部件中监听调整大小事件

Flutter的AnimatedSize类根据其子级的大小为其大小设置动画。我需要知道如何监听大小的变化,最好是在调整大小完成后。在我的用例中,这个小部件包含在ListView中,但我似乎只能通过NotificationListener来收听滚动事件(能够监听可滚动高度的变化将解决我的问题)。或者,能够监听一个小部件,例如Column改变它的child数量也会起作用。 最佳答案 有一个专门为这种情况制作的小部件。它被称为:SizeChangedLayoutNotifier(https://api.flutter.dev/flutte