Flutter 如何在颤振中设置CupertinoButton的宽度?
我是不是漏掉了什么明显的东西? 在CupertinOn按钮上设置minSize可设置宽度和高度(见图) 如何仅设置宽度 提前谢谢Flutter 如何在颤振中设置CupertinoButton的宽度?,flutter,dart,flutter-cupertino,Flutter,Dart,Flutter Cupertino,我是不是漏掉了什么明显的东西? 在CupertinOn按钮上设置minSize可设置宽度和高度(见图) 如何仅设置宽度 提前谢谢 将其包装在一个大小合适的盒子中,并设置宽度和高度 范例 SizedBox( width: 500, height: 200 child: CupertinoButton( onPressed: (){}, child: Text("Click Me", style: TextStyle(color: Colors.whit
将其包装在一个大小合适的盒子中,并设置宽度和高度 范例
SizedBox(
width: 500,
height: 200
child: CupertinoButton(
onPressed: (){},
child: Text("Click Me", style: TextStyle(color: Colors.white)),
color: Colors.green
)
)
注意:最好使用SizedBox,因为它更有效,因为您只需要更改宽度和高度
看看这个。
将其包装在容器中(),然后设置宽度和高度为您的
杯垫按钮提供特定的宽度
和高度
您可以执行以下操作之一:
1) 将其包装在一个大小为的盒子中
,并指定宽度和高度
检查下面的代码,例如:
SizedBox(
// set your width property here
width: 100,
// set your width property here
height: 100
child: CupertinoButton(
......
),
);
Container(
// set your width property here
width: 100,
// set your width property here
height: 100
child: CupertinoButton(
......
),
);
2) 将其包装在容器中
并指定宽度和高度
检查下面的代码,例如:
SizedBox(
// set your width property here
width: 100,
// set your width property here
height: 100
child: CupertinoButton(
......
),
);
Container(
// set your width property here
width: 100,
// set your width property here
height: 100
child: CupertinoButton(
......
),
);
注意:为了获得更好的性能,建议根据要使用的属性选择小部件。如果需要容器
的某些属性,请转到容器
小部件
如果您不需要容器的大多数属性,请转到SizedBox
小部件。请发布您的代码