gpt4 book ai didi

android - flutter/Dart ,开关 : Another exception was thrown: A RenderFlex overflowed by 99640 pixels on the right

转载 作者:IT王子 更新时间:2023-10-29 06:54:07 28 4
gpt4 key购买 nike

我目前正在尝试向我的 android 应用程序的设置页面添加一个开关。但是,当我添加代码并尝试在模拟器上查看它时,它会抛出以下错误:

Another exception was thrown: A RenderFlex overflowed by 99640 pixels on the right.

代码:

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,)
),
],
),
),

我正在尝试对其进行设置,以便文本与屏幕左侧对齐,而开关与屏幕右侧对齐。我不明白一个小部件怎么会溢出 99640 像素。我没有看到 Switch 的尺寸选项。

enter image description here

最佳答案

这应该很容易完成这项工作。自定义 ListTile 或将其包装在 Container 中以进行您自己的自定义。

ListTile(
title: Text("Setting Text One Title"),
trailing: Switch(value: true, onChanged: (bool x) {}),
)

enter image description here

关于android - flutter/Dart ,开关 : Another exception was thrown: A RenderFlex overflowed by 99640 pixels on the right,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54164002/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com