如何在抽屉的ExpansionTile中添加动态内容?

时间:2019-06-20 04:29:35

标签: flutter dart

我需要在ExpansionTile中添加ListViewBuilder。左侧抽屉中的扩展板。我是扑扑的新手,我不知道该如何添加?请帮我解决这个问题吗?

 drawer: Drawer(
 child: Container(
    child: ListView(
        padding: EdgeInsets.zero,
        children: <Widget>[
ListTile(......),
ListTile(......),
ListTile(......),
 ExpansionTile(
                  title: Text(
                    'Game Rules',
                    style: TextStyle(color: Colors.white),
                  ),
                  leading: new IconButton(
                    icon: new Icon(
                      Icons.wb_iridescent,
                      color: Colors.white,
                    ),
                  ),
                  children: <Widget>[
                    ListView.builder(
                        itemCount: _rules.length,
                        itemBuilder: (context, index) {
                          return Text(_rules[index]['category']);
                        })
                  ],
                ),

]

1 个答案:

答案 0 :(得分:0)

在您的<Style TargetType="local:CustomButton" > <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:CustomButton"> <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"> <Grid> <TextBlock x:Name="TBK"/> </Grid> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> 中-添加-ListView.builder

shrinkWrap: true,