Skip to content

Commit

Permalink
Merge pull request #62 from chooyan-eng/feature/localization
Browse files Browse the repository at this point in the history
feat: added support for localization
  • Loading branch information
mkobuolys authored Mar 3, 2024
2 parents aefde38 + 84eb8a0 commit f78639e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Next

- feat: add support for slide deck localization

# 0.11.1

- fix: hot reload doesn't work on macOS
Expand Down
28 changes: 28 additions & 0 deletions lib/src/flutter_deck_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class FlutterDeckApp extends StatefulWidget {
/// The [themeMode] argument can be used to provide a custom theme mode for
/// the slide deck.
///
/// The [locale], [localizationsDelegates] and [supportedLocales] arguments
/// are equivalent to those of [MaterialApp]'s.
///
/// See also:
///
/// * [FlutterDeckSlide], which represents a single slide.
Expand All @@ -56,6 +59,9 @@ class FlutterDeckApp extends StatefulWidget {
this.lightTheme,
this.darkTheme,
this.themeMode = ThemeMode.system,
this.locale,
this.localizationsDelegates,
this.supportedLocales = const <Locale>[Locale('en')],
super.key,
}) : assert(slides.length > 0, 'You must provide at least one slide');

Expand Down Expand Up @@ -96,6 +102,25 @@ class FlutterDeckApp extends StatefulWidget {
/// By default, the system theme mode is used.
final ThemeMode themeMode;

/// The initial locale for the slide deck.
///
/// See also:
/// * [MaterialApp.locale], which is equivalent to this argument.
final Locale? locale;

/// The delegates for the slide deck's localization.
///
/// See also:
/// * [MaterialApp.localizationsDelegates], which is equivalent to this
/// argument.
final Iterable<LocalizationsDelegate<dynamic>>? localizationsDelegates;

/// The list of locales that the slide deck has been localized for.
///
/// See also:
/// * [MaterialApp.supportedLocales], which is equivalent to this argument.
final Iterable<Locale> supportedLocales;

@override
State<FlutterDeckApp> createState() => _FlutterDeckAppState();
}
Expand Down Expand Up @@ -173,6 +198,9 @@ class _FlutterDeckAppState extends State<FlutterDeckApp> {
),
),
debugShowCheckedModeBanner: false,
locale: widget.locale,
localizationsDelegates: widget.localizationsDelegates,
supportedLocales: widget.supportedLocales,
);
},
);
Expand Down

0 comments on commit f78639e

Please sign in to comment.