我的目标是在页面上实现滚动,默认情况下会压缩过度滚动。这是由AlwaysScrollableScrollPhysics
上的flutter
类实现的,但我无法找到有关其实现的适当资源。
下面是我想要实现这一目标的其中一个页面的代码 - 但请注意我面临着关于滚动功能的复杂性。我尝试了Scrollable
和SingleChildScrollView
,两者都给出了“太多位置参数”的错误。根据我的理解,这个问题是我使用一个列来实现这个,这不是正确的方式。
任何关于整个问题的帮助或指示都将非常感激。
body: Container(
padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
child: Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Header(),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 10),
child: Text(
'Some Exam',
style: TextStyle(
fontSize: 15,
fontFamily: 'GoogleMedium',
color: Colors.black54),
),
),
Subject(
iconData: OMIcons.supervisorAccount,
title: 'English',
msg: 'Difficulty Level: Easy',
count: '145',
colors: Color(0xff1a73e8),
),
Subject(
iconData: OMIcons.forum,
title: 'Chinese',
msg: 'Score 25 more to become an expert!',
count: '475',
colors: Color(0xff8024cd),
),
Subject(
iconData: OMIcons.forum,
title: 'Analytical',
msg: 'Good improvement!',
count: '123 in 4 days',
colors: Color(0xff8024cd),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 10),
child: Text(
'ACTIVE FRIENDS',
style: TextStyle(
fontSize: 15,
fontFamily: 'GoogleMedium',
color: Colors.black54),
),
),
activeFriend(
sender: "Another Name",
title: "Just an Exam",
time: "3 seconds ago",
studied: "Bangla",
),
activeFriend(
sender: "Difficult Guy",
title: "An Exam",
time: "18 minutes ago",
studied: "Analytical",
)
],
),
),
把你的Column
包裹在SingleChildScrollView
里面,它只需要一个孩子。
SingleChildScrollView (
child: Column( ...