Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/281.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Dart 如何将SingleChildScrollView添加到列_Dart_Flutter - Fatal编程技术网

Dart 如何将SingleChildScrollView添加到列

Dart 如何将SingleChildScrollView添加到列,dart,flutter,Dart,Flutter,我正在开发一个应用程序,并遵循此示例,遇到了一个问题,其中显示底部溢出xx像素,如下所示: 现在,我以前遇到过这个问题,通过添加SingleChildScrollView解决了它,如下所示: @覆盖 小部件构建(构建上下文){ 返回材料PP( 标题:"学院",, 主题:新主题数据( primaryColor:Color.fromRGBO(58,66,86,1.0) ), debugShowCheckedModeBanner:false, 家庭:脚手架( 主体:新容器( 子:SingleChil

我正在开发一个应用程序,并遵循此示例,遇到了一个问题,其中显示底部溢出xx像素,如下所示:

现在,我以前遇到过这个问题,通过添加SingleChildScrollView解决了它,如下所示:

@覆盖
小部件构建(构建上下文){
返回材料PP(
标题:"学院",,
主题:新主题数据(
primaryColor:Color.fromRGBO(58,66,86,1.0)
),
debugShowCheckedModeBanner:false,
家庭:脚手架(
主体:新容器(
子:SingleChildScrollView(
子项:LoginScreen(),
)
),
),
);
}
当我不是使用容器而是使用列时,我该怎么做?这就是我在上图中使用的内容(代码底部的列,作者在其中返回脚手架):

class DetailPage扩展了无状态小部件{
最后一课;
DetailPage({Key,this.lesson}):super(Key:Key);
@凌驾
小部件构建(构建上下文){
最终液位指示器=集装箱(
子:容器(
子对象:线性表达式指示器(
背景颜色:颜色。来自RGBO(2092242240.2),
值:lesson.indicator值,
valueColor:AlwaysStoppedAnimation(Colors.green)),
),
);
最终课程价格=集装箱(
填充:常数边集全部(7.0),
装饰:新盒子装饰(
边框:新边框。全部(颜色:颜色。白色),
边界半径:边界半径。圆形(5.0)),
儿童:新文本(
“\$”+lesson.price.toString(),
样式:TextStyle(颜色:Colors.white),
),
);
最终topContentText=列(
crossAxisAlignment:crossAxisAlignment.start,
儿童:[
尺寸箱(高度:120.0),
图标(
图标、方向和汽车,
颜色:颜色,白色,
尺寸:40.0,
),
容器(
宽度:90.0,
子项:新分隔符(颜色:Colors.green),
),
尺寸箱(高度:10.0),
正文(
课程名称,
样式:TextStyle(颜色:Colors.white,fontSize:45.0),
),
尺寸箱(高度:30.0),
划船(
mainAxisAlignment:mainAxisAlignment.start,
儿童:[
扩展(flex:1,child:levelIndicator),
扩大(
弹性:6,
孩子:填充(
填充:仅限边缘设置(左:10.0),
子:文本(
第1课.级别,
样式:TextStyle(颜色:Colors.white),
))),
扩展(flex:1,child:coursePrice)
],
),
],
);
最终topContent=堆栈(
儿童:[
容器(
填充:仅限边缘设置(左:10.0),
高度:MediaQuery.of(上下文).size.height*0.5,
装饰:新盒子装饰(
图片:新装饰图片(
图像:新资产图像(“资产/图像/无人机1.jpg”),
适合:BoxFit.cover,
),
)),
容器(
高度:MediaQuery.of(上下文).size.height*0.5,
填充:所有边缘设置(40.0),
宽度:MediaQuery.of(context).size.width,
装饰:盒子装饰(颜色:color.fromRGBO(58,66,86,9)),
儿童:中心(
child:topContentText,
),
),
定位(
左:8.0,
排名:60.0,
孩子:InkWell(
onTap:(){
Navigator.pop(上下文);
},
子:图标(Icons.arrow\u back,颜色:Colors.white),
),
)
],
);
final bottomContentText=文本(
课程内容,
样式:TextStyle(fontSize:18.0),
);
最终读取按钮=容器(
填充:边缘组。对称(垂直:16.0),
宽度:MediaQuery.of(context).size.width,
孩子:升起按钮(
按下:()=>{},
颜色:颜色。来自RGBO(58,66,86,1.0),
儿童:
Text(“接受本课”,样式:TextStyle(颜色:Colors.white)),
));
最终含量=容器(
宽度:MediaQuery.of(context).size.width,
填充:所有边缘设置(40.0),
儿童:中心(
子:列(
子项:[bottomContentText,readButton],
),
),
);
返回脚手架(
body:Column(//这里是列
children:[topContent,bottomContent],
),
);
}
}
我尝试了这些,但不起作用,结果与之前相同:

返回脚手架(
正文:容器(子项:SingleChildScrollView(子项:列(子项:[topContent,bottomContent],),),),
);
返回脚手架(
正文:第(
子项:[展开(子项:列(子项:[topContent,bottomContent],)],
),
);
返回脚手架(
正文:SingleChildScrollView(子项:容器(子项:列(子项:[topContent,bottomContent],),),),
);
当我按照建议尝试时,我的结果是:

返回脚手架(
body:Column(//这里是列
子项:[扩展(子项:SingleChildScrollView(子项:文本(“测试”))),文本(“数据”)],
),
);

我通过在
topContent
中添加
SingleChildScrollView
来解决这个问题:

容器(
高度:MediaQuery.of(上下文).size.height*0.5,
填充:所有边缘设置(40.0),
宽度:MediaQuery.of(context).size.width,
装饰:盒子装饰(颜色:color.fromRGBO(58,66,86,9)),
子:SingleChildScrollView(
儿童:中心(
child:topContentText,
),
),
),
@pskink结果屏幕