簡體   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