Flutter ElevatedButtonの影の大きさを変えるサンプル
環境
Windows11 pro 64bit
Flutter 3.3.7
構文
style: ElevatedButton.styleFrom(
elevation: /*影の大きさ*/
),
style: ElevatedButton.styleFrom(
elevation: /*影の大きさ*/
),
style: ElevatedButton.styleFrom( elevation: /*影の大きさ*/ ),
ElevatedButtonの引数「style」にElevatedButton.styleFromを指定します。
ElevatedButtonの影の大きさを設定します。
使用例
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: Center(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 20,
),
onPressed: () {
print("test");
},
child: Text('表示'),
),
),
),
);
}
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: Center(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 20,
),
onPressed: () {
print("test");
},
child: Text('表示'),
),
),
),
);
}
@override Widget build(BuildContext context) { return SafeArea( child: Scaffold( body: Center( child: ElevatedButton( style: ElevatedButton.styleFrom( elevation: 20, ), onPressed: () { print("test"); }, child: Text('表示'), ), ), ), ); }