Skip to content

Commit 0a7ac0f

Browse files
authored
🐛 Fix the index with bottom items in the preview (#563)
1 parent 263db78 commit 0a7ac0f

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ that can be found in the LICENSE file. -->
77
> [!IMPORTANT]
88
> See the [Migration Guide](guides/migration_guide.md) for the details of breaking changes between versions.
99
10+
## 9.0.2
11+
12+
### Fixes
13+
14+
- Fix the index with bottom items in the preview.
15+
1016
## 9.0.1
1117

1218
### Fixes

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: wechat_assets_picker_demo
22
description: The demo project for the wechat_assets_picker package.
3-
version: 9.0.0+49
3+
version: 9.0.2+51
44
publish_to: none
55

66
environment:

lib/src/delegates/asset_picker_viewer_builder_delegate.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,12 +608,15 @@ class DefaultAssetPickerViewerBuilderDelegate
608608
const double padding = 8.0;
609609

610610
void onTap(AssetEntity asset) {
611-
final int page;
611+
int page;
612612
if (previewAssets != selectedAssets) {
613613
page = previewAssets.indexOf(asset);
614614
} else {
615615
page = index;
616616
}
617+
if (shouldReversePreview) {
618+
page = previewAssets.length - page - 1;
619+
}
617620
if (pageController.page == page.toDouble()) {
618621
return;
619622
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: wechat_assets_picker
2-
version: 9.0.1
2+
version: 9.0.2
33
description: |
44
An image picker (also with videos and audio)
55
for Flutter projects based on WeChat's UI,

0 commit comments

Comments
 (0)