【发布时间】:2020-03-05 09:35:30
【问题描述】:
我想要一个按钮,当我单击它时,listView 会随着 animation 消失,就像“向上”动画一样。我设法在没有animation 的情况下使用列表视图的以下代码实现了这一目标:
Visibility(
// O valor aqui e o inicial
visible: isExpanded,
child: ListView.builder(
scrollDirection: Axis.vertical,
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: 2,
itemBuilder: (BuildContext context, int index) {
return Column(
children: <Widget>[
SizedBox(height: 30),
GameCard(locale: widget.locale)
],
);
}),
)
按钮执行此操作:
onTapHeader() {
setState(() {
if (isExpanded) {
_controller.forward();
} else {
_controller.reverse();
}
isExpanded = !isExpanded;
});
}
有什么方法可以制作动画吗?
【问题讨论】:
标签: flutter dart flutter-layout flutter-animation