diff options
author | uvok | 2025-08-01 14:28:05 +0200 |
---|---|---|
committer | uvok | 2025-08-01 14:28:05 +0200 |
commit | 5c1ffb1caa83681b9bb128841c6919ccfc1823e7 (patch) | |
tree | 14daff445a24fd136ef7c8fc13c860bd2f1b4a6f /lib/widgets/badge_motive_list.dart | |
parent | 3c6100197cedd6b2e08a3237f596aff6e25f672b (diff) |
Proper theming, selection
Diffstat (limited to 'lib/widgets/badge_motive_list.dart')
-rw-r--r-- | lib/widgets/badge_motive_list.dart | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/widgets/badge_motive_list.dart b/lib/widgets/badge_motive_list.dart index 93e79f8..1da85fa 100644 --- a/lib/widgets/badge_motive_list.dart +++ b/lib/widgets/badge_motive_list.dart @@ -30,8 +30,12 @@ class BadgeMotiveList extends NotifyingListWidget<BadgeMotive> { } class _BadgeMotiveListState extends State<BadgeMotiveList> { + int _selectedIndex = -1; + @override Widget build(BuildContext context) { + var mytheme = Theme.of(context); + return Flexible( fit: FlexFit.loose, child: Column( @@ -47,7 +51,18 @@ class _BadgeMotiveListState extends State<BadgeMotiveList> { return ListView.separated( itemBuilder: (context, index) { var item = widget._motiveVM.motives[index]; - return ListTile(title: Text(item.toString())); + return ListTile( + title: Text(item.description), + selectedTileColor: mytheme.primaryColorLight, + selectedColor: Colors.black, + onTap: () { + setState(() { + _selectedIndex = index; + }); + widget.onItemSelected(item); + }, + selected: _selectedIndex == index, + ); }, separatorBuilder: (context, index) { return Divider(); |