[英]ListView Scrolling not working in dart/flutter
我需要滾動但不滾動。 此時,一些數據/項目顯示但最大數據已被隱藏。 那么如何克服/滾動所有數據項。 我需要滾動但不滾動。 此時,一些數據/項目顯示但最大數據已被隱藏。 那么如何克服/滾動所有數據項。 我需要滾動但不滾動。 此時,一些數據/項目顯示但最大數據已被隱藏。 那么如何克服/滾動所有數據項。 我的源代碼如下:
body:
ListView(
children: [
ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: _mOfferListRemoveDuplicate == null ? 0 : _mOfferListRemoveDuplicate.length,
// itemCount: _mOfferList == null ? 0 : _mOfferList.length,
itemBuilder: (BuildContext context, index) {
return Card(
margin: EdgeInsets.all(5.0),
elevation: 1,
child: SizedBox(
height: 100,
child: ListView(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
_mOfferListRemoveDuplicate[index],
textAlign: TextAlign.left,
style: TextStyle(fontSize: 4.0, color: Colors.green,),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount:
_mOfferList == null ? 0 : _mOfferList.length,
itemBuilder: (BuildContext context, index) {
return Column(
children: [
Text("" + _mOfferList[index].offerTitle,style: TextStyle(fontSize: 5.0),)
],
);
}),
),
],
),
));
}),
],
));
在每個 listview 和 listview.builder (期望第一個)中使用以下代碼:
physics: ScrollPhysics(),
shrinkWrap: true,
它必須工作
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.