Skip to content

Commit 9a35c03

Browse files
authored
🐛 Fix the app bar of the viewer that is not animating. (#580)
Fixes #572
1 parent 466b9e0 commit 9a35c03

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
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.4
11+
12+
### Fixes
13+
14+
- Fix the app bar of the viewer that is not animating.
15+
1016
## 9.0.3
1117

1218
### Fixes

lib/src/delegates/asset_picker_viewer_builder_delegate.dart

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -551,15 +551,14 @@ class DefaultAssetPickerViewerBuilderDelegate
551551
themeData.bottomAppBarTheme.color!.opacity *
552552
(isAppleOS(context) ? .9 : 1),
553553
);
554-
return ValueListenableBuilder2<bool, int>(
555-
firstNotifier: isDisplayingDetail,
556-
secondNotifier: selectedNotifier,
557-
builder: (_, bool v, __, Widget? child) => AnimatedPositionedDirectional(
554+
return ValueListenableBuilder(
555+
valueListenable: isDisplayingDetail,
556+
builder: (_, v, child) => AnimatedPositionedDirectional(
558557
duration: kThemeAnimationDuration,
559558
curve: Curves.easeInOut,
560-
bottom: v ? 0 : -(context.bottomPadding + bottomDetailHeight),
561-
start: 0,
562-
end: 0,
559+
bottom: v ? 0.0 : -(context.bottomPadding + bottomDetailHeight),
560+
start: 0.0,
561+
end: 0.0,
563562
height: context.bottomPadding + bottomDetailHeight,
564563
child: child!,
565564
),
@@ -717,7 +716,7 @@ class DefaultAssetPickerViewerBuilderDelegate
717716
/// AppBar widget.
718717
/// 顶栏部件
719718
Widget appBar(BuildContext context) {
720-
return AssetPickerAppBar(
719+
final bar = AssetPickerAppBar(
721720
leading: Semantics(
722721
sortKey: ordinalSortKey(0),
723722
child: IconButton(
@@ -757,6 +756,18 @@ class DefaultAssetPickerViewerBuilderDelegate
757756
const SizedBox(width: 14),
758757
],
759758
);
759+
return ValueListenableBuilder(
760+
valueListenable: isDisplayingDetail,
761+
builder: (_, v, child) => AnimatedPositionedDirectional(
762+
duration: kThemeAnimationDuration,
763+
curve: Curves.easeInOut,
764+
top: v ? 0.0 : -(context.topPadding + bar.preferredSize.height),
765+
start: 0.0,
766+
end: 0.0,
767+
child: child!,
768+
),
769+
child: bar,
770+
);
760771
}
761772

762773
/// It'll pop with [AssetPickerProvider.selectedAssets] when there are

0 commit comments

Comments
 (0)