You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1000 B
30 lines
1000 B
2 years ago
|
part of '../../settings.dart';
|
||
|
|
||
|
class CheckBoxSettingsTile extends InputSettingsTile<ToggleOption> {
|
||
|
const CheckBoxSettingsTile({
|
||
|
required super.option,
|
||
|
super.key,
|
||
|
});
|
||
|
|
||
|
@override
|
||
|
Widget build(final BuildContext context) => OptionBuilder<bool>(
|
||
|
option: option,
|
||
|
builder: (final context, final value) => value == null
|
||
|
? Container()
|
||
|
: StreamBuilder<bool>(
|
||
|
stream: option.enabled,
|
||
|
builder: (final context, final enabledSnapshot) => !enabledSnapshot.hasData
|
||
|
? Container()
|
||
|
: CheckboxListTile(
|
||
|
title: Text(option.label(context)),
|
||
|
value: value,
|
||
|
onChanged: enabledSnapshot.data!
|
||
|
? (final value) async {
|
||
|
await option.set(value!);
|
||
|
}
|
||
|
: null,
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|