choose controller

This commit is contained in:
niuhuan 2021-12-03 18:51:21 +08:00
parent 44f1b42b01
commit 46494f13a5
2 changed files with 30 additions and 16 deletions

View File

@ -40,7 +40,7 @@ FullScreenAction _fullScreenActionFromString(String string) {
return FullScreenAction.CONTROLLER; return FullScreenAction.CONTROLLER;
} }
String _currentFullScreenActionName() { String currentFullScreenActionName() {
for (var e in _fullScreenActionMap.entries) { for (var e in _fullScreenActionMap.entries) {
if (e.value == _fullScreenAction) { if (e.value == _fullScreenAction) {
return e.key; return e.key;
@ -49,7 +49,7 @@ String _currentFullScreenActionName() {
return ''; return '';
} }
Future<void> _chooseFullScreenAction(BuildContext context) async { Future<void> chooseFullScreenAction(BuildContext context) async {
FullScreenAction? result = await chooseMapDialog<FullScreenAction>( FullScreenAction? result = await chooseMapDialog<FullScreenAction>(
context, _fullScreenActionMap, "选择操控方式"); context, _fullScreenActionMap, "选择操控方式");
if (result != null) { if (result != null) {
@ -63,9 +63,9 @@ Widget fullScreenActionSetting() {
builder: (BuildContext context, void Function(void Function()) setState) { builder: (BuildContext context, void Function(void Function()) setState) {
return ListTile( return ListTile(
title: Text("操控方式"), title: Text("操控方式"),
subtitle: Text(_currentFullScreenActionName()), subtitle: Text(currentFullScreenActionName()),
onTap: () async { onTap: () async {
await _chooseFullScreenAction(context); await chooseFullScreenAction(context);
setState(() {}); setState(() {});
}, },
); );

View File

@ -144,21 +144,25 @@ class ImageReader extends StatefulWidget {
class _ImageReaderState extends State<ImageReader> { class _ImageReaderState extends State<ImageReader> {
// //
final ReaderDirection pagerDirection = gReaderDirection; final ReaderDirection _pagerDirection = gReaderDirection;
// //
final ReaderType pagerType = currentReaderType(); final ReaderType _pagerType = currentReaderType();
// //
final currentQuality = currentQualityCode(); final _currentQuality = currentQualityCode();
//
late FullScreenAction _fullScreenAction = currentFullScreenAction();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return _ImageReaderContent( return _ImageReaderContent(
widget.struct, widget.struct,
pagerDirection, _pagerDirection,
pagerType, _pagerType,
currentQuality, _currentQuality,
_fullScreenAction,
); );
} }
} }
@ -174,6 +178,7 @@ class _ImageReaderContent extends StatefulWidget {
// //
final String currentQuality; final String currentQuality;
final FullScreenAction fullScreenAction;
final ImageReaderStruct struct; final ImageReaderStruct struct;
@ -182,6 +187,7 @@ class _ImageReaderContent extends StatefulWidget {
this.pagerDirection, this.pagerDirection,
this.pagerType, this.pagerType,
this.currentQuality, this.currentQuality,
this.fullScreenAction,
); );
@override @override
@ -311,7 +317,6 @@ abstract class _ImageReaderContentState extends State<_ImageReaderContent> {
AppBar( AppBar(
title: Text( title: Text(
"${widget.struct.epNameMap[widget.struct.epOrder] ?? ""} - ${widget.struct.comicTitle}"), "${widget.struct.epNameMap[widget.struct.epOrder] ?? ""} - ${widget.struct.comicTitle}"),
backgroundColor: readerAppbarColor2,
actions: [ actions: [
IconButton( IconButton(
onPressed: _onChooseEp, onPressed: _onChooseEp,
@ -326,7 +331,7 @@ abstract class _ImageReaderContentState extends State<_ImageReaderContent> {
Expanded(child: Container()), Expanded(child: Container()),
Container( Container(
height: 45, height: 45,
color: readerAppbarColor2, color: Color(0x88000000),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
@ -537,7 +542,7 @@ abstract class _ImageReaderContentState extends State<_ImageReaderContent> {
Future _onChooseEp() async { Future _onChooseEp() async {
showMaterialModalBottomSheet( showMaterialModalBottomSheet(
context: context, context: context,
backgroundColor: Color(0xFF20253B), backgroundColor: Color(0xAA000000),
builder: (context) { builder: (context) {
return Container( return Container(
height: MediaQuery.of(context).size.height / 2, height: MediaQuery.of(context).size.height / 2,
@ -554,7 +559,7 @@ abstract class _ImageReaderContentState extends State<_ImageReaderContent> {
Future _onMoreSetting() async { Future _onMoreSetting() async {
await showMaterialModalBottomSheet( await showMaterialModalBottomSheet(
context: context, context: context,
backgroundColor: readerAppbarColor, backgroundColor: Color(0xAA000000),
builder: (context) { builder: (context) {
return Container( return Container(
height: MediaQuery.of(context).size.height / 2, height: MediaQuery.of(context).size.height / 2,
@ -564,7 +569,8 @@ abstract class _ImageReaderContentState extends State<_ImageReaderContent> {
); );
if (widget.pagerDirection != gReaderDirection || if (widget.pagerDirection != gReaderDirection ||
widget.pagerType != currentReaderType() || widget.pagerType != currentReaderType() ||
widget.currentQuality != currentQualityCode()) { widget.currentQuality != currentQualityCode() ||
widget.fullScreenAction != currentFullScreenAction()) {
widget.struct.onReloadEp(); widget.struct.onReloadEp();
} }
} }
@ -613,7 +619,7 @@ class _EpChooserState extends State<_EpChooser> {
return Container( return Container(
margin: EdgeInsets.only(left: 15, right: 15, top: 5, bottom: 5), margin: EdgeInsets.only(left: 15, right: 15, top: 5, bottom: 5),
decoration: BoxDecoration( decoration: BoxDecoration(
color: widget.epOrder == e.key ? Colors.grey.withAlpha(35) : null, color: widget.epOrder == e.key ? Colors.grey.withAlpha(100) : null,
border: Border.all( border: Border.all(
color: Color(0xff484c60), color: Color(0xff484c60),
style: BorderStyle.solid, style: BorderStyle.solid,
@ -675,6 +681,14 @@ class _SettingPanelState extends State<_SettingPanel> {
setState(() {}); setState(() {});
}, },
), ),
_bottomIcon(
icon: Icons.control_camera_outlined,
title: currentFullScreenActionName(),
onPressed: () async {
await chooseFullScreenAction(context);
setState(() {});
},
),
], ],
), ),
), ),