简体   繁体   中英

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

I have a NestedScrollView whose body contains a TabBarView . And one of the tabs has a column with an image and a scrollable widget( GridView.builder ). When scrolling this scrollable widget, the images get stuck halfway(as if it was pinned in that position).

Here's the code

//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);
            },
          );
        },
      ),
    );
  }

Here is a video of the problem

I think you need to use SliverAppBar() widget alongside with TabBar() .

Here's a resource that might help you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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