FlutterのButtonボタンについて高さ設定はありません(初心者)
1499 ワード
flutter内のRaisedButton、FloatingActionButton、FlatButton、OutlineButtonの4つのbuttonは高さ設定されていません.RaisedButtonの例を次に示します.
Containerは高さを設定すれば実現しますが、Containerの幅がいっぱいになることはなく、中のフォントの幅とともに表示されます.次にpadingを用いてButtonの高さを実現する
pading高さを設定すると幅がいっぱいになります
処理方法1:高さがないで1つの高さのViewでContainerをロードして、そこでありました
new Container(
height: 60.0,
child: new RaisedButton(onPressed: (){},
child: new Text(" Buton "),
color: Colors.deepOrange,
),
),
Containerは高さを設定すれば実現しますが、Containerの幅がいっぱいになることはなく、中のフォントの幅とともに表示されます.次にpadingを用いてButtonの高さを実現する
処理方法二padingを用いてButtonの高さを実現する
new Padding(padding: new EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 20.0),
child: new Row(
children: [
new Expanded(child:
new RaisedButton(onPressed: (){
print(" Padding RaisedButton");
},
// Text
child: new Padding(padding: new EdgeInsets.fromLTRB(10.0, 10.0, 0.0, 10.0),
child: new Text("Padding Buton "),
),
color: Colors.deepOrange,
),
),
],
),
),
pading高さを設定すると幅がいっぱいになります