Last active
November 10, 2018 00:56
-
-
Save rohan20/14acd280e4367965bfe1324cb2cdffd9 to your computer and use it in GitHub Desktop.
flutter-localizations
This file contains hidden or 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
| import 'package:flutter/material.dart'; | |
| import 'package:flutter_localizations/flutter_localizations.dart'; | |
| import 'package:your_app_package/services/localization/app_translations_delegate.dart'; | |
| import 'package:your_app_package/screens/home_page.dart'; | |
| void main() { | |
| runApp(MyApp()); | |
| } | |
| class MyApp extends StatefulWidget { | |
| @override | |
| _MyAppState createState() => _MyAppState(); | |
| } | |
| class _MyAppState extends State<MyApp> { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| home: HomePage(), | |
| localizationsDelegates: [ | |
| const AppTranslationsDelegate(), | |
| //provides localised strings | |
| GlobalMaterialLocalizations.delegate, | |
| //provides RTL support | |
| GlobalWidgetsLocalizations.delegate, | |
| ], | |
| supportedLocales: [ | |
| const Locale("en", ""), | |
| const Locale("es", ""), | |
| ], | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @rohan20, Flutter recently removed support for passing
''as countryCodes. Since this is being referenced in a guide, it would be nice if you could either pass null (const Locale('en', null),) or omit the countryCode (const Locale('en'),)Thanks!