Skip to content

Commit

Permalink
Replace initialSetting with initialLocale in addon
Browse files Browse the repository at this point in the history
  • Loading branch information
petr-jilek-deploy committed Jan 12, 2024
1 parent 7a4006f commit 0c42dfc
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions storybook/lib/localization_addon_custom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ class LocalizationAddonCustom extends WidgetbookAddon<Locale> {
// ignore: avoid-dynamic, ok here
final List<LocalizationsDelegate<dynamic>> localizationsDelegates;
final ValueChanged<Locale> onChange;
final Locale initialLocale;

@override
List<Field> get fields {
return [
ListField<Locale>(
name: 'name',
values: locales,
initialValue: initialSetting,
initialValue: initialLocale,
labelBuilder: (locale) => locale.toLanguageTag(),
onChanged: (context, locale) => locale != null ? onChange(locale) : null,
),
Expand All @@ -36,11 +37,8 @@ class LocalizationAddonCustom extends WidgetbookAddon<Locale> {
initialLocale == null || locales.contains(initialLocale),
'initialLocale must be in locales',
),
super(
name: 'Locale',
// ignore: avoid-unsafe-collection-methods, ok here
initialSetting: initialLocale ?? locales.first,
);
initialLocale = initialLocale ?? locales.first,
super(name: 'Locale');

@override
Locale valueFromQueryGroup(Map<String, String> group) {
Expand Down

0 comments on commit 0c42dfc

Please sign in to comment.