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
Flutter 如何在颤振中设置CupertinoButton的宽度?_Flutter_Dart_Flutter Cupertino - Fatal编程技术网

Flutter 如何在颤振中设置CupertinoButton的宽度?

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

我是不是漏掉了什么明显的东西? 在CupertinOn按钮上设置minSize可设置宽度和高度(见图)

如何仅设置宽度

提前谢谢


将其包装在一个大小合适的盒子中,并设置宽度和高度

范例

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
小部件。

请发布您的代码