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,51 +300,56 @@ abstract class _ImageReaderContentState extends State<_ImageReaderContent> {
Widget _buildBar() { Widget _buildBar() {
return Column( return Column(
children: [ children: [
AppBar( widget.struct.fullScreen
title: Text( ? Container()
"${widget.struct.epNameMap[widget.struct.epOrder] ?? ""} - ${widget.struct.comicTitle}"), : AppBar(
actions: [ title: Text(
IconButton( "${widget.struct.epNameMap[widget.struct.epOrder] ?? ""} - ${widget.struct.comicTitle}"),
onPressed: _onChooseEp, actions: [
icon: Icon(Icons.menu_open), IconButton(
), onPressed: _onChooseEp,
IconButton( icon: Icon(Icons.menu_open),
onPressed: _onMoreSetting, ),
icon: Icon(Icons.more_horiz), IconButton(
), onPressed: _onMoreSetting,
], icon: Icon(Icons.more_horiz),
), ),
Expanded(child: Container()), ],
Container(
height: 45,
color: Color(0x88000000),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(width: 15),
IconButton(
icon: Icon(Icons.fullscreen),
color: Colors.white,
onPressed: () {
widget.struct.onFullScreenChange(!widget.struct.fullScreen);
},
), ),
Container(width: 10), Expanded(child: _buildController()),
Expanded( widget.struct.fullScreen
child: widget.pagerType != ReaderType.WEB_TOON_FREE_ZOOM ? Container()
? _buildSlider() : Container(
: Container(), height: 45,
color: Color(0x88000000),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(width: 15),
IconButton(
icon: Icon(Icons.fullscreen),
color: Colors.white,
onPressed: () {
widget.struct
.onFullScreenChange(!widget.struct.fullScreen);
},
),
Container(width: 10),
Expanded(
child: widget.pagerType != ReaderType.WEB_TOON_FREE_ZOOM
? _buildSlider()
: Container(),
),
Container(width: 10),
IconButton(
icon: Icon(Icons.skip_next_outlined),
color: Colors.white,
onPressed: _onNextAction,
),
Container(width: 15),
],
),
), ),
Container(width: 10),
IconButton(
icon: Icon(Icons.skip_next_outlined),
color: Colors.white,
onPressed: _onNextAction,
),
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(),
); );
} }