どうも、ちょげ(@chogetarou)です。
CheckboxListTileに色付きの枠線をつける方法を紹介します。
方法

CheckboxListTileに色付きの枠線をつけるには、引数「shape」を使います。
まず、CheckboxListTileの引数「shape」にRoundedRectangleBorderを指定します。
次に、RoundedRectangleBorderの引数「side」にBorderSideクラスを指定します。
そして、BorderSideの引数「color」に枠線の色を指定します。
CheckboxListTile(
shape: RoundedRectangleBorder(
side: BorderSide(
color: /*枠線の色*/,
),
),
・・・
),
これでCheckboxListTileに色付きの枠線がつきます。
使用例
以下は、使用例です。

@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: CheckboxListTile(
shape: RoundedRectangleBorder(
side: BorderSide(
color: Colors.pink,
),
),
title: Text('リストタイル'),
value: _isChecked,
onChanged: (value) {
setState(() {
_isChecked = !_isChecked;
});
},
),
),
),
);
}
コメント