【问题标题】:How to make border inside GridView如何在 GridView 内制作边框
【发布时间】:2020-05-03 00:32:20
【问题描述】:

所以我想要实现的是像这样的应用程序的 GridView,我不知道该怎么做。你能帮助我吗?

【问题讨论】:

标签: flutter


【解决方案1】:

这会很好用,检查一下。

这是网格视图

          crossAxisCount: 3,
          childAspectRatio: 1.0,
          children: List.generate(
            20,
            (index) => _gridTile('Sarapan'),
          ),
        ),

这是网格图块小部件

Widget _gridTile(String name) {
    return Container(
      decoration: BoxDecoration(
        border: Border.all(
          color: Colors.black54,
          width: 0.3,
        ),
      ),
      child: Center(
        child: Text(
          name,
          style: TextStyle(
            fontSize: 20,
            fontWeight: FontWeight.w500,
          ),
        ),
      ),
    );
  }

上面的代码产生下面的输出:

【讨论】:

  • 任何线索如何做上面图片的样式?
  • 您可以调整我上面的代码,通过添加图像和图标来获得它。我希望这会有所帮助。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-11-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-08-16
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多