Created
July 14, 2021 20:30
-
-
Save roipeker/7bee8d463fe349336412edc15d0fddf0 to your computer and use it in GitHub Desktop.
GetX/Material issue with locales
This file contains hidden or 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 'package:flutter/material.dart'; | |
import 'package:get/get.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return GetMaterialApp( | |
supportedLocales: [Locale('es'), Locale('en')], | |
locale: Locale('es'), /// "es" locale not found in Material and fallback doesnt work. | |
/// fix: | |
/// localeResolutionCallback: (_, __) => Locale('en'), | |
fallbackLocale: Locale('en'), | |
translationsKeys: {'en': {}, 'es': {}}, /// irrelevant for Material | |
home: HomePage(), | |
); | |
} | |
} | |
class HomePage extends StatelessWidget { | |
const HomePage({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar(title: Text('locales bug')), | |
); | |
} | |
} |
This file contains hidden or 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
name: getx_test | |
description: test for intl8 issue | |
publish_to: 'none' | |
version: 1.0.0+1 | |
environment: | |
sdk: ">=2.13.0 <3.0.0" | |
dependencies: | |
flutter: | |
sdk: flutter | |
get: ^4.1.4 | |
dev_dependencies: | |
flutter_test: | |
sdk: flutter | |
flutter: | |
uses-material-design: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment