marcglasberg / i18n_extension

Flutter package: Easy and powerful internationalization using Dart extensions.
Other
294 stars 64 forks source link

MaterialApp title #103

Open MLZ91 opened 2 years ago

MLZ91 commented 2 years ago

How to use i18n_extension for the MaterialApp title?

Does someone know a solution or a nice/simple workaround?

MarcVanDaele90 commented 2 years ago

Maybe the following is helpful: https://docs.flutter.dev/development/accessibility-and-localization/internationalization and search for "onGenerateTitle"

MLZ91 commented 2 years ago

Maybe the following is helpful: https://docs.flutter.dev/development/accessibility-and-localization/internationalization and search for "onGenerateTitle"

I played a bit around but didnt find an easy solution with "onGenerateTitle" yet

The easiest way I found (not using i18n_extension at all for the app name):

PackageInfo packageInfo = await PackageInfo.fromPlatform();

and than use the name like this: title: packageInfo.appName,

Other solutions are welcome