关于 Flutter TabBar

mgdq6dx1  于 2023-11-21  发布在  Flutter
关注(0)|答案(1)|浏览(125)


的数据
有没有类似的组件在flutter?或者任何专业的家伙可以提供我的代码?谢谢。
我找不到这样的效果包,我的要求是显示所有的标签后,Animatedcontainer打开标签栏.

2wnc66cl

2wnc66cl1#

你可能想要ExpansionTile,我让它变得简单快捷。

class ExpansionGrid extends StatelessWidget {
  const ExpansionGrid({
    super.key,
    required this.itemList,
  });

  final List<YourItem> itemList;

  @override
  Widget build(BuildContext context) {
    return ExpansionTile(
      tilePadding: EdgeInsets.zero,
      childrenPadding: const EdgeInsets.only(right: 40),
      // it's kind dirty. You may use Row() for title instead.
      title: GridView.builder(
        shrinkWrap: true,
        gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
          crossAxisCount: 3,
          mainAxisSpacing: 10,
          crossAxisSpacing: 10,
        ),
        itemBuilder: (context, index) => itemList.sublist(0, 3)[index],
        itemCount: itemList.sublist(0, 3).length,
      ),
      children: [
        GridView.builder(
          shrinkWrap: true,
          physics: const NeverScrollableScrollPhysics(),
          gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
            crossAxisCount: 3,
            mainAxisSpacing: 10,
            crossAxisSpacing: 10,
          ),
          itemBuilder: (context, index) => itemList.sublist(3)[index],
          itemCount: itemList.sublist(3).length,
        ),
      ],
    );
  }
}

个字符
您将需要自定义它,使更好,更适合您的形象。
希望能帮上忙。

相关问题