Posts

Showing posts with the label dart

[Flutter] Translations, internationalisation with GetX package

Image
As applications are actually spread around the world, a common task to implement when developing your app (mobile, web or desktop), is to setup a multi-language option .  In Flutter, it can be done easily with the GetX Package (a useful package that provides a lot more services ! You should take a look if you don't know this package:  GetX package on pub.dev . The implementation steps are the following: 1-Add GetX package to your solution You can do it the traditional way you like. For instance with "Pub Assist" extension: Shift+CMD+P > Pub asssist: add/upgrade > get 2-Use a GetMaterialApp Important step, do not forget to use the GetMaterialApp classe instead of Flutter's MaterialApp: @ override Widget build ( BuildContext context ) { return GetMaterialApp ( 3-Add a translation file Next you have to add a class that will embed all your strings declaration / translations. This class must extends the GetX's Translation class. Here is an example:

[Flutter] Splashscreen (native way)

Image
The splash screen is the first screen you see when you start your app. - you can display your logo for instance - and while the splash screen is shown,  your application is loaded (like user data, business data...) In this example we will use flutter_native_splash package. I- Package: flutter_native_splash (for native splash screen) In your " pubspec.yaml " file you have to add the correct dependency, here at less version 2.0.5 # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions # consider running `flutter pub upgrade --major-versions`. Alternatively, # dependencies can be manually updated by changing the version numbers below to # the latest version available on pub.dev. To see which dependencies have newer # versions available, run `flutter pub outdated`. dependencies : flutter : sdk : flutter flutter_native_splash : ^2.0.5 hint : Pubspec Assist extension To auto