简体   繁体   English

颤振:如何使用扩展文本子构建网格视图

[英]flutter : How To build a grid view with expanded text child

I need to Build this UI Using Flutter, List or (Grid view) of categories which every category has title as text and this texts is different lengths(maybe 4 letters and maybe 15 ).我需要使用 Flutter、 List or (Grid view)类别构建这个 UI,每个类别都有标题作为文本,并且这些文本的长度不同(可能是 4 个字母,也可能是 15 个)。 any suggestions??有什么建议么?? Note : data will fetched from API endpoint注意:数据将从 API 端点获取在此处输入图像描述

You can use Wrap instead of GridView .您可以使用Wrap而不是GridView

Wrap(
  children: result
      .map(
        (e) => Chip(label: Text(e)),
      )
      .toList()),

More about Wrap and Chip .更多关于WrapChip

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

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