我正在使用该Provider
库并有一个扩展ChangeNotifier
. 这个类提供UnmodifiableListView
的historicalRosters
,以我的小部件。
我想创建一个AnimatedListView
显示这些名册的。动画列表应该需要一个单独的列表,它会告诉小部件何时小部件进入或退出新列表项的动画。
final GlobalKey<AnimatedListState> _listKey = GlobalKey<AnimatedListState>();
Run Code Online (Sandbox Code Playgroud)
此示例使用模型同时更新附加到小部件状态的列表和 AnimateListState。
// Inside model
void insert(int index, E item) {
_items.insert(index, item);
_animatedList.insertItem(index);
}
Run Code Online (Sandbox Code Playgroud)
我想做同样的事情,但我无法思考如何做。也就是说,我可以更新由提供的列表provider
并更改AnimatedListState
.
我正在尝试为我的 Flutter 应用程序创建这样的东西:
现在我已经成功地得到一行文字,一条虚线和更大的文字。我似乎无法解决的最后一个问题是摆脱不同大小文本中的可变大小差距。
[编辑] 我的意思是让所有内容都在同一条红线上对齐:
看着这个答案,我想我可以做同样的事情并将所有文本放在定位堆栈中。然而,这打破了我的布局,给了我这个错误:
I/flutter (26439): The following assertion was thrown during performLayout():
I/flutter (26439): RenderFlex children have non-zero flex but incoming height constraints are unbounded.
I/flutter (26439): When a column is in a parent that does not provide a finite height constraint, for example if it is
I/flutter (26439): in a vertical scrollable, it will try to shrink-wrap its children along the vertical axis. Setting a
I/flutter (26439): flex on a child (e.g. using …
Run Code Online (Sandbox Code Playgroud)