Browse Source

Merge pull request #427 from Leptopoda/cleanup/requireData

settings: use requireData for AsyncSnapshots
pull/428/head
Nikolas Rimikis 2 years ago committed by GitHub
parent
commit
7fe089f733
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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