#278 viewer: black background when overlay is disabled with light theme
This commit is contained in:
parent
15f1f5eb63
commit
aa9521fdbb
3 changed files with 24 additions and 4 deletions
|
@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
- viewer: black background when overlay is disabled with light theme
|
||||||
- upgraded Flutter to beta v3.1.0-9.0.pre
|
- upgraded Flutter to beta v3.1.0-9.0.pre
|
||||||
|
|
||||||
## <a id="v1.6.9"></a>[v1.6.9] - 2022-06-18
|
## <a id="v1.6.9"></a>[v1.6.9] - 2022-06-18
|
||||||
|
|
|
@ -23,6 +23,7 @@ class ViewerVerticalPageView extends StatefulWidget {
|
||||||
final CollectionLens? collection;
|
final CollectionLens? collection;
|
||||||
final ValueNotifier<AvesEntry?> entryNotifier;
|
final ValueNotifier<AvesEntry?> entryNotifier;
|
||||||
final ViewerController viewerController;
|
final ViewerController viewerController;
|
||||||
|
final Animation<double> overlayOpacity;
|
||||||
final PageController horizontalPager, verticalPager;
|
final PageController horizontalPager, verticalPager;
|
||||||
final void Function(int page) onVerticalPageChanged, onHorizontalPageChanged;
|
final void Function(int page) onVerticalPageChanged, onHorizontalPageChanged;
|
||||||
final VoidCallback onImagePageRequested;
|
final VoidCallback onImagePageRequested;
|
||||||
|
@ -33,6 +34,7 @@ class ViewerVerticalPageView extends StatefulWidget {
|
||||||
required this.collection,
|
required this.collection,
|
||||||
required this.entryNotifier,
|
required this.entryNotifier,
|
||||||
required this.viewerController,
|
required this.viewerController,
|
||||||
|
required this.overlayOpacity,
|
||||||
required this.verticalPager,
|
required this.verticalPager,
|
||||||
required this.horizontalPager,
|
required this.horizontalPager,
|
||||||
required this.onVerticalPageChanged,
|
required this.onVerticalPageChanged,
|
||||||
|
@ -145,9 +147,15 @@ class _ViewerVerticalPageViewState extends State<ViewerVerticalPageView> {
|
||||||
return ValueListenableBuilder<double>(
|
return ValueListenableBuilder<double>(
|
||||||
valueListenable: _backgroundOpacityNotifier,
|
valueListenable: _backgroundOpacityNotifier,
|
||||||
builder: (context, backgroundOpacity, child) {
|
builder: (context, backgroundOpacity, child) {
|
||||||
final background = Theme.of(context).brightness == Brightness.dark ? Colors.black : Colors.white;
|
return ValueListenableBuilder<double>(
|
||||||
return Container(
|
valueListenable: widget.overlayOpacity,
|
||||||
color: background.withOpacity(backgroundOpacity),
|
builder: (context, overlayOpacity, child) {
|
||||||
|
final background = Theme.of(context).brightness == Brightness.dark ? Colors.black : Color.lerp(Colors.black, Colors.white, overlayOpacity)!;
|
||||||
|
return Container(
|
||||||
|
color: background.withOpacity(backgroundOpacity),
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
},
|
||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -62,9 +62,10 @@ class _EntryViewerStackState extends State<EntryViewerStack> with EntryViewContr
|
||||||
late ValueNotifier<int> _currentVerticalPage;
|
late ValueNotifier<int> _currentVerticalPage;
|
||||||
late PageController _horizontalPager, _verticalPager;
|
late PageController _horizontalPager, _verticalPager;
|
||||||
final AChangeNotifier _verticalScrollNotifier = AChangeNotifier();
|
final AChangeNotifier _verticalScrollNotifier = AChangeNotifier();
|
||||||
|
bool _overlayInitialized = false;
|
||||||
final ValueNotifier<bool> _overlayVisible = ValueNotifier(true);
|
final ValueNotifier<bool> _overlayVisible = ValueNotifier(true);
|
||||||
late AnimationController _overlayAnimationController;
|
late AnimationController _overlayAnimationController;
|
||||||
late Animation<double> _overlayButtonScale, _overlayVideoControlScale;
|
late Animation<double> _overlayButtonScale, _overlayVideoControlScale, _overlayOpacity;
|
||||||
late Animation<Offset> _overlayTopOffset;
|
late Animation<Offset> _overlayTopOffset;
|
||||||
EdgeInsets? _frozenViewInsets, _frozenViewPadding;
|
EdgeInsets? _frozenViewInsets, _frozenViewPadding;
|
||||||
late VideoActionDelegate _videoActionDelegate;
|
late VideoActionDelegate _videoActionDelegate;
|
||||||
|
@ -129,6 +130,10 @@ class _EntryViewerStackState extends State<EntryViewerStack> with EntryViewContr
|
||||||
// no bounce at the bottom, to avoid video controller displacement
|
// no bounce at the bottom, to avoid video controller displacement
|
||||||
curve: Curves.easeOutQuad,
|
curve: Curves.easeOutQuad,
|
||||||
);
|
);
|
||||||
|
_overlayOpacity = CurvedAnimation(
|
||||||
|
parent: _overlayAnimationController,
|
||||||
|
curve: Curves.easeOutQuad,
|
||||||
|
);
|
||||||
_overlayTopOffset = Tween(begin: const Offset(0, -1), end: const Offset(0, 0)).animate(CurvedAnimation(
|
_overlayTopOffset = Tween(begin: const Offset(0, -1), end: const Offset(0, 0)).animate(CurvedAnimation(
|
||||||
parent: _overlayAnimationController,
|
parent: _overlayAnimationController,
|
||||||
curve: Curves.easeOutQuad,
|
curve: Curves.easeOutQuad,
|
||||||
|
@ -259,6 +264,11 @@ class _EntryViewerStackState extends State<EntryViewerStack> with EntryViewContr
|
||||||
collection: collection,
|
collection: collection,
|
||||||
entryNotifier: entryNotifier,
|
entryNotifier: entryNotifier,
|
||||||
viewerController: viewerController,
|
viewerController: viewerController,
|
||||||
|
overlayOpacity: _overlayInitialized
|
||||||
|
? _overlayOpacity
|
||||||
|
: settings.showOverlayOnOpening
|
||||||
|
? kAlwaysCompleteAnimation
|
||||||
|
: kAlwaysDismissedAnimation,
|
||||||
verticalPager: _verticalPager,
|
verticalPager: _verticalPager,
|
||||||
horizontalPager: _horizontalPager,
|
horizontalPager: _horizontalPager,
|
||||||
onVerticalPageChanged: _onVerticalPageChanged,
|
onVerticalPageChanged: _onVerticalPageChanged,
|
||||||
|
@ -644,6 +654,7 @@ class _EntryViewerStackState extends State<EntryViewerStack> with EntryViewContr
|
||||||
// to show overlay after hero animation is complete
|
// to show overlay after hero animation is complete
|
||||||
await Future.delayed(ModalRoute.of(context)!.transitionDuration * timeDilation);
|
await Future.delayed(ModalRoute.of(context)!.transitionDuration * timeDilation);
|
||||||
await _onOverlayVisibleChange();
|
await _onOverlayVisibleChange();
|
||||||
|
_overlayInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onOverlayVisibleChange({bool animate = true}) async {
|
Future<void> _onOverlayVisibleChange({bool animate = true}) async {
|
||||||
|
|
Loading…
Reference in a new issue