0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

@gi-ra-ffeAdvent Calendar 2023

Day 20

【Flutter】ボタン

Last updated at Posted at 2023-12-19

ボタンの種類

ElevatedButton

マテリアルデザインのボタン

ElevatedButton(
  onPressed: () {
    // ボタンが押された時の処理
  },
  child: Text('Elevated Button'),
);

TextButton(テキストボタン)

輪郭や塗りつぶしなし

TextButton(
  onPressed: () {
    // ボタンが押された時の処理
  },
  child: Text('Text Button'),
);

IconButton(アイコンボタン)

IconButton(
  icon: Icon(Icons.add),
  onPressed: () {
    // ボタンが押された時の処理
  },
);

# ボタンのスタイルについて
ElevatedButtonでサンプル作成

文字色や背景色、ボタンの形状の変更

ElevatedButton(
  onPressed: () {
    // ボタンが押された時の処理
  },
  style: ElevatedButton.styleFrom(
    primary: Colors.green, // ボタンの背景色
    onPrimary: Colors.white, // 押下時の文字色
    shape: RoundedRectangleBorder(
      borderRadius: BorderRadius.circular(10.0), // 角丸
    ),
  ),
  child: Text('Styled Button'),
);
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?