Skip to content

Instantly share code, notes, and snippets.

View foxanna's full-sized avatar
💭
👩‍💻💙📱🇺🇦

Anna Leushchenko foxanna

💭
👩‍💻💙📱🇺🇦
View GitHub Profile
// marvel_comic.g.dart
...
_$_MarvelComic _$$_MarvelComicFromJson(Map<String, dynamic> json) =>
_$_MarvelComic(
...
format: $enumDecodeNullable(_$MarvelComicFormatEnumMap, json['format'],
unknownValue: MarvelComicFormat.unknown) ??
MarvelComicFormat.unknown,
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>fr</string>
<string>uk</string>
</array>
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) => MaterialApp(
localizationsDelegates: [
ExampleLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
const _supportedLocales = ['en', 'fr', 'uk'];
class ExampleLocalizations {
const ExampleLocalizations(this.translations);
final Translations translations;
static final _translations = <String, Translations Function()>{
'en': () => const Translations(),
'fr': () => const Translations_fr(),
homePageTitle: Exemple de localisation en Flutter
homePageCenterText(int times): "Vous avez appuyé le bouton $times fois"
incrementTooltip: Incrémenter
homePageTitle: Flutter localization example
homePageCenterText(int times):
"You have pushed the button $times ${_plural(times, one:'time', many:'times')}"
incrementTooltip: Increment
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
i69n: ^2.0.1
dev_dependencies:
flutter_test:
class Translations_fr extends Translations {
const Translations_fr();
String get greetings => "Bonjour le monde!";
}
class Translations implements i69n.I69nMessageBundle {
const Translations();
String get greetings => "Hello, world!";
}