如何在这些列表图块之间放置分隔线

问题描述 投票:0回答:1

我是编码的新手,我刚刚开始我的第一个项目,我只是在阅读flutter的文档并尝试自己做一些事情,但这有点困难,我如何在这些列表之间放置分隔符瓷砖?

我已经尝试过诸如ListView.separated之类的东西以及类似的替代方法,无法使其在我的代码上运行,可能会导致其结构以某种方式全部错误,有任何提示吗?

Widget build(BuildContext context) {
return Container(
  child: Drawer(
    child: ListView(
      children: <Widget>[
        UserAccountsDrawerHeader(
          currentAccountPicture: CircleAvatar(
            backgroundColor: Colors.blueGrey,
            child: Text(
              "LPI",
              style: TextStyle(
                fontSize: 32,
                fontWeight: FontWeight.w700,
              ),
            ),
          ),
          accountName: Text(
            'Lucas Pereira Issler',
            style: TextStyle(
              fontSize: 22,
              fontWeight: FontWeight.w700,
            ),
          ),
          accountEmail: Text(
            '[email protected]',
            style: TextStyle(
              fontSize: 14,
              fontWeight: FontWeight.w400,
            ),
          ),
        ),
        ListTile(
          leading: Icon(
            Icons.pets,
            size: 40,
            color: Colors.blueAccent,
          ),
          title: Text('Adoção',
              style: TextStyle(
                fontSize: 22,
                fontWeight: FontWeight.w800,
                color: Colors.blueAccent,
              )),
          onTap: () {
            Navigator.pop(context);
          },
        ),
        ListTile(
          leading: Icon(
            Icons.remove_red_eye,
            size: 40,
            color: Colors.blueAccent,
          ),
          title: Text('Desaparecidos',
              style: TextStyle(
                fontSize: 22,
                fontWeight: FontWeight.w800,
                color: Colors.blueAccent,
              )),
          onTap: () {
            Navigator.pop(context);
          },
        ),
android flutter flutter-layout
1个回答
0
投票

您需要为ListTile创建一个单独的ListView.separated()。签出此DartPad,希望对您有所帮助。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.