Aja*_*tam 8 dart flutter flutter-cupertino
我在这里遗漏了一些明显的东西吗?在 CupertinoButton 按钮上设置 minSize 可设置宽度和高度(参见图片)。
如何只设置宽度?
提前致谢。
Jos*_*eve 12
将其包裹在 SizedBox 中并设置宽度和高度。
例子
SizedBox(
width: 500,
height: 200
child: CupertinoButton(
onPressed: (){},
child: Text("Click Me", style: TextStyle(color: Colors.white)),
color: Colors.green
)
)
Run Code Online (Sandbox Code Playgroud)
注意:最佳实践是使用 SizedBox,因为它更有效,因为您只需要更改宽度和高度。
检查一下。 Flutter:SizedBox 与 Container,为什么使用一个而不是另一个?