如何在ListView中使用SingleChildScroll视图?
这是我当前的实现
ListView(
shrinkWrap: true,
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
Card(
child: Container(
padding: const EdgeInsets.all(12),
color: Colors.orange,
width: 300,
child: const Text('Hello'),
),
),
Card(
child: Container(
padding: const EdgeInsets.all(12),
color: Colors.orange,
width: 300,
child: const Text('Sample events'),
),
),
],
),
),
//... more widgets here
],
);
但是当我水平滚动的时候我得到了这个错误
@pragma("vm:external-name", "AssertionError_throwNew")
external static _doThrowNew(
int assertionStart, int assertionEnd, Object? message);
@pragma("vm:external-name", "AssertionError_throwNewSource")
external static _doThrowNewSource(
String failedAssertion, int line, int column, Object? message);
这是我想要解决的设计。
1条答案
按热度按时间t2a7ltrp1#
我正在努力解决您的问题:
physics:BouncingScrollPhysics(),