Skip to content

Commit

Permalink
v1.5.9
Browse files Browse the repository at this point in the history
  • Loading branch information
niuhuan committed Aug 20, 2022
1 parent e290080 commit 0289e96
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 35 deletions.
2 changes: 1 addition & 1 deletion ci/version.code.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.5.8
v1.5.9
5 changes: 4 additions & 1 deletion ci/version.info.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v1.5.9
- [x] 下载漫画中显示评论区(设置中寻找)

v1.5.8
- [x] 解决历史记录图片不刷新的问题
- [x] 增加退出是增加提示的选项(设置中寻找)
- [x] 增加退出是增加提示的选项(设置中寻找)
41 changes: 41 additions & 0 deletions lib/basic/config/ShowCommentAtDownload.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import 'package:flutter/material.dart';

import '../Common.dart';
import '../Method.dart';

const _propertyName = "showCommentAtDownload";

late bool _showCommentAtDownload;

Future initShowCommentAtDownload() async {
_showCommentAtDownload = (await method.loadProperty(_propertyName, "false")) == "true";
}

bool showCommentAtDownload() {
return _showCommentAtDownload;
}

Future<void> _chooseShowCommentAtDownload(BuildContext context) async {
String? result =
await chooseListDialog<String>(context, "在下载显示评论区", ["是", "否"]);
if (result != null) {
var target = result == "是";
await method.saveProperty(_propertyName, "$target");
_showCommentAtDownload = target;
}
}

Widget showCommentAtDownloadSetting() {
return StatefulBuilder(
builder: (BuildContext context, void Function(void Function()) setState) {
return ListTile(
title: const Text("在下载显示评论区"),
subtitle: Text(_showCommentAtDownload ? "是" : "否"),
onTap: () async {
await _chooseShowCommentAtDownload(context);
setState(() {});
},
);
},
);
}
120 changes: 87 additions & 33 deletions lib/screens/DownloadInfoScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@ import 'package:flutter/material.dart';
import 'package:pikapika/basic/Entities.dart';
import 'package:pikapika/basic/Navigator.dart';
import 'package:pikapika/basic/Method.dart';
import '../basic/config/ShowCommentAtDownload.dart';
import 'ComicInfoScreen.dart';
import 'DownloadExportToFileScreen.dart';
import 'DownloadReaderScreen.dart';
import 'components/ComicDescriptionCard.dart';
import 'components/ComicTagsCard.dart';
import 'components/CommentList.dart';
import 'components/CommentMainType.dart';
import 'components/ContentError.dart';
import 'components/ContentLoading.dart';
import 'components/ContinueReadButton.dart';
import 'components/DownloadInfoCard.dart';
import 'components/Recommendation.dart';

// 下载详情
class DownloadInfoScreen extends StatefulWidget {
Expand Down Expand Up @@ -117,51 +121,101 @@ class _DownloadInfoScreenState extends State<DownloadInfoScreen>
}
List<dynamic> tagsDynamic = json.decode(_task.tags);
List<String> tags = tagsDynamic.map((e) => "$e").toList();
return ListView(
var list = ListView(
children: [
DownloadInfoCard(task: _task, linkItem: true),
ComicTagsCard(tags),
ComicDescriptionCard(description: _task.description),
Container(height: 5),
Wrap(
spacing: 10,
runSpacing: 10,
alignment: WrapAlignment.spaceAround,
children: [
ContinueReadButton(
viewFuture: _viewFuture,
onChoose: (int? epOrder, int? pictureRank) {
if (epOrder != null && pictureRank != null) {
for (var i in _epList) {
if (i.epOrder == epOrder) {
_push(_task, _epList, epOrder, pictureRank);
return;
}
}
} else {
_push(_task, _epList, _epList.first.epOrder, null);
}
},
),
..._epList.map((e) {
return MaterialButton(
onPressed: () {
_push(_task, _epList, e.epOrder, null);
},
color: Colors.white,
child: Text(e.title,
style: const TextStyle(color: Colors.black)),
);
}),
],
),
_bottom(),
],
);
// todo only pika task
if (showCommentAtDownload()) {
return DefaultTabController(
length: 3,
child: list,
);
}
return list;
},
),
);
}

var _tabIndex = 0;

Widget _bottom() {
// todo only pika task
if (showCommentAtDownload()) {
final theme = Theme.of(context);
var _tabs = <Widget>[
Tab(text: '章节 (${_epList.length})'),
const Tab(text: '评论'),
const Tab(text: '推荐'),
];
var _views = <Widget>[
_chapters(),
CommentList(CommentMainType.COMIC, widget.comicId),
Recommendation(comicId: widget.comicId),
];
return Column(children: [
Container(
height: 40,
color: theme.colorScheme.secondary.withOpacity(.025),
child: TabBar(
tabs: _tabs,
indicatorColor: theme.colorScheme.secondary,
labelColor: theme.colorScheme.secondary,
onTap: (val) async {
setState(() {
_tabIndex = val;
});
},
),
),
Container(height: 15),
_views[_tabIndex],
Container(height: 5),
]);
}
return _chapters();
}

Widget _chapters() {
return Wrap(
spacing: 10,
runSpacing: 10,
alignment: WrapAlignment.spaceAround,
children: [
ContinueReadButton(
viewFuture: _viewFuture,
onChoose: (int? epOrder, int? pictureRank) {
if (epOrder != null && pictureRank != null) {
for (var i in _epList) {
if (i.epOrder == epOrder) {
_push(_task, _epList, epOrder, pictureRank);
return;
}
}
} else {
_push(_task, _epList, _epList.first.epOrder, null);
}
},
),
..._epList.map((e) {
return MaterialButton(
onPressed: () {
_push(_task, _epList, e.epOrder, null);
},
color: Colors.white,
child: Text(e.title, style: const TextStyle(color: Colors.black)),
);
}),
],
);
}

void _push(
DownloadComic task,
List<DownloadEp> epList,
Expand Down
2 changes: 2 additions & 0 deletions lib/screens/InitScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import 'package:pikapika/basic/config/ReaderDirection.dart';
import 'package:pikapika/basic/config/ReaderSliderPosition.dart';
import 'package:pikapika/basic/config/ReaderType.dart';
import 'package:pikapika/basic/config/ShadowCategories.dart';
import 'package:pikapika/basic/config/ShowCommentAtDownload.dart';
import 'package:pikapika/basic/config/Themes.dart';
import 'package:pikapika/basic/Method.dart';
import 'package:pikapika/basic/config/ListLayout.dart';
Expand Down Expand Up @@ -99,6 +100,7 @@ class _InitScreenState extends State<InitScreen> {
await reloadIsPro();
autoCheckNewVersion();
await initWillPopNotice();
await initShowCommentAtDownload();

String? initUrl;
if (Platform.isAndroid || Platform.isIOS) {
Expand Down
2 changes: 2 additions & 0 deletions lib/screens/SettingsScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import 'package:pikapika/basic/config/ReaderDirection.dart';
import 'package:pikapika/basic/config/ReaderSliderPosition.dart';
import 'package:pikapika/basic/config/ReaderType.dart';
import 'package:pikapika/basic/config/ShadowCategories.dart';
import 'package:pikapika/basic/config/ShowCommentAtDownload.dart';
import 'package:pikapika/basic/config/Themes.dart';
import 'package:pikapika/basic/config/TimeOffsetHour.dart';
import 'package:pikapika/basic/config/Version.dart';
Expand Down Expand Up @@ -110,6 +111,7 @@ class SettingsScreen extends StatelessWidget {
chooserRootSetting(),
downloadThreadCountSetting(),
downloadAndExportPathSetting(),
showCommentAtDownloadSetting(),
exportRenameSetting(),
fontSetting(),
usingRightClickPopSetting(),
Expand Down

0 comments on commit 0289e96

Please sign in to comment.