繁体   English   中英

滚动滚动窗口小部件时,列中的窗口小部件不能完全滚动

[英]Widget inside a column not scrolling completely when scrolling Scroll-able widget

我有一个NestedScrollView其主体包含一个TabBarView 其中一个选项卡有一个带有图像的列和一个可滚动的小部件( GridView.builder )。 滚动此可滚动窗口小部件时,图像会中途卡住(就像它被固定在该位置一样)。

这是代码

//home.dart

class _HomePage extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Container(                //this is the image that gets stuck
      child: Column(
        children: <Widget>[
          new Container(
            child: new Image.asset(
              "images/product.jpg",
              fit: BoxFit.fitWidth,
            ),
          ),
          Expanded(
            child: FreshFinds(),    //this is the scrollable widget
          ),
        ],
      ),
    );
  }
}

// Freshfind.dart 

  @override
  Widget build(BuildContext context) {
    return Card(
      child: GridView.builder(
        // shrinkWrap: true,
        itemCount: 50,
        physics: ScrollPhysics(),
        gridDelegate:
            new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2),
        itemBuilder: (BuildContext context, int index) {
          return FutureBuilder(
            future: fetchdata(index),
            builder: (BuildContext context, AsyncSnapshot snapshot) {
              if (!snapshot.hasData)
                return buildfake(index);
              else
                return buildcard(snapshot.data, index);
            },
          );
        },
      ),
    );
  }

这是一个问题的视频

我认为你需要使用SliverAppBar()小部件和TabBar()

这是一个可能对您有帮助的资源

暂无
暂无

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

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