我们有一个UI设计,该设计使用我们需要使其动态的静态链接。是否可以使用列表构建器来填充这样设计的链接?我们希望使用日历名称动态填充getCategory卡中的名称,我们将其绑定到设备日历中。
物品
AnimatedContainer(
curve: Curves.linear,
duration: Duration(milliseconds: 300),
height: isViewAll ? 0 : 100,
child: Row(
children: <Widget>[
_getCategoryCard('Favorites', Color(0xff4dc2a6),
Color(0xff65d4bc)),
_getCategoryCard(
'New List', Color(0xfff77769), Color(0xfff88a7d))
],
),
),
AnimatedContainer(
curve: Curves.linear,
duration: Duration(milliseconds: 300),
height: isViewAll ? 0 : 100,
child: Row(
children: <Widget>[
_getCategoryCard('Share List', Color(0xff7b528c),
Color(0xff9569a5)),
_getCategoryCard('Recipes', Color(0xffb1726c),
Color(0xffc1877e))
],
),
),
日历代码
ListView.builder(
itemCount: _calendars?.length ?? 0,
itemBuilder: (BuildContext context, int index) {
return new GestureDetector(
onTap: () async {
await Navigator.push(context, new MaterialPageRoute(
builder: (BuildContext context) {
return new CalendarEventsPage(_calendars[index]);
}));
},
child: new Padding(
padding: const EdgeInsets.all(10.0),
child: new Row(
children: <Widget>[
new Expanded(
flex: 1,
child: new Text(
_calendars[index].name,
style: new TextStyle(fontSize: 25.0, color: Colors.white),
),
),
new Icon(_calendars[index].isReadOnly
? Icons.lock
: Icons.lock_open, color: Colors.white,)
],
)));
},
),