Created
December 12, 2023 13:23
-
-
Save alpha2048/e7cd3913c55024956e756bd240fa7ad7 to your computer and use it in GitHub Desktop.
iOSで数字テキストが崩れる件の直し方
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 'dart:ui'; | |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Demo', | |
theme: ThemeData( | |
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), | |
useMaterial3: true, | |
), | |
home: const MyHomePage(title: 'Flutter Demo Home Page'), | |
); | |
} | |
} | |
class MyHomePage extends StatefulWidget { | |
const MyHomePage({super.key, required this.title}); | |
final String title; | |
@override | |
State<MyHomePage> createState() => _MyHomePageState(); | |
} | |
class _MyHomePageState extends State<MyHomePage> { | |
@override | |
Widget build(BuildContext context) { | |
const text = '111111555555888888'; | |
const text2 = '111111777777999999'; | |
return Scaffold( | |
appBar: AppBar( | |
backgroundColor: Theme.of(context).colorScheme.inversePrimary, | |
title: Text(widget.title), | |
), | |
body: const Center( | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Text( | |
"FontFeature.tabularFigures() なし", | |
style: TextStyle(fontSize: 24), | |
), | |
SizedBox(height: 8,), | |
Text( | |
text, | |
style: TextStyle(fontSize: 20), | |
), | |
Text( | |
text2, | |
style: TextStyle(fontSize: 20), | |
), | |
SizedBox(height: 16,), | |
Text("FontFeature.tabularFigures() あり", | |
style: TextStyle(fontSize: 24)), | |
SizedBox(height: 8,), | |
Text( | |
text, | |
style: TextStyle( | |
fontSize: 20, | |
fontFeatures: [FontFeature.tabularFigures()], | |
), | |
), | |
Text( | |
text2, | |
style: TextStyle( | |
fontSize: 20, | |
fontFeatures: [FontFeature.tabularFigures()], | |
), | |
), | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment