瀏覽代碼

fix video ui

lucky1213 4 年之前
父節點
當前提交
03315eeeb7
共有 5 個檔案被更改,包括 40 行新增19 行删除
  1. 二進制
      lib/fonts/iconfont.ttf
  2. 5
    5
      lib/photo.dart
  3. 20
    14
      lib/src/delegate/badge_delegate.dart
  4. 10
    0
      lib/src/engine/iconfont.dart
  5. 5
    0
      pubspec.yaml

二進制
lib/fonts/iconfont.ttf 查看文件


+ 5
- 5
lib/photo.dart 查看文件

29
 export 'package:photo/src/delegate/badge_delegate.dart';
29
 export 'package:photo/src/delegate/badge_delegate.dart';
30
 export 'package:photo/src/entity/_theme.dart';
30
 export 'package:photo/src/entity/_theme.dart';
31
 export 'package:image_picker/image_picker.dart' show CameraDevice, PickedFile;
31
 export 'package:image_picker/image_picker.dart' show CameraDevice, PickedFile;
32
-export 'package:photo_manager/photo_manager.dart' show AssetEntity;
32
+export 'package:photo_manager/photo_manager.dart' show AssetEntity, AssetType;
33
 
33
 
34
 class PhotoPicker {
34
 class PhotoPicker {
35
   static PhotoPicker _instance;
35
   static PhotoPicker _instance;
60
     @required BuildContext context,
60
     @required BuildContext context,
61
     int rowCount = 4,
61
     int rowCount = 4,
62
     int maxSelected = 9,
62
     int maxSelected = 9,
63
-    double padding = 1,
63
+    double padding = 0.5,
64
     double itemRadio = 1.0,
64
     double itemRadio = 1.0,
65
     int thumbSize = 180,
65
     int thumbSize = 180,
66
     PhotoTheme theme,
66
     PhotoTheme theme,
90
       sortDelegate: sortDelegate,
90
       sortDelegate: sortDelegate,
91
       checkBoxBuilderDelegate: DefaultCheckBoxBuilderDelegate(),
91
       checkBoxBuilderDelegate: DefaultCheckBoxBuilderDelegate(),
92
       loadingDelegate: loadingDelegate,
92
       loadingDelegate: loadingDelegate,
93
-      badgeDelegate: DefaultBadgeDelegate(),
93
+      badgeDelegate: DurationBadgeDelegate(),
94
       pickType: pickType,
94
       pickType: pickType,
95
     );
95
     );
96
 
96
 
106
   static Future<AssetEntity> pickSingleAsset({
106
   static Future<AssetEntity> pickSingleAsset({
107
     @required BuildContext context,
107
     @required BuildContext context,
108
     int rowCount = 4,
108
     int rowCount = 4,
109
-    double padding = 1,
109
+    double padding = 0.5,
110
     double itemRadio = 1.0,
110
     double itemRadio = 1.0,
111
     int thumbSize = 180,
111
     int thumbSize = 180,
112
     PhotoTheme theme,
112
     PhotoTheme theme,
207
       sortDelegate: sortDelegate,
207
       sortDelegate: sortDelegate,
208
       checkBoxBuilderDelegate: DefaultCheckBoxBuilderDelegate(),
208
       checkBoxBuilderDelegate: DefaultCheckBoxBuilderDelegate(),
209
       loadingDelegate: loadingDelegate,
209
       loadingDelegate: loadingDelegate,
210
-      badgeDelegate: DefaultBadgeDelegate(),
210
+      badgeDelegate: DurationBadgeDelegate(),
211
       pickType: pickType,
211
       pickType: pickType,
212
     );
212
     );
213
     assert(provider != null, "provider must be not null");
213
     assert(provider != null, "provider must be not null");

+ 20
- 14
lib/src/delegate/badge_delegate.dart 查看文件

1
 import 'package:flutter/material.dart';
1
 import 'package:flutter/material.dart';
2
+import 'package:photo/src/engine/iconfont.dart';
2
 import 'package:photo_manager/photo_manager.dart';
3
 import 'package:photo_manager/photo_manager.dart';
3
 
4
 
4
 abstract class BadgeDelegate {
5
 abstract class BadgeDelegate {
51
   Widget buildBadge(BuildContext context, AssetType type, Duration duration) {
52
   Widget buildBadge(BuildContext context, AssetType type, Duration duration) {
52
     if (type == AssetType.video) {
53
     if (type == AssetType.video) {
53
       var s = duration.inSeconds % 60;
54
       var s = duration.inSeconds % 60;
54
-      var m = duration.inMinutes % 60;
55
-      var h = duration.inHours;
55
+      var m = duration.inMinutes;
56
 
56
 
57
-      String text =
58
-          "$h:${m.toString().padLeft(2, '0')}:${s.toString().padLeft(2, '0')}";
57
+      String text = "${m.toString().padLeft(2, '0')}:${s.toString().padLeft(2, '0')}";
59
 
58
 
60
       return Padding(
59
       return Padding(
61
-        padding: const EdgeInsets.all(2.0),
60
+        padding: const EdgeInsets.all(4.0),
62
         child: Align(
61
         child: Align(
63
           alignment: alignment,
62
           alignment: alignment,
64
           child: Container(
63
           child: Container(
65
-            decoration: BoxDecoration(
66
-              color: Theme.of(context).primaryColor.withOpacity(0.65),
64
+            child: Row(
65
+              children: [
66
+                Icon(MutliImagePickerFont.video, size: 20, color: Colors.white,),
67
+                Padding(
68
+                  padding: EdgeInsets.only(left: 6.0),
69
+                  child: Text(
70
+                    text,
71
+                    style: const TextStyle(
72
+                      fontSize: 14.0,
73
+                      color: Colors.white,
74
+                    ),
75
+                  ),
76
+                ),
77
+              ],
67
             ),
78
             ),
68
-            child: Text(
69
-              text,
70
-              style: const TextStyle(
71
-                fontSize: 12.0,
72
-                color: Colors.white,
73
-              ),
79
+            padding: EdgeInsets.symmetric(
80
+              horizontal: 2,
74
             ),
81
             ),
75
-            padding: const EdgeInsets.all(4.0),
76
           ),
82
           ),
77
         ),
83
         ),
78
       );
84
       );

+ 10
- 0
lib/src/engine/iconfont.dart 查看文件

1
+
2
+import 'package:flutter/material.dart';
3
+
4
+class MutliImagePickerFont {
5
+  MutliImagePickerFont._();
6
+  static const String _family = 'PhotoFont';
7
+  static const String _fontPackage = 'photo';
8
+
9
+  static const IconData video = IconData(0xe6bd, fontFamily: _family, fontPackage: _fontPackage);
10
+}

+ 5
- 0
pubspec.yaml 查看文件

25
 
25
 
26
 # The following section is specific to Flutter.
26
 # The following section is specific to Flutter.
27
 flutter:
27
 flutter:
28
+  uses-material-design: true
29
+  fonts:
30
+    - family: PhotoFont
31
+      fonts:
32
+        - asset: lib/fonts/iconfont.ttf
28
   # To add assets to your package, add an assets section, like this:
33
   # To add assets to your package, add an assets section, like this:
29
   # assets:
34
   # assets:
30
   #  - images/a_dot_burr.jpeg
35
   #  - images/a_dot_burr.jpeg