frosty/lib/screens/settings/widgets/settings_list_select.dart
Tommy Chow f68de827cd
Refresh themes and styling (#394)
* consolidate themes

* update and tweak styles, add border styling

* add borders between video and chat

* tweak heights

* improve reply threads
- taller new design
- can now tap parent's reply
- fix crash when tapping self

* tweak border colors

* tweak theme

* tweak theme

* tweak theme

* add accent color picker in settings

* overhaul colors and styles

* remove print

* add divider to chat user modal and revert height

* increase deleted message opacity

* revert highlight color

* tweak color

* tweak colors

* tweak padding

* tweak padding

* tweak placeholder color

* revert input fill color

* use error color
2024-09-06 21:43:27 -07:00

47 lines
1.3 KiB
Dart

import 'package:flutter/material.dart';
/// A custom-styled adaptive [ListTile] with options to select.
class SettingsListSelect extends StatelessWidget {
final String? title;
final String? subtitle;
final String selectedOption;
final List<String> options;
final ValueChanged<String> onChanged;
const SettingsListSelect({
super.key,
this.title,
this.subtitle,
required this.selectedOption,
required this.options,
required this.onChanged,
});
@override
Widget build(BuildContext context) {
return ListTile(
title: title != null ? Text(title!) : null,
subtitle: Padding(
padding: title != null
? const EdgeInsets.symmetric(vertical: 8)
: EdgeInsets.zero,
child: SegmentedButton(
style: const ButtonStyle(visualDensity: VisualDensity.compact),
segments: options
.map(
(option) => ButtonSegment(
value: option,
label: Text(
option,
overflow: TextOverflow.ellipsis,
),
),
)
.toList(),
selected: {selectedOption},
onSelectionChanged: (selection) => onChanged(selection.first),
),
),
);
}
}