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 | |
parent | 3c6100197cedd6b2e08a3237f596aff6e25f672b (diff) |
Proper theming, selection
Diffstat (limited to 'lib')
-rw-r--r-- | lib/widgets/badge_motive_list.dart | 17 | ||||
-rw-r--r-- | lib/widgets/device_scan_select.dart | 4 |
2 files changed, 19 insertions, 2 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(); diff --git a/lib/widgets/device_scan_select.dart b/lib/widgets/device_scan_select.dart index cd65eac..a2e7fc5 100644 --- a/lib/widgets/device_scan_select.dart +++ b/lib/widgets/device_scan_select.dart @@ -33,6 +33,8 @@ class _DeviceScanSelectionState extends State<DeviceScanSelection> { @override Widget build(BuildContext context) { + var mytheme = Theme.of(context); + return Expanded( child: ListView.separated( itemCount: widget.items.length, @@ -45,7 +47,7 @@ class _DeviceScanSelectionState extends State<DeviceScanSelection> { title: Text(name), subtitle: Text(result.address ?? "???"), trailing: Text('RSSI: ${result.rssi}'), - selectedTileColor: Colors.amber, + selectedTileColor: mytheme.primaryColorLight, selectedColor: Colors.black, onTap: () { setState(() { |