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( : CheckboxListTile(
title: Text(option.label(context)), title: Text(option.label(context)),
value: value, value: value,
onChanged: enabledSnapshot.data! onChanged: enabledSnapshot.requireData
? (final value) async { ? (final value) async {
await option.set(value!); 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>( child: DropdownButton<T>(
isExpanded: true, isExpanded: true,
value: value, value: value,
items: valuesSnapshot.data!.keys items: valuesSnapshot.requireData.keys
.map( .map(
(final k) => DropdownMenuItem( (final k) => DropdownMenuItem(
value: k, value: k,
child: Text( child: Text(
valuesSnapshot.data![k]!(context), valuesSnapshot.requireData[k]!(context),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
), ),

Loading…
Cancel
Save