central reader controller

This commit is contained in:
niuhuan 2021-12-08 23:35:26 +08:00
parent 0dae6de69c
commit 5b4771d988
1 changed files with 64 additions and 69 deletions

View File

@ -289,33 +289,10 @@ abstract class _ImageReaderContentState extends State<_ImageReaderContent> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
switch (currentFullScreenAction()) {
case FullScreenAction.CONTROLLER:
return Stack(
children: [
_buildViewerAndBar(),
_buildFullScreenController(),
],
);
case FullScreenAction.TOUCH_ONCE:
return _buildTouchOnceController(_buildViewerAndBar());
case FullScreenAction.THREE_AREA:
return Stack(
children: [
_buildViewerAndBar(),
_buildThreeAreaController(),
],
);
default:
return Container();
}
}
Widget _buildViewerAndBar() {
return Stack( return Stack(
children: [ children: [
_buildViewer(), _buildViewer(),
widget.struct.fullScreen ? Container() : _buildBar(), _buildBar(),
], ],
); );
} }
@ -323,7 +300,9 @@ abstract class _ImageReaderContentState extends State<_ImageReaderContent> {
Widget _buildBar() { Widget _buildBar() {
return Column( return Column(
children: [ children: [
AppBar( widget.struct.fullScreen
? Container()
: AppBar(
title: Text( title: Text(
"${widget.struct.epNameMap[widget.struct.epOrder] ?? ""} - ${widget.struct.comicTitle}"), "${widget.struct.epNameMap[widget.struct.epOrder] ?? ""} - ${widget.struct.comicTitle}"),
actions: [ actions: [
@ -337,8 +316,10 @@ abstract class _ImageReaderContentState extends State<_ImageReaderContent> {
), ),
], ],
), ),
Expanded(child: Container()), Expanded(child: _buildController()),
Container( widget.struct.fullScreen
? Container()
: Container(
height: 45, height: 45,
color: Color(0x88000000), color: Color(0x88000000),
child: Row( child: Row(
@ -349,7 +330,8 @@ abstract class _ImageReaderContentState extends State<_ImageReaderContent> {
icon: Icon(Icons.fullscreen), icon: Icon(Icons.fullscreen),
color: Colors.white, color: Colors.white,
onPressed: () { onPressed: () {
widget.struct.onFullScreenChange(!widget.struct.fullScreen); widget.struct
.onFullScreenChange(!widget.struct.fullScreen);
}, },
), ),
Container(width: 10), Container(width: 10),
@ -367,7 +349,7 @@ abstract class _ImageReaderContentState extends State<_ImageReaderContent> {
Container(width: 15), Container(width: 15),
], ],
), ),
) ),
], ],
); );
} }
@ -431,6 +413,19 @@ abstract class _ImageReaderContentState extends State<_ImageReaderContent> {
); );
} }
Widget _buildController() {
switch (currentFullScreenAction()) {
case FullScreenAction.CONTROLLER:
return _buildFullScreenController();
case FullScreenAction.TOUCH_ONCE:
return _buildTouchOnceController();
case FullScreenAction.THREE_AREA:
return _buildThreeAreaController();
default:
return Container();
}
}
Widget _buildFullScreenController() { Widget _buildFullScreenController() {
if (!widget.struct.fullScreen) { if (!widget.struct.fullScreen) {
return Container(); return Container();
@ -466,13 +461,13 @@ abstract class _ImageReaderContentState extends State<_ImageReaderContent> {
); );
} }
Widget _buildTouchOnceController(Widget viewerAndBar) { Widget _buildTouchOnceController() {
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.translucent, behavior: HitTestBehavior.translucent,
onTap: () { onTap: () {
widget.struct.onFullScreenChange(!widget.struct.fullScreen); widget.struct.onFullScreenChange(!widget.struct.fullScreen);
}, },
child: viewerAndBar, child: Container(),
); );
} }