どうも、ちょげ(@chogetarou)です。
ElevatedButtonのパディングを設定する方法を紹介します。
方法

ElevatedButtonのパディングを設定するには、引数「style」を使います。
まず、ElevatedButtonの引数「style」にElevatedButton.styleFromを指定します。
そして、styleFromの引数「padding」にパディングを指定します。
パディングの指定には、EdgeInsetsクラスを使います。
ElevatedButton(
style: ElevatedButton.styleFrom(
padding: EdgeInsets(・・・), //パディングを指定
),
・・・
),
ElevatedButton.styleFromの引数「padding」に指定したパディングが、ElevatedButtonのパディングに設定されます。
使用例

@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: Center(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
padding: EdgeInsets.all(20),
),
onPressed: () {
print("Button Tap");
},
child: Text('Button'),
),
),
),
);
}
コメント