From 99960e0edf9ed250882601d5be4bc91f48ff1dd6 Mon Sep 17 00:00:00 2001 From: Jihad Date: Mon, 29 May 2023 18:12:50 +0300 Subject: [PATCH] dependencies updated --- .DS_Store | Bin 8196 -> 8196 bytes .../.dart_tool/package_config.json | 242 ++++++++++++++++++ .../.dart_tool/package_config_subset | 157 ++++++++++++ localization_demo/.dart_tool/version | 1 + localization_demo/android/local.properties | 4 +- .../ios/Runner/GeneratedPluginRegistrant.h | 5 + .../ios/Runner/GeneratedPluginRegistrant.m | 2 + localization_demo/lib/LocaleHelper.dart | 4 +- localization_demo/lib/l10n/messages_all.dart | 13 +- localization_demo/lib/localizations.dart | 22 +- localization_demo/lib/main.dart | 87 +++---- localization_demo/pubspec.lock | 239 +++++++++-------- localization_demo/pubspec.yaml | 6 +- 13 files changed, 603 insertions(+), 179 deletions(-) create mode 100644 localization_demo/.dart_tool/package_config.json create mode 100644 localization_demo/.dart_tool/package_config_subset create mode 100644 localization_demo/.dart_tool/version diff --git a/.DS_Store b/.DS_Store index 3ba595be25b288e3ca56e92b135292fcf2b94e8d..5227017d2a77be91955a30f05728183d5a418238 100644 GIT binary patch delta 120 zcmZp1XmQwJE1AvvYFu^1B$ofRPbGGw?!b7}Y(QM?h_}uHY@Ui4B6A*(JWQY~~aF$uzNn F4*(n$98CZK delta 130 zcmZp1XmQwJD`0RksURn_xWvHVIwKP^3o9Et2L~4i7cW;+{&uzn%cUV3}C>>2%#DHp)`z|HJL|1ZL^HvEw;_< N65m)hzY$?)1^^LmAQS)q diff --git a/localization_demo/.dart_tool/package_config.json b/localization_demo/.dart_tool/package_config.json new file mode 100644 index 0000000..89194ca --- /dev/null +++ b/localization_demo/.dart_tool/package_config.json @@ -0,0 +1,242 @@ +{ + "configVersion": 2, + "packages": [ + { + "name": "_fe_analyzer_shared", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/_fe_analyzer_shared-61.0.0", + "packageUri": "lib/", + "languageVersion": "2.17" + }, + { + "name": "analyzer", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/analyzer-5.13.0", + "packageUri": "lib/", + "languageVersion": "2.19" + }, + { + "name": "args", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/args-2.4.1", + "packageUri": "lib/", + "languageVersion": "2.18" + }, + { + "name": "async", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/async-2.11.0", + "packageUri": "lib/", + "languageVersion": "2.18" + }, + { + "name": "boolean_selector", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1", + "packageUri": "lib/", + "languageVersion": "2.17" + }, + { + "name": "characters", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/characters-1.3.0", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "clock", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/clock-1.1.1", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "collection", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/collection-1.17.1", + "packageUri": "lib/", + "languageVersion": "2.18" + }, + { + "name": "convert", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/convert-3.1.1", + "packageUri": "lib/", + "languageVersion": "2.18" + }, + { + "name": "crypto", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/crypto-3.0.3", + "packageUri": "lib/", + "languageVersion": "2.19" + }, + { + "name": "cupertino_icons", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/cupertino_icons-1.0.5", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "dart_style", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/dart_style-2.3.1", + "packageUri": "lib/", + "languageVersion": "2.19" + }, + { + "name": "fake_async", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/fake_async-1.3.1", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "file", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/file-7.0.0", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "flutter", + "rootUri": "file:///Users/jihad/developer/flutter/packages/flutter", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "flutter_localizations", + "rootUri": "file:///Users/jihad/developer/flutter/packages/flutter_localizations", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "flutter_test", + "rootUri": "file:///Users/jihad/developer/flutter/packages/flutter_test", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "glob", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/glob-2.1.2", + "packageUri": "lib/", + "languageVersion": "2.19" + }, + { + "name": "intl", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/intl-0.18.0", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "intl_translation", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/intl_translation-0.18.2", + "packageUri": "lib/", + "languageVersion": "2.18" + }, + { + "name": "js", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/js-0.6.7", + "packageUri": "lib/", + "languageVersion": "2.19" + }, + { + "name": "matcher", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/matcher-0.12.15", + "packageUri": "lib/", + "languageVersion": "2.18" + }, + { + "name": "material_color_utilities", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/material_color_utilities-0.2.0", + "packageUri": "lib/", + "languageVersion": "2.13" + }, + { + "name": "meta", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/meta-1.9.1", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "package_config", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/package_config-2.1.0", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "path", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/path-1.8.3", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "pub_semver", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/pub_semver-2.1.4", + "packageUri": "lib/", + "languageVersion": "2.17" + }, + { + "name": "sky_engine", + "rootUri": "file:///Users/jihad/developer/flutter/bin/cache/pkg/sky_engine", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "source_span", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/source_span-1.9.1", + "packageUri": "lib/", + "languageVersion": "2.14" + }, + { + "name": "stack_trace", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/stack_trace-1.11.0", + "packageUri": "lib/", + "languageVersion": "2.18" + }, + { + "name": "stream_channel", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/stream_channel-2.1.1", + "packageUri": "lib/", + "languageVersion": "2.14" + }, + { + "name": "string_scanner", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/string_scanner-1.2.0", + "packageUri": "lib/", + "languageVersion": "2.18" + }, + { + "name": "term_glyph", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/term_glyph-1.2.1", + "packageUri": "lib/", + "languageVersion": "2.12" + }, + { + "name": "test_api", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/test_api-0.5.1", + "packageUri": "lib/", + "languageVersion": "2.18" + }, + { + "name": "typed_data", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/typed_data-1.3.2", + "packageUri": "lib/", + "languageVersion": "2.17" + }, + { + "name": "vector_math", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/vector_math-2.1.4", + "packageUri": "lib/", + "languageVersion": "2.14" + }, + { + "name": "watcher", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/watcher-1.1.0", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "yaml", + "rootUri": "file:///Users/jihad/.pub-cache/hosted/pub.dev/yaml-3.1.2", + "packageUri": "lib/", + "languageVersion": "2.19" + }, + { + "name": "localization_demo", + "rootUri": "../", + "packageUri": "lib/", + "languageVersion": "2.12" + } + ], + "generated": "2023-05-29T15:02:39.658210Z", + "generator": "pub", + "generatorVersion": "3.0.2" +} diff --git a/localization_demo/.dart_tool/package_config_subset b/localization_demo/.dart_tool/package_config_subset new file mode 100644 index 0000000..6ae9b6f --- /dev/null +++ b/localization_demo/.dart_tool/package_config_subset @@ -0,0 +1,157 @@ +_fe_analyzer_shared +2.17 +file:///Users/jihad/.pub-cache/hosted/pub.dev/_fe_analyzer_shared-61.0.0/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/_fe_analyzer_shared-61.0.0/lib/ +analyzer +2.19 +file:///Users/jihad/.pub-cache/hosted/pub.dev/analyzer-5.13.0/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/analyzer-5.13.0/lib/ +args +2.18 +file:///Users/jihad/.pub-cache/hosted/pub.dev/args-2.4.1/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/args-2.4.1/lib/ +async +2.18 +file:///Users/jihad/.pub-cache/hosted/pub.dev/async-2.11.0/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/async-2.11.0/lib/ +boolean_selector +2.17 +file:///Users/jihad/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1/lib/ +characters +2.12 +file:///Users/jihad/.pub-cache/hosted/pub.dev/characters-1.3.0/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/characters-1.3.0/lib/ +clock +2.12 +file:///Users/jihad/.pub-cache/hosted/pub.dev/clock-1.1.1/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/clock-1.1.1/lib/ +collection +2.18 +file:///Users/jihad/.pub-cache/hosted/pub.dev/collection-1.17.1/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/collection-1.17.1/lib/ +convert +2.18 +file:///Users/jihad/.pub-cache/hosted/pub.dev/convert-3.1.1/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/convert-3.1.1/lib/ +crypto +2.19 +file:///Users/jihad/.pub-cache/hosted/pub.dev/crypto-3.0.3/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/crypto-3.0.3/lib/ +cupertino_icons +2.12 +file:///Users/jihad/.pub-cache/hosted/pub.dev/cupertino_icons-1.0.5/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/cupertino_icons-1.0.5/lib/ +dart_style +2.19 +file:///Users/jihad/.pub-cache/hosted/pub.dev/dart_style-2.3.1/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/dart_style-2.3.1/lib/ +fake_async +2.12 +file:///Users/jihad/.pub-cache/hosted/pub.dev/fake_async-1.3.1/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/fake_async-1.3.1/lib/ +file +3.0 +file:///Users/jihad/.pub-cache/hosted/pub.dev/file-7.0.0/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/file-7.0.0/lib/ +glob +2.19 +file:///Users/jihad/.pub-cache/hosted/pub.dev/glob-2.1.2/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/glob-2.1.2/lib/ +intl +2.12 +file:///Users/jihad/.pub-cache/hosted/pub.dev/intl-0.18.0/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/intl-0.18.0/lib/ +intl_translation +2.18 +file:///Users/jihad/.pub-cache/hosted/pub.dev/intl_translation-0.18.2/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/intl_translation-0.18.2/lib/ +js +2.19 +file:///Users/jihad/.pub-cache/hosted/pub.dev/js-0.6.7/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/js-0.6.7/lib/ +matcher +2.18 +file:///Users/jihad/.pub-cache/hosted/pub.dev/matcher-0.12.15/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/matcher-0.12.15/lib/ +material_color_utilities +2.13 +file:///Users/jihad/.pub-cache/hosted/pub.dev/material_color_utilities-0.2.0/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/material_color_utilities-0.2.0/lib/ +meta +2.12 +file:///Users/jihad/.pub-cache/hosted/pub.dev/meta-1.9.1/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/meta-1.9.1/lib/ +package_config +2.12 +file:///Users/jihad/.pub-cache/hosted/pub.dev/package_config-2.1.0/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/package_config-2.1.0/lib/ +path +2.12 +file:///Users/jihad/.pub-cache/hosted/pub.dev/path-1.8.3/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/path-1.8.3/lib/ +pub_semver +2.17 +file:///Users/jihad/.pub-cache/hosted/pub.dev/pub_semver-2.1.4/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/pub_semver-2.1.4/lib/ +source_span +2.14 +file:///Users/jihad/.pub-cache/hosted/pub.dev/source_span-1.9.1/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/source_span-1.9.1/lib/ +stack_trace +2.18 +file:///Users/jihad/.pub-cache/hosted/pub.dev/stack_trace-1.11.0/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/stack_trace-1.11.0/lib/ +stream_channel +2.14 +file:///Users/jihad/.pub-cache/hosted/pub.dev/stream_channel-2.1.1/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/stream_channel-2.1.1/lib/ +string_scanner +2.18 +file:///Users/jihad/.pub-cache/hosted/pub.dev/string_scanner-1.2.0/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/string_scanner-1.2.0/lib/ +term_glyph +2.12 +file:///Users/jihad/.pub-cache/hosted/pub.dev/term_glyph-1.2.1/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/term_glyph-1.2.1/lib/ +test_api +2.18 +file:///Users/jihad/.pub-cache/hosted/pub.dev/test_api-0.5.1/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/test_api-0.5.1/lib/ +typed_data +2.17 +file:///Users/jihad/.pub-cache/hosted/pub.dev/typed_data-1.3.2/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/typed_data-1.3.2/lib/ +vector_math +2.14 +file:///Users/jihad/.pub-cache/hosted/pub.dev/vector_math-2.1.4/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/vector_math-2.1.4/lib/ +watcher +3.0 +file:///Users/jihad/.pub-cache/hosted/pub.dev/watcher-1.1.0/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/watcher-1.1.0/lib/ +yaml +2.19 +file:///Users/jihad/.pub-cache/hosted/pub.dev/yaml-3.1.2/ +file:///Users/jihad/.pub-cache/hosted/pub.dev/yaml-3.1.2/lib/ +localization_demo +2.12 +file:///Users/jihad/Documents/other_projects/Flutter_Localizations/localization_demo/ +file:///Users/jihad/Documents/other_projects/Flutter_Localizations/localization_demo/lib/ +sky_engine +3.0 +file:///Users/jihad/developer/flutter/bin/cache/pkg/sky_engine/ +file:///Users/jihad/developer/flutter/bin/cache/pkg/sky_engine/lib/ +flutter +3.0 +file:///Users/jihad/developer/flutter/packages/flutter/ +file:///Users/jihad/developer/flutter/packages/flutter/lib/ +flutter_localizations +3.0 +file:///Users/jihad/developer/flutter/packages/flutter_localizations/ +file:///Users/jihad/developer/flutter/packages/flutter_localizations/lib/ +flutter_test +3.0 +file:///Users/jihad/developer/flutter/packages/flutter_test/ +file:///Users/jihad/developer/flutter/packages/flutter_test/lib/ +2 diff --git a/localization_demo/.dart_tool/version b/localization_demo/.dart_tool/version new file mode 100644 index 0000000..e86ec35 --- /dev/null +++ b/localization_demo/.dart_tool/version @@ -0,0 +1 @@ +3.10.2 \ No newline at end of file diff --git a/localization_demo/android/local.properties b/localization_demo/android/local.properties index ed01156..6bdb4aa 100644 --- a/localization_demo/android/local.properties +++ b/localization_demo/android/local.properties @@ -1,5 +1,5 @@ -sdk.dir=/Users/mhamdan/Library/Android/sdk -flutter.sdk=/Users/mhamdan/Desktop/dev/flutter +sdk.dir=/Users/jihad/Library/Android/sdk +flutter.sdk=/Users/jihad/developer/flutter flutter.versionName=1.0.0 flutter.versionCode=1 flutter.buildMode=debug \ No newline at end of file diff --git a/localization_demo/ios/Runner/GeneratedPluginRegistrant.h b/localization_demo/ios/Runner/GeneratedPluginRegistrant.h index 3b700eb..7a89092 100644 --- a/localization_demo/ios/Runner/GeneratedPluginRegistrant.h +++ b/localization_demo/ios/Runner/GeneratedPluginRegistrant.h @@ -2,13 +2,18 @@ // Generated file. Do not edit. // +// clang-format off + #ifndef GeneratedPluginRegistrant_h #define GeneratedPluginRegistrant_h #import +NS_ASSUME_NONNULL_BEGIN + @interface GeneratedPluginRegistrant : NSObject + (void)registerWithRegistry:(NSObject*)registry; @end +NS_ASSUME_NONNULL_END #endif /* GeneratedPluginRegistrant_h */ diff --git a/localization_demo/ios/Runner/GeneratedPluginRegistrant.m b/localization_demo/ios/Runner/GeneratedPluginRegistrant.m index 60dfa42..efe65ec 100644 --- a/localization_demo/ios/Runner/GeneratedPluginRegistrant.m +++ b/localization_demo/ios/Runner/GeneratedPluginRegistrant.m @@ -2,6 +2,8 @@ // Generated file. Do not edit. // +// clang-format off + #import "GeneratedPluginRegistrant.h" @implementation GeneratedPluginRegistrant diff --git a/localization_demo/lib/LocaleHelper.dart b/localization_demo/lib/LocaleHelper.dart index e43c8c0..568e667 100644 --- a/localization_demo/lib/LocaleHelper.dart +++ b/localization_demo/lib/LocaleHelper.dart @@ -3,14 +3,14 @@ import 'dart:ui'; typedef void LocaleChangeCallback(Locale locale); class LocaleHelper { - LocaleChangeCallback onLocaleChanged; + LocaleChangeCallback onLocaleChanged = (locale) => {}; static final LocaleHelper _helper = new LocaleHelper._internal(); factory LocaleHelper() { return _helper; } -LocaleHelper._internal(); + LocaleHelper._internal(); } LocaleHelper helper = new LocaleHelper(); diff --git a/localization_demo/lib/l10n/messages_all.dart b/localization_demo/lib/l10n/messages_all.dart index 71ee858..a0b16ed 100644 --- a/localization_demo/lib/l10n/messages_all.dart +++ b/localization_demo/lib/l10n/messages_all.dart @@ -11,6 +11,7 @@ import 'package:intl/src/intl_helpers.dart'; import 'messages_ar.dart' as messages_ar; import 'messages_en.dart' as messages_en; + typedef Future LibraryLoader(); Map _deferredLibraries = { // ignore: unnecessary_new @@ -22,7 +23,7 @@ MessageLookupByLibrary _findExact(localeName) { switch (localeName) { case 'ar': return messages_ar.messages; - case 'en': + case 'en': return messages_en.messages; default: return messages_en.messages; @@ -31,10 +32,7 @@ MessageLookupByLibrary _findExact(localeName) { /// User programs should call this before using [localeName] for messages. Future initializeMessages(String localeName) async { - var availableLocale = Intl.verifiedLocale( - localeName, - (locale) => _deferredLibraries[locale] != null, - onFailure: (_) => null); + var availableLocale = Intl.verifiedLocale(localeName, (locale) => _deferredLibraries[locale] != null, onFailure: (_) => null); if (availableLocale == null) { // ignore: unnecessary_new return new Future.value(false); @@ -57,9 +55,8 @@ bool _messagesExistFor(String locale) { } } -MessageLookupByLibrary _findGeneratedMessagesFor(locale) { - var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor, - onFailure: (_) => null); +MessageLookupByLibrary? _findGeneratedMessagesFor(locale) { + var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null); if (actualLocale == null) return null; return _findExact(actualLocale); } diff --git a/localization_demo/lib/localizations.dart b/localization_demo/lib/localizations.dart index 2413a63..c03dea0 100644 --- a/localization_demo/lib/localizations.dart +++ b/localization_demo/lib/localizations.dart @@ -1,20 +1,16 @@ import 'dart:async'; -import 'dart:ui'; - import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'l10n/messages_all.dart'; class AppLocalizations { static AppLocalizations of(BuildContext context) { - return Localizations.of(context, AppLocalizations); + return Localizations.of(context, AppLocalizations)!; } static Future load(Locale locale) { - final String name = - locale.countryCode == null ? locale.languageCode : locale.toString(); + final String name = locale.countryCode == null ? locale.languageCode : locale.toString(); final String localeName = Intl.canonicalizedLocale(name); return initializeMessages(localeName).then((bool _) { @@ -22,7 +18,6 @@ class AppLocalizations { return new AppLocalizations(); }); } - String get title { return Intl.message('Contact Us', name: 'title'); @@ -49,8 +44,7 @@ class AppLocalizations { } } -class SpecificLocalizationDelegate - extends LocalizationsDelegate { +class SpecificLocalizationDelegate extends LocalizationsDelegate { final Locale overriddenLocale; SpecificLocalizationDelegate(this.overriddenLocale); @@ -59,8 +53,7 @@ class SpecificLocalizationDelegate bool isSupported(Locale locale) => overriddenLocale != null; @override - Future load(Locale locale) => - AppLocalizations.load(overriddenLocale); + Future load(Locale locale) => AppLocalizations.load(overriddenLocale); @override bool shouldReload(LocalizationsDelegate old) => true; @@ -73,7 +66,8 @@ class FallbackCupertinoLocalisationsDelegate extends LocalizationsDelegate ['en', 'ar'].contains(locale.languageCode); @override - Future load(Locale locale) => SynchronousFuture<_DefaultCupertinoLocalizations>(_DefaultCupertinoLocalizations(locale)); + Future load(Locale locale) => + SynchronousFuture<_DefaultCupertinoLocalizations>(_DefaultCupertinoLocalizations(locale)); @override bool shouldReload(FallbackCupertinoLocalisationsDelegate old) => false; @@ -81,8 +75,6 @@ class FallbackCupertinoLocalisationsDelegate extends LocalizationsDelegate runApp(MyApp()); class MyApp extends StatefulWidget { @@ -14,18 +13,17 @@ class MyApp extends StatefulWidget { class _MyAppState extends State { // This widget is the root of your application. - SpecificLocalizationDelegate _specificLocalizationDelegate; + SpecificLocalizationDelegate? _specificLocalizationDelegate; -@override void initState() { - // TODO: implement initState + @override + void initState() { super.initState(); helper.onLocaleChanged = onLocaleChange; - _specificLocalizationDelegate = SpecificLocalizationDelegate(new Locale("en")); + _specificLocalizationDelegate = SpecificLocalizationDelegate(new Locale("en")); } - onLocaleChange(Locale locale){ - setState((){ - + onLocaleChange(Locale locale) { + setState(() { _specificLocalizationDelegate = new SpecificLocalizationDelegate(locale); }); } @@ -34,18 +32,16 @@ class _MyAppState extends State { Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', - localizationsDelegates: [ - GlobalMaterialLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - new FallbackCupertinoLocalisationsDelegate(), - //app-specific localization - _specificLocalizationDelegate - ], - - supportedLocales: [Locale('en'),Locale('ar')], - locale: _specificLocalizationDelegate.overriddenLocale , + localizationsDelegates: [ + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + new FallbackCupertinoLocalisationsDelegate(), + //app-specific localization + if (_specificLocalizationDelegate != null) _specificLocalizationDelegate! + ], + supportedLocales: [Locale('en'), Locale('ar')], + locale: _specificLocalizationDelegate == null ? null : _specificLocalizationDelegate!.overriddenLocale, theme: ThemeData( - primarySwatch: Colors.blue, ), home: MyHomePage(title: 'Flutter Demo Home Page'), @@ -54,9 +50,8 @@ class _MyAppState extends State { } class MyHomePage extends StatefulWidget { - MyHomePage( {Key key, this.title}) : super(key: key); - - final String title; + MyHomePage({Key? key, this.title = ''}) : super(key: key); + final String title; @override _MyHomePageState createState() => _MyHomePageState(); @@ -70,23 +65,29 @@ class _MyHomePageState extends State { appBar: new AppBar( title: new Text(AppLocalizations.of(context).title), actions: [ - new FlatButton( - child: new Text("English"), color: AppLocalizations.of(context).locale == "en" ? Colors.grey : Colors.blue, onPressed: (){ - this.setState((){ - helper.onLocaleChanged(new Locale("en")); - }); + new TextButton( + child: new Text( + "English", + style: TextStyle(color: AppLocalizations.of(context).locale == "en" ? Colors.grey : Colors.blue), + ), + onPressed: () { + this.setState(() { + helper.onLocaleChanged(new Locale("en")); + }); }, ), - - new FlatButton( - child: Text("عربى"),color: AppLocalizations.of(context).locale == "ar" ? Colors.grey : Colors.blue,onPressed: (){ - this.setState((){ - helper.onLocaleChanged(new Locale("ar")); - }); + new TextButton( + child: Text( + "عربى", + style: TextStyle(color: AppLocalizations.of(context).locale == "ar" ? Colors.grey : Colors.blue), + ), + onPressed: () { + this.setState(() { + helper.onLocaleChanged(new Locale("ar")); + }); }, ) ], - ), body: new Form( key: _formKey, @@ -104,7 +105,7 @@ class _MyHomePageState extends State { hintText: '', labelText: AppLocalizations.of(context).lblname, ), - onSaved: (String value) {}, + onSaved: (String? value) {}, ), const SizedBox(height: 24.0), new TextFormField( @@ -117,10 +118,10 @@ class _MyHomePageState extends State { prefixText: '', ), keyboardType: TextInputType.phone, - onSaved: (String value) {}, - inputFormatters: [ - WhitelistingTextInputFormatter.digitsOnly, - ], + onSaved: (String? value) {}, + // inputFormatters: [ + // WhitelistingTextInputFormatter.digitsOnly, + // ], ), const SizedBox(height: 24.0), new TextFormField( @@ -131,13 +132,13 @@ class _MyHomePageState extends State { labelText: AppLocalizations.of(context).lblemail, ), keyboardType: TextInputType.emailAddress, - onSaved: (String value) {}, + onSaved: (String? value) {}, ), const SizedBox(height: 24.0), const SizedBox(height: 24.0), new Center( - child: new RaisedButton( - child: Text(AppLocalizations.of(context).btnsubmit), + child: new TextButton( + child: Text(AppLocalizations.of(context).btnsubmit), onPressed: () {}, ), ), diff --git a/localization_demo/pubspec.lock b/localization_demo/pubspec.lock index 2e062ad..be8e51b 100644 --- a/localization_demo/pubspec.lock +++ b/localization_demo/pubspec.lock @@ -1,83 +1,118 @@ # Generated by pub -# See https://www.dartlang.org/tools/pub/glossary#lockfile +# See https://dart.dev/tools/pub/glossary#lockfile packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a + url: "https://pub.dev" + source: hosted + version: "61.0.0" analyzer: dependency: transitive description: name: analyzer - url: "https://pub.dartlang.org" + sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 + url: "https://pub.dev" source: hosted - version: "0.36.2" + version: "5.13.0" args: dependency: transitive description: name: args - url: "https://pub.dartlang.org" + sha256: c372bb384f273f0c2a8aaaa226dad84dc27c8519a691b888725dec59518ad53a + url: "https://pub.dev" source: hosted - version: "1.5.1" + version: "2.4.1" async: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.0.8" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "1.0.4" - charcode: + version: "2.1.1" + characters: dependency: transitive description: - name: charcode - url: "https://pub.dartlang.org" + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.3.0" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" + url: "https://pub.dev" source: hosted - version: "1.14.11" + version: "1.17.1" convert: dependency: transitive description: name: convert - url: "https://pub.dartlang.org" + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "3.1.1" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.6" - csslib: - dependency: transitive - description: - name: csslib - url: "https://pub.dartlang.org" + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" source: hosted - version: "0.16.0" + version: "3.0.3" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be + url: "https://pub.dev" source: hosted - version: "0.1.2" + version: "1.0.5" dart_style: dependency: transitive description: name: dart_style - url: "https://pub.dartlang.org" + sha256: f4f1f73ab3fd2afcbcca165ee601fe980d966af6a21b5970c6c9376955c528ad + url: "https://pub.dev" + source: hosted + version: "2.3.1" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + file: + dependency: transitive + description: + name: file + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" source: hosted - version: "1.2.7" + version: "7.0.0" flutter: dependency: "direct main" description: flutter @@ -93,104 +128,86 @@ packages: description: flutter source: sdk version: "0.0.0" - front_end: - dependency: transitive - description: - name: front_end - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.17" glob: dependency: transitive description: name: glob - url: "https://pub.dartlang.org" + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" source: hosted - version: "1.1.7" - html: - dependency: transitive - description: - name: html - url: "https://pub.dartlang.org" - source: hosted - version: "0.14.0+2" + version: "2.1.2" intl: dependency: transitive description: name: intl - url: "https://pub.dartlang.org" + sha256: a3715e3bc90294e971cb7dc063fbf3cd9ee0ebf8604ffeafabd9e6f16abbdbe6 + url: "https://pub.dev" source: hosted - version: "0.15.7" + version: "0.18.0" intl_translation: dependency: "direct dev" description: name: intl_translation - url: "https://pub.dartlang.org" + sha256: c8dce69cd7ce7ffea26126c32d284c829a94f08c13e4322ec0d98753dde6baff + url: "https://pub.dev" source: hosted - version: "0.17.4" - kernel: + version: "0.18.2" + js: dependency: transitive description: - name: kernel - url: "https://pub.dartlang.org" + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" source: hosted - version: "0.3.17" + version: "0.6.7" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" + url: "https://pub.dev" + source: hosted + version: "0.12.15" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + url: "https://pub.dev" source: hosted - version: "0.12.3+1" + version: "0.2.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + url: "https://pub.dev" source: hosted - version: "1.1.6" + version: "1.9.1" package_config: dependency: transitive description: name: package_config - url: "https://pub.dartlang.org" + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "2.1.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.2" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" source: hosted - version: "1.4.0" - petitparser: - dependency: transitive - description: - name: petitparser - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.1" + version: "1.8.3" pub_semver: dependency: transitive description: name: pub_semver - url: "https://pub.dartlang.org" - source: hosted - version: "1.4.2" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.1.4" sky_engine: dependency: transitive description: flutter @@ -200,71 +217,81 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + url: "https://pub.dev" source: hosted - version: "1.5.4" + version: "1.9.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.dev" source: hosted - version: "1.9.3" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" source: hosted - version: "1.6.8" + version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb + url: "https://pub.dev" source: hosted - version: "0.2.2" + version: "0.5.1" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" source: hosted - version: "1.1.6" + version: "1.3.2" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.0.8" + version: "2.1.4" watcher: dependency: transitive description: name: watcher - url: "https://pub.dartlang.org" + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" source: hosted - version: "0.9.7+10" + version: "1.1.0" yaml: dependency: transitive description: name: yaml - url: "https://pub.dartlang.org" + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" source: hosted - version: "2.1.15" + version: "3.1.2" sdks: - dart: ">=2.1.0 <3.0.0" + dart: ">=3.0.0 <4.0.0" diff --git a/localization_demo/pubspec.yaml b/localization_demo/pubspec.yaml index 6796443..3f3ecd3 100644 --- a/localization_demo/pubspec.yaml +++ b/localization_demo/pubspec.yaml @@ -10,7 +10,7 @@ description: A new Flutter project. version: 1.0.0+1 environment: - sdk: ">=2.0.0-dev.68.0 <3.0.0" + sdk: ">=2.12.0-dev.68.0 <3.0.0" dependencies: flutter: @@ -20,12 +20,12 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^0.1.2 + cupertino_icons: ^1.0.5 dev_dependencies: flutter_test: sdk: flutter - intl_translation: ^0.17.1 + intl_translation: ^0.18.2 # For information on the generic Dart part of this file, see the