I wrap my column with a SingleChildScrollView so my column content can be scrollable, however it show me the error Bottom overflow by 234 Pixels
我用SingleChildScrollView包装我的列,这样我的列内容就可以滚动了,但是它显示了错误的底部溢出234个像素
Widget build(BuildContext context) {
double height = MediaQuery.of(context).size.height;
double width = MediaQuery.of(context).size.width;
return SingleChildScrollView(
child: Container(
height: height,
width: width,
child: Scaffold(
body: Container(
How can I set a height that can be expand with the height on my container content, so the error Bottom overflowed ...
is not show up?
我如何设置一个可以随容器内容物上的高度扩展的高度,以便错误底部溢出...是不是不露面了?
更多回答
优秀答案推荐
You're setting a fixed height (Media Query giving screen height)
您正在设置固定高度(提供屏幕高度的媒体查询)
child: Container(
height: height, // screen height
If the scaffold's height gets bigger than screen height, it will overflow and this is what happening here. What you want is that if the height is bigger than screen, it should be scrollable. You need to remove height: height
from above Container. Also you can remove the the Container, it is not necessary here.
如果脚手架的高度大于屏幕高度,它将溢出,这就是这里发生的情况。你想要的是,如果高度大于屏幕,它应该是可滚动的。您需要从容器上方移除Height:Height。您也可以移除容器,这里不是必需的。
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Scaffold(
body: Container(
or if body
need to be scrollable
或者正文是否需要可滚动
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: Container(
Find more about scrolling widgets in flutter.
在flutter中找到更多关于滚动部件的信息。
更多回答
我是一名优秀的程序员,十分优秀!