我创建了一个可以很好地处理列的屏幕,但我需要因键盘而滚动。Flutter - SingleChildScrollView干扰列
当您插入SingleChildScrollView
或ListView
属性MainAxisAlignment.spaceBetween
时,它不再起作用。
有没有解决方案?
的Gif不SingleChildScrollView
屏幕不滚动和FloatingActionButton
在屏幕
的Gif与SingleChildScrollView
屏幕滚动的底部,他FloatingActionButton
是不是在屏幕的底部
import 'package:flutter/material.dart';
void main() {
runApp(new MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(backgroundColor: new Color(0xFF26C6DA)),
body: new SingleChildScrollView(
child: new Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
new Container(
child: new Column(
children: <Widget>[
new TextField(
decoration: const InputDecoration(
labelText: "Description",
),
style: Theme.of(context).textTheme.title,
),
new TextField(
decoration: const InputDecoration(
labelText: "Description",
),
style: Theme.of(context).textTheme.title,
),
new TextField(
decoration: const InputDecoration(
labelText: "Description",
),
style: Theme.of(context).textTheme.title,
),
],
)
),
new Container(
margin: new EdgeInsets.only(bottom: 16.0),
child: new FloatingActionButton(
backgroundColor: new Color(0xFFE57373),
child: new Icon(Icons.check),
onPressed:(){}
),
)
],
),
)
);
}
}
感谢您的解释,它帮助了很多。 – rafaelcb21