hints) {
356 | viewRef = new WeakReference<>(view);
357 | hintsRef = new WeakReference<>(hints);
358 | }
359 |
360 | @Override
361 | protected Result doInBackground(byte[]... params) {
362 | final QRCodeReaderView view = viewRef.get();
363 | if (view == null) {
364 | return null;
365 | }
366 |
367 | final PlanarYUVLuminanceSource source =
368 | view.mCameraManager.buildLuminanceSource(params[0], view.mPreviewWidth,
369 | view.mPreviewHeight);
370 |
371 | final HybridBinarizer hybBin = new HybridBinarizer(source);
372 | final BinaryBitmap bitmap = new BinaryBitmap(hybBin);
373 |
374 | try {
375 | return view.mQRCodeReader.decode(bitmap, hintsRef.get());
376 | } catch (ChecksumException e) {
377 | SimpleLog.d(TAG, "ChecksumException", e);
378 | } catch (NotFoundException e) {
379 | MultiFormatReader multiFormatReader = new MultiFormatReader();
380 | try {
381 | SimpleLog.d(TAG, "No QR Code found");
382 |
383 | LuminanceSource invertedSource = source.invert();
384 | BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer(invertedSource));
385 |
386 | return multiFormatReader.decode(binaryBitmap, HINTS);
387 | } catch (NotFoundException exception) {
388 | SimpleLog.d(TAG, "No Inverted QR Code found");
389 | return null;
390 | } finally {
391 | multiFormatReader.reset();
392 | }
393 | } catch (FormatException e) {
394 | SimpleLog.d(TAG, "FormatException", e);
395 | } finally {
396 | view.mQRCodeReader.reset();
397 | }
398 |
399 | return null;
400 | }
401 |
402 | @Override
403 | protected void onPostExecute(Result result) {
404 | super.onPostExecute(result);
405 |
406 | final QRCodeReaderView view = viewRef.get();
407 |
408 | // Notify we found a QRCode
409 | if (view != null && result != null && view.mOnQRCodeReadListener != null) {
410 | // Transform resultPoints to View coordinates
411 | final PointF[] transformedPoints =
412 | transformToViewCoordinates(view, result.getResultPoints());
413 | view.mOnQRCodeReadListener.onQRCodeRead(result.getText(), transformedPoints);
414 | }
415 | }
416 |
417 | /**
418 | * Transform result to surfaceView coordinates
419 | *
420 | * This method is needed because coordinates are given in landscape google.zxing.client.android.android.com.google.zxing.client.android.camera coordinates when
421 | * device is in portrait mode and different coordinates otherwise.
422 | *
423 | * @return a new PointF array with transformed points
424 | */
425 | private PointF[] transformToViewCoordinates(QRCodeReaderView view,
426 | ResultPoint[] resultPoints) {
427 | int orientationDegrees = view.getCameraDisplayOrientation();
428 | Orientation orientation =
429 | orientationDegrees == 90 || orientationDegrees == 270 ? Orientation.PORTRAIT
430 | : Orientation.LANDSCAPE;
431 | Point viewSize = new Point(view.getWidth(), view.getHeight());
432 | Point cameraPreviewSize = view.mCameraManager.getPreviewSize();
433 | boolean isMirrorCamera =
434 | view.mCameraManager.getPreviewCameraId()
435 | == Camera.CameraInfo.CAMERA_FACING_FRONT;
436 |
437 | return qrToViewPointTransformer.transform(resultPoints, isMirrorCamera, orientation,
438 | viewSize, cameraPreviewSize);
439 | }
440 | }
441 | }
442 |
--------------------------------------------------------------------------------
/android/src/main/java/me/hetian/flutter_qr_reader/readerView/QRToViewPointTransformer.java:
--------------------------------------------------------------------------------
1 | package me.hetian.flutter_qr_reader.readerView;
2 |
3 | import android.graphics.Point;
4 | import android.graphics.PointF;
5 |
6 | import com.google.zxing.ResultPoint;
7 |
8 | public class QRToViewPointTransformer {
9 |
10 | public PointF[] transform(ResultPoint[] qrPoints, boolean isMirrorPreview,
11 | Orientation orientation,
12 | Point viewSize, Point cameraPreviewSize) {
13 | PointF[] transformedPoints = new PointF[qrPoints.length];
14 | int index = 0;
15 | for (ResultPoint qrPoint : qrPoints) {
16 | PointF transformedPoint = transform(qrPoint, isMirrorPreview, orientation, viewSize,
17 | cameraPreviewSize);
18 | transformedPoints[index] = transformedPoint;
19 | index++;
20 | }
21 | return transformedPoints;
22 | }
23 |
24 | public PointF transform(ResultPoint qrPoint, boolean isMirrorPreview, Orientation orientation,
25 | Point viewSize, Point cameraPreviewSize) {
26 | float previewX = cameraPreviewSize.x;
27 | float previewY = cameraPreviewSize.y;
28 |
29 | PointF transformedPoint = null;
30 | float scaleX;
31 | float scaleY;
32 |
33 | if (orientation == Orientation.PORTRAIT) {
34 | scaleX = viewSize.x / previewY;
35 | scaleY = viewSize.y / previewX;
36 | transformedPoint = new PointF((previewY - qrPoint.getY()) * scaleX, qrPoint.getX() * scaleY);
37 | if (isMirrorPreview) {
38 | transformedPoint.y = viewSize.y - transformedPoint.y;
39 | }
40 | } else if (orientation == Orientation.LANDSCAPE) {
41 | scaleX = viewSize.x / previewX;
42 | scaleY = viewSize.y / previewY;
43 | transformedPoint = new PointF(viewSize.x - qrPoint.getX() * scaleX,
44 | viewSize.y - qrPoint.getY() * scaleY);
45 | if (isMirrorPreview) {
46 | transformedPoint.x = viewSize.x - transformedPoint.x;
47 | }
48 | }
49 | return transformedPoint;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/android/src/main/java/me/hetian/flutter_qr_reader/readerView/README.md:
--------------------------------------------------------------------------------
1 | copy:https://github.com/dlazaro66/QRCodeReaderView
--------------------------------------------------------------------------------
/android/src/main/java/me/hetian/flutter_qr_reader/readerView/SimpleLog.java:
--------------------------------------------------------------------------------
1 | package me.hetian.flutter_qr_reader.readerView;
2 |
3 | import android.util.Log;
4 |
5 | public class SimpleLog {
6 |
7 | private static boolean loggingEnabled = false;
8 |
9 | public static void setLoggingEnabled(boolean enabled) {
10 | loggingEnabled = enabled;
11 | }
12 |
13 | public static void d(String tag, String text) {
14 | if (loggingEnabled) {
15 | Log.d(tag, text);
16 | }
17 | }
18 |
19 | public static void w(String tag, String text) {
20 | if (loggingEnabled) {
21 | Log.w(tag, text);
22 | }
23 | }
24 |
25 | public static void w(String tag, String text, Throwable e) {
26 | if (loggingEnabled) {
27 | Log.w(tag, text, e);
28 | }
29 | }
30 |
31 | public static void e(String tag, String text) {
32 | if (loggingEnabled) {
33 | Log.e(tag, text);
34 | }
35 | }
36 |
37 | public static void d(String tag, String text, Throwable e) {
38 | if (loggingEnabled) {
39 | Log.d(tag, text, e);
40 | }
41 | }
42 |
43 | public static void i(String tag, String text) {
44 | if (loggingEnabled) {
45 | Log.i(tag, text);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/android/src/main/java/me/hetian/flutter_qr_reader/views/QrReaderView.java:
--------------------------------------------------------------------------------
1 | package me.hetian.flutter_qr_reader.views;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.app.ActionBar;
5 | import android.content.Context;
6 | import android.graphics.PointF;
7 | import android.hardware.Camera;
8 | import android.view.View;
9 |
10 | import com.google.zxing.client.android.camera.CameraManager;
11 |
12 | import java.util.ArrayList;
13 | import java.util.HashMap;
14 | import java.util.Map;
15 |
16 | import io.flutter.plugin.common.MethodCall;
17 | import io.flutter.plugin.common.MethodChannel;
18 | import io.flutter.plugin.common.PluginRegistry;
19 | import io.flutter.plugin.platform.PlatformView;
20 | import me.hetian.flutter_qr_reader.readerView.QRCodeReaderView;
21 |
22 | public class QrReaderView implements PlatformView, QRCodeReaderView.OnQRCodeReadListener, MethodChannel.MethodCallHandler {
23 |
24 | private final MethodChannel mMethodChannel;
25 | private final Context mContext;
26 | private Map mParams;
27 | private PluginRegistry.Registrar mRegistrar;
28 | QRCodeReaderView _view;
29 |
30 | public static String EXTRA_FOCUS_INTERVAL = "extra_focus_interval";
31 | public static String EXTRA_TORCH_ENABLED = "extra_torch_enabled";
32 |
33 | public QrReaderView(Context context, PluginRegistry.Registrar registrar, int id, Map params){
34 | this.mContext = context;
35 | this.mParams = params;
36 | this.mRegistrar = registrar;
37 |
38 | // 创建视图
39 | int width = (int) mParams.get("width");
40 | int height = (int) mParams.get("height");
41 | _view = new QRCodeReaderView(mContext);
42 | ActionBar.LayoutParams layoutParams = new ActionBar.LayoutParams(width, height);
43 | _view.setLayoutParams(layoutParams);
44 | _view.setOnQRCodeReadListener(this);
45 | _view.setQRDecodingEnabled(true);
46 | _view.forceAutoFocus();
47 | int interval = mParams.containsKey(EXTRA_FOCUS_INTERVAL) ? (int) mParams.get(EXTRA_FOCUS_INTERVAL) : 2000;
48 | _view.setAutofocusInterval(interval);
49 | _view.setTorchEnabled((boolean)mParams.get(EXTRA_TORCH_ENABLED));
50 |
51 | // 操作监听
52 | mMethodChannel = new MethodChannel(registrar.messenger(), "me.hetian.flutter_qr_reader.reader_view_" + id);
53 | mMethodChannel.setMethodCallHandler(this);
54 | }
55 |
56 | @Override
57 | public View getView() {
58 | return _view;
59 | }
60 |
61 | @Override
62 | public void dispose() {
63 | _view = null;
64 | mParams = null;
65 | mRegistrar = null;
66 | }
67 |
68 | @Override
69 | public void onQRCodeRead(String text, PointF[] points) {
70 | HashMap rest = new HashMap();
71 | rest.put("text", text);
72 | ArrayList poi = new ArrayList();
73 | for (PointF point : points) {
74 | poi.add(point.x + "," + point.y);
75 | }
76 | rest.put("points", poi);
77 | mMethodChannel.invokeMethod("onQRCodeRead", rest);
78 | }
79 |
80 | boolean flashlight;
81 | @Override
82 | public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) {
83 | switch (methodCall.method) {
84 | case "flashlight":
85 | _view.setTorchEnabled(!flashlight);
86 | flashlight = !flashlight;
87 | result.success(flashlight);
88 | break;
89 | case "startCamera":
90 | _view.startCamera();
91 | break;
92 | case "stopCamera":
93 | _view.stopCamera();
94 | break;
95 | }
96 |
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/assets/tool_flashlight_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/assets/tool_flashlight_close.png
--------------------------------------------------------------------------------
/assets/tool_flashlight_open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/assets/tool_flashlight_open.png
--------------------------------------------------------------------------------
/assets/tool_img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/assets/tool_img.png
--------------------------------------------------------------------------------
/assets/tool_qrcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/assets/tool_qrcode.png
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | .dart_tool/
26 | .flutter-plugins
27 | .packages
28 | .pub-cache/
29 | .pub/
30 | /build/
31 |
32 | # Android related
33 | **/android/**/gradle-wrapper.jar
34 | **/android/.gradle
35 | **/android/captures/
36 | **/android/gradlew
37 | **/android/gradlew.bat
38 | **/android/local.properties
39 | **/android/**/GeneratedPluginRegistrant.java
40 |
41 | # iOS/XCode related
42 | **/ios/**/*.mode1v3
43 | **/ios/**/*.mode2v3
44 | **/ios/**/*.moved-aside
45 | **/ios/**/*.pbxuser
46 | **/ios/**/*.perspectivev3
47 | **/ios/**/*sync/
48 | **/ios/**/.sconsign.dblite
49 | **/ios/**/.tags*
50 | **/ios/**/.vagrant/
51 | **/ios/**/DerivedData/
52 | **/ios/**/Icon?
53 | **/ios/**/Pods/
54 | **/ios/**/.symlinks/
55 | **/ios/**/profile
56 | **/ios/**/xcuserdata
57 | **/ios/.generated/
58 | **/ios/Flutter/App.framework
59 | **/ios/Flutter/Flutter.framework
60 | **/ios/Flutter/Generated.xcconfig
61 | **/ios/Flutter/app.flx
62 | **/ios/Flutter/app.zip
63 | **/ios/Flutter/flutter_assets/
64 | **/ios/ServiceDefinitions.json
65 | **/ios/Runner/GeneratedPluginRegistrant.*
66 |
67 | # Exceptions to above rules.
68 | !**/ios/**/default.mode1v3
69 | !**/ios/**/default.mode2v3
70 | !**/ios/**/default.pbxuser
71 | !**/ios/**/default.perspectivev3
72 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
73 |
--------------------------------------------------------------------------------
/example/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: b3b6d03737bd3f61209570e86f2b045c80f35c44
8 | channel: dev
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # flutter_qr_reader_example
2 |
3 | Demonstrates how to use the flutter_qr_reader plugin.
4 |
5 | ## Getting Started
6 |
7 | This project is a starting point for a Flutter application.
8 |
9 | A few resources to get you started if this is your first Flutter project:
10 |
11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
13 |
14 | For help getting started with Flutter, view our
15 | [online documentation](https://flutter.dev/docs), which offers tutorials,
16 | samples, guidance on mobile development, and a full API reference.
17 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
26 |
27 | android {
28 | compileSdkVersion 28
29 |
30 | lintOptions {
31 | disable 'InvalidPackage'
32 | }
33 |
34 | defaultConfig {
35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
36 | applicationId "me.hetian.flutter_qr_reader_example"
37 | minSdkVersion 16
38 | targetSdkVersion 28
39 | versionCode flutterVersionCode.toInteger()
40 | versionName flutterVersionName
41 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
42 | }
43 |
44 | buildTypes {
45 | release {
46 | // TODO: Add your own signing config for the release build.
47 | // Signing with the debug keys for now, so `flutter run --release` works.
48 | signingConfig signingConfigs.debug
49 | }
50 | }
51 | }
52 |
53 | flutter {
54 | source '../..'
55 | }
56 |
57 | dependencies {
58 | testImplementation 'junit:junit:4.12'
59 | androidTestImplementation 'androidx.test:runner:1.1.0'
60 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
61 | }
62 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
14 |
18 |
25 |
29 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/me/hetian/flutter_qr_reader_example/MainActivity.java:
--------------------------------------------------------------------------------
1 | package me.hetian.flutter_qr_reader_example;
2 |
3 | import android.os.Bundle;
4 | import io.flutter.app.FlutterActivity;
5 | import io.flutter.plugins.GeneratedPluginRegistrant;
6 |
7 | public class MainActivity extends FlutterActivity {
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | GeneratedPluginRegistrant.registerWith(this);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | google()
4 | jcenter()
5 | }
6 |
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:3.3.1'
9 | }
10 | }
11 |
12 | allprojects {
13 | repositories {
14 | google()
15 | jcenter()
16 | }
17 | }
18 |
19 | rootProject.buildDir = '../build'
20 | subprojects {
21 | project.buildDir = "${rootProject.buildDir}/${project.name}"
22 | }
23 | subprojects {
24 | project.evaluationDependsOn(':app')
25 | }
26 |
27 | task clean(type: Delete) {
28 | delete rootProject.buildDir
29 | }
30 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | android.enableJetifier=true
2 | android.useAndroidX=true
3 | org.gradle.jvmargs=-Xmx1536M
4 |
5 | android.enableR8=true
6 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
7 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
4 |
5 | def plugins = new Properties()
6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7 | if (pluginsFile.exists()) {
8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
9 | }
10 |
11 | plugins.each { name, path ->
12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13 | include ":$name"
14 | project(":$name").projectDir = pluginDirectory
15 | }
16 |
--------------------------------------------------------------------------------
/example/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 8.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '9.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def parse_KV_file(file, separator='=')
14 | file_abs_path = File.expand_path(file)
15 | if !File.exists? file_abs_path
16 | return [];
17 | end
18 | pods_ary = []
19 | skip_line_start_symbols = ["#", "/"]
20 | File.foreach(file_abs_path) { |line|
21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
22 | plugin = line.split(pattern=separator)
23 | if plugin.length == 2
24 | podname = plugin[0].strip()
25 | path = plugin[1].strip()
26 | podpath = File.expand_path("#{path}", file_abs_path)
27 | pods_ary.push({:name => podname, :path => podpath});
28 | else
29 | puts "Invalid plugin specification: #{line}"
30 | end
31 | }
32 | return pods_ary
33 | end
34 |
35 | target 'Runner' do
36 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
37 | # referring to absolute paths on developers' machines.
38 | system('rm -rf .symlinks')
39 | system('mkdir -p .symlinks/plugins')
40 |
41 | # Flutter Pods
42 | generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
43 | if generated_xcode_build_settings.empty?
44 | puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
45 | end
46 | generated_xcode_build_settings.map { |p|
47 | if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
48 | symlink = File.join('.symlinks', 'flutter')
49 | File.symlink(File.dirname(p[:path]), symlink)
50 | pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
51 | end
52 | }
53 |
54 | # Plugin Pods
55 | plugin_pods = parse_KV_file('../.flutter-plugins')
56 | plugin_pods.map { |p|
57 | symlink = File.join('.symlinks', 'plugins', p[:name])
58 | File.symlink(p[:path], symlink)
59 | pod p[:name], :path => File.join(symlink, 'ios')
60 | }
61 | end
62 |
63 | post_install do |installer|
64 | installer.pods_project.targets.each do |target|
65 | target.build_configurations.each do |config|
66 | config.build_settings['ENABLE_BITCODE'] = 'NO'
67 | end
68 | end
69 | end
70 |
--------------------------------------------------------------------------------
/example/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Flutter (1.0.0)
3 | - flutter_qr_reader (0.0.1):
4 | - Flutter
5 | - image_picker (0.0.1):
6 | - Flutter
7 | - permission_handler (3.1.0):
8 | - Flutter
9 |
10 | DEPENDENCIES:
11 | - Flutter (from `.symlinks/flutter/ios`)
12 | - flutter_qr_reader (from `.symlinks/plugins/flutter_qr_reader/ios`)
13 | - image_picker (from `.symlinks/plugins/image_picker/ios`)
14 | - permission_handler (from `.symlinks/plugins/permission_handler/ios`)
15 |
16 | EXTERNAL SOURCES:
17 | Flutter:
18 | :path: ".symlinks/flutter/ios"
19 | flutter_qr_reader:
20 | :path: ".symlinks/plugins/flutter_qr_reader/ios"
21 | image_picker:
22 | :path: ".symlinks/plugins/image_picker/ios"
23 | permission_handler:
24 | :path: ".symlinks/plugins/permission_handler/ios"
25 |
26 | SPEC CHECKSUMS:
27 | Flutter: 9d0fac939486c9aba2809b7982dfdbb47a7b0296
28 | flutter_qr_reader: cb791fdc527672537c644b2080196237bac85dfa
29 | image_picker: 86b84c4fe89267356a1f17297a45b5d317ebd2e7
30 | permission_handler: a1b8c0f8c83b4e7201f9c04b9aef09979cc97f60
31 |
32 | PODFILE CHECKSUM: e8988baac3a50f787b9d3ed7ca44957b442f92a7
33 |
34 | COCOAPODS: 1.5.3
35 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
14 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
15 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
16 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
17 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
18 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
19 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
20 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
21 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
22 | 9C1E29AF6A342B906797DE1E /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 609EE3FBD7BBC40F3A6BE32C /* libPods-Runner.a */; };
23 | /* End PBXBuildFile section */
24 |
25 | /* Begin PBXCopyFilesBuildPhase section */
26 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
27 | isa = PBXCopyFilesBuildPhase;
28 | buildActionMask = 2147483647;
29 | dstPath = "";
30 | dstSubfolderSpec = 10;
31 | files = (
32 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
33 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
34 | );
35 | name = "Embed Frameworks";
36 | runOnlyForDeploymentPostprocessing = 0;
37 | };
38 | /* End PBXCopyFilesBuildPhase section */
39 |
40 | /* Begin PBXFileReference section */
41 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
42 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
43 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
44 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; };
45 | 609EE3FBD7BBC40F3A6BE32C /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
46 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
47 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
48 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
49 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
50 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
51 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; };
52 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
53 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
54 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
55 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
56 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
57 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
58 | /* End PBXFileReference section */
59 |
60 | /* Begin PBXFrameworksBuildPhase section */
61 | 97C146EB1CF9000F007C117D /* Frameworks */ = {
62 | isa = PBXFrameworksBuildPhase;
63 | buildActionMask = 2147483647;
64 | files = (
65 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
66 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
67 | 9C1E29AF6A342B906797DE1E /* libPods-Runner.a in Frameworks */,
68 | );
69 | runOnlyForDeploymentPostprocessing = 0;
70 | };
71 | /* End PBXFrameworksBuildPhase section */
72 |
73 | /* Begin PBXGroup section */
74 | 41B3147FE4618AF8430B6376 /* Frameworks */ = {
75 | isa = PBXGroup;
76 | children = (
77 | 609EE3FBD7BBC40F3A6BE32C /* libPods-Runner.a */,
78 | );
79 | name = Frameworks;
80 | sourceTree = "";
81 | };
82 | 6B70193001E3453BA92650CB /* Pods */ = {
83 | isa = PBXGroup;
84 | children = (
85 | );
86 | name = Pods;
87 | sourceTree = "";
88 | };
89 | 9740EEB11CF90186004384FC /* Flutter */ = {
90 | isa = PBXGroup;
91 | children = (
92 | 3B80C3931E831B6300D905FE /* App.framework */,
93 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
94 | 9740EEBA1CF902C7004384FC /* Flutter.framework */,
95 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
96 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
97 | 9740EEB31CF90195004384FC /* Generated.xcconfig */,
98 | );
99 | name = Flutter;
100 | sourceTree = "";
101 | };
102 | 97C146E51CF9000F007C117D = {
103 | isa = PBXGroup;
104 | children = (
105 | 9740EEB11CF90186004384FC /* Flutter */,
106 | 97C146F01CF9000F007C117D /* Runner */,
107 | 97C146EF1CF9000F007C117D /* Products */,
108 | 6B70193001E3453BA92650CB /* Pods */,
109 | 41B3147FE4618AF8430B6376 /* Frameworks */,
110 | );
111 | sourceTree = "";
112 | };
113 | 97C146EF1CF9000F007C117D /* Products */ = {
114 | isa = PBXGroup;
115 | children = (
116 | 97C146EE1CF9000F007C117D /* Runner.app */,
117 | );
118 | name = Products;
119 | sourceTree = "";
120 | };
121 | 97C146F01CF9000F007C117D /* Runner */ = {
122 | isa = PBXGroup;
123 | children = (
124 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
125 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
126 | 97C146FA1CF9000F007C117D /* Main.storyboard */,
127 | 97C146FD1CF9000F007C117D /* Assets.xcassets */,
128 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
129 | 97C147021CF9000F007C117D /* Info.plist */,
130 | 97C146F11CF9000F007C117D /* Supporting Files */,
131 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
132 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
133 | );
134 | path = Runner;
135 | sourceTree = "";
136 | };
137 | 97C146F11CF9000F007C117D /* Supporting Files */ = {
138 | isa = PBXGroup;
139 | children = (
140 | 97C146F21CF9000F007C117D /* main.m */,
141 | );
142 | name = "Supporting Files";
143 | sourceTree = "";
144 | };
145 | /* End PBXGroup section */
146 |
147 | /* Begin PBXNativeTarget section */
148 | 97C146ED1CF9000F007C117D /* Runner */ = {
149 | isa = PBXNativeTarget;
150 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
151 | buildPhases = (
152 | FE00275F0DF8F0C5DE8C24A3 /* [CP] Check Pods Manifest.lock */,
153 | 9740EEB61CF901F6004384FC /* Run Script */,
154 | 97C146EA1CF9000F007C117D /* Sources */,
155 | 97C146EB1CF9000F007C117D /* Frameworks */,
156 | 97C146EC1CF9000F007C117D /* Resources */,
157 | 9705A1C41CF9048500538489 /* Embed Frameworks */,
158 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
159 | 50436DDA28C48A7C620C513D /* [CP] Embed Pods Frameworks */,
160 | );
161 | buildRules = (
162 | );
163 | dependencies = (
164 | );
165 | name = Runner;
166 | productName = Runner;
167 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
168 | productType = "com.apple.product-type.application";
169 | };
170 | /* End PBXNativeTarget section */
171 |
172 | /* Begin PBXProject section */
173 | 97C146E61CF9000F007C117D /* Project object */ = {
174 | isa = PBXProject;
175 | attributes = {
176 | LastUpgradeCheck = 0910;
177 | ORGANIZATIONNAME = "The Chromium Authors";
178 | TargetAttributes = {
179 | 97C146ED1CF9000F007C117D = {
180 | CreatedOnToolsVersion = 7.3.1;
181 | DevelopmentTeam = Y5H7257JB2;
182 | };
183 | };
184 | };
185 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
186 | compatibilityVersion = "Xcode 3.2";
187 | developmentRegion = English;
188 | hasScannedForEncodings = 0;
189 | knownRegions = (
190 | en,
191 | Base,
192 | );
193 | mainGroup = 97C146E51CF9000F007C117D;
194 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
195 | projectDirPath = "";
196 | projectRoot = "";
197 | targets = (
198 | 97C146ED1CF9000F007C117D /* Runner */,
199 | );
200 | };
201 | /* End PBXProject section */
202 |
203 | /* Begin PBXResourcesBuildPhase section */
204 | 97C146EC1CF9000F007C117D /* Resources */ = {
205 | isa = PBXResourcesBuildPhase;
206 | buildActionMask = 2147483647;
207 | files = (
208 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
209 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
210 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
211 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
212 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
213 | );
214 | runOnlyForDeploymentPostprocessing = 0;
215 | };
216 | /* End PBXResourcesBuildPhase section */
217 |
218 | /* Begin PBXShellScriptBuildPhase section */
219 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
220 | isa = PBXShellScriptBuildPhase;
221 | buildActionMask = 2147483647;
222 | files = (
223 | );
224 | inputPaths = (
225 | );
226 | name = "Thin Binary";
227 | outputPaths = (
228 | );
229 | runOnlyForDeploymentPostprocessing = 0;
230 | shellPath = /bin/sh;
231 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
232 | };
233 | 50436DDA28C48A7C620C513D /* [CP] Embed Pods Frameworks */ = {
234 | isa = PBXShellScriptBuildPhase;
235 | buildActionMask = 2147483647;
236 | files = (
237 | );
238 | inputPaths = (
239 | "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
240 | "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
241 | );
242 | name = "[CP] Embed Pods Frameworks";
243 | outputPaths = (
244 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
245 | );
246 | runOnlyForDeploymentPostprocessing = 0;
247 | shellPath = /bin/sh;
248 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
249 | showEnvVarsInLog = 0;
250 | };
251 | 9740EEB61CF901F6004384FC /* Run Script */ = {
252 | isa = PBXShellScriptBuildPhase;
253 | buildActionMask = 2147483647;
254 | files = (
255 | );
256 | inputPaths = (
257 | );
258 | name = "Run Script";
259 | outputPaths = (
260 | );
261 | runOnlyForDeploymentPostprocessing = 0;
262 | shellPath = /bin/sh;
263 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
264 | };
265 | FE00275F0DF8F0C5DE8C24A3 /* [CP] Check Pods Manifest.lock */ = {
266 | isa = PBXShellScriptBuildPhase;
267 | buildActionMask = 2147483647;
268 | files = (
269 | );
270 | inputPaths = (
271 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
272 | "${PODS_ROOT}/Manifest.lock",
273 | );
274 | name = "[CP] Check Pods Manifest.lock";
275 | outputPaths = (
276 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
277 | );
278 | runOnlyForDeploymentPostprocessing = 0;
279 | shellPath = /bin/sh;
280 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
281 | showEnvVarsInLog = 0;
282 | };
283 | /* End PBXShellScriptBuildPhase section */
284 |
285 | /* Begin PBXSourcesBuildPhase section */
286 | 97C146EA1CF9000F007C117D /* Sources */ = {
287 | isa = PBXSourcesBuildPhase;
288 | buildActionMask = 2147483647;
289 | files = (
290 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
291 | 97C146F31CF9000F007C117D /* main.m in Sources */,
292 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
293 | );
294 | runOnlyForDeploymentPostprocessing = 0;
295 | };
296 | /* End PBXSourcesBuildPhase section */
297 |
298 | /* Begin PBXVariantGroup section */
299 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
300 | isa = PBXVariantGroup;
301 | children = (
302 | 97C146FB1CF9000F007C117D /* Base */,
303 | );
304 | name = Main.storyboard;
305 | sourceTree = "";
306 | };
307 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
308 | isa = PBXVariantGroup;
309 | children = (
310 | 97C147001CF9000F007C117D /* Base */,
311 | );
312 | name = LaunchScreen.storyboard;
313 | sourceTree = "";
314 | };
315 | /* End PBXVariantGroup section */
316 |
317 | /* Begin XCBuildConfiguration section */
318 | 249021D3217E4FDB00AE95B9 /* Profile */ = {
319 | isa = XCBuildConfiguration;
320 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
321 | buildSettings = {
322 | ALWAYS_SEARCH_USER_PATHS = NO;
323 | CLANG_ANALYZER_NONNULL = YES;
324 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
325 | CLANG_CXX_LIBRARY = "libc++";
326 | CLANG_ENABLE_MODULES = YES;
327 | CLANG_ENABLE_OBJC_ARC = YES;
328 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
329 | CLANG_WARN_BOOL_CONVERSION = YES;
330 | CLANG_WARN_COMMA = YES;
331 | CLANG_WARN_CONSTANT_CONVERSION = YES;
332 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
333 | CLANG_WARN_EMPTY_BODY = YES;
334 | CLANG_WARN_ENUM_CONVERSION = YES;
335 | CLANG_WARN_INFINITE_RECURSION = YES;
336 | CLANG_WARN_INT_CONVERSION = YES;
337 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
338 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
339 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
340 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
341 | CLANG_WARN_STRICT_PROTOTYPES = YES;
342 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
343 | CLANG_WARN_UNREACHABLE_CODE = YES;
344 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
345 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
346 | COPY_PHASE_STRIP = NO;
347 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
348 | ENABLE_NS_ASSERTIONS = NO;
349 | ENABLE_STRICT_OBJC_MSGSEND = YES;
350 | GCC_C_LANGUAGE_STANDARD = gnu99;
351 | GCC_NO_COMMON_BLOCKS = YES;
352 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
353 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
354 | GCC_WARN_UNDECLARED_SELECTOR = YES;
355 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
356 | GCC_WARN_UNUSED_FUNCTION = YES;
357 | GCC_WARN_UNUSED_VARIABLE = YES;
358 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
359 | MTL_ENABLE_DEBUG_INFO = NO;
360 | SDKROOT = iphoneos;
361 | TARGETED_DEVICE_FAMILY = "1,2";
362 | VALIDATE_PRODUCT = YES;
363 | };
364 | name = Profile;
365 | };
366 | 249021D4217E4FDB00AE95B9 /* Profile */ = {
367 | isa = XCBuildConfiguration;
368 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
369 | buildSettings = {
370 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
371 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
372 | DEVELOPMENT_TEAM = Y5H7257JB2;
373 | ENABLE_BITCODE = NO;
374 | FRAMEWORK_SEARCH_PATHS = (
375 | "$(inherited)",
376 | "$(PROJECT_DIR)/Flutter",
377 | );
378 | INFOPLIST_FILE = Runner/Info.plist;
379 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
380 | LIBRARY_SEARCH_PATHS = (
381 | "$(inherited)",
382 | "$(PROJECT_DIR)/Flutter",
383 | );
384 | PRODUCT_BUNDLE_IDENTIFIER = me.hetian.flutterQrReaderExample;
385 | PRODUCT_NAME = "$(TARGET_NAME)";
386 | VERSIONING_SYSTEM = "apple-generic";
387 | };
388 | name = Profile;
389 | };
390 | 97C147031CF9000F007C117D /* Debug */ = {
391 | isa = XCBuildConfiguration;
392 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
393 | buildSettings = {
394 | ALWAYS_SEARCH_USER_PATHS = NO;
395 | CLANG_ANALYZER_NONNULL = YES;
396 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
397 | CLANG_CXX_LIBRARY = "libc++";
398 | CLANG_ENABLE_MODULES = YES;
399 | CLANG_ENABLE_OBJC_ARC = YES;
400 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
401 | CLANG_WARN_BOOL_CONVERSION = YES;
402 | CLANG_WARN_COMMA = YES;
403 | CLANG_WARN_CONSTANT_CONVERSION = YES;
404 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
405 | CLANG_WARN_EMPTY_BODY = YES;
406 | CLANG_WARN_ENUM_CONVERSION = YES;
407 | CLANG_WARN_INFINITE_RECURSION = YES;
408 | CLANG_WARN_INT_CONVERSION = YES;
409 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
410 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
411 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
412 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
413 | CLANG_WARN_STRICT_PROTOTYPES = YES;
414 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
415 | CLANG_WARN_UNREACHABLE_CODE = YES;
416 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
417 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
418 | COPY_PHASE_STRIP = NO;
419 | DEBUG_INFORMATION_FORMAT = dwarf;
420 | ENABLE_STRICT_OBJC_MSGSEND = YES;
421 | ENABLE_TESTABILITY = YES;
422 | GCC_C_LANGUAGE_STANDARD = gnu99;
423 | GCC_DYNAMIC_NO_PIC = NO;
424 | GCC_NO_COMMON_BLOCKS = YES;
425 | GCC_OPTIMIZATION_LEVEL = 0;
426 | GCC_PREPROCESSOR_DEFINITIONS = (
427 | "DEBUG=1",
428 | "$(inherited)",
429 | );
430 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
431 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
432 | GCC_WARN_UNDECLARED_SELECTOR = YES;
433 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
434 | GCC_WARN_UNUSED_FUNCTION = YES;
435 | GCC_WARN_UNUSED_VARIABLE = YES;
436 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
437 | MTL_ENABLE_DEBUG_INFO = YES;
438 | ONLY_ACTIVE_ARCH = YES;
439 | SDKROOT = iphoneos;
440 | TARGETED_DEVICE_FAMILY = "1,2";
441 | };
442 | name = Debug;
443 | };
444 | 97C147041CF9000F007C117D /* Release */ = {
445 | isa = XCBuildConfiguration;
446 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
447 | buildSettings = {
448 | ALWAYS_SEARCH_USER_PATHS = NO;
449 | CLANG_ANALYZER_NONNULL = YES;
450 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
451 | CLANG_CXX_LIBRARY = "libc++";
452 | CLANG_ENABLE_MODULES = YES;
453 | CLANG_ENABLE_OBJC_ARC = YES;
454 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
455 | CLANG_WARN_BOOL_CONVERSION = YES;
456 | CLANG_WARN_COMMA = YES;
457 | CLANG_WARN_CONSTANT_CONVERSION = YES;
458 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
459 | CLANG_WARN_EMPTY_BODY = YES;
460 | CLANG_WARN_ENUM_CONVERSION = YES;
461 | CLANG_WARN_INFINITE_RECURSION = YES;
462 | CLANG_WARN_INT_CONVERSION = YES;
463 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
464 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
465 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
466 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
467 | CLANG_WARN_STRICT_PROTOTYPES = YES;
468 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
469 | CLANG_WARN_UNREACHABLE_CODE = YES;
470 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
471 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
472 | COPY_PHASE_STRIP = NO;
473 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
474 | ENABLE_NS_ASSERTIONS = NO;
475 | ENABLE_STRICT_OBJC_MSGSEND = YES;
476 | GCC_C_LANGUAGE_STANDARD = gnu99;
477 | GCC_NO_COMMON_BLOCKS = YES;
478 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
479 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
480 | GCC_WARN_UNDECLARED_SELECTOR = YES;
481 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
482 | GCC_WARN_UNUSED_FUNCTION = YES;
483 | GCC_WARN_UNUSED_VARIABLE = YES;
484 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
485 | MTL_ENABLE_DEBUG_INFO = NO;
486 | SDKROOT = iphoneos;
487 | TARGETED_DEVICE_FAMILY = "1,2";
488 | VALIDATE_PRODUCT = YES;
489 | };
490 | name = Release;
491 | };
492 | 97C147061CF9000F007C117D /* Debug */ = {
493 | isa = XCBuildConfiguration;
494 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
495 | buildSettings = {
496 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
497 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
498 | DEVELOPMENT_TEAM = Y5H7257JB2;
499 | ENABLE_BITCODE = NO;
500 | FRAMEWORK_SEARCH_PATHS = (
501 | "$(inherited)",
502 | "$(PROJECT_DIR)/Flutter",
503 | );
504 | INFOPLIST_FILE = Runner/Info.plist;
505 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
506 | LIBRARY_SEARCH_PATHS = (
507 | "$(inherited)",
508 | "$(PROJECT_DIR)/Flutter",
509 | );
510 | PRODUCT_BUNDLE_IDENTIFIER = me.hetian.flutterQrReaderExample;
511 | PRODUCT_NAME = "$(TARGET_NAME)";
512 | VERSIONING_SYSTEM = "apple-generic";
513 | };
514 | name = Debug;
515 | };
516 | 97C147071CF9000F007C117D /* Release */ = {
517 | isa = XCBuildConfiguration;
518 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
519 | buildSettings = {
520 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
521 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
522 | DEVELOPMENT_TEAM = Y5H7257JB2;
523 | ENABLE_BITCODE = NO;
524 | FRAMEWORK_SEARCH_PATHS = (
525 | "$(inherited)",
526 | "$(PROJECT_DIR)/Flutter",
527 | );
528 | INFOPLIST_FILE = Runner/Info.plist;
529 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
530 | LIBRARY_SEARCH_PATHS = (
531 | "$(inherited)",
532 | "$(PROJECT_DIR)/Flutter",
533 | );
534 | PRODUCT_BUNDLE_IDENTIFIER = me.hetian.flutterQrReaderExample;
535 | PRODUCT_NAME = "$(TARGET_NAME)";
536 | VERSIONING_SYSTEM = "apple-generic";
537 | };
538 | name = Release;
539 | };
540 | /* End XCBuildConfiguration section */
541 |
542 | /* Begin XCConfigurationList section */
543 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
544 | isa = XCConfigurationList;
545 | buildConfigurations = (
546 | 97C147031CF9000F007C117D /* Debug */,
547 | 97C147041CF9000F007C117D /* Release */,
548 | 249021D3217E4FDB00AE95B9 /* Profile */,
549 | );
550 | defaultConfigurationIsVisible = 0;
551 | defaultConfigurationName = Release;
552 | };
553 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
554 | isa = XCConfigurationList;
555 | buildConfigurations = (
556 | 97C147061CF9000F007C117D /* Debug */,
557 | 97C147071CF9000F007C117D /* Release */,
558 | 249021D4217E4FDB00AE95B9 /* Profile */,
559 | );
560 | defaultConfigurationIsVisible = 0;
561 | defaultConfigurationName = Release;
562 | };
563 | /* End XCConfigurationList section */
564 | };
565 | rootObject = 97C146E61CF9000F007C117D /* Project object */;
566 | }
567 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
31 |
32 |
33 |
34 |
40 |
41 |
42 |
43 |
44 |
45 |
56 |
58 |
64 |
65 |
66 |
67 |
68 |
69 |
75 |
77 |
83 |
84 |
85 |
86 |
88 |
89 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildSystemType
6 | Original
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface AppDelegate : FlutterAppDelegate
5 |
6 | @end
7 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.m:
--------------------------------------------------------------------------------
1 | #include "AppDelegate.h"
2 | #include "GeneratedPluginRegistrant.h"
3 |
4 | @implementation AppDelegate
5 |
6 | - (BOOL)application:(UIApplication *)application
7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
8 | [GeneratedPluginRegistrant registerWithRegistry:self];
9 | // Override point for customization after application launch.
10 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
11 | }
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | io.flutter.embedded_views_preview
6 |
7 | NSPhotoLibraryUsageDescription
8 | 你的操作需要访问照片库权限
9 | NSCameraUsageDescription
10 | 你的操作需要访问相机权限
11 | NSMicrophoneUsageDescription
12 | 你的操作需要访问录像机权限
13 | CFBundleDevelopmentRegion
14 | en
15 | CFBundleExecutable
16 | $(EXECUTABLE_NAME)
17 | CFBundleIdentifier
18 | $(PRODUCT_BUNDLE_IDENTIFIER)
19 | CFBundleInfoDictionaryVersion
20 | 6.0
21 | CFBundleName
22 | flutter_qr_reader_example
23 | CFBundlePackageType
24 | APPL
25 | CFBundleShortVersionString
26 | $(FLUTTER_BUILD_NAME)
27 | CFBundleSignature
28 | ????
29 | CFBundleVersion
30 | $(FLUTTER_BUILD_NUMBER)
31 | LSRequiresIPhoneOS
32 |
33 | UILaunchStoryboardName
34 | LaunchScreen
35 | UIMainStoryboardFile
36 | Main
37 | UISupportedInterfaceOrientations
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationLandscapeLeft
41 | UIInterfaceOrientationLandscapeRight
42 |
43 | UISupportedInterfaceOrientations~ipad
44 |
45 | UIInterfaceOrientationPortrait
46 | UIInterfaceOrientationPortraitUpsideDown
47 | UIInterfaceOrientationLandscapeLeft
48 | UIInterfaceOrientationLandscapeRight
49 |
50 | UIViewControllerBasedStatusBarAppearance
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/example/ios/Runner/main.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char* argv[]) {
6 | @autoreleasepool {
7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/example/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import 'package:flutter_qr_reader/flutter_qr_reader.dart';
4 | import 'package:flutter_qr_reader_example/scanViewDemo.dart';
5 | import 'package:image_picker/image_picker.dart';
6 | import 'package:permission_handler/permission_handler.dart';
7 |
8 | void main() => runApp(MyApp());
9 |
10 | class MyApp extends StatefulWidget {
11 | @override
12 | _MyAppState createState() => _MyAppState();
13 | }
14 |
15 | class _MyAppState extends State {
16 | @override
17 | void initState() {
18 | super.initState();
19 | }
20 |
21 | @override
22 | Widget build(BuildContext context) {
23 | return MaterialApp(home: HomePage());
24 | }
25 | }
26 |
27 | class HomePage extends StatefulWidget {
28 | HomePage({Key key}) : super(key: key);
29 |
30 | @override
31 | _HomePageState createState() => new _HomePageState();
32 | }
33 |
34 | class _HomePageState extends State {
35 | QrReaderViewController _controller;
36 | bool isOk = false;
37 | String data;
38 | @override
39 | void initState() {
40 | super.initState();
41 | }
42 |
43 | @override
44 | Widget build(BuildContext context) {
45 | return Scaffold(
46 | appBar: AppBar(
47 | title: const Text('Plugin example app'),
48 | ),
49 | body: SingleChildScrollView(
50 | child: Column(
51 | children: [
52 | FlatButton(
53 | onPressed: () async {
54 | Map permissions =
55 | await PermissionHandler().requestPermissions([PermissionGroup.camera]);
56 | print(permissions);
57 | if (permissions[PermissionGroup.camera] == PermissionStatus.granted) {
58 | showDialog(
59 | context: context,
60 | builder: (context) {
61 | return Dialog(
62 | child: Text("ok"),
63 | );
64 | },
65 | );
66 | setState(() {
67 | isOk = true;
68 | });
69 | }
70 | },
71 | child: Text("请求权限"),
72 | color: Colors.blue,
73 | ),
74 | FlatButton(
75 | onPressed: () async {
76 | Navigator.push(context, MaterialPageRoute(builder: (context) => ScanViewDemo()));
77 | },
78 | child: Text("独立UI"),
79 | ),
80 | FlatButton(
81 | onPressed: () async {
82 | var image = await ImagePicker.pickImage(source: ImageSource.gallery);
83 | if (image == null) return;
84 | final rest = await FlutterQrReader.imgScan(image);
85 | setState(() {
86 | data = rest;
87 | });
88 | },
89 | child: Text("识别图片")),
90 | FlatButton(
91 | onPressed: () {
92 | assert(_controller != null);
93 | _controller.setFlashlight();
94 | },
95 | child: Text("切换闪光灯")),
96 | FlatButton(
97 | onPressed: () {
98 | assert(_controller != null);
99 | _controller.startCamera(onScan);
100 | },
101 | child: Text("开始扫码(暂停后)")),
102 | if (data != null) Text(data),
103 | if (isOk)
104 | Container(
105 | width: 320,
106 | height: 350,
107 | child: QrReaderView(
108 | width: 320,
109 | height: 350,
110 | callback: (container) {
111 | this._controller = container;
112 | _controller.startCamera(onScan);
113 | },
114 | ),
115 | )
116 | ],
117 | ),
118 | ),
119 | );
120 | }
121 |
122 | void onScan(String v, List offsets) {
123 | print([v, offsets]);
124 | setState(() {
125 | data = v;
126 | });
127 | _controller.stopCamera();
128 | }
129 |
130 | @override
131 | void dispose() {
132 | // TODO: implement dispose
133 | super.dispose();
134 | }
135 | }
136 |
--------------------------------------------------------------------------------
/example/lib/scanViewDemo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/cupertino.dart';
3 | import 'package:flutter_qr_reader/qrcode_reader_view.dart';
4 |
5 | class ScanViewDemo extends StatefulWidget {
6 | ScanViewDemo({Key key}) : super(key: key);
7 |
8 | @override
9 | _ScanViewDemoState createState() => new _ScanViewDemoState();
10 | }
11 |
12 | class _ScanViewDemoState extends State {
13 | GlobalKey _key = GlobalKey();
14 | @override
15 | void initState() {
16 | super.initState();
17 | }
18 |
19 | @override
20 | Widget build(BuildContext context) {
21 | return new Scaffold(
22 | body: QrcodeReaderView(
23 | key: _key,
24 | onScan: onScan,
25 | headerWidget: AppBar(
26 | backgroundColor: Colors.transparent,
27 | elevation: 0.0,
28 | ),
29 | ),
30 | );
31 | }
32 |
33 | Future onScan(String data) async {
34 | await showCupertinoDialog(
35 | context: context,
36 | builder: (context) {
37 | return CupertinoAlertDialog(
38 | title: Text("扫码结果"),
39 | content: Text(data),
40 | actions: [
41 | CupertinoDialogAction(
42 | child: Text("确认"),
43 | onPressed: () => Navigator.pop(context),
44 | )
45 | ],
46 | );
47 | },
48 | );
49 | _key.currentState.startScan();
50 | }
51 |
52 | @override
53 | void dispose() {
54 | super.dispose();
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/example/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://dart.dev/tools/pub/glossary#lockfile
3 | packages:
4 | archive:
5 | dependency: transitive
6 | description:
7 | name: archive
8 | url: "https://pub.dartlang.org"
9 | source: hosted
10 | version: "2.0.11"
11 | args:
12 | dependency: transitive
13 | description:
14 | name: args
15 | url: "https://pub.dartlang.org"
16 | source: hosted
17 | version: "1.5.2"
18 | async:
19 | dependency: transitive
20 | description:
21 | name: async
22 | url: "https://pub.dartlang.org"
23 | source: hosted
24 | version: "2.4.0"
25 | boolean_selector:
26 | dependency: transitive
27 | description:
28 | name: boolean_selector
29 | url: "https://pub.dartlang.org"
30 | source: hosted
31 | version: "1.0.5"
32 | charcode:
33 | dependency: transitive
34 | description:
35 | name: charcode
36 | url: "https://pub.dartlang.org"
37 | source: hosted
38 | version: "1.1.2"
39 | collection:
40 | dependency: transitive
41 | description:
42 | name: collection
43 | url: "https://pub.dartlang.org"
44 | source: hosted
45 | version: "1.14.11"
46 | convert:
47 | dependency: transitive
48 | description:
49 | name: convert
50 | url: "https://pub.dartlang.org"
51 | source: hosted
52 | version: "2.1.1"
53 | crypto:
54 | dependency: transitive
55 | description:
56 | name: crypto
57 | url: "https://pub.dartlang.org"
58 | source: hosted
59 | version: "2.1.3"
60 | cupertino_icons:
61 | dependency: "direct main"
62 | description:
63 | name: cupertino_icons
64 | url: "https://pub.dartlang.org"
65 | source: hosted
66 | version: "0.1.3"
67 | flutter:
68 | dependency: "direct main"
69 | description: flutter
70 | source: sdk
71 | version: "0.0.0"
72 | flutter_plugin_android_lifecycle:
73 | dependency: transitive
74 | description:
75 | name: flutter_plugin_android_lifecycle
76 | url: "https://pub.dartlang.org"
77 | source: hosted
78 | version: "1.0.6"
79 | flutter_qr_reader:
80 | dependency: "direct dev"
81 | description:
82 | path: ".."
83 | relative: true
84 | source: path
85 | version: "1.0.3"
86 | flutter_test:
87 | dependency: "direct dev"
88 | description: flutter
89 | source: sdk
90 | version: "0.0.0"
91 | image:
92 | dependency: transitive
93 | description:
94 | name: image
95 | url: "https://pub.dartlang.org"
96 | source: hosted
97 | version: "2.1.4"
98 | image_picker:
99 | dependency: "direct main"
100 | description:
101 | name: image_picker
102 | url: "https://pub.dartlang.org"
103 | source: hosted
104 | version: "0.6.3+4"
105 | matcher:
106 | dependency: transitive
107 | description:
108 | name: matcher
109 | url: "https://pub.dartlang.org"
110 | source: hosted
111 | version: "0.12.6"
112 | meta:
113 | dependency: transitive
114 | description:
115 | name: meta
116 | url: "https://pub.dartlang.org"
117 | source: hosted
118 | version: "1.1.8"
119 | path:
120 | dependency: transitive
121 | description:
122 | name: path
123 | url: "https://pub.dartlang.org"
124 | source: hosted
125 | version: "1.6.4"
126 | pedantic:
127 | dependency: transitive
128 | description:
129 | name: pedantic
130 | url: "https://pub.dartlang.org"
131 | source: hosted
132 | version: "1.8.0+1"
133 | permission_handler:
134 | dependency: "direct main"
135 | description:
136 | name: permission_handler
137 | url: "https://pub.dartlang.org"
138 | source: hosted
139 | version: "3.3.0"
140 | petitparser:
141 | dependency: transitive
142 | description:
143 | name: petitparser
144 | url: "https://pub.dartlang.org"
145 | source: hosted
146 | version: "2.4.0"
147 | quiver:
148 | dependency: transitive
149 | description:
150 | name: quiver
151 | url: "https://pub.dartlang.org"
152 | source: hosted
153 | version: "2.0.5"
154 | sky_engine:
155 | dependency: transitive
156 | description: flutter
157 | source: sdk
158 | version: "0.0.99"
159 | source_span:
160 | dependency: transitive
161 | description:
162 | name: source_span
163 | url: "https://pub.dartlang.org"
164 | source: hosted
165 | version: "1.5.5"
166 | stack_trace:
167 | dependency: transitive
168 | description:
169 | name: stack_trace
170 | url: "https://pub.dartlang.org"
171 | source: hosted
172 | version: "1.9.3"
173 | stream_channel:
174 | dependency: transitive
175 | description:
176 | name: stream_channel
177 | url: "https://pub.dartlang.org"
178 | source: hosted
179 | version: "2.0.0"
180 | string_scanner:
181 | dependency: transitive
182 | description:
183 | name: string_scanner
184 | url: "https://pub.dartlang.org"
185 | source: hosted
186 | version: "1.0.5"
187 | term_glyph:
188 | dependency: transitive
189 | description:
190 | name: term_glyph
191 | url: "https://pub.dartlang.org"
192 | source: hosted
193 | version: "1.1.0"
194 | test_api:
195 | dependency: transitive
196 | description:
197 | name: test_api
198 | url: "https://pub.dartlang.org"
199 | source: hosted
200 | version: "0.2.11"
201 | typed_data:
202 | dependency: transitive
203 | description:
204 | name: typed_data
205 | url: "https://pub.dartlang.org"
206 | source: hosted
207 | version: "1.1.6"
208 | vector_math:
209 | dependency: transitive
210 | description:
211 | name: vector_math
212 | url: "https://pub.dartlang.org"
213 | source: hosted
214 | version: "2.0.8"
215 | xml:
216 | dependency: transitive
217 | description:
218 | name: xml
219 | url: "https://pub.dartlang.org"
220 | source: hosted
221 | version: "3.5.0"
222 | sdks:
223 | dart: ">=2.4.0 <3.0.0"
224 | flutter: ">=1.12.13 <2.0.0"
225 |
--------------------------------------------------------------------------------
/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_qr_reader_example
2 | description: Demonstrates how to use the flutter_qr_reader plugin.
3 | publish_to: 'none'
4 |
5 | environment:
6 | sdk: ">=2.2.2 <3.0.0"
7 |
8 | dependencies:
9 | flutter:
10 | sdk: flutter
11 |
12 | # The following adds the Cupertino Icons font to your application.
13 | # Use with the CupertinoIcons class for iOS style icons.
14 | cupertino_icons: ^0.1.2
15 | permission_handler: '^3.0.0'
16 | image_picker: ^0.6.0+9
17 |
18 | dev_dependencies:
19 | flutter_test:
20 | sdk: flutter
21 |
22 | flutter_qr_reader:
23 | path: ../
24 |
25 | # For information on the generic Dart part of this file, see the
26 | # following page: https://dart.dev/tools/pub/pubspec
27 |
28 | # The following section is specific to Flutter.
29 | flutter:
30 |
31 | # The following line ensures that the Material Icons font is
32 | # included with your application, so that you can use the icons in
33 | # the material Icons class.
34 | uses-material-design: true
35 |
36 | # To add assets to your application, add an assets section, like this:
37 | # assets:
38 | # - images/a_dot_burr.jpeg
39 | # - images/a_dot_ham.jpeg
40 |
41 | # An image asset can refer to one or more resolution-specific "variants", see
42 | # https://flutter.dev/assets-and-images/#resolution-aware.
43 |
44 | # For details regarding adding assets from package dependencies, see
45 | # https://flutter.dev/assets-and-images/#from-packages
46 |
47 | # To add custom fonts to your application, add a fonts section here,
48 | # in this "flutter" section. Each entry in this list should have a
49 | # "family" key with the font family name, and a "fonts" key with a
50 | # list giving the asset and other descriptors for the font. For
51 | # example:
52 | # fonts:
53 | # - family: Schyler
54 | # fonts:
55 | # - asset: fonts/Schyler-Regular.ttf
56 | # - asset: fonts/Schyler-Italic.ttf
57 | # style: italic
58 | # - family: Trajan Pro
59 | # fonts:
60 | # - asset: fonts/TrajanPro.ttf
61 | # - asset: fonts/TrajanPro_Bold.ttf
62 | # weight: 700
63 | #
64 | # For details regarding fonts from package dependencies,
65 | # see https://flutter.dev/custom-fonts/#from-packages
66 |
--------------------------------------------------------------------------------
/example/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility that Flutter provides. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:flutter/material.dart';
9 | import 'package:flutter_test/flutter_test.dart';
10 |
11 | import 'package:flutter_qr_reader_example/main.dart';
12 |
13 | void main() {
14 | testWidgets('Verify Platform version', (WidgetTester tester) async {
15 | // Build our app and trigger a frame.
16 | await tester.pumpWidget(MyApp());
17 |
18 | // Verify that platform version is retrieved.
19 | expect(
20 | find.byWidgetPredicate(
21 | (Widget widget) => widget is Text &&
22 | widget.data.startsWith('Running on:'),
23 | ),
24 | findsOneWidget,
25 | );
26 | });
27 | }
28 |
--------------------------------------------------------------------------------
/ezgif-3-7c8bfe5fd68a.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/ezgif-3-7c8bfe5fd68a.gif
--------------------------------------------------------------------------------
/flutter_qr_reader.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | .vagrant/
3 | .sconsign.dblite
4 | .svn/
5 |
6 | .DS_Store
7 | *.swp
8 | profile
9 |
10 | DerivedData/
11 | build/
12 | GeneratedPluginRegistrant.h
13 | GeneratedPluginRegistrant.m
14 |
15 | .generated/
16 |
17 | *.pbxuser
18 | *.mode1v3
19 | *.mode2v3
20 | *.perspectivev3
21 |
22 | !default.pbxuser
23 | !default.mode1v3
24 | !default.mode2v3
25 | !default.perspectivev3
26 |
27 | xcuserdata
28 |
29 | *.moved-aside
30 |
31 | *.pyc
32 | *sync/
33 | Icon?
34 | .tags*
35 |
36 | /Flutter/Generated.xcconfig
37 |
--------------------------------------------------------------------------------
/ios/Assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hetian9288/flutter_qr_reader/e568f90723d9715bd3496877d1b23bffd09e88e2/ios/Assets/.gitkeep
--------------------------------------------------------------------------------
/ios/Classes/FlutterQrReaderPlugin.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface FlutterQrReaderPlugin : NSObject
4 | @end
5 |
--------------------------------------------------------------------------------
/ios/Classes/FlutterQrReaderPlugin.m:
--------------------------------------------------------------------------------
1 | #import "FlutterQrReaderPlugin.h"
2 | #import "QrReaderViewController.h"
3 |
4 | @implementation FlutterQrReaderPlugin
5 | + (void)registerWithRegistrar:(NSObject*)registrar {
6 | // 注册原生视图
7 | QrReaderViewFactory *viewFactory = [[QrReaderViewFactory alloc] initWithRegistrar:registrar];
8 | [registrar registerViewFactory:viewFactory withId:@"me.hetian.flutter_qr_reader.reader_view"];
9 |
10 | FlutterMethodChannel* channel = [FlutterMethodChannel
11 | methodChannelWithName:@"me.hetian.flutter_qr_reader"
12 | binaryMessenger:[registrar messenger]];
13 | FlutterQrReaderPlugin* instance = [[FlutterQrReaderPlugin alloc] init];
14 | [registrar addMethodCallDelegate:instance channel:channel];
15 | }
16 |
17 | - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
18 | if ([@"imgQrCode" isEqualToString:call.method]) {
19 | [self scanQRCode:call result:result];
20 | } else {
21 | result(FlutterMethodNotImplemented);
22 | }
23 | }
24 |
25 | - (void)scanQRCode:(FlutterMethodCall*)call result:(FlutterResult)result{
26 | NSString *path = call.arguments[@"file"];
27 | UIImage *image = [UIImage imageWithContentsOfFile:path];
28 | CIDetector *detector = [CIDetector detectorOfType:CIDetectorTypeQRCode context:nil options:@{ CIDetectorAccuracy : CIDetectorAccuracyHigh }];
29 |
30 | NSArray *features = [detector featuresInImage:[CIImage imageWithCGImage:image.CGImage]];
31 | if (features.count > 0) {
32 | CIQRCodeFeature *feature = [features objectAtIndex:0];
33 | NSString *qrData = feature.messageString;
34 | result(qrData);
35 | } else {
36 | result(NULL);
37 | }
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/ios/Classes/QrReaderViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ReReaderViewController.h
3 | // flutter_qr_reader
4 | //
5 | // Created by 王贺天 on 2019/6/7.
6 | //
7 |
8 | #import
9 | #import
10 | #import
11 | #import
12 | NS_ASSUME_NONNULL_BEGIN
13 |
14 | @interface QrReaderViewController : NSObject
15 | @end
16 |
17 | @interface QrReaderViewFactory : NSObject
18 | - (instancetype)initWithRegistrar:(NSObject*)registrar;
19 | @end
20 |
21 | NS_ASSUME_NONNULL_END
22 |
--------------------------------------------------------------------------------
/ios/Classes/QrReaderViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ReReaderViewController.m
3 | // flutter_qr_reader
4 | //
5 | // Created by 王贺天 on 2019/6/7.
6 | //
7 |
8 | #import "QrReaderViewController.h"
9 |
10 | @interface QrReaderViewController()
11 | @property (nonatomic, strong) AVCaptureSession *captureSession;
12 | @property (nonatomic, strong) AVCaptureVideoPreviewLayer *videoPreviewLayer;
13 | @end
14 |
15 | @implementation QrReaderViewController{
16 | UIView* _qrcodeview;
17 | int64_t _viewId;
18 | FlutterMethodChannel* _channel;
19 | NSObject* _registrar;
20 | NSNumber *height;
21 | NSNumber *width;
22 | BOOL isOpenFlash;
23 | BOOL _isReading;
24 | AVCaptureDevice *captureDevice;
25 | }
26 |
27 | - (instancetype)initWithFrame:(CGRect)frame
28 | viewIdentifier:(int64_t)viewId
29 | arguments:(id _Nullable)args
30 | binaryRegistrar:(NSObject*)registrar
31 | {
32 | if ([super init]) {
33 | _registrar = registrar;
34 | _viewId = viewId;
35 | NSString *channelName = [NSString stringWithFormat:@"me.hetian.flutter_qr_reader.reader_view_%lld", viewId];
36 | _channel = [FlutterMethodChannel methodChannelWithName:channelName binaryMessenger:registrar.messenger];
37 | __weak __typeof__(self) weakSelf = self;
38 | [_channel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) {
39 | [weakSelf onMethodCall:call result:result];
40 | }];
41 | width = args[@"width"];
42 | height = args[@"height"];
43 | NSLog(@"%@,%@", width, height);
44 | _qrcodeview= [[UIView alloc] initWithFrame:CGRectMake(0, 0, width.floatValue, height.floatValue) ];
45 | _qrcodeview.opaque = NO;
46 | _qrcodeview.backgroundColor = [UIColor blackColor];
47 | isOpenFlash = NO;
48 | _isReading = NO;
49 | }
50 | return self;
51 | }
52 |
53 | - (void)onMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result
54 | {
55 | if ([call.method isEqualToString:@"flashlight"]) {
56 | [self setFlashlight];
57 | }else if ([call.method isEqualToString:@"startCamera"]) {
58 | [self startReading];
59 | } else if ([call.method isEqualToString:@"stopCamera"]) {
60 | [self stopReading];
61 | }
62 | }
63 |
64 | - (nonnull UIView *)view {
65 | return _qrcodeview;
66 | }
67 |
68 | - (BOOL)startReading {
69 | if (_isReading) return NO;
70 | _isReading = YES;
71 | NSError *error;
72 | _captureSession = [[AVCaptureSession alloc] init];
73 | captureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
74 | AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:captureDevice error:&error];
75 | if (!input) {
76 | NSLog(@"%@", [error localizedDescription]);
77 | return NO;
78 | }
79 | [_captureSession addInput:input];
80 | AVCaptureMetadataOutput *captureMetadataOutput = [[AVCaptureMetadataOutput alloc] init];
81 | [_captureSession addOutput:captureMetadataOutput];
82 | dispatch_queue_t dispatchQueue;
83 | dispatchQueue = dispatch_queue_create("myQueue", NULL);
84 | [captureMetadataOutput setMetadataObjectsDelegate:self queue:dispatchQueue];
85 | [captureMetadataOutput setMetadataObjectTypes:[NSArray arrayWithObject:AVMetadataObjectTypeQRCode]];
86 | _videoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:_captureSession];
87 | [_videoPreviewLayer setVideoGravity:AVLayerVideoGravityResizeAspectFill];
88 | [_videoPreviewLayer setFrame:_qrcodeview.layer.bounds];
89 | [_qrcodeview.layer addSublayer:_videoPreviewLayer];
90 | [_captureSession startRunning];
91 | return YES;
92 | }
93 |
94 |
95 | -(void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection{
96 | if (metadataObjects != nil && [metadataObjects count] > 0) {
97 | AVMetadataMachineReadableCodeObject *metadataObj = [metadataObjects objectAtIndex:0];
98 | if ([[metadataObj type] isEqualToString:AVMetadataObjectTypeQRCode]) {
99 | NSMutableDictionary *dic = [[NSMutableDictionary alloc] init];
100 | [dic setObject:[metadataObj stringValue] forKey:@"text"];
101 | [_channel invokeMethod:@"onQRCodeRead" arguments:dic];
102 | [self performSelectorOnMainThread:@selector(stopReading) withObject:nil waitUntilDone:NO];
103 | _isReading = NO;
104 | }
105 | }
106 | }
107 |
108 |
109 | -(void)stopReading{
110 | [_captureSession stopRunning];
111 | _captureSession = nil;
112 | [_videoPreviewLayer removeFromSuperlayer];
113 | _isReading = NO;
114 | }
115 |
116 | // 手电筒开关
117 | - (void) setFlashlight
118 | {
119 | [captureDevice lockForConfiguration:nil];
120 | if (isOpenFlash == NO) {
121 | [captureDevice setTorchMode:AVCaptureTorchModeOn];
122 | isOpenFlash = YES;
123 | } else {
124 | [captureDevice setTorchMode:AVCaptureTorchModeOff];
125 | isOpenFlash = NO;
126 | }
127 |
128 | [captureDevice unlockForConfiguration];
129 | }
130 |
131 | @end
132 |
133 | @implementation QrReaderViewFactory{
134 | NSObject* _registrar;
135 | }
136 | - (instancetype)initWithRegistrar:(NSObject*)registrar
137 | {
138 | self = [super init];
139 | if (self) {
140 | _registrar = registrar;
141 | }
142 | return self;
143 | }
144 |
145 | - (NSObject*)createArgsCodec {
146 | return [FlutterStandardMessageCodec sharedInstance];
147 | }
148 |
149 | - (NSObject*)createWithFrame:(CGRect)frame
150 | viewIdentifier:(int64_t)viewId
151 | arguments:(id _Nullable)args
152 | {
153 | QrReaderViewController* viewController = [[QrReaderViewController alloc] initWithFrame:frame
154 | viewIdentifier:viewId
155 | arguments:args
156 | binaryRegistrar:_registrar];
157 | return viewController;
158 | }
159 | @end
160 |
161 |
--------------------------------------------------------------------------------
/ios/flutter_qr_reader.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
3 | #
4 | Pod::Spec.new do |s|
5 | s.name = 'flutter_qr_reader'
6 | s.version = '0.0.1'
7 | s.summary = 'QR code (scan code / picture) recognition (AndroidView/UiKitView)'
8 | s.description = <<-DESC
9 | QR code (scan code / picture) recognition (AndroidView/UiKitView)
10 | DESC
11 | s.homepage = 'http://example.com'
12 | s.license = { :file => '../LICENSE' }
13 | s.author = { 'Your Company' => 'email@example.com' }
14 | s.source = { :path => '.' }
15 | s.source_files = 'Classes/**/*'
16 | s.public_header_files = 'Classes/**/*.h'
17 | s.dependency 'Flutter'
18 |
19 | s.ios.deployment_target = '8.0'
20 | end
21 |
22 |
--------------------------------------------------------------------------------
/lib/flutter_qr_reader.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'dart:io';
3 | import 'dart:ui';
4 |
5 | import 'package:flutter/foundation.dart';
6 | import 'package:flutter/gestures.dart';
7 | import 'package:flutter/services.dart';
8 | import 'package:flutter/widgets.dart';
9 |
10 | class FlutterQrReader {
11 | static const MethodChannel _channel = const MethodChannel('me.hetian.flutter_qr_reader');
12 |
13 | static Future imgScan(File file) async {
14 | if (file?.existsSync() == false) {
15 | return null;
16 | }
17 | try {
18 | final rest = await _channel.invokeMethod("imgQrCode", {"file": file.path});
19 | return rest;
20 | } catch (e) {
21 | print(e);
22 | return null;
23 | }
24 | }
25 | }
26 |
27 | class QrReaderView extends StatefulWidget {
28 | final Function(QrReaderViewController) callback;
29 |
30 | final int autoFocusIntervalInMs;
31 | final bool torchEnabled;
32 | final double width;
33 | final double height;
34 |
35 | QrReaderView({
36 | Key key,
37 | this.width,
38 | this.height,
39 | this.callback,
40 | this.autoFocusIntervalInMs = 500,
41 | this.torchEnabled = false,
42 | }) : super(key: key);
43 |
44 | @override
45 | _QrReaderViewState createState() => new _QrReaderViewState();
46 | }
47 |
48 | class _QrReaderViewState extends State {
49 | @override
50 | void initState() {
51 | super.initState();
52 | }
53 |
54 | @override
55 | Widget build(BuildContext context) {
56 | if (defaultTargetPlatform == TargetPlatform.android) {
57 | return AndroidView(
58 | viewType: "me.hetian.flutter_qr_reader.reader_view",
59 | creationParams: {
60 | "width": (widget.width * window.devicePixelRatio).floor(),
61 | "height": (widget.height * window.devicePixelRatio).floor(),
62 | "extra_focus_interval": widget.autoFocusIntervalInMs,
63 | "extra_torch_enabled": widget.torchEnabled,
64 | },
65 | creationParamsCodec: const StandardMessageCodec(),
66 | onPlatformViewCreated: _onPlatformViewCreated,
67 | gestureRecognizers: >[
68 | new Factory(() => new EagerGestureRecognizer()),
69 | ].toSet(),
70 | );
71 | } else if (defaultTargetPlatform == TargetPlatform.iOS) {
72 | return UiKitView(
73 | viewType: "me.hetian.flutter_qr_reader.reader_view",
74 | creationParams: {
75 | "width": widget.width,
76 | "height": widget.height,
77 | "extra_focus_interval": widget.autoFocusIntervalInMs,
78 | "extra_torch_enabled": widget.torchEnabled,
79 | },
80 | creationParamsCodec: const StandardMessageCodec(),
81 | onPlatformViewCreated: _onPlatformViewCreated,
82 | gestureRecognizers: >[
83 | new Factory(() => new EagerGestureRecognizer()),
84 | ].toSet(),
85 | );
86 | } else {
87 | return Text('平台暂不支持');
88 | }
89 | }
90 |
91 | void _onPlatformViewCreated(int id) {
92 | widget.callback(QrReaderViewController(id));
93 | }
94 |
95 | @override
96 | void dispose() {
97 | super.dispose();
98 | }
99 | }
100 |
101 | typedef ReadChangeBack = void Function(String, List);
102 |
103 | class QrReaderViewController {
104 | final int id;
105 | final MethodChannel _channel;
106 | QrReaderViewController(this.id) : _channel = MethodChannel('me.hetian.flutter_qr_reader.reader_view_$id') {
107 | _channel.setMethodCallHandler(_handleMessages);
108 | }
109 | ReadChangeBack onQrBack;
110 |
111 | Future _handleMessages(MethodCall call) async {
112 | switch (call.method) {
113 | case "onQRCodeRead":
114 | final points = List();
115 | if (call.arguments.containsKey("points")) {
116 | final pointsStrs = call.arguments["points"];
117 | for (String point in pointsStrs) {
118 | final a = point.split(",");
119 | points.add(Offset(double.tryParse(a.first), double.tryParse(a.last)));
120 | }
121 | }
122 |
123 | this.onQrBack(call.arguments["text"], points);
124 | break;
125 | }
126 | }
127 |
128 | // 打开手电筒
129 | Future setFlashlight() async {
130 | return _channel.invokeMethod("flashlight");
131 | }
132 |
133 | // 开始扫码
134 | Future startCamera(ReadChangeBack onQrBack) async {
135 | this.onQrBack = onQrBack;
136 | return _channel.invokeMethod("startCamera");
137 | }
138 |
139 | // 结束扫码
140 | Future stopCamera() async {
141 | return _channel.invokeMethod("stopCamera");
142 | }
143 | }
144 |
--------------------------------------------------------------------------------
/lib/qrcode_reader_view.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'flutter_qr_reader.dart';
5 | import 'package:image_picker/image_picker.dart';
6 |
7 | /// 使用前需已经获取相关权限
8 | /// Relevant privileges must be obtained before use
9 | class QrcodeReaderView extends StatefulWidget {
10 | final Widget headerWidget;
11 | final Future Function(String) onScan;
12 | final double scanBoxRatio;
13 | final Color boxLineColor;
14 | final Widget helpWidget;
15 | QrcodeReaderView({
16 | Key key,
17 | @required this.onScan,
18 | this.headerWidget,
19 | this.boxLineColor = Colors.cyanAccent,
20 | this.helpWidget,
21 | this.scanBoxRatio = 0.85,
22 | }) : super(key: key);
23 |
24 | @override
25 | QrcodeReaderViewState createState() => new QrcodeReaderViewState();
26 | }
27 |
28 | /// 扫码后的后续操作
29 | /// ```dart
30 | /// GlobalKey qrViewKey = GlobalKey();
31 | /// qrViewKey.currentState.startScan();
32 | /// ```
33 | class QrcodeReaderViewState extends State
34 | with TickerProviderStateMixin {
35 | QrReaderViewController _controller;
36 | AnimationController _animationController;
37 | bool openFlashlight;
38 | Timer _timer;
39 | @override
40 | void initState() {
41 | super.initState();
42 | openFlashlight = false;
43 | _initAnimation();
44 | }
45 |
46 | void _initAnimation() {
47 | setState(() {
48 | _animationController = AnimationController(
49 | vsync: this, duration: Duration(milliseconds: 1000));
50 | });
51 | _animationController
52 | ..addListener(_upState)
53 | ..addStatusListener((state) {
54 | if (state == AnimationStatus.completed) {
55 | _timer = Timer(Duration(seconds: 1), () {
56 | _animationController?.reverse(from: 1.0);
57 | });
58 | } else if (state == AnimationStatus.dismissed) {
59 | _timer = Timer(Duration(seconds: 1), () {
60 | _animationController?.forward(from: 0.0);
61 | });
62 | }
63 | });
64 | _animationController.forward(from: 0.0);
65 | }
66 |
67 | void _clearAnimation() {
68 | _timer?.cancel();
69 | if (_animationController != null) {
70 | _animationController?.dispose();
71 | _animationController = null;
72 | }
73 | }
74 |
75 | void _upState() {
76 | setState(() {});
77 | }
78 |
79 | void _onCreateController(QrReaderViewController controller) async {
80 | _controller = controller;
81 | _controller.startCamera(_onQrBack);
82 | }
83 |
84 | bool isScan = false;
85 | Future _onQrBack(data, _) async {
86 | if (isScan == true) return;
87 | isScan = true;
88 | stopScan();
89 | await widget.onScan(data);
90 | }
91 |
92 | void startScan() {
93 | isScan = false;
94 | _controller.startCamera(_onQrBack);
95 | _initAnimation();
96 | }
97 |
98 | void stopScan() {
99 | _clearAnimation();
100 | _controller.stopCamera();
101 | }
102 |
103 | Future setFlashlight() async {
104 | openFlashlight = await _controller.setFlashlight();
105 | setState(() {});
106 | return openFlashlight;
107 | }
108 |
109 | Future _scanImage() async {
110 | stopScan();
111 | var image = await ImagePicker.pickImage(source: ImageSource.gallery);
112 | if (image == null) {
113 | startScan();
114 | return;
115 | }
116 | final rest = await FlutterQrReader.imgScan(image);
117 | await widget.onScan(rest);
118 | startScan();
119 | }
120 |
121 | @override
122 | Widget build(BuildContext context) {
123 | final flashOpen = Image.asset(
124 | "assets/tool_flashlight_open.png",
125 | package: "flutter_qr_reader",
126 | width: 35,
127 | height: 35,
128 | color: Colors.white,
129 | );
130 | final flashClose = Image.asset(
131 | "assets/tool_flashlight_close.png",
132 | package: "flutter_qr_reader",
133 | width: 35,
134 | height: 35,
135 | color: Colors.white,
136 | );
137 | return Material(
138 | color: Colors.black,
139 | child: LayoutBuilder(builder: (context, constraints) {
140 | final qrScanSize = constraints.maxWidth * widget.scanBoxRatio;
141 | final mediaQuery = MediaQuery.of(context);
142 | if (constraints.maxHeight < qrScanSize * 1.5) {
143 | print("建议高度与扫码区域高度比大于1.5");
144 | }
145 | return Stack(
146 | children: [
147 | SizedBox(
148 | width: constraints.maxWidth,
149 | height: constraints.maxHeight,
150 | child: QrReaderView(
151 | width: constraints.maxWidth,
152 | height: constraints.maxHeight,
153 | callback: _onCreateController,
154 | ),
155 | ),
156 | if (widget.headerWidget != null) widget.headerWidget,
157 | Positioned(
158 | left: (constraints.maxWidth - qrScanSize) / 2,
159 | top: (constraints.maxHeight - qrScanSize) * 0.333333,
160 | child: CustomPaint(
161 | painter: QrScanBoxPainter(
162 | boxLineColor: widget.boxLineColor,
163 | animationValue: _animationController?.value ?? 0,
164 | isForward:
165 | _animationController?.status == AnimationStatus.forward,
166 | ),
167 | child: SizedBox(
168 | width: qrScanSize,
169 | height: qrScanSize,
170 | ),
171 | ),
172 | ),
173 | Positioned(
174 | top: (constraints.maxHeight - qrScanSize) * 0.333333 +
175 | qrScanSize +
176 | 24,
177 | width: constraints.maxWidth,
178 | child: Align(
179 | alignment: Alignment.center,
180 | child: DefaultTextStyle(
181 | style: TextStyle(color: Colors.white),
182 | child: widget.helpWidget ?? Text("请将二维码置于方框中"),
183 | ),
184 | ),
185 | ),
186 | Positioned(
187 | top: (constraints.maxHeight - qrScanSize) * 0.333333 +
188 | qrScanSize -
189 | 12 -
190 | 35,
191 | width: constraints.maxWidth,
192 | child: Align(
193 | alignment: Alignment.center,
194 | child: GestureDetector(
195 | behavior: HitTestBehavior.translucent,
196 | onTap: setFlashlight,
197 | child: openFlashlight ? flashOpen : flashClose,
198 | ),
199 | ),
200 | ),
201 | Positioned(
202 | width: constraints.maxWidth,
203 | bottom: constraints.maxHeight == mediaQuery.size.height
204 | ? 12 + mediaQuery.padding.top
205 | : 12,
206 | child: Row(
207 | crossAxisAlignment: CrossAxisAlignment.center,
208 | mainAxisAlignment: MainAxisAlignment.spaceEvenly,
209 | children: [
210 | GestureDetector(
211 | behavior: HitTestBehavior.translucent,
212 | onTap: _scanImage,
213 | child: Container(
214 | width: 45,
215 | height: 45,
216 | alignment: Alignment.center,
217 | child: Image.asset(
218 | "assets/tool_img.png",
219 | package: "flutter_qr_reader",
220 | width: 25,
221 | height: 25,
222 | color: Colors.white54,
223 | ),
224 | ),
225 | ),
226 | Container(
227 | width: 80,
228 | height: 80,
229 | decoration: BoxDecoration(
230 | borderRadius: BorderRadius.all(Radius.circular(40)),
231 | border: Border.all(color: Colors.white30, width: 12),
232 | ),
233 | alignment: Alignment.center,
234 | child: Image.asset(
235 | "assets/tool_qrcode.png",
236 | package: "flutter_qr_reader",
237 | width: 35,
238 | height: 35,
239 | color: Colors.white54,
240 | ),
241 | ),
242 | SizedBox(width: 45, height: 45),
243 | ],
244 | ),
245 | )
246 | ],
247 | );
248 | }),
249 | );
250 | }
251 |
252 | @override
253 | void dispose() {
254 | _clearAnimation();
255 | super.dispose();
256 | }
257 | }
258 |
259 | class QrScanBoxPainter extends CustomPainter {
260 | final double animationValue;
261 | final bool isForward;
262 | final Color boxLineColor;
263 |
264 | QrScanBoxPainter(
265 | {@required this.animationValue,
266 | @required this.isForward,
267 | this.boxLineColor})
268 | : assert(animationValue != null),
269 | assert(isForward != null);
270 |
271 | @override
272 | void paint(Canvas canvas, Size size) {
273 | final borderRadius = BorderRadius.all(Radius.circular(12)).toRRect(
274 | Rect.fromLTWH(0, 0, size.width, size.height),
275 | );
276 | canvas.drawRRect(
277 | borderRadius,
278 | Paint()
279 | ..color = Colors.white54
280 | ..style = PaintingStyle.stroke
281 | ..strokeWidth = 1,
282 | );
283 | final borderPaint = Paint()
284 | ..color = Colors.white
285 | ..style = PaintingStyle.stroke
286 | ..strokeWidth = 2;
287 | final path = new Path();
288 | // leftTop
289 | path.moveTo(0, 50);
290 | path.lineTo(0, 12);
291 | path.quadraticBezierTo(0, 0, 12, 0);
292 | path.lineTo(50, 0);
293 | // rightTop
294 | path.moveTo(size.width - 50, 0);
295 | path.lineTo(size.width - 12, 0);
296 | path.quadraticBezierTo(size.width, 0, size.width, 12);
297 | path.lineTo(size.width, 50);
298 | // rightBottom
299 | path.moveTo(size.width, size.height - 50);
300 | path.lineTo(size.width, size.height - 12);
301 | path.quadraticBezierTo(
302 | size.width, size.height, size.width - 12, size.height);
303 | path.lineTo(size.width - 50, size.height);
304 | // leftBottom
305 | path.moveTo(50, size.height);
306 | path.lineTo(12, size.height);
307 | path.quadraticBezierTo(0, size.height, 0, size.height - 12);
308 | path.lineTo(0, size.height - 50);
309 |
310 | canvas.drawPath(path, borderPaint);
311 |
312 | canvas.clipRRect(
313 | BorderRadius.all(Radius.circular(12)).toRRect(Offset.zero & size));
314 |
315 | // 绘制横向网格
316 | final linePaint = Paint();
317 | final lineSize = size.height * 0.45;
318 | final leftPress = (size.height + lineSize) * animationValue - lineSize;
319 | linePaint.style = PaintingStyle.stroke;
320 | linePaint.shader = LinearGradient(
321 | colors: [Colors.transparent, boxLineColor],
322 | begin: isForward ? Alignment.topCenter : Alignment(0.0, 2.0),
323 | end: isForward ? Alignment(0.0, 0.5) : Alignment.topCenter,
324 | ).createShader(Rect.fromLTWH(0, leftPress, size.width, lineSize));
325 | for (int i = 0; i < size.height / 5; i++) {
326 | canvas.drawLine(
327 | Offset(
328 | i * 5.0,
329 | leftPress,
330 | ),
331 | Offset(i * 5.0, leftPress + lineSize),
332 | linePaint,
333 | );
334 | }
335 | for (int i = 0; i < lineSize / 5; i++) {
336 | canvas.drawLine(
337 | Offset(0, leftPress + i * 5.0),
338 | Offset(
339 | size.width,
340 | leftPress + i * 5.0,
341 | ),
342 | linePaint,
343 | );
344 | }
345 | }
346 |
347 | @override
348 | bool shouldRepaint(QrScanBoxPainter oldDelegate) =>
349 | animationValue != oldDelegate.animationValue;
350 |
351 | @override
352 | bool shouldRebuildSemantics(QrScanBoxPainter oldDelegate) =>
353 | animationValue != oldDelegate.animationValue;
354 | }
355 |
--------------------------------------------------------------------------------
/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://dart.dev/tools/pub/glossary#lockfile
3 | packages:
4 | archive:
5 | dependency: transitive
6 | description:
7 | name: archive
8 | url: "https://pub.dartlang.org"
9 | source: hosted
10 | version: "2.0.11"
11 | args:
12 | dependency: transitive
13 | description:
14 | name: args
15 | url: "https://pub.dartlang.org"
16 | source: hosted
17 | version: "1.5.2"
18 | async:
19 | dependency: transitive
20 | description:
21 | name: async
22 | url: "https://pub.dartlang.org"
23 | source: hosted
24 | version: "2.4.0"
25 | boolean_selector:
26 | dependency: transitive
27 | description:
28 | name: boolean_selector
29 | url: "https://pub.dartlang.org"
30 | source: hosted
31 | version: "1.0.5"
32 | charcode:
33 | dependency: transitive
34 | description:
35 | name: charcode
36 | url: "https://pub.dartlang.org"
37 | source: hosted
38 | version: "1.1.2"
39 | collection:
40 | dependency: transitive
41 | description:
42 | name: collection
43 | url: "https://pub.dartlang.org"
44 | source: hosted
45 | version: "1.14.11"
46 | convert:
47 | dependency: transitive
48 | description:
49 | name: convert
50 | url: "https://pub.dartlang.org"
51 | source: hosted
52 | version: "2.1.1"
53 | crypto:
54 | dependency: transitive
55 | description:
56 | name: crypto
57 | url: "https://pub.dartlang.org"
58 | source: hosted
59 | version: "2.1.3"
60 | flutter:
61 | dependency: "direct main"
62 | description: flutter
63 | source: sdk
64 | version: "0.0.0"
65 | flutter_plugin_android_lifecycle:
66 | dependency: transitive
67 | description:
68 | name: flutter_plugin_android_lifecycle
69 | url: "https://pub.dartlang.org"
70 | source: hosted
71 | version: "1.0.6"
72 | flutter_test:
73 | dependency: "direct dev"
74 | description: flutter
75 | source: sdk
76 | version: "0.0.0"
77 | image:
78 | dependency: transitive
79 | description:
80 | name: image
81 | url: "https://pub.dartlang.org"
82 | source: hosted
83 | version: "2.1.4"
84 | image_picker:
85 | dependency: "direct main"
86 | description:
87 | name: image_picker
88 | url: "https://pub.dartlang.org"
89 | source: hosted
90 | version: "0.6.3+4"
91 | matcher:
92 | dependency: transitive
93 | description:
94 | name: matcher
95 | url: "https://pub.dartlang.org"
96 | source: hosted
97 | version: "0.12.6"
98 | meta:
99 | dependency: transitive
100 | description:
101 | name: meta
102 | url: "https://pub.dartlang.org"
103 | source: hosted
104 | version: "1.1.8"
105 | path:
106 | dependency: transitive
107 | description:
108 | name: path
109 | url: "https://pub.dartlang.org"
110 | source: hosted
111 | version: "1.6.4"
112 | pedantic:
113 | dependency: transitive
114 | description:
115 | name: pedantic
116 | url: "https://pub.dartlang.org"
117 | source: hosted
118 | version: "1.8.0+1"
119 | petitparser:
120 | dependency: transitive
121 | description:
122 | name: petitparser
123 | url: "https://pub.dartlang.org"
124 | source: hosted
125 | version: "2.4.0"
126 | quiver:
127 | dependency: transitive
128 | description:
129 | name: quiver
130 | url: "https://pub.dartlang.org"
131 | source: hosted
132 | version: "2.0.5"
133 | sky_engine:
134 | dependency: transitive
135 | description: flutter
136 | source: sdk
137 | version: "0.0.99"
138 | source_span:
139 | dependency: transitive
140 | description:
141 | name: source_span
142 | url: "https://pub.dartlang.org"
143 | source: hosted
144 | version: "1.5.5"
145 | stack_trace:
146 | dependency: transitive
147 | description:
148 | name: stack_trace
149 | url: "https://pub.dartlang.org"
150 | source: hosted
151 | version: "1.9.3"
152 | stream_channel:
153 | dependency: transitive
154 | description:
155 | name: stream_channel
156 | url: "https://pub.dartlang.org"
157 | source: hosted
158 | version: "2.0.0"
159 | string_scanner:
160 | dependency: transitive
161 | description:
162 | name: string_scanner
163 | url: "https://pub.dartlang.org"
164 | source: hosted
165 | version: "1.0.5"
166 | term_glyph:
167 | dependency: transitive
168 | description:
169 | name: term_glyph
170 | url: "https://pub.dartlang.org"
171 | source: hosted
172 | version: "1.1.0"
173 | test_api:
174 | dependency: transitive
175 | description:
176 | name: test_api
177 | url: "https://pub.dartlang.org"
178 | source: hosted
179 | version: "0.2.11"
180 | typed_data:
181 | dependency: transitive
182 | description:
183 | name: typed_data
184 | url: "https://pub.dartlang.org"
185 | source: hosted
186 | version: "1.1.6"
187 | vector_math:
188 | dependency: transitive
189 | description:
190 | name: vector_math
191 | url: "https://pub.dartlang.org"
192 | source: hosted
193 | version: "2.0.8"
194 | xml:
195 | dependency: transitive
196 | description:
197 | name: xml
198 | url: "https://pub.dartlang.org"
199 | source: hosted
200 | version: "3.5.0"
201 | sdks:
202 | dart: ">=2.4.0 <3.0.0"
203 | flutter: ">=1.12.13 <2.0.0"
204 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_qr_reader
2 | description: QR code (scan QRCode and picture) recognition (AndroidView/UiKitView)
3 | version: 1.0.3
4 | author: 王贺天
5 | homepage: https://github.com/hetian9288/flutter_qr_reader
6 |
7 | environment:
8 | sdk: ">=2.2.2 <3.0.0"
9 |
10 | dependencies:
11 | flutter:
12 | sdk: flutter
13 | image_picker: ^0.6.0+9
14 |
15 | dev_dependencies:
16 | flutter_test:
17 | sdk: flutter
18 |
19 | # For information on the generic Dart part of this file, see the
20 | # following page: https://dart.dev/tools/pub/pubspec
21 |
22 | # The following section is specific to Flutter.
23 | flutter:
24 | # This section identifies this Flutter project as a plugin project.
25 | # The androidPackage and pluginClass identifiers should not ordinarily
26 | # be modified. They are used by the tooling to maintain consistency when
27 | # adding or updating assets for this project.
28 | plugin:
29 | androidPackage: me.hetian.flutter_qr_reader
30 | pluginClass: FlutterQrReaderPlugin
31 |
32 | # To add assets to your plugin package, add an assets section, like this:
33 | # assets:
34 | # - images/a_dot_burr.jpeg
35 | # - images/a_dot_ham.jpeg
36 | assets:
37 | - assets/tool_img.png
38 | - assets/tool_qrcode.png
39 | - assets/tool_flashlight_close.png
40 | - assets/tool_flashlight_open.png
41 | #
42 | # For details regarding assets in packages, see
43 | # https://flutter.dev/assets-and-images/#from-packages
44 | #
45 | # An image asset can refer to one or more resolution-specific "variants", see
46 | # https://flutter.dev/assets-and-images/#resolution-aware.
47 |
48 | # To add custom fonts to your plugin package, add a fonts section here,
49 | # in this "flutter" section. Each entry in this list should have a
50 | # "family" key with the font family name, and a "fonts" key with a
51 | # list giving the asset and other descriptors for the font. For
52 | # example:
53 | # fonts:
54 | # - family: Schyler
55 | # fonts:
56 | # - asset: fonts/Schyler-Regular.ttf
57 | # - asset: fonts/Schyler-Italic.ttf
58 | # style: italic
59 | # - family: Trajan Pro
60 | # fonts:
61 | # - asset: fonts/TrajanPro.ttf
62 | # - asset: fonts/TrajanPro_Bold.ttf
63 | # weight: 700
64 | #
65 | # For details regarding fonts in packages, see
66 | # https://flutter.dev/custom-fonts/#from-packages
67 |
--------------------------------------------------------------------------------
/test/flutter_qr_reader_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/services.dart';
2 | import 'package:flutter_test/flutter_test.dart';
3 |
4 | void main() {
5 | const MethodChannel channel = MethodChannel('flutter_qr_reader');
6 |
7 | setUp(() {
8 | channel.setMockMethodCallHandler((MethodCall methodCall) async {
9 | return '42';
10 | });
11 | });
12 |
13 | tearDown(() {
14 | channel.setMockMethodCallHandler(null);
15 | });
16 |
17 | test('getPlatformVersion', () async {
18 | });
19 | }
20 |
--------------------------------------------------------------------------------