Flutter OutlinedButtonの背景色を変えるサンプル
環境
Windows11 pro 64bit
Flutter 3.3.7
構文
style: OutlinedButton.styleFrom(
backgroundColor: /*背景色*/,
),
style: OutlinedButton.styleFrom(
backgroundColor: /*背景色*/,
),
style: OutlinedButton.styleFrom( backgroundColor: /*背景色*/, ),
「OutlinedButton.styleFrom」の引数「backgroundColor」で、背景色を設定します。
OutlinedButtonの引数「style」に、背景色を設定した「OutlinedButton.styleFrom」を指定します。
使用例
child: OutlinedButton(
onPressed: () {},
child: Text('表示'),
style: OutlinedButton.styleFrom(
backgroundColor: Colors.green, //背景色
),
),
child: OutlinedButton(
onPressed: () {},
child: Text('表示'),
style: OutlinedButton.styleFrom(
backgroundColor: Colors.green, //背景色
),
),
child: OutlinedButton( onPressed: () {}, child: Text('表示'), style: OutlinedButton.styleFrom( backgroundColor: Colors.green, //背景色 ), ),