Browse Source

settings: use requireData for AsyncSnapshots

pull/427/head
Nikolas Rimikis 1 year ago
parent
commit
686945431b
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 2
      packages/settings/lib/src/widgets/checkbox_settings_tile.dart
  2. 4
      packages/settings/lib/src/widgets/dropdown_button_settings_tile.dart

2
packages/settings/lib/src/widgets/checkbox_settings_tile.dart

@ -18,7 +18,7 @@ class CheckBoxSettingsTile extends InputSettingsTile<ToggleOption> {
: CheckboxListTile(
title: Text(option.label(context)),
value: value,
onChanged: enabledSnapshot.data!
onChanged: enabledSnapshot.requireData
? (final value) async {
await option.set(value!);
}

4
packages/settings/lib/src/widgets/dropdown_button_settings_tile.dart

@ -42,12 +42,12 @@ class DropdownButtonSettingsTile<T> extends InputSettingsTile<SelectOption<T>> {
child: DropdownButton<T>(
isExpanded: true,
value: value,
items: valuesSnapshot.data!.keys
items: valuesSnapshot.requireData.keys
.map(
(final k) => DropdownMenuItem(
value: k,
child: Text(
valuesSnapshot.data![k]!(context),
valuesSnapshot.requireData[k]!(context),
overflow: TextOverflow.ellipsis,
),
),

Loading…
Cancel
Save