choose quality
This commit is contained in:
parent
57104f7b6d
commit
44f1b42b01
|
@ -32,7 +32,7 @@ String currentQualityCode() {
|
||||||
return _currentQualityCode;
|
return _currentQualityCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
String _currentQualityName() {
|
String currentQualityName() {
|
||||||
for (var e in _qualities.entries) {
|
for (var e in _qualities.entries) {
|
||||||
if (e.value == _currentQualityCode) {
|
if (e.value == _currentQualityCode) {
|
||||||
return e.key;
|
return e.key;
|
||||||
|
@ -41,7 +41,7 @@ String _currentQualityName() {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _chooseQuality(BuildContext context) async {
|
Future<void> chooseQuality(BuildContext context) async {
|
||||||
String? code = await showDialog<String>(
|
String? code = await showDialog<String>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
|
@ -71,9 +71,9 @@ Widget qualitySetting() {
|
||||||
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(_currentQualityName()),
|
subtitle: Text(currentQualityName()),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await _chooseQuality(context);
|
await chooseQuality(context);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -41,6 +41,8 @@ String _currentReaderDirectionName() {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var gReaderDirectionName = _currentReaderDirectionName;
|
||||||
|
|
||||||
/// ?? to ActionButton And Event ??
|
/// ?? to ActionButton And Event ??
|
||||||
Future<void> choosePagerDirection(BuildContext buildContext) async {
|
Future<void> choosePagerDirection(BuildContext buildContext) async {
|
||||||
ReaderDirection? choose = await showDialog<ReaderDirection>(
|
ReaderDirection? choose = await showDialog<ReaderDirection>(
|
||||||
|
|
|
@ -15,6 +15,7 @@ import 'package:pikapika/basic/Method.dart';
|
||||||
import 'package:pikapika/basic/config/FullScreenAction.dart';
|
import 'package:pikapika/basic/config/FullScreenAction.dart';
|
||||||
import 'package:pikapika/basic/config/KeyboardController.dart';
|
import 'package:pikapika/basic/config/KeyboardController.dart';
|
||||||
import 'package:pikapika/basic/config/NoAnimation.dart';
|
import 'package:pikapika/basic/config/NoAnimation.dart';
|
||||||
|
import 'package:pikapika/basic/config/Quality.dart';
|
||||||
import 'package:pikapika/basic/config/ReaderDirection.dart';
|
import 'package:pikapika/basic/config/ReaderDirection.dart';
|
||||||
import 'package:pikapika/basic/config/ReaderType.dart';
|
import 'package:pikapika/basic/config/ReaderType.dart';
|
||||||
import 'package:pikapika/basic/config/VolumeController.dart';
|
import 'package:pikapika/basic/config/VolumeController.dart';
|
||||||
|
@ -148,9 +149,17 @@ class _ImageReaderState extends State<ImageReader> {
|
||||||
// 记录初始阅读器类型
|
// 记录初始阅读器类型
|
||||||
final ReaderType pagerType = currentReaderType();
|
final ReaderType pagerType = currentReaderType();
|
||||||
|
|
||||||
|
// 记录开始的画质
|
||||||
|
final currentQuality = currentQualityCode();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return _ImageReaderContent(widget.struct, pagerDirection, pagerType);
|
return _ImageReaderContent(
|
||||||
|
widget.struct,
|
||||||
|
pagerDirection,
|
||||||
|
pagerType,
|
||||||
|
currentQuality,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,9 +172,17 @@ class _ImageReaderContent extends StatefulWidget {
|
||||||
// 记录初始阅读器类型
|
// 记录初始阅读器类型
|
||||||
final ReaderType pagerType;
|
final ReaderType pagerType;
|
||||||
|
|
||||||
|
// 记录开始的画质
|
||||||
|
final String currentQuality;
|
||||||
|
|
||||||
final ImageReaderStruct struct;
|
final ImageReaderStruct struct;
|
||||||
|
|
||||||
const _ImageReaderContent(this.struct, this.pagerDirection, this.pagerType);
|
const _ImageReaderContent(
|
||||||
|
this.struct,
|
||||||
|
this.pagerDirection,
|
||||||
|
this.pagerType,
|
||||||
|
this.currentQuality,
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() {
|
State<StatefulWidget> createState() {
|
||||||
|
@ -288,18 +305,6 @@ abstract class _ImageReaderContentState extends State<_ImageReaderContent> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
IconButton(
|
|
||||||
onPressed: _onSelectDirection,
|
|
||||||
icon: Icon(Icons.grid_goldenratio),
|
|
||||||
),
|
|
||||||
IconButton(
|
|
||||||
onPressed: _onSelectReaderType,
|
|
||||||
icon: Icon(Icons.view_day_outlined),
|
|
||||||
),
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
Widget _buildBar() {
|
Widget _buildBar() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
|
@ -529,39 +534,39 @@ abstract class _ImageReaderContentState extends State<_ImageReaderContent> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future _onSelectDirection() async {
|
|
||||||
await choosePagerDirection(context);
|
|
||||||
if (widget.pagerDirection != gReaderDirection) {
|
|
||||||
widget.struct.onReloadEp();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future _onSelectReaderType() async {
|
|
||||||
await choosePagerType(context);
|
|
||||||
if (widget.pagerType != currentReaderType()) {
|
|
||||||
widget.struct.onReloadEp();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future _onChooseEp() async {
|
Future _onChooseEp() async {
|
||||||
// todo
|
|
||||||
var mq = MediaQuery.of(context);
|
|
||||||
showMaterialModalBottomSheet(
|
showMaterialModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
backgroundColor: Color(0xFF20253B),
|
backgroundColor: Color(0xFF20253B),
|
||||||
builder: (context) => Container(
|
builder: (context) {
|
||||||
height: mq.size.height / 2,
|
return Container(
|
||||||
|
height: MediaQuery.of(context).size.height / 2,
|
||||||
child: _EpChooser(
|
child: _EpChooser(
|
||||||
widget.struct.epNameMap,
|
widget.struct.epNameMap,
|
||||||
widget.struct.epOrder,
|
widget.struct.epOrder,
|
||||||
widget.struct.onChangeEp,
|
widget.struct.onChangeEp,
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future _onMoreSetting() async {
|
Future _onMoreSetting() async {
|
||||||
// todo
|
await showMaterialModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
backgroundColor: readerAppbarColor,
|
||||||
|
builder: (context) {
|
||||||
|
return Container(
|
||||||
|
height: MediaQuery.of(context).size.height / 2,
|
||||||
|
child: _SettingPanel(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (widget.pagerDirection != gReaderDirection ||
|
||||||
|
widget.pagerType != currentReaderType() ||
|
||||||
|
widget.currentQuality != currentQualityCode()) {
|
||||||
|
widget.struct.onReloadEp();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -633,6 +638,88 @@ class _EpChooserState extends State<_EpChooser> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _SettingPanel extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() => _SettingPanelState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SettingPanelState extends State<_SettingPanel> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ListView(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
_bottomIcon(
|
||||||
|
icon: Icons.crop_sharp,
|
||||||
|
title: gReaderDirectionName(),
|
||||||
|
onPressed: () async {
|
||||||
|
await choosePagerDirection(context);
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
_bottomIcon(
|
||||||
|
icon: Icons.view_day_outlined,
|
||||||
|
title: currentReaderTypeName(),
|
||||||
|
onPressed: () async {
|
||||||
|
await choosePagerType(context);
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
_bottomIcon(
|
||||||
|
icon: Icons.image_aspect_ratio_outlined,
|
||||||
|
title: currentQualityName(),
|
||||||
|
onPressed: () async {
|
||||||
|
await chooseQuality(context);
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _bottomIcon({
|
||||||
|
required IconData icon,
|
||||||
|
required String title,
|
||||||
|
required void Function() onPressed,
|
||||||
|
}) {
|
||||||
|
return Expanded(
|
||||||
|
child: Center(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
IconButton(
|
||||||
|
iconSize: 55,
|
||||||
|
icon: Column(
|
||||||
|
children: [
|
||||||
|
Container(height: 3),
|
||||||
|
Icon(
|
||||||
|
icon,
|
||||||
|
size: 25,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
Container(height: 3),
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 10),
|
||||||
|
maxLines: 1,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
Container(height: 3),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
onPressed: onPressed,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class _WebToonReaderState extends _ImageReaderContentState {
|
class _WebToonReaderState extends _ImageReaderContentState {
|
||||||
|
|
Loading…
Reference in New Issue