找到了解决方案。Stepper已经是可滚动的小部件,并且当我在ListView中添加Stepper时,它已成为另一个Scrollable小部件中的Scrollable小部件。
来自Gitter的@FunMiles建议使用NestedScrollView小部件而不是ListView&解决了我的问题。
class TestAppHomePage extends StatefulWidget {
@override
TestAppHomePageState createState() => new TestAppHomePageState();
}
class TestAppHomePageState extends State<TestAppHomePage>
with TickerProviderStateMixin {
ScrollController _scrollController = new ScrollController();
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text('Test Title'),
elevation: 0.0,
),
body: new NestedScrollView(
controller: _scrollController,
headerSliverBuilder: (BuildContext context, bool inner@R_974_2419@IsScrolled) {
return <Widget>[
new SliverList(
delegate:new SliverChildListDelegate(<Widget>[
new MyContents(),
new MyContents(),
new MyContents(),
new MyContents(),
]),
),
];
},
body: new SimpleWidget(),
),
);
}
}