Skip to content

Instantly share code, notes, and snippets.

@najeira

najeira/locale.dart

Last active May 25, 2018
Embed
What would you like to do?
Test for Flutter font selection
// 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}: 累令直刃漢"),
),
);
}
}
@najeira

This comment has been minimized.

Copy link
Owner Author

@najeira najeira commented May 25, 2018

on Android emulator API 26:

2018-05-25 10 49 15

OK!

@najeira

This comment has been minimized.

Copy link
Owner Author

@najeira najeira commented May 25, 2018

on Galaxy S7 edge (Android 7.0):

screenshot_20180525-105234

All texts are in Japanese font.

@najeira

This comment has been minimized.

Copy link
Owner Author

@najeira najeira commented May 25, 2018

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
You can’t perform that action at this time.