From 3d368a0098dc8b699dcced819ab6b64fb174e1f9 Mon Sep 17 00:00:00 2001 From: chooyan-eng Date: Sat, 2 Mar 2024 20:51:00 +0900 Subject: [PATCH 1/4] add support for localization --- lib/src/flutter_deck_app.dart | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lib/src/flutter_deck_app.dart b/lib/src/flutter_deck_app.dart index ff1a2f9..1bfa7c7 100644 --- a/lib/src/flutter_deck_app.dart +++ b/lib/src/flutter_deck_app.dart @@ -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. @@ -56,6 +59,9 @@ class FlutterDeckApp extends StatefulWidget { this.lightTheme, this.darkTheme, this.themeMode = ThemeMode.system, + this.locale, + this.localizationsDelegates, + this.supportedLocales = const [Locale('en')], super.key, }) : assert(slides.length > 0, 'You must provide at least one slide'); @@ -96,6 +102,24 @@ class FlutterDeckApp extends StatefulWidget { /// By default, the system theme mode is used. final ThemeMode themeMode; + /// The initial locale for the slide. + /// + /// See also: + /// * [MaterialApp.locale], which is equivalent to this argument. + final Locale? locale; + + /// The delegates for the slide's localization. + /// + /// See also: + /// * [MaterialApp.localizationsDelegates], which is equivalent to this argument. + final Iterable>? localizationsDelegates; + + /// The list of locales that the slide has been localized for. + /// + /// See also: + /// * [MaterialApp.supportedLocales], which is equivalent to this argument. + final Iterable supportedLocales; + @override State createState() => _FlutterDeckAppState(); } @@ -173,6 +197,9 @@ class _FlutterDeckAppState extends State { ), ), debugShowCheckedModeBanner: false, + locale: widget.locale, + localizationsDelegates: widget.localizationsDelegates, + supportedLocales: widget.supportedLocales, ); }, ); From cf7360c4ced75a4fc8e7a84fa027e950ed744538 Mon Sep 17 00:00:00 2001 From: chooyan-eng Date: Sun, 3 Mar 2024 11:36:27 +0900 Subject: [PATCH 2/4] fix words of doc comments --- lib/src/flutter_deck_app.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/flutter_deck_app.dart b/lib/src/flutter_deck_app.dart index 1bfa7c7..805611f 100644 --- a/lib/src/flutter_deck_app.dart +++ b/lib/src/flutter_deck_app.dart @@ -102,19 +102,19 @@ class FlutterDeckApp extends StatefulWidget { /// By default, the system theme mode is used. final ThemeMode themeMode; - /// The initial locale for the slide. + /// 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's localization. + /// The delegates for the slide deck's localization. /// /// See also: /// * [MaterialApp.localizationsDelegates], which is equivalent to this argument. final Iterable>? localizationsDelegates; - /// The list of locales that the slide has been localized for. + /// The list of locales that the slide deck has been localized for. /// /// See also: /// * [MaterialApp.supportedLocales], which is equivalent to this argument. From 287b065c9e4eff454d8258cb921d0d648fcd9ca9 Mon Sep 17 00:00:00 2001 From: chooyan-eng Date: Sun, 3 Mar 2024 11:36:56 +0900 Subject: [PATCH 3/4] add change log for localization --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef33b14..7ff399c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# Next + +- feat: add support for slide deck localization + # 0.11.1 - fix: hot reload doesn't work on macOS From 84eb8a08fec6a1531d13b593a75a44fa02a921cc Mon Sep 17 00:00:00 2001 From: Mangirdas Kazlauskas Date: Sun, 3 Mar 2024 12:36:24 +0200 Subject: [PATCH 4/4] fix: lint issues --- lib/src/flutter_deck_app.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/src/flutter_deck_app.dart b/lib/src/flutter_deck_app.dart index 805611f..c61cda7 100644 --- a/lib/src/flutter_deck_app.dart +++ b/lib/src/flutter_deck_app.dart @@ -39,8 +39,8 @@ 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. + /// The [locale], [localizationsDelegates] and [supportedLocales] arguments + /// are equivalent to those of [MaterialApp]'s. /// /// See also: /// @@ -111,7 +111,8 @@ class FlutterDeckApp extends StatefulWidget { /// The delegates for the slide deck's localization. /// /// See also: - /// * [MaterialApp.localizationsDelegates], which is equivalent to this argument. + /// * [MaterialApp.localizationsDelegates], which is equivalent to this + /// argument. final Iterable>? localizationsDelegates; /// The list of locales that the slide deck has been localized for.