瀏覽代碼

Auto refresh when the asset changes

Caijinglong 5 年之前
父節點
當前提交
b94b82948d
共有 3 個檔案被更改,包括 18 行新增4 行删除
  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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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