[英]Flutter page is not scrollable: How to scroll when more than one widget?
I am trying to make my page scrollable but I didn't manage it.我试图让我的页面可滚动,但我没有管理它。 What I tried so far is to use SingeChildScrollView , ListView and ScrollView ... Everytime I use one of these an error occurs.
到目前为止我尝试过的是使用SingeChildScrollView 、 ListView和ScrollView ......每次我使用其中一个时都会发生错误。 How can I manage this?
我该如何管理? Is there any alternative to use those three options?
有没有其他方法可以使用这三个选项? I am new to flutter and what I googled so far didn't work because I could only find solutions with one of these three scrolling options.
我是 flutter 的新手,到目前为止我在谷歌上搜索的内容没有用,因为我只能找到这三个滚动选项之一的解决方案。 Thank you!
谢谢! This is my code:
这是我的代码:
class LadevorgangScreen extends StatefulWidget {
@override
_LadevorgangScreen createState() => _LadevorgangScreen();
}
@override
class _LadevorgangScreen extends State<LadevorgangScreen> {
//class LadevorgangScreen extends StatelessWidget {
PageController pageController = PageController(initialPage: 0);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Ladevorgang'),
flexibleSpace: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xffFBD23E), Color(0xffF6BE03)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter),
),
),
),
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xffFEFDFD), Color(0xffBDBDB2)],
begin: Alignment.topLeft,
end: Alignment.bottomRight),
),
child: Column(
children: <Widget>[
Padding(
padding: EdgeInsets.fromLTRB(10, 15, 10, 45),
child: FlatButton(
onPressed: () {},
color: Colors.blue,
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
child: RichText(
textAlign: TextAlign.center,
text: TextSpan(
text: 'FAQs:\n',
style: TextStyle(
fontFamily: 'Avenir',
fontSize: 22.0,
fontWeight: FontWeight.w900,
decoration: TextDecoration.underline,
color: Color(0xff232323),
),
children: [
TextSpan(
text: 'Ladevorgang des Elektroautos',
style: TextStyle(
fontFamily: 'Avenir',
fontSize: 20.0,
fontWeight: FontWeight.w500,
decoration: TextDecoration.none,
color: Color(0xff232323)),
),
],
),
),
),
),
Flexible(
child: Text(
'Zu Hause laden',
style: TextStyle(
fontSize: 18.5,
fontFamily: 'Avenir',
fontWeight: FontWeight.w700),
),
),
Padding(
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
child: Column(
children: [
Row(
children: [
Padding(
padding: EdgeInsets.fromLTRB(0, 12, 7, 12),
child: Icon(
Icons.circle_outlined,
size: 15.0,
color: Color(0xffF6BE03),
),
),
Flexible(
child: Text(
"Wie lade ich zu Hause?",
style:
TextStyle(fontSize: 17.0, fontFamily: 'Avenir'),
),
),
],
),
Row(
children: [
Padding(
padding: EdgeInsets.fromLTRB(0, 12, 7, 12),
child: Icon(
Icons.circle_outlined,
size: 15.0,
color: Color(0xffF6BE03),
),
),
Flexible(
child: Text(
"Benötige ich überhaupt eine Lademöglichkeit zu Hause?",
style: TextStyle(
fontSize: 17.0, fontFamily: 'Avenir')),
),
],
),
],
),
),
],
),
),
);
}
}
JUST WRAP your main widget OF BODY in SingleChildScrollView widget只需将您的主要 BODY 小部件包裹在 SingleChildScrollView 小部件中
body: SingleChildScrollView(
child: Container(
decoration: BoxDecoration
.....
..
.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.