Android 颤振/飞镖,切换:引发了另一个异常:右侧的RenderFlex溢出99640像素
我目前正在尝试将一个开关添加到我的android应用程序的设置页面。但是,当我添加代码并尝试在emulator上查看时,它会抛出以下错误: 引发了另一个异常:右侧的RenderFlex溢出99640像素 代码:Android 颤振/飞镖,切换:引发了另一个异常:右侧的RenderFlex溢出99640像素,android,dart,flutter,Android,Dart,Flutter,我目前正在尝试将一个开关添加到我的android应用程序的设置页面。但是,当我添加代码并尝试在emulator上查看时,它会抛出以下错误: 引发了另一个异常:右侧的RenderFlex溢出99640像素 代码: Container( decoration: BoxDecoration ( color: Colors.white, border: Border( bottom: BorderSide(width: 1.0, color: Colors.grey)
Container(
decoration: BoxDecoration (
color: Colors.white,
border: Border(
bottom: BorderSide(width: 1.0, color: Colors.grey)
),
),
constraints: BoxConstraints (
maxHeight: ((width * ratio) * 0.1),
minWidth: width,
maxWidth: width,
),
child: Row(
children: <Widget>[
Expanded(
child: Padding(
padding: EdgeInsets.only(left: (width*ratio) * 0.025),
child: Text('Highlight Identical Numbers', style: TextStyle(color: Colors.black87, fontSize: fontTextTwoScale, fontFamily: 'Roboto'))
)
),
Container(
child: Switch(value: null, onChanged: null,)
),
],
),
),
容器(
装饰:盒子装饰(
颜色:颜色,白色,
边界:边界(
底部:边框边(宽度:1.0,颜色:颜色。灰色)
),
),
约束:BoxConstraints(
最大高度:((宽度*比率)*0.1),
minWidth:width,
maxWidth:width,
),
孩子:排(
儿童:[
扩大(
孩子:填充(
填充:仅限边缘组(左:(宽度*比率)*0.025),
子项:文本('高亮显示相同的数字',样式:TextStyle(颜色:Colors.black87,fontSize:fontTextTwoScale,fontFamily:'Roboto'))
)
),
容器(
子:开关(值:null,onChanged:null,)
),
],
),
),
我正在尝试设置它,使文本与屏幕左侧对齐,开关与右侧对齐。我不明白小部件怎么会溢出99640像素。我看不到开关的尺寸选项
这项工作应该很容易完成。自定义ListTile或将其包装在容器中以进行自定义
ListTile(
title: Text("Setting Text One Title"),
trailing: Switch(value: true, onChanged: (bool x) {}),
)
谢谢,这比我想做的要简单得多。