小编Nol*_*nce的帖子

使用 AnimatedListView 使提供者的列表保持最新

我正在使用该Provider库并有一个扩展ChangeNotifier. 这个类提供UnmodifiableListViewhistoricalRosters,以我的小部件。

我想创建一个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 flutter-animation

7
推荐指数
1
解决办法
356
查看次数

Flutter 中的基本对齐文本和虚线

我正在尝试为我的 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)

layout styling flutter

1
推荐指数
2
解决办法
4165
查看次数

标签 统计

flutter ×2

flutter-animation ×1

layout ×1

styling ×1