Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_localizations/flutter_localizations.dart';
  3.  
  4. import 'l10n/demo_localizations.dart';
  5.  
  6. class Home extends StatelessWidget {
  7. @override
  8. Widget build(BuildContext context) {
  9. return Scaffold(
  10. body: Center(
  11. child: Column(
  12. mainAxisSize: MainAxisSize.min,
  13. children: <Widget>[
  14. Text(DemoLocalizations.of(context).helloWorld()),
  15. Text(DemoLocalizations.of(context).hello('International World')),
  16. Text(DemoLocalizations.of(context).greeting('Greetings', 'Earthlings')),
  17. Text(DemoLocalizations.of(context).helloWorlds(100)),
  18. ],
  19. ),
  20. ),
  21. );
  22. }
  23. }
  24.  
  25. class I18NDemoApp extends StatelessWidget {
  26. @override
  27. Widget build(BuildContext context) {
  28. return MaterialApp(
  29. localizationsDelegates: <LocalizationsDelegate<dynamic>>[
  30. DemoLocalizations.delegate,
  31. GlobalMaterialLocalizations.delegate,
  32. GlobalWidgetsLocalizations.delegate,
  33. ],
  34. supportedLocales: const <Locale>[
  35. Locale('en', 'US'),
  36. Locale('es', 'ES'),
  37. ],
  38. home: Home(),
  39. );
  40. }
  41. }
  42.  
  43. void main() {
  44. runApp(I18NDemoApp());
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement