Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exposes l10n-related properties #27

Merged
merged 1 commit into from Dec 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions lib/src/flutterbook.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ class FlutterBook extends StatefulWidget {
/// dropdown will appear in the editor tabs.
final List<FlutterBookTheme>? themes;

final Locale? locale;
final Iterable<LocalizationsDelegate<dynamic>>? localizationsDelegates;
final LocaleListResolutionCallback? localeListResolutionCallback;
final LocaleResolutionCallback? localeResolutionCallback;
final Iterable<Locale>? supportedLocales;

const FlutterBook({
Key? key,
required this.categories,
Expand All @@ -49,6 +55,11 @@ class FlutterBook extends StatefulWidget {
this.header,
this.headerPadding = const EdgeInsets.fromLTRB(20, 16, 20, 8),
this.themes,
this.locale,
this.localizationsDelegates,
this.localeListResolutionCallback,
this.localeResolutionCallback,
this.supportedLocales,
}) : super(key: key);

@override
Expand Down Expand Up @@ -99,6 +110,12 @@ class _FlutterBookState extends State<FlutterBook> {
title: 'Flutterbook',
debugShowCheckedModeBanner: false,
theme: activeTheme,
locale: widget.locale,
localizationsDelegates: widget.localizationsDelegates,
localeListResolutionCallback: widget.localeListResolutionCallback,
localeResolutionCallback: widget.localeResolutionCallback,
supportedLocales:
widget.supportedLocales ?? const <Locale>[Locale('en', 'US')],
builder: (context, child) {
return StyledScaffold(
body: Row(
Expand Down