ExpansionTile(每日Flutter 小部件)

可折叠的控件

initiallyExpanded: true, 初始是否展开

 

class ExpansionTileWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return getLv(context);
  }

  Widget getLv(BuildContext context) {
    return Expanded(
      child: ListView(children: <Widget>[
        const ListTile(title: Text('Top')),
        ExpansionTile(
            title: const Text('Sublist'),
            backgroundColor: Theme.of(context).accentColor.withOpacity(0.025),
            initiallyExpanded: true,
            children: const <Widget>[
              ListTile(title: Text('One')),
              ListTile(title: Text('Two')),
              ListTile(title: Text('Free')),
              ListTile(title: Text('Four'))
            ]),
        const ListTile(title: Text('Bottom'))
      ]),
    );
  }
}

 

 

 

 

posted on 2020-03-21 16:20  wjw334  阅读(829)  评论(0编辑  收藏  举报

导航