LoginSignup
0
0

【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