[英]flutter - To scroll through two list views at the same time
我想實現兩個列表同時滾動的功能。 我在列表中放了兩個不可滾動的列表,但是出現錯誤。
我從一個列表中得到了抵消,而另一個提出了轉移到那個抵消的想法,但我找不到辦法。
我希望你告訴我該怎么做或建議一種新的方法。 這個問題對我很重要。 請告訴我怎么做。
Row(
children: [
Expanded(
child: SizedBox(
height: 200,
child: ListView(
// scrollDirection: Axis.horizontal,
children: [
Container(
height: 36,
child: ListView.builder(
physics: NeverScrollableScrollPhysics(),
itemCount:
_selectedTimeStartBtn ? 24 : 49,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
return Container(
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(
horizontal: 17, vertical: 7),
decoration: new BoxDecoration(
color: Color(0xfffff2f1),
border: Border.all(
color: Color(0xffffdddb),
),
borderRadius:
BorderRadius.circular(5),
),
child: Text(
(index ~/ 24 == 2)
? '24:00'
: (index % 24 < 10)
? '0${index % 24}:00'
: '${index % 24}:00',
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: 'NotoSansKR',
color: Color(0xfff03127),
fontSize: 16,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
),
),
);
},
),
),
Container(
height: 36,
child: ListView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount:
_selectedTimeStartBtn ? 24 : 49,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
return Container(
margin: index == 0
? EdgeInsets.only(left: 50)
: null,
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(
horizontal: 17, vertical: 7),
decoration: new BoxDecoration(
color: Colors.grey,
border: Border.all(
color: Colors.grey,
),
borderRadius:
BorderRadius.circular(5),
),
child: Text('DATA'),
);
},
),
),
],
),
),
),
],
),
嘗試這個:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.