Last active
May 25, 2018 02:17
-
-
Save najeira/41c8e43df8304f9c2544aae83b36b3f1 to your computer and use it in GitHub Desktop.
Test for Flutter font selection
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
// A test for https://github.com/flutter/flutter/pull/17879 | |
import 'package:flutter/material.dart'; | |
import 'package:flutter_localizations/flutter_localizations.dart'; | |
void main() { | |
runApp(new MaterialApp( | |
localizationsDelegates: GlobalMaterialLocalizations.delegates, | |
locale: const Locale("ja", "JP"), | |
supportedLocales: [ | |
const Locale("ja", "JP"), | |
const Locale("zh", "CN"), | |
const Locale("zh", "TW"), | |
const Locale("ko", "KR"), | |
const Locale("vi", "VN"), | |
], | |
home: new FooPage(), | |
)); | |
} | |
class FooPage extends StatefulWidget { | |
@override | |
State<StatefulWidget> createState() { | |
return new FooPageState(); | |
} | |
} | |
class FooPageState extends State<FooPage> { | |
@override | |
Widget build(BuildContext context) { | |
return new Scaffold( | |
appBar: new AppBar(title: new Text("Locale test")), | |
body: new Center( | |
child: new Column( | |
children: <Widget>[ | |
_buildRow(context, const Locale("ja", "JP")), | |
_buildRow(context, const Locale("zh", "CN")), | |
_buildRow(context, const Locale("zh", "TW")), | |
_buildRow(context, const Locale("ko", "KR")), | |
_buildRow(context, const Locale("vi", "VN")), | |
], | |
), | |
), | |
); | |
} | |
Widget _buildRow(BuildContext context, Locale locale) { | |
return new Container( | |
padding: const EdgeInsets.all(8.0), | |
child: new Localizations.override( | |
context: context, | |
locale: locale, | |
child: new Text("${locale}: 累令直刃漢"), | |
), | |
); | |
} | |
} |
I changed the language of the device to Chinese and tested it, but it is the same result.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
on Galaxy S7 edge (Android 7.0):
All texts are in Japanese font.