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 为什么可以';在颤振中,我是否改变凸起按钮的宽度和高度属性?_Flutter_Dart - Fatal编程技术网

Flutter 为什么可以';在颤振中,我是否改变凸起按钮的宽度和高度属性?

Flutter 为什么可以';在颤振中,我是否改变凸起按钮的宽度和高度属性?,flutter,dart,Flutter,Dart,我正在开发这个简单的应用程序,我似乎无法更改凸起按钮的宽度和高度属性,我也尝试过使用平面按钮,但它也不起作用 行(mainAxisAlignment:mainAxisAlignment.space、, 儿童:[ 升起的按钮( 身高:20, 颜色:颜色。绿色, 已按下:(){ setState((){}); }, 错误消息:未定义命名参数“height”。请尝试将名称更正为现有命名参数的名称,或使用名称“height”定义命名参数。如链接中所示 准备就绪后,您需要将button小部件与butto

我正在开发这个简单的应用程序,我似乎无法更改凸起按钮的宽度和高度属性,我也尝试过使用平面按钮,但它也不起作用

行(mainAxisAlignment:mainAxisAlignment.space、,
儿童:[
升起的按钮(
身高:20,
颜色:颜色。绿色,
已按下:(){
setState((){});
},

错误消息:未定义命名参数“height”。请尝试将名称更正为现有命名参数的名称,或使用名称“height”定义命名参数。

如链接中所示

准备就绪后,您需要将button小部件与button主题小部件包装在一起。我给出了一个示例代码:

ButtonTheme(
  minWidth: 200.0,
  height: 100.0,
  child: RaisedButton(
    onPressed: () {},
    child: Text("test"),
  ),
);

您应该用其他传递约束的小部件(如容器)包装您的凸起按钮

Container(
  width: 200,
  height: 50,
  child: RaisedButton(
    onPressed: this.action,
    color: Colors.blue,
    child: Text('Title', style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
  ),
)

请在问题正文中包含格式化代码。您可以使用三个反勾(`)或波浪号(~)格式化代码块在代码前后的行上。更多格式帮助。错误消息也应该包含在文章的正文中。我已经对它进行了格式设置,但为什么根据颤振文档,它应该具有诸如height和minWidth之类的属性。如果检查构造函数,则没有诸如height和minWidth之类的属性。它们位于属性标题和按钮具有属性,但要设置,您需要使用另一个小部件。但它列在属性下,我真的很困惑按钮本身不应该具有高度属性吗?RaisedButton没有属性来设置其大小。它可以从父项继承约束
Container(
  width: 200,
  height: 50,
  child: RaisedButton(
    onPressed: this.action,
    color: Colors.blue,
    child: Text('Title', style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
  ),
)