diff --git a/lib/main.mobile.dart b/lib/main.mobile.dart index 33e8505..f84b894 100644 --- a/lib/main.mobile.dart +++ b/lib/main.mobile.dart @@ -5,31 +5,31 @@ import 'package:firebase_analytics/firebase_analytics.dart'; import 'package:admob_flutter/admob_flutter.dart'; import 'package:firebase_analytics/observer.dart'; +import 'configs/Ads.dart'; import 'native/Cache.dart'; -import 'configs/Ads.dart'; import 'configs/App.dart'; import 'Navigator.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); + FirebaseCrashlytics _firebaseCrashlytics; + _firebaseCrashlytics = FirebaseCrashlytics.instance; await Cache.init(); App.showAds = true; if (App.showAds) { - Admob.initialize(Ads.getAppId()); + Admob.initialize(testDeviceIds: [Ads.getAppId()]); } final analyticsObserver = FirebaseAnalyticsObserver( analytics: FirebaseAnalytics(), ); - Crashlytics.instance.enableInDevMode = true; - FlutterError.onError = (FlutterErrorDetails err) { - Crashlytics.instance.recordFlutterError(err); + _firebaseCrashlytics.recordFlutterError(err); }; runApp(AppNavigator([analyticsObserver])); } diff --git a/lib/main.web.dart b/lib/main.web.dart index 89d8c18..7e2cc77 100644 --- a/lib/main.web.dart +++ b/lib/main.web.dart @@ -9,15 +9,15 @@ import 'Navigator.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); + FirebaseCrashlytics _firebaseCrashlytics; + _firebaseCrashlytics = FirebaseCrashlytics.instance; await Cache.init(); final analyticsObeserver = FirebaseAnalyticsObserver( analytics: FirebaseAnalytics(), ); - Crashlytics.instance.enableInDevMode = true; - FlutterError.onError = (FlutterErrorDetails err) { - Crashlytics.instance.recordFlutterError(err); + _firebaseCrashlytics.recordFlutterError(err); }; runApp(AppNavigator([analyticsObeserver])); } diff --git a/lib/widgets/Alerts/OpenOrShare.dart b/lib/widgets/Alerts/OpenOrShare.dart index 22fcaaf..d925743 100644 --- a/lib/widgets/Alerts/OpenOrShare.dart +++ b/lib/widgets/Alerts/OpenOrShare.dart @@ -35,59 +35,61 @@ void openOrShare({ showDialog( context: context, - child: AlertDialog( - title: Text( - App.translate(title, context), - ), - actions: [ - TextButton( - style: style, - onPressed: () => Navigator.pop(context), - child: Text( - App.translate(AlertWidgetMessages.close), - style: textStyle, - ), - ), - TextButton( - style: style, - onPressed: () => Utils.launchUrl(actionLink), - child: Text(App.translate(actionLabel), style: textStyle), + builder: (BuildContext context) { + return AlertDialog( + title: Text( + App.translate(title, context), ), - TextButton( - style: style, - onPressed: () async { - if (Utils.isMobile()) { - Share.share( - action2Link, - subject: shareLabel, - ); - - Navigator.pop(context); - } else if (Utils.isDesktop()) { - bool hasSnackbar = snackLabel != null; - await Clipboard.setData(ClipboardData(text: action2Link)); - Navigator.pop(context); - if (hasSnackbar) { - Scaffold.of(context).showSnackBar( - SnackBar( - content: Text(snackLabel), - ), + actions: [ + TextButton( + style: style, + onPressed: () => Navigator.pop(context), + child: Text( + App.translate(AlertWidgetMessages.close), + style: textStyle, + ), + ), + TextButton( + style: style, + onPressed: () => Utils.launchUrl(actionLink), + child: Text(App.translate(actionLabel), style: textStyle), + ), + TextButton( + style: style, + onPressed: () async { + if (Utils.isMobile()) { + Share.share( + action2Link, + subject: shareLabel, ); - await 1600.milliseconds.delay; - Scaffold.of(context).hideCurrentSnackBar(); + + Navigator.pop(context); + } else if (Utils.isDesktop()) { + bool hasSnackbar = snackLabel != null; + await Clipboard.setData(ClipboardData(text: action2Link)); + Navigator.pop(context); + if (hasSnackbar) { + Scaffold.of(context).showSnackBar( + SnackBar( + content: Text(snackLabel), + ), + ); + await 1600.milliseconds.delay; + Scaffold.of(context).hideCurrentSnackBar(); + } } - } - }, - child: Text( - App.translate( - Utils.isMobile() - ? AlertWidgetMessages.share - : AlertWidgetMessages.copy, + }, + child: Text( + App.translate( + Utils.isMobile() + ? AlertWidgetMessages.share + : AlertWidgetMessages.copy, + ), + style: textStyle, ), - style: textStyle, ), - ), - ], - ), + ], + ); + }, ); } diff --git a/pubspec.lock b/pubspec.lock index 8cba8ef..b9cb09d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,147 +7,133 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "7.0.0" + version: "22.0.0" admob_flutter: dependency: "direct main" description: name: admob_flutter url: "https://pub.dartlang.org" source: hosted - version: "0.3.4" + version: "1.0.1" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "0.39.17" + version: "1.7.1" animate_do: dependency: "direct main" description: name: animate_do url: "https://pub.dartlang.org" source: hosted - version: "1.7.3" + version: "2.0.0" archive: dependency: transitive description: name: archive url: "https://pub.dartlang.org" source: hosted - version: "2.0.13" + version: "3.1.2" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "1.6.0" + version: "2.3.0" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0-nullsafety.2" + version: "2.6.1" barcode: dependency: "direct main" description: name: barcode url: "https://pub.dartlang.org" source: hosted - version: "1.17.1" + version: "2.1.0" barcode_widget: dependency: "direct main" description: name: barcode_widget url: "https://pub.dartlang.org" source: hosted - version: "1.5.0" + version: "2.0.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.2" + version: "2.1.0" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.4" + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.2" + version: "1.2.0" cli_util: dependency: transitive description: name: cli_util url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "0.3.3" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.2" + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0-nullsafety.4" + version: "1.15.0" convert: dependency: transitive description: name: convert url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "3.0.1" coverage: dependency: transitive description: name: coverage url: "https://pub.dartlang.org" source: hosted - version: "0.14.1" + version: "1.0.3" crypto: dependency: transitive description: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.5" - csslib: - dependency: transitive - description: - name: csslib - url: "https://pub.dartlang.org" - source: hosted - version: "0.16.2" - dart_style: - dependency: transitive - description: - name: dart_style - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.6" + version: "3.0.1" dotted_border: dependency: "direct main" description: name: dotted_border url: "https://pub.dartlang.org" source: hosted - version: "1.0.6" + version: "2.0.0+1" emojis: dependency: "direct main" description: @@ -161,84 +147,105 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.2" + version: "1.2.0" ffi: dependency: transitive description: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "1.1.2" file: dependency: transitive description: name: file url: "https://pub.dartlang.org" source: hosted - version: "6.0.0-nullsafety.3" + version: "6.1.0" firebase: dependency: transitive description: name: firebase url: "https://pub.dartlang.org" source: hosted - version: "7.3.2" + version: "9.0.2" firebase_analytics: dependency: "direct main" description: name: firebase_analytics url: "https://pub.dartlang.org" source: hosted - version: "6.0.0" + version: "8.3.2" firebase_analytics_platform_interface: dependency: transitive description: name: firebase_analytics_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "2.0.1" firebase_analytics_web: dependency: transitive description: name: firebase_analytics_web url: "https://pub.dartlang.org" source: hosted - version: "0.1.1" + version: "0.3.0+1" firebase_core: dependency: "direct main" description: name: firebase_core url: "https://pub.dartlang.org" source: hosted - version: "0.5.0" + version: "1.6.0" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "4.0.1" firebase_core_web: dependency: transitive description: name: firebase_core_web url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "1.1.0" firebase_crashlytics: dependency: "direct main" description: name: firebase_crashlytics url: "https://pub.dartlang.org" source: hosted - version: "0.1.4+1" + version: "2.2.1" + firebase_crashlytics_platform_interface: + dependency: transitive + description: + name: firebase_crashlytics_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.2" firebase_performance: dependency: "direct main" description: name: firebase_performance url: "https://pub.dartlang.org" source: hosted - version: "0.4.0" + version: "0.7.1+1" + firebase_performance_platform_interface: + dependency: transitive + description: + name: firebase_performance_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+3" + firebase_performance_web: + dependency: transitive + description: + name: firebase_performance_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+1" flutter: dependency: "direct main" description: flutter @@ -256,6 +263,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" + flutter_lints: + dependency: transitive + description: + name: flutter_lints + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" flutter_localizations: dependency: "direct main" description: flutter @@ -282,210 +296,182 @@ packages: name: glob url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" - html: - dependency: transitive - description: - name: html - url: "https://pub.dartlang.org" - source: hosted - version: "0.14.0+3" + version: "2.0.1" http: dependency: transitive description: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.12.2" + version: "0.13.3" http_multi_server: dependency: transitive description: name: http_multi_server url: "https://pub.dartlang.org" source: hosted - version: "2.2.0" + version: "3.0.1" http_parser: dependency: transitive description: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "3.1.4" + version: "4.0.0" image: dependency: "direct dev" description: name: image url: "https://pub.dartlang.org" source: hosted - version: "2.1.18" + version: "3.0.4" intl: dependency: transitive description: name: intl url: "https://pub.dartlang.org" source: hosted - version: "0.16.1" - intl_translation: - dependency: "direct dev" - description: - name: intl_translation - url: "https://pub.dartlang.org" - source: hosted - version: "0.17.10" + version: "0.17.0" io: dependency: transitive description: name: io url: "https://pub.dartlang.org" source: hosted - version: "0.3.4" + version: "1.0.3" js: dependency: transitive description: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3-nullsafety.2" - json_rpc_2: + version: "0.6.3" + lints: dependency: transitive description: - name: json_rpc_2 + name: lints url: "https://pub.dartlang.org" source: hosted - version: "2.2.2" + version: "1.0.1" logging: dependency: transitive description: name: logging url: "https://pub.dartlang.org" source: hosted - version: "0.11.4" + version: "1.0.2" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10-nullsafety.2" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.5" + version: "1.3.0" mime: dependency: transitive description: name: mime url: "https://pub.dartlang.org" source: hosted - version: "0.9.7" + version: "1.0.0" nested: dependency: transitive description: name: nested url: "https://pub.dartlang.org" source: hosted - version: "0.0.4" - node_interop: - dependency: transitive - description: - name: node_interop - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.1" - node_io: - dependency: transitive - description: - name: node_io - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.1" + version: "1.0.0" node_preamble: dependency: transitive description: name: node_preamble url: "https://pub.dartlang.org" source: hosted - version: "1.4.12" + version: "2.0.1" open_url: dependency: "direct main" description: name: open_url url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "2.0.0" package_config: dependency: transitive description: name: package_config url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "2.0.2" page_transition: dependency: "direct main" description: name: page_transition url: "https://pub.dartlang.org" source: hosted - version: "1.1.7+2" + version: "2.0.2" path: dependency: "direct dev" description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.2" + version: "1.8.0" path_drawing: dependency: transitive description: name: path_drawing url: "https://pub.dartlang.org" source: hosted - version: "0.4.1+1" + version: "0.5.1" path_parsing: dependency: transitive description: name: path_parsing url: "https://pub.dartlang.org" source: hosted - version: "0.1.4" + version: "0.2.1" path_provider_linux: dependency: transitive description: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+2" + version: "2.1.0" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "2.0.1" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.4+1" + version: "2.0.3" pedantic: dependency: transitive description: name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.2" + version: "1.11.1" petitparser: dependency: transitive description: name: petitparser url: "https://pub.dartlang.org" source: hosted - version: "3.1.0" + version: "4.1.0" pigment: dependency: transitive description: @@ -499,175 +485,140 @@ packages: name: platform url: "https://pub.dartlang.org" source: hosted - version: "3.0.0-nullsafety.3" - platform_detect: - dependency: transitive - description: - name: platform_detect - url: "https://pub.dartlang.org" - source: hosted - version: "1.4.0" + version: "3.0.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" + version: "2.0.1" pool: dependency: transitive description: name: pool url: "https://pub.dartlang.org" source: hosted - version: "1.5.0-nullsafety.2" + version: "1.5.0" process: dependency: transitive description: name: process url: "https://pub.dartlang.org" source: hosted - version: "4.0.0-nullsafety.3" + version: "4.2.1" provider: dependency: "direct main" description: name: provider url: "https://pub.dartlang.org" source: hosted - version: "4.3.2+2" + version: "6.0.0" pub_semver: dependency: transitive description: name: pub_semver url: "https://pub.dartlang.org" source: hosted - version: "1.4.4" + version: "2.1.0" qr: dependency: transitive description: name: qr url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "2.1.0" quiver: dependency: transitive description: name: quiver url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" - sa_anicoto: - dependency: transitive - description: - name: sa_anicoto - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.3" - sa_multi_tween: - dependency: transitive - description: - name: sa_multi_tween - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.2" - sa_stateless_animation: - dependency: transitive - description: - name: sa_stateless_animation - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.3" - sa_v1_migration: - dependency: transitive - description: - name: sa_v1_migration - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.2" + version: "3.0.1" share: dependency: "direct main" description: name: share url: "https://pub.dartlang.org" source: hosted - version: "0.6.5" + version: "2.0.4" shared_preferences: dependency: "direct main" description: name: shared_preferences url: "https://pub.dartlang.org" source: hosted - version: "0.5.12" + version: "2.0.7" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux url: "https://pub.dartlang.org" source: hosted - version: "0.0.2+2" + version: "2.0.2" shared_preferences_macos: dependency: transitive description: name: shared_preferences_macos url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+10" + version: "2.0.2" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.0.0" shared_preferences_web: dependency: transitive description: name: shared_preferences_web url: "https://pub.dartlang.org" source: hosted - version: "0.1.2+7" + version: "2.0.2" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+1" + version: "2.0.2" shelf: dependency: transitive description: name: shelf url: "https://pub.dartlang.org" source: hosted - version: "0.7.9" + version: "1.2.0" shelf_packages_handler: dependency: transitive description: name: shelf_packages_handler url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "3.0.0" shelf_static: dependency: transitive description: name: shelf_static url: "https://pub.dartlang.org" source: hosted - version: "0.2.8" + version: "1.1.0" shelf_web_socket: dependency: transitive description: name: shelf_web_socket url: "https://pub.dartlang.org" source: hosted - version: "0.2.3" + version: "1.0.1" simple_animations: dependency: "direct main" description: name: simple_animations url: "https://pub.dartlang.org" source: hosted - version: "2.2.2" + version: "3.2.0" sky_engine: dependency: transitive description: flutter @@ -679,91 +630,91 @@ packages: name: source_map_stack_trace url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.3" + version: "2.1.0" source_maps: dependency: transitive description: name: source_maps url: "https://pub.dartlang.org" source: hosted - version: "0.10.10-nullsafety.2" + version: "0.10.10" source_span: dependency: transitive description: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.3" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.5" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.2" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.2" + version: "1.1.0" supercharged: dependency: "direct main" description: name: supercharged url: "https://pub.dartlang.org" source: hosted - version: "1.10.0" + version: "2.1.1" supercharged_dart: dependency: transitive description: name: supercharged_dart url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "2.1.1" sync_http: dependency: transitive description: name: sync_http url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "0.3.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.2" + version: "1.2.0" test: dependency: "direct dev" description: name: test url: "https://pub.dartlang.org" source: hosted - version: "1.16.0-nullsafety.7" + version: "1.16.8" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19-nullsafety.4" + version: "0.3.0" test_core: dependency: transitive description: name: test_core url: "https://pub.dartlang.org" source: hosted - version: "0.3.12-nullsafety.7" + version: "0.3.19" tinycolor: dependency: "direct main" description: @@ -777,140 +728,147 @@ packages: name: touchable_opacity url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.2.0" translator: dependency: "direct dev" description: name: translator url: "https://pub.dartlang.org" source: hosted - version: "0.1.4" + version: "0.1.7" tuple: dependency: "direct main" description: name: tuple url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "2.0.0" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.4" + version: "1.3.0" universal_io: dependency: "direct main" description: name: universal_io url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "2.0.4" url_launcher: dependency: "direct main" description: name: url_launcher url: "https://pub.dartlang.org" source: hosted - version: "5.4.1" + version: "6.0.10" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" url_launcher_macos: dependency: transitive description: name: url_launcher_macos url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+7" + version: "2.0.2" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.8" + version: "2.0.4" url_launcher_web: dependency: transitive description: name: url_launcher_web url: "https://pub.dartlang.org" source: hosted - version: "0.1.3+1" + version: "2.0.4" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.4" + version: "2.1.0" vm_service: dependency: transitive description: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "5.2.0" + version: "6.2.0" watcher: dependency: transitive description: name: watcher url: "https://pub.dartlang.org" source: hosted - version: "0.9.7+15" + version: "1.0.0" web_socket_channel: dependency: transitive description: name: web_socket_channel url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "2.1.0" webdriver: dependency: transitive description: name: webdriver url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "3.0.0" webkit_inspection_protocol: dependency: transitive description: name: webkit_inspection_protocol url: "https://pub.dartlang.org" source: hosted - version: "0.7.3" + version: "1.0.0" win32: dependency: transitive description: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "1.7.3" + version: "2.2.9" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.1.2" + version: "0.2.0" xml: dependency: transitive description: name: xml url: "https://pub.dartlang.org" source: hosted - version: "4.5.1" + version: "5.1.2" yaml: dependency: "direct dev" description: name: yaml url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" - zone_local: - dependency: transitive - description: - name: zone_local - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.2" + version: "3.1.0" sdks: - dart: ">=2.11.0-0.0 <=2.12.0-3.0.dev" - flutter: ">=1.16.0 <2.0.0" + dart: ">=2.13.0 <3.0.0" + flutter: ">=2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index dc15924..975b40e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,44 +14,44 @@ dependencies: flutter_localizations: sdk: flutter - tuple: 1.0.3 - animate_do: 1.7.3 - supercharged: 1.10.0 + tuple: 2.0.0 + animate_do: 2.0.0 + supercharged: 2.1.1 emojis: 0.9.3 - barcode: 1.17.1 + barcode: 2.1.0 tinycolor: 1.0.3 flutter_icons: 1.1.0 - dotted_border: 1.0.6 - barcode_widget: 1.5.0 - touchable_opacity: 1.1.2 - page_transition: 1.1.7+2 - simple_animations: 2.2.2 + dotted_border: 2.0.0+1 + barcode_widget: 2.0.1 + touchable_opacity: 1.2.0 + page_transition: 2.0.2 + simple_animations: 3.2.0 - share: 0.6.5 - open_url: 1.0.1 - provider: 4.3.2+2 - url_launcher: 5.4.1 - universal_io: 1.0.1 + share: 2.0.4 + open_url: 2.0.0 + provider: 6.0.0 + url_launcher: 6.0.10 + universal_io: 2.0.4 - admob_flutter: 0.3.4 - firebase_core: 0.5.0 - firebase_analytics: 6.0.0 - firebase_performance: 0.4.0 - firebase_crashlytics: 0.1.4+1 + admob_flutter: 1.0.1 + firebase_core: 1.6.0 + firebase_analytics: 8.3.2 + firebase_performance: 0.7.1+1 + firebase_crashlytics: 2.2.1 - shared_preferences: 0.5.12 + shared_preferences: 2.0.7 dev_dependencies: flutter_driver: sdk: flutter test: any - glob: 1.2.0 - image: 2.1.18 - path: 1.8.0-nullsafety.2 - translator: 0.1.4 - intl_translation: 0.17.10 - yaml: 2.2.1 + glob: 2.0.1 + image: 3.0.4 + path: 1.8.0 + translator: 0.1.7 + # intl_translation: 0.17.10 + yaml: 3.1.0 flutter_icons: includes: diff --git a/scripts/genIntlJson.dart b/scripts/genIntlJson.dart index 85f05dc..3f49123 100644 --- a/scripts/genIntlJson.dart +++ b/scripts/genIntlJson.dart @@ -2,16 +2,26 @@ import 'dart:convert'; import 'dart:io'; import 'dart:isolate'; import 'package:glob/glob.dart'; +import 'package:glob/list_local_fs.dart'; import 'package:translator/translator.dart'; import './utils.dart'; main(List args) async { print("\n\n\nGENERATE BUNDLED JSON FOR YOUR LOCALIZE MESSAGES"); - final dartFile = new Glob("lib/**/**.dart"); + final disableAutoTranslate = args.contains("--no-translate"); + final fileIndex = args.indexOf("--file"); + Glob filesGlob = Glob("lib/**/**.dart"); + List files; final translator = new GoogleTranslator(); - - final List files = dartFile.listSync(); + if (fileIndex >= 0) { + final path = args[fileIndex + 1]; + final source = File(path); + files = [source]; + } + if (fileIndex < 0) { + files = filesGlob.listSync(); + } final Map defaultMessages = {}; final Map> defaultLocaleMessages = {}; final JsonEncoder jsonEncoder = JsonEncoder.withIndent(' '); @@ -21,15 +31,12 @@ main(List args) async { ReceivePort port = new ReceivePort(); final raw = await getMessagesViaIsolate(entity, port); final Map messages = raw["strings"].cast(); + defaultMessages.addAll(messages); final localesDirectory = new Directory( entity.path.replaceFirst(r'strings.dart', r'locales').toString(), ); - // print("dlkasdhaskjhd $localesDirectory"); if (localesDirectory.existsSync()) { - // print("$localesDirectory EXISSITS"); - - // await localesDirectory.list().forEach((localeFile) async {}); for (final localeFile in localesDirectory.listSync()) { final localeCode = localeFile.path.split(normalize("/")).last.split(".").first; @@ -37,19 +44,18 @@ main(List args) async { localeFile, new ReceivePort(), ); - final Map localeMessages = localeRaw.cast(); + final Map localeMessages = + localeRaw["strings"].cast(); if (defaultLocaleMessages[localeCode] == null) { defaultLocaleMessages[localeCode] = {}; } defaultLocaleMessages[localeCode].addAll(localeMessages); } } - - defaultMessages.addAll(messages); } } - final directory = new Directory(normalize("./assets/langs")); + final directory = new Directory(normalize("./assets/locales")); await directory.list().forEach((element) async { final file = new File(element.path); @@ -82,7 +88,8 @@ main(List args) async { // print("rootVal $rootVal"); // } if ((parsedVal == null || (parsedVal != null && parsedVal.isEmpty)) && - rootVal.isNotEmpty) { + rootVal.isNotEmpty && + !disableAutoTranslate) { newObj[key] = await translator.translate( newObj[key], from: "en", diff --git a/scripts/genIntlKeys.dart b/scripts/genIntlKeys.dart index 246bd15..e4b4388 100644 --- a/scripts/genIntlKeys.dart +++ b/scripts/genIntlKeys.dart @@ -1,6 +1,7 @@ import 'dart:io'; import 'dart:isolate'; import 'package:glob/glob.dart'; +import 'package:glob/list_local_fs.dart'; import 'utils.dart'; @@ -8,8 +9,17 @@ import 'utils.dart'; main(List args) async { print("GENERATE CLASS KEYS FOR YOUR LOCALIZE MESSAGES"); - final dartFile = new Glob("lib/**/**.dart"); - List files = dartFile.listSync(); + final fileIndex = args.indexOf("--file"); + Glob filesGlob = new Glob("lib/**/**.dart"); + List files; + if (fileIndex >= 0) { + final path = args[fileIndex + 1]; + final source = File(path); + files = [source]; + } + if (fileIndex < 0) { + files = filesGlob.listSync(); + } for (var entity in files) { if (entity.path.contains(normalize("/messages/strings.dart"))) { @@ -23,7 +33,7 @@ main(List args) async { (str) { final key = str.toString(); final parsedKey = key.split('/').last; - return "\tstatic String $parsedKey = '\$scope\/$parsedKey';"; + return "\tstatic const $parsedKey = '\$scope\/$parsedKey';"; }, ) .toList()