「Flutter/font」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→フォントスタイル) |
|||
| (同じ利用者による、間の5版が非表示) | |||
| 行1: | 行1: | ||
==日本語フォント対応== | ==日本語フォント対応== | ||
| + | androidはデフォルトで中華フォントになってる。 | ||
| + | iosは日本語が当たってた。 | ||
| + | |||
| + | ===Textの対応=== | ||
Textの第2引数 | Textの第2引数 | ||
Text('編集') | Text('編集') | ||
| 行8: | 行12: | ||
children: <Widget>[ | children: <Widget>[ | ||
CupertinoButton.filled( | CupertinoButton.filled( | ||
| − | child: const Text(' | + | child: const Text('編集', style: TextStyle(locale: Locale("ja", "JP")) |
</pre> | </pre> | ||
| − | === | + | ===アプリtitle対応=== |
locale: Locale("ja", "JP"),を追加 | locale: Locale("ja", "JP"),を追加 | ||
| 行19: | 行23: | ||
return MaterialApp( | return MaterialApp( | ||
locale: Locale("ja", "JP"), | locale: Locale("ja", "JP"), | ||
| + | </pre> | ||
| + | |||
| + | ==フォントスタイル== | ||
| + | style: TextStyle( | ||
| + | fontWeight: FontWeight.bold, | ||
| + | fontFamily: 'Cursive', | ||
| + | ), | ||
| + | |||
| + | ==googleフォント一覧== | ||
| + | https://fonts.google.com/?subset=japanese | ||
| + | |||
| + | ==flutterに組み込まれてるフォント== | ||
| + | /d/src/flutter/packages/flutter/lib/src/material/typography.dart | ||
| + | <pre> | ||
| + | display4 : TextStyle(debugLabel: 'blackMountainView display4', fontFamily: 'Roboto', inherit: true, color: Colors.black54, decoration: TextDecoration.none), | ||
</pre> | </pre> | ||
2019年12月2日 (月) 23:58時点における最新版
日本語フォント対応
androidはデフォルトで中華フォントになってる。 iosは日本語が当たってた。
Textの対応
Textの第2引数
Text('編集')
↓
Text('編集', style: TextStyle(locale: Locale("ja", "JP"))
children: <Widget>[
CupertinoButton.filled(
child: const Text('編集', style: TextStyle(locale: Locale("ja", "JP"))
アプリtitle対応
locale: Locale("ja", "JP"),を追加
app.dart
Widget build(BuildContext context) {
return MaterialApp(
locale: Locale("ja", "JP"),
フォントスタイル
style: TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'Cursive',
),
googleフォント一覧
https://fonts.google.com/?subset=japanese
flutterに組み込まれてるフォント
/d/src/flutter/packages/flutter/lib/src/material/typography.dart
display4 : TextStyle(debugLabel: 'blackMountainView display4', fontFamily: 'Roboto', inherit: true, color: Colors.black54, decoration: TextDecoration.none),
