-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from mkobuolys/feat/localization-controls
feat: add localization controls
- Loading branch information
Showing
20 changed files
with
276 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
arb-dir: lib/l10n/arb | ||
template-arb-file: messages_en.arb | ||
output-localization-file: app_localizations.dart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"@@locale": "en", | ||
"helloWorld": "Hello, World!", | ||
"@helloWorld": { | ||
"description": "The conventional newborn programmer greeting" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"@@locale": "es", | ||
"helloWorld": "¡Hola Mundo!" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"@@locale": "lt", | ||
"helloWorld": "Sveikas, Pasauli!" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// ignore_for_file: depend_on_referenced_packages | ||
|
||
import 'package:flutter/widgets.dart'; | ||
|
||
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; | ||
export 'package:flutter_gen/gen_l10n/app_localizations.dart'; | ||
|
||
extension AppLocalizationsX on BuildContext { | ||
AppLocalizations get l10n => AppLocalizations.of(this)!; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_deck/flutter_deck.dart'; | ||
import 'package:flutter_deck_example/l10n/l10n.dart'; | ||
|
||
class LocalizationSlide extends FlutterDeckSlideWidget { | ||
const LocalizationSlide() | ||
: super( | ||
configuration: const FlutterDeckSlideConfiguration( | ||
route: '/localization', | ||
header: FlutterDeckHeaderConfiguration( | ||
title: 'Slide deck localization', | ||
), | ||
), | ||
); | ||
|
||
@override | ||
FlutterDeckSlide build(BuildContext context) { | ||
final locale = context.l10n.localeName; | ||
|
||
return FlutterDeckSlide.blank( | ||
builder: (context) => Center( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
Text( | ||
context.l10n.helloWorld, | ||
style: FlutterDeckTheme.of(context).textTheme.display, | ||
), | ||
const SizedBox(height: 32), | ||
Text( | ||
'Current locale: $locale', | ||
style: FlutterDeckTheme.of(context).textTheme.bodyLarge, | ||
), | ||
const SizedBox(height: 32), | ||
Text( | ||
'It is possible to localize your slide deck using the same ' | ||
'approach as any other Flutter app.\nUse deck controls to change ' | ||
'the locale and see the text change without restarting your ' | ||
'presentation!', | ||
style: FlutterDeckTheme.of(context).textTheme.bodyMedium, | ||
textAlign: TextAlign.center, | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.