カウントダウンタイマーを作る上で、日本語版にしたいという希望を解決できたので、共有しておきます。
参考になったサイト : 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(),
);
}
}
これでやってみるとできると思います。僕はできました。
