minor fixes
This commit is contained in:
parent
ef49888a22
commit
7a5ad21c36
2 changed files with 27 additions and 10 deletions
|
@ -80,6 +80,7 @@ class _ThumbnailRasterImageState extends State<ThumbnailRasterImage> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final fastImage = Image(
|
||||
key: const ValueKey('LQ'),
|
||||
image: _fastThumbnailProvider,
|
||||
width: extent,
|
||||
height: extent,
|
||||
|
@ -88,16 +89,24 @@ class _ThumbnailRasterImageState extends State<ThumbnailRasterImage> {
|
|||
final image = _sizedThumbnailProvider == null
|
||||
? fastImage
|
||||
: Image(
|
||||
key: const ValueKey('HQ'),
|
||||
frameBuilder: (context, child, frame, wasSynchronouslyLoaded) {
|
||||
if (wasSynchronouslyLoaded) return child;
|
||||
return AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
transitionBuilder: (child, animation) => child == fastImage
|
||||
? child
|
||||
: FadeTransition(
|
||||
opacity: animation,
|
||||
child: child,
|
||||
),
|
||||
transitionBuilder: (child, animation) {
|
||||
var shouldFade = true;
|
||||
if (child is Image && child.image == _fastThumbnailProvider) {
|
||||
// directly show LQ thumbnail, only fade when switching from LQ to HQ
|
||||
shouldFade = false;
|
||||
}
|
||||
return shouldFade
|
||||
? FadeTransition(
|
||||
opacity: animation,
|
||||
child: child,
|
||||
)
|
||||
: child;
|
||||
},
|
||||
child: frame == null ? fastImage : child,
|
||||
);
|
||||
},
|
||||
|
|
|
@ -74,7 +74,7 @@ class FullscreenBodyState extends State<FullscreenBody> with SingleTickerProvide
|
|||
_horizontalPager = PageController(initialPage: _currentHorizontalPage);
|
||||
_verticalPager = PageController(initialPage: _currentVerticalPage.value)..addListener(_onVerticalPageControllerChange);
|
||||
_overlayAnimationController = AnimationController(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
duration: const Duration(milliseconds: 200),
|
||||
vsync: this,
|
||||
);
|
||||
_topOverlayScale = CurvedAnimation(
|
||||
|
@ -316,10 +316,14 @@ class FullscreenBodyState extends State<FullscreenBody> with SingleTickerProvide
|
|||
await _onOverlayVisibleChange();
|
||||
}
|
||||
|
||||
Future<void> _onOverlayVisibleChange() async {
|
||||
Future<void> _onOverlayVisibleChange({bool animate = true}) async {
|
||||
if (_overlayVisible.value) {
|
||||
_showSystemUI();
|
||||
_overlayAnimationController.forward();
|
||||
if (animate) {
|
||||
_overlayAnimationController.forward();
|
||||
} else {
|
||||
_overlayAnimationController.value = _overlayAnimationController.upperBound;
|
||||
}
|
||||
} else {
|
||||
final mediaQuery = Provider.of<MediaQueryData>(context, listen: false);
|
||||
setState(() {
|
||||
|
@ -327,7 +331,11 @@ class FullscreenBodyState extends State<FullscreenBody> with SingleTickerProvide
|
|||
_frozenViewPadding = mediaQuery.viewPadding;
|
||||
});
|
||||
_hideSystemUI();
|
||||
await _overlayAnimationController.reverse();
|
||||
if (animate) {
|
||||
await _overlayAnimationController.reverse();
|
||||
} else {
|
||||
_overlayAnimationController.reset();
|
||||
}
|
||||
setState(() {
|
||||
_frozenViewInsets = null;
|
||||
_frozenViewPadding = null;
|
||||
|
|
Loading…
Reference in a new issue