Flutter ElevatedButtonの影の大きさを変えるサンプル

環境
Windows11 pro 64bit
Flutter 3.3.7

構文

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
style: ElevatedButton.styleFrom(
elevation: /*影の大きさ*/
),
style: ElevatedButton.styleFrom( elevation: /*影の大きさ*/ ),
style: ElevatedButton.styleFrom(
  elevation: /*影の大きさ*/
),

ElevatedButtonの引数「style」にElevatedButton.styleFromを指定します。
ElevatedButtonの影の大きさを設定します。

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
@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('表示'),
         ),
       ),
     ),
   );
 }

 

Flutter

Posted by arkgame