カウントダウンタイマーを作る上で、日本語版にしたいという希望を解決できたので、共有しておきます。
参考になったサイト : https://hazm.jp/archives/90
① pubspecにプラグインを追加する
pubspec.yamlの中に追加する(コピペでOK)
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
② Pub get する
自分のファイルで使えるようにしましょう。
③ main.dartに追加していく。
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: [Locale('English'), Locale('ja')],
debugShowCheckedModeBanner: false,
home: ????Screen(),
);
}
}
これでやってみるとできると思います。僕はできました。
![](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F672609%2F993eddd6-d71a-1340-7d15-20a33a840ad3.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=29aa8363ca9a96908525b1631d0b45a5)