Browse Source

Auto refresh when the asset changes

Caijinglong 5 years ago
parent
commit
b94b82948d
3 changed files with 18 additions and 4 deletions
  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 View File

@@ -1,6 +1,13 @@
1 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 12
 ## [0.2.0]
6 13
 

+ 9
- 2
lib/src/ui/page/photo_main_page.dart View File

@@ -70,6 +70,8 @@ class _PhotoMainPageState extends State<PhotoMainPage>
70 70
 
71 71
   bool isPushed = false;
72 72
 
73
+  bool get useAlbum => widget.photoList == null || widget.photoList.isEmpty;
74
+
73 75
   @override
74 76
   void initState() {
75 77
     super.initState();
@@ -172,7 +174,7 @@ class _PhotoMainPageState extends State<PhotoMainPage>
172 174
   }
173 175
 
174 176
   void _refreshList() {
175
-    if (widget.photoList != null && widget.photoList.isNotEmpty) {
177
+    if (!useAlbum) {
176 178
       _refreshListFromWidget();
177 179
       return;
178 180
     }
@@ -456,5 +458,10 @@ class _PhotoMainPageState extends State<PhotoMainPage>
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 View File

@@ -1,6 +1,6 @@
1 1
 name: photo
2 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 4
 author: caijinglong<cjl_spy@163.com>
5 5
 homepage: https://github.com/CaiJingLong/flutter_photo
6 6