lucky1213 vor 4 Jahren
Ursprung
Commit
4bc1e4f19e
3 geänderte Dateien mit 55 neuen und 50 gelöschten Zeilen
  1. 19
    1
      lib/photo.dart
  2. 35
    49
      pubspec.lock
  3. 1
    0
      pubspec.yaml

+ 19
- 1
lib/photo.dart Datei anzeigen

@@ -1,8 +1,10 @@
1 1
 library photo;
2 2
 
3 3
 import 'dart:async';
4
+import 'dart:io';
4 5
 
5 6
 import 'package:flutter/material.dart';
7
+import 'package:image_picker/image_picker.dart';
6 8
 import 'package:photo/src/entity/_theme.dart';
7 9
 import 'package:photo/src/ui/page/photo_list_page.dart';
8 10
 import 'package:photo/src/ui/page/photo_main_page.dart';
@@ -116,6 +118,21 @@ class PhotoPicker {
116 118
     );
117 119
   }
118 120
 
121
+  static Future<File> pickCamera({
122
+    double maxWidth,
123
+    double maxHeight,
124
+    int imageQuality,
125
+    CameraDevice preferredCameraDevice,
126
+  }) async {
127
+    return ImagePicker.pickImage(
128
+      source: ImageSource.camera,
129
+      maxWidth: maxWidth,
130
+      maxHeight: maxHeight,
131
+      imageQuality: imageQuality,
132
+      preferredCameraDevice: preferredCameraDevice,
133
+    );
134
+  }
135
+
119 136
   Future<PickedEntity> _pickAsset(
120 137
     BuildContext context,
121 138
     Options options,
@@ -184,7 +201,8 @@ class PhotoPicker {
184 201
     );
185 202
   }
186 203
 
187
-  Future<void> requestPermission(BuildContext context, {@required I18nProvider provider}) async {
204
+  Future<void> requestPermission(BuildContext context,
205
+      {@required I18nProvider provider}) async {
188 206
     var requestPermission = await PhotoManager.requestPermission();
189 207
     if (requestPermission != true) {
190 208
       var result = await showDialog(

+ 35
- 49
pubspec.lock Datei anzeigen

@@ -1,20 +1,6 @@
1 1
 # Generated by pub
2 2
 # See https://dart.dev/tools/pub/glossary#lockfile
3 3
 packages:
4
-  archive:
5
-    dependency: transitive
6
-    description:
7
-      name: archive
8
-      url: "https://pub.flutter-io.cn"
9
-    source: hosted
10
-    version: "2.0.13"
11
-  args:
12
-    dependency: transitive
13
-    description:
14
-      name: args
15
-      url: "https://pub.flutter-io.cn"
16
-    source: hosted
17
-    version: "1.6.0"
18 4
   async:
19 5
     dependency: transitive
20 6
     description:
@@ -36,44 +22,58 @@ packages:
36 22
       url: "https://pub.flutter-io.cn"
37 23
     source: hosted
38 24
     version: "1.1.3"
39
-  collection:
25
+  clock:
40 26
     dependency: transitive
41 27
     description:
42
-      name: collection
28
+      name: clock
43 29
       url: "https://pub.flutter-io.cn"
44 30
     source: hosted
45
-    version: "1.14.12"
46
-  convert:
31
+    version: "1.0.1"
32
+  collection:
47 33
     dependency: transitive
48 34
     description:
49
-      name: convert
35
+      name: collection
50 36
       url: "https://pub.flutter-io.cn"
51 37
     source: hosted
52
-    version: "2.1.1"
53
-  crypto:
38
+    version: "1.14.12"
39
+  fake_async:
54 40
     dependency: transitive
55 41
     description:
56
-      name: crypto
42
+      name: fake_async
57 43
       url: "https://pub.flutter-io.cn"
58 44
     source: hosted
59
-    version: "2.1.4"
45
+    version: "1.1.0"
60 46
   flutter:
61 47
     dependency: "direct main"
62 48
     description: flutter
63 49
     source: sdk
64 50
     version: "0.0.0"
51
+  flutter_plugin_android_lifecycle:
52
+    dependency: transitive
53
+    description:
54
+      name: flutter_plugin_android_lifecycle
55
+      url: "https://pub.flutter-io.cn"
56
+    source: hosted
57
+    version: "1.0.7"
65 58
   flutter_test:
66 59
     dependency: "direct dev"
67 60
     description: flutter
68 61
     source: sdk
69 62
     version: "0.0.0"
70
-  image:
63
+  image_picker:
64
+    dependency: "direct main"
65
+    description:
66
+      name: image_picker
67
+      url: "https://pub.flutter-io.cn"
68
+    source: hosted
69
+    version: "0.6.6+1"
70
+  image_picker_platform_interface:
71 71
     dependency: transitive
72 72
     description:
73
-      name: image
73
+      name: image_picker_platform_interface
74 74
       url: "https://pub.flutter-io.cn"
75 75
     source: hosted
76
-    version: "2.1.12"
76
+    version: "1.0.0"
77 77
   matcher:
78 78
     dependency: transitive
79 79
     description:
@@ -101,14 +101,7 @@ packages:
101 101
       name: path
102 102
       url: "https://pub.flutter-io.cn"
103 103
     source: hosted
104
-    version: "1.6.4"
105
-  petitparser:
106
-    dependency: transitive
107
-    description:
108
-      name: petitparser
109
-      url: "https://pub.flutter-io.cn"
110
-    source: hosted
111
-    version: "2.4.0"
104
+    version: "1.7.0"
112 105
   photo_manager:
113 106
     dependency: "direct main"
114 107
     description:
@@ -116,6 +109,13 @@ packages:
116 109
       url: "https://pub.flutter-io.cn"
117 110
     source: hosted
118 111
     version: "0.5.1-dev.4"
112
+  plugin_platform_interface:
113
+    dependency: transitive
114
+    description:
115
+      name: plugin_platform_interface
116
+      url: "https://pub.flutter-io.cn"
117
+    source: hosted
118
+    version: "1.0.2"
119 119
   provider:
120 120
     dependency: "direct main"
121 121
     description:
@@ -123,13 +123,6 @@ packages:
123 123
       url: "https://pub.flutter-io.cn"
124 124
     source: hosted
125 125
     version: "4.0.5"
126
-  quiver:
127
-    dependency: transitive
128
-    description:
129
-      name: quiver
130
-      url: "https://pub.flutter-io.cn"
131
-    source: hosted
132
-    version: "2.1.3"
133 126
   sky_engine:
134 127
     dependency: transitive
135 128
     description: flutter
@@ -191,13 +184,6 @@ packages:
191 184
       url: "https://pub.flutter-io.cn"
192 185
     source: hosted
193 186
     version: "2.0.8"
194
-  xml:
195
-    dependency: transitive
196
-    description:
197
-      name: xml
198
-      url: "https://pub.flutter-io.cn"
199
-    source: hosted
200
-    version: "3.6.1"
201 187
 sdks:
202 188
   dart: ">=2.7.0 <3.0.0"
203
-  flutter: ">=1.12.1"
189
+  flutter: ">=1.12.13 <2.0.0"

+ 1
- 0
pubspec.yaml Datei anzeigen

@@ -13,6 +13,7 @@ dependencies:
13 13
 
14 14
   photo_manager: ^0.5.1-dev.2
15 15
   provider: ^4.0.5
16
+  image_picker: ^0.6.5
16 17
   # photo_manager:
17 18
   #   git:
18 19
   #     url: https://github.com/CaiJingLong/flutter_photo_manager.git