fullscreen: transparency while popping by drag down
This commit is contained in:
parent
582afba3e9
commit
68766d0e17
2 changed files with 51 additions and 16 deletions
|
@ -157,26 +157,26 @@ class SectionSliver extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showFullscreen(BuildContext context, ImageEntry entry) {
|
void _showFullscreen(BuildContext context, ImageEntry entry) {
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => FullscreenPage(
|
|
||||||
collection: collection,
|
|
||||||
initialUri: entry.uri,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
// TODO TLAD consider the following to have transparency while popping fullscreen by drag down
|
|
||||||
// Navigator.push(
|
// Navigator.push(
|
||||||
// context,
|
// context,
|
||||||
// PageRouteBuilder(
|
// MaterialPageRoute(
|
||||||
// opaque: false,
|
// builder: (context) => FullscreenPage(
|
||||||
// pageBuilder: (BuildContext context, _, __) => FullscreenPage(
|
|
||||||
// collection: collection,
|
// collection: collection,
|
||||||
// initialUri: entry.uri,
|
// initialUri: entry.uri,
|
||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
// );
|
// );
|
||||||
|
// TODO TLAD consider the following to have transparency while popping fullscreen by drag down
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
PageRouteBuilder(
|
||||||
|
opaque: false,
|
||||||
|
pageBuilder: (BuildContext context, _, __) => FullscreenPage(
|
||||||
|
collection: collection,
|
||||||
|
initialUri: entry.uri,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class FullscreenPage extends AnimatedWidget {
|
||||||
collection: collection,
|
collection: collection,
|
||||||
initialUri: initialUri,
|
initialUri: initialUri,
|
||||||
),
|
),
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.transparent,
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -298,6 +298,38 @@ class FullscreenVerticalPageView extends StatefulWidget {
|
||||||
|
|
||||||
class _FullscreenVerticalPageViewState extends State<FullscreenVerticalPageView> {
|
class _FullscreenVerticalPageViewState extends State<FullscreenVerticalPageView> {
|
||||||
bool _isInitialScale = true;
|
bool _isInitialScale = true;
|
||||||
|
Color _background = Colors.black;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_registerWidget(widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didUpdateWidget(FullscreenVerticalPageView oldWidget) {
|
||||||
|
super.didUpdateWidget(oldWidget);
|
||||||
|
_unregisterWidget(oldWidget);
|
||||||
|
_registerWidget(widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
_unregisterWidget(widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _registerWidget(FullscreenVerticalPageView widget) {
|
||||||
|
widget.verticalPager.addListener(_onVerticalPageControllerChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _unregisterWidget(FullscreenVerticalPageView widget) {
|
||||||
|
widget.verticalPager.removeListener(_onVerticalPageControllerChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _onVerticalPageControllerChange() {
|
||||||
|
setState(() => _background = _background.withOpacity(min(1.0, widget.verticalPager.page)));
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -307,9 +339,12 @@ class _FullscreenVerticalPageViewState extends State<FullscreenVerticalPageView>
|
||||||
physics: _isInitialScale ? const PageScrollPhysics() : const NeverScrollableScrollPhysics(),
|
physics: _isInitialScale ? const PageScrollPhysics() : const NeverScrollableScrollPhysics(),
|
||||||
onPageChanged: widget.onVerticalPageChanged,
|
onPageChanged: widget.onVerticalPageChanged,
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(),
|
|
||||||
Container(
|
Container(
|
||||||
color: Colors.black,
|
color: _background,
|
||||||
|
child: const SizedBox(),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
color: _background,
|
||||||
child: ImagePage(
|
child: ImagePage(
|
||||||
collection: widget.collection,
|
collection: widget.collection,
|
||||||
pageController: widget.horizontalPager,
|
pageController: widget.horizontalPager,
|
||||||
|
|
Loading…
Reference in a new issue