Ver código fonte

Auto refresh when the asset changes

Caijinglong 6 anos atrás
pai
commit
b94b82948d
3 arquivos alterados com 18 adições e 4 exclusões
  1. 8
    1
      CHANGELOG.md
  2. 9
    2
      lib/src/ui/page/photo_main_page.dart
  3. 1
    1
      pubspec.yaml

+ 8
- 1
CHANGELOG.md Ver arquivo

1
 # CHANGELOG
1
 # CHANGELOG
2
 
2
 
3
-## [0.2.1] add params photoList
3
+## [0.3.0] add params photoList
4
+
5
+**Breaking change**. Migrate from the deprecated original Android Support Library to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to also migrate if they're using the original support library.
6
+
7
+fix:
8
+
9
+- duration badge
10
+- sort image
4
 
11
 
5
 ## [0.2.0]
12
 ## [0.2.0]
6
 
13
 

+ 9
- 2
lib/src/ui/page/photo_main_page.dart Ver arquivo

70
 
70
 
71
   bool isPushed = false;
71
   bool isPushed = false;
72
 
72
 
73
+  bool get useAlbum => widget.photoList == null || widget.photoList.isEmpty;
74
+
73
   @override
75
   @override
74
   void initState() {
76
   void initState() {
75
     super.initState();
77
     super.initState();
172
   }
174
   }
173
 
175
 
174
   void _refreshList() {
176
   void _refreshList() {
175
-    if (widget.photoList != null && widget.photoList.isNotEmpty) {
177
+    if (!useAlbum) {
176
       _refreshListFromWidget();
178
       _refreshListFromWidget();
177
       return;
179
       return;
178
     }
180
     }
456
     );
458
     );
457
   }
459
   }
458
 
460
 
459
-  void _onAssetChange() {}
461
+  void _onAssetChange() {
462
+    if (useAlbum) {
463
+      _refreshList();
464
+    }
465
+  }
466
+  
460
 }
467
 }

+ 1
- 1
pubspec.yaml Ver arquivo

1
 name: photo
1
 name: photo
2
 description: image picker, multi picker support video / icloud asset ,use flutter as ui, if you want to build custom ui,you just use photo_manager.
2
 description: image picker, multi picker support video / icloud asset ,use flutter as ui, if you want to build custom ui,you just use photo_manager.
3
-version: 0.2.1
3
+version: 0.3.0
4
 author: caijinglong<cjl_spy@163.com>
4
 author: caijinglong<cjl_spy@163.com>
5
 homepage: https://github.com/CaiJingLong/flutter_photo
5
 homepage: https://github.com/CaiJingLong/flutter_photo
6
 
6