どうも、ちょげ(@chogetarou)です。
ListTileの枠線の色を変える方法を紹介します。
方法

ListTileの枠線の色を変えるには、RoundedRectangleBorderを使います。
まず、ListTileの引数「shape」にRoundedRectangleBorderを指定します。
次に、RoundedRectangleBorderの引数「borderSide」にBorderSideを指定します。
そして、BorderSideの引数「color」に枠線の色を指定します。
ListTile(
shape: RoundedRectangleBorder(
side: BorderSide(
color: /*枠線の色*/,
),
),
title: Text('テキスト'),
);
RoundedRectangleBorderを使えば、ListTileの枠線の色を変えることが出来ます。
使用例
以下は、使用例です。

@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ListView.builder(
shrinkWrap: true,
padding: EdgeInsets.all(10),
itemBuilder: (context, index) {
return ListTile(
shape: RoundedRectangleBorder(
side: BorderSide(
color: Colors.pink,
),
),
title: Text('Item : $index'),
);
},
itemCount: 10,
),
),
);
}
コメント