diff --git a/.gitignore b/.gitignore index 645cec3..44a2e7e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,9 +8,10 @@ .buildlog/ .history .svn/ +migrate_working_dir/ # IntelliJ related -*.iml +#*.iml(Do not ignore) *.ipr *.iws .idea/ @@ -21,24 +22,9 @@ #.vscode/ # Flutter/Dart/Pub related +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. +#/pubspec.lock **/doc/api/ .dart_tool/ -.flutter-plugins -.flutter-plugins-dependencies .packages -.pub-cache/ -.pub/ -/build/ - -# Web related -lib/generated_plugin_registrant.dart - -# Visual Code -.vscode/* - -# Additional -.fvm - -# Exceptions to above rules. -!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages -!.vscode/launch.json \ No newline at end of file +build/ diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index cd553a2..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "ai_barcode (example)", - "request": "launch", - "type": "dart", - "program": "example/lib/main.dart" - }, - ] -} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cb8ffb..0d686cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [3.1.0] + +* Flutter 3.0.1 +* Dart 2.17.1 + + ## [3.0.1] * improve: website running on mobile browser diff --git a/example/.gitignore b/example/.gitignore index ae1f183..62346ac 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -10,7 +10,7 @@ .svn/ # IntelliJ related -*.iml +#*.iml(Do not ignore) *.ipr *.iws .idea/ diff --git a/example/pubspec.lock b/example/pubspec.lock index 2547f62..e191aa3 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,7 +5,7 @@ packages: dependency: "direct main" description: name: ai_awesome_message - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "2.2.0" ai_barcode: @@ -14,103 +14,103 @@ packages: path: ".." relative: true source: path - version: "3.0.2" + version: "3.1.0" ai_barcode_platform_interface: dependency: transitive description: name: ai_barcode_platform_interface - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "3.0.0" ai_barcode_web: dependency: transitive description: name: ai_barcode_web - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "3.0.0" air_design: dependency: "direct main" description: name: air_design - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "2.2.0" airoute: dependency: "direct main" description: name: airoute - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "2.2.0" async: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "2.8.2" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "2.1.0" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.2.0" charcode: dependency: transitive description: name: charcode - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.3.1" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.1.0" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.16.0" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "3.0.2" csslib: dependency: transitive description: name: csslib - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted - version: "0.17.1" + version: "0.17.2" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.0.4" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.3.0" flutter: @@ -132,77 +132,77 @@ packages: dependency: transitive description: name: html - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "0.15.0" js: dependency: transitive description: name: js - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "0.6.4" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "0.12.11" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "0.1.4" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.7.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.8.1" permission_handler: dependency: "direct main" description: name: permission_handler - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "8.3.0" permission_handler_platform_interface: dependency: transitive description: name: permission_handler_platform_interface - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "3.7.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "2.1.2" qr: dependency: transitive description: name: qr - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "2.1.0" qr_flutter: dependency: transitive description: name: qr_flutter - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "4.0.0" sky_engine: @@ -214,77 +214,70 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.8.2" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.2.0" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "0.4.9" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.3.1" universal_html: dependency: transitive description: name: universal_html - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "2.0.8" universal_io: dependency: transitive description: name: universal_io - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "2.0.4" - universal_platform: - dependency: transitive - description: - name: universal_platform - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0+1" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "2.1.2" sdks: diff --git a/lib/src/ai_barcode_widget.dart b/lib/src/ai_barcode_widget.dart index 9848c48..514e584 100644 --- a/lib/src/ai_barcode_widget.dart +++ b/lib/src/ai_barcode_widget.dart @@ -1,9 +1,10 @@ +import 'dart:io'; + import 'package:ai_barcode/src/creator/ai_barcode_mobile_creator_plugin.dart'; import 'package:ai_barcode/src/scanner/ai_barcode_mobile_scanner_plugin.dart'; import 'package:ai_barcode_platform_interface/ai_barcode_platform_interface.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:universal_platform/universal_platform.dart'; /// /// PlatformScannerWidget @@ -74,7 +75,7 @@ class _PlatformScannerWidgetState @override Widget build(BuildContext context) { if (!kIsWeb) { - if (UniversalPlatform.isAndroid || UniversalPlatform.isIOS) { + if (Platform.isAndroid || Platform.isIOS) { AiBarcodeScannerPlatform.instance = AiBarcodeMobileScannerPlugin(); } } @@ -207,7 +208,7 @@ class _PlatformAiBarcodeCreatorState @override Widget build(BuildContext context) { if (!kIsWeb) { - if (UniversalPlatform.isAndroid || UniversalPlatform.isIOS) { + if (Platform.isAndroid || Platform.isIOS) { AiBarcodeCreatorPlatform.instance = AiBarcodeMobileCreatorPlugin(); } } diff --git a/lib/src/creator/ai_barcode_mobile_creator_plugin.dart b/lib/src/creator/ai_barcode_mobile_creator_plugin.dart index 3775c11..9d637d5 100644 --- a/lib/src/creator/ai_barcode_mobile_creator_plugin.dart +++ b/lib/src/creator/ai_barcode_mobile_creator_plugin.dart @@ -1,7 +1,6 @@ import 'package:ai_barcode_platform_interface/ai_barcode_platform_interface.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:universal_platform/universal_platform.dart'; /// AiBarcodeMobileCreatorPlugin class AiBarcodeMobileCreatorPlugin extends AiBarcodeCreatorPlatform { @@ -12,7 +11,8 @@ class AiBarcodeMobileCreatorPlugin extends AiBarcodeCreatorPlatform { /// Barcode widget Widget _barcodeCreator({required BuildContext context}) { - if (UniversalPlatform.isAndroid) { + final TargetPlatform targetPlatform = Theme.of(context).platform; + if (targetPlatform == TargetPlatform.android) { return AndroidView( viewType: AiBarcodePlatform.viewIdOfCreator, creationParams: { @@ -28,7 +28,7 @@ class AiBarcodeMobileCreatorPlugin extends AiBarcodeCreatorPlatform { AiBarcodeCreatorPlatform.instance.initialValueOfCreator); }, ); - } else if (UniversalPlatform.isIOS) { + } else if (targetPlatform == TargetPlatform.iOS) { return UiKitView( viewType: AiBarcodePlatform.viewIdOfCreator, creationParams: { diff --git a/lib/src/scanner/ai_barcode_mobile_scanner_plugin.dart b/lib/src/scanner/ai_barcode_mobile_scanner_plugin.dart index bd6b200..81b547f 100644 --- a/lib/src/scanner/ai_barcode_mobile_scanner_plugin.dart +++ b/lib/src/scanner/ai_barcode_mobile_scanner_plugin.dart @@ -1,7 +1,6 @@ import 'package:ai_barcode_platform_interface/ai_barcode_platform_interface.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:universal_platform/universal_platform.dart'; /// /// AiBarcodeMobileScannerPlugin @@ -15,7 +14,8 @@ class AiBarcodeMobileScannerPlugin extends AiBarcodeScannerPlatform { /// /// Support android and ios platform barcode reader Widget _cameraView(BuildContext context) { - if (UniversalPlatform.isAndroid) { + final TargetPlatform targetPlatform = Theme.of(context).platform; + if (targetPlatform == TargetPlatform.android) { return AndroidView( viewType: AiBarcodePlatform.viewIdOfScanner, onPlatformViewCreated: (int id) { @@ -24,7 +24,7 @@ class AiBarcodeMobileScannerPlugin extends AiBarcodeScannerPlatform { creationParams: {}, creationParamsCodec: StandardMessageCodec(), ); - } else if (UniversalPlatform.isIOS) { + } else if (targetPlatform == TargetPlatform.iOS) { return UiKitView( viewType: AiBarcodePlatform.viewIdOfScanner, onPlatformViewCreated: (int id) { diff --git a/pubspec.lock b/pubspec.lock index 8c3bab0..c164408 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,77 +5,77 @@ packages: dependency: "direct main" description: name: ai_barcode_platform_interface - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "3.0.0" ai_barcode_web: dependency: "direct main" description: name: ai_barcode_web - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "3.0.0" async: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "2.8.2" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "2.1.0" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.2.0" charcode: dependency: transitive description: name: charcode - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.3.1" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.1.0" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.16.0" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted - version: "3.0.1" + version: "3.0.2" csslib: dependency: transitive description: name: csslib - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted - version: "0.17.0" + version: "0.17.2" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.3.0" flutter: @@ -87,7 +87,7 @@ packages: dependency: "direct dev" description: name: flutter_lints - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "2.0.1" flutter_test: @@ -104,63 +104,63 @@ packages: dependency: transitive description: name: html - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "0.15.0" js: dependency: transitive description: name: js - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "0.6.4" lints: dependency: transitive description: name: lints - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "2.0.0" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "0.12.11" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "0.1.4" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.7.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.8.1" qr: dependency: transitive description: name: qr - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted - version: "2.0.0" + version: "2.1.0" qr_flutter: dependency: transitive description: name: qr_flutter - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "4.0.0" sky_engine: @@ -172,77 +172,70 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.8.2" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "1.2.0" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "0.4.9" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted - version: "1.3.0" + version: "1.3.1" universal_html: dependency: transitive description: name: universal_html - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "2.0.8" universal_io: dependency: transitive description: name: universal_io - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "2.0.4" - universal_platform: - dependency: "direct main" - description: - name: universal_platform - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0-nullsafety" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" source: hosted version: "2.1.2" sdks: diff --git a/pubspec.yaml b/pubspec.yaml index 01559c4..91d8774 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: ai_barcode description: barcode,qrcode,scan,scanning,Barcode generation,Barcode scanning,qrcode,qrcode generation,qrcode creator -version: 3.0.2 +version: 3.1.0 homepage: https://pdliuw.github.io/ repository: https://github.com/pdliuw/ai_barcode @@ -12,7 +12,6 @@ environment: dependencies: flutter: sdk: flutter - universal_platform: ^1.0.0-nullsafety ai_barcode_platform_interface: ^3.0.0 ai_barcode_web: ^3.0.0