如何在GridView flutter中实现自动列

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

enter image description here

[我如何实现这一目标,知道项目的数量和内容可能会增加?

flutter flutter-layout
1个回答
0
投票

您可以轻松地使用Wrap小部件https://api.flutter.dev/flutter/widgets/Wrap-class.html

Wrap(
  spacing: 8.0, // gap between adjacent chips
  runSpacing: 4.0, // gap between lines
  children: <Widget>[
      Chip(
        label: Text('Mobiles'),
      ),
      Chip(
        label: Text('Tabletes'),
      ),
      Chip(
        label: Text('Vip Phone Number'),
      ),
      Chip(
        label: Text('Mobile - Tablet Spare Parts'),
      ),
  ],
)
© www.soinside.com 2019 - 2024. All rights reserved.