[英]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.