Flutter shapeを使ってListTileに枠線をつけるサンプル
環境
Windows11 pro 64bit
Flutter 3.3.7
構文
shape: RoundedRectangleBorder(
side: BorderSide(),
)
ListTileにRoundedRectangleBorderを指定します。
ListTileに枠線をつけるには、引数「shape」を使います。
使用例
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ListView.builder(
shrinkWrap: true,
padding: EdgeInsets.all(8),
itemBuilder: (context, index) {
return ListTile(
shape: RoundedRectangleBorder(
side: BorderSide(),
),
title: Text('ttt : $index'),
);
},
itemCount: 3,
),
),
);
}