Created
September 27, 2019 01:31
-
-
Save HansMuller/883d6f9d6a69a094f67d5bf9c93dd300 to your computer and use it in GitHub Desktop.
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
import 'package:flutter/material.dart'; | |
import 'package:flutter_localizations/flutter_localizations.dart'; | |
import 'l10n/demo_localizations.dart'; | |
class Home extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Center( | |
child: Column( | |
mainAxisSize: MainAxisSize.min, | |
children: <Widget>[ | |
Text(DemoLocalizations.of(context).helloWorld()), | |
Text(DemoLocalizations.of(context).hello('International World')), | |
Text(DemoLocalizations.of(context).greeting('Greetings', 'Earthlings')), | |
Text(DemoLocalizations.of(context).helloWorlds(100)), | |
], | |
), | |
), | |
); | |
} | |
} | |
class I18NDemoApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
localizationsDelegates: <LocalizationsDelegate<dynamic>>[ | |
DemoLocalizations.delegate, | |
GlobalMaterialLocalizations.delegate, | |
GlobalWidgetsLocalizations.delegate, | |
], | |
supportedLocales: const <Locale>[ | |
Locale('en', 'US'), | |
Locale('es', 'ES'), | |
], | |
home: Home(), | |
); | |
} | |
} | |
void main() { | |
runApp(I18NDemoApp()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment