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

CuopertinoButtonのパディングを設定するには、引数「padding」を使います。
具体的には、CupertinoButtonの引数「padding」に、EdgeInsetsクラスでパディングを指定します。
CupertinoButton(
padding: /*EdgeInsetsでパディングを指定*/,
child: Text('Button'),
onPressed: () {
print('Tap');
},
),
引数「padding」を使えば、CupertinoButtonのパディングを設定することができます。
使用例
以下は、使用例です。

@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: Center(
child: CupertinoButton(
padding: EdgeInsets.all(10.0), //全方向に10
child: Text('Button'),
onPressed: () {
print('Tap');
},
color: Colors.blue,
),
),
),
);
}
コメント