微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Flutter 交错的网格布局将其子项隐藏在底部按钮后面

如何解决Flutter 交错的网格布局将其子项隐藏在底部按钮后面

我尝试过 Flutter grid-layout 但由于一些响应问题,我导入了 staggered-layout 库,一切正常,除了它隐藏了图像底部对齐的按钮。

这是代码...

class _WelcomeScreenState extends State<WelcomeScreen> {
  int itemSelected = 0;
  bool isSelected = true;
  List<Welcome> itemList;
  List<Welcome> selectedList;

  @override
  void initState() {
    itemList = DataLists.welcomeList;
    selectedList = List();
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Padding(
          padding: const EdgeInsets.symmetric(horizontal: 34.0,vertical: 20.0),child: Column(
            children: [
              const WelcomeHeader(),const WelcomeSubHeader(),TextField(
                style: TextStyle(color: Colors.black87),cursorColor: Colors.grey,cursorHeight: 20.0,cursorWidth: 1.5,decoration: kInterestsFielddecoration,),const SizedBox(
                height: 16.0,Expanded(
                  child: StaggeredGridView.count(
                    scrollDirection: Axis.vertical,crossAxisCount: 2,crossAxisspacing: 20,mainAxisspacing: 20.0,shrinkWrap: true,staggeredTiles: List.generate(itemList.length,(index) => StaggeredTile.fit(1)),children: List.generate(itemList.length,(index) {
                  return WelcomeGridBox(
                      item: itemList[index],isSelected: (bool value) {
                        setState(() {
                          if (value) {
                            selectedList.add(itemList[index]);
                          } else {
                            selectedList.remove(itemList[index]);
                          }
                        });
                        print("$index : $value");
                      },key: Key(itemList[index].rank.toString()));
                }),)),GestureDetector(
                  onTap: () {
                    Navigator.pushNamed(context,HomeScreen.id);
                  },child: ButtonGetStarted(isSmall: false))
            ],);
  }
}

当我向上滚动一点时,它开始正常运行(按钮在网格上没有重叠)。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。