繁体   English   中英

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

[英]How can I place a divider between those list tiles

我是编码新手,我刚刚开始我的第一个项目,我只是在阅读 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(
            'lucas.issler@ftc.edu.br',
            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);
          },
        ),

您需要为 ListTile 制作一个单独的 ListView.separated()。 看看这个DartPad ,希望它有帮助。

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM