Skip to content

Commit

Permalink
v0.1.15
Browse files Browse the repository at this point in the history
  • Loading branch information
niuhuan committed Jan 23, 2023
1 parent a499f8f commit 431d67f
Show file tree
Hide file tree
Showing 11 changed files with 646 additions and 31 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ jobs:
config:
- target: linux
host: ubuntu-latest
flutter_version: '3.3.9'
flutter_version: '3.3.10'
- target: windows
host: windows-latest
flutter_version: '3.3.9'
flutter_version: '3.3.10'
- target: macos
host: macos-11
flutter_version: '3.3.9'
flutter_version: '3.3.10'
- target: ios
host: macos-11
flutter_version: '3.3.9'
flutter_version: '3.3.10'
- target: android-arm32
host: ubuntu-latest
flutter_version: '2.10.5'
Expand All @@ -87,13 +87,13 @@ jobs:
flutter_version: '2.10.5'
- target: android-arm32
host: ubuntu-latest
flutter_version: '3.3.9'
flutter_version: '3.3.10'
- target: android-arm64
host: ubuntu-latest
flutter_version: '3.3.9'
flutter_version: '3.3.10'
- target: android-x86_64
host: ubuntu-latest
flutter_version: '3.3.9'
flutter_version: '3.3.10'

runs-on: ${{ matrix.config.host }}

Expand Down
2 changes: 1 addition & 1 deletion ci/version.code.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.1.14
v0.1.15
10 changes: 2 additions & 8 deletions ci/version.info.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
计划
- [x] 下载? / / 高清画质? / / 通过点击进行上一页下一页?

v0.1.14
- [x] 小说左右翻页进行优化, 支持在最后一页后面追加下一章

v0.1.13
- [x] 小说左右翻页

v0.1.11
- [x] 修复登录, 以及登录造成的开启很慢等
v0.1.15
- [x] 下载(缓存)漫画
10 changes: 5 additions & 5 deletions lib/screens/comic_bookshelf_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ const _navPages = [
title: "历史",
icon: Icons.history,
),
// NavPage(
// screen: ComicDownloadsScreen(),
// title: "下载",
// icon: Icons.download,
// ),
NavPage(
screen: ComicSubscribedScreen(),
title: "订阅",
icon: Icons.subscriptions,
),
NavPage(
screen: ComicDownloadsScreen(),
title: "下载",
icon: Icons.download,
),
];
147 changes: 147 additions & 0 deletions lib/screens/comic_create_download_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
import 'package:daisy/commons.dart';
import 'package:daisy/ffi.dart';
import 'package:flutter/material.dart';

class ComicCreateDownloadScreen extends StatefulWidget {
final ComicDetail comic;

const ComicCreateDownloadScreen({Key? key, required this.comic})
: super(key: key);

@override
State<StatefulWidget> createState() => _ComicCreateDownloadScreenState();
}

class _ComicCreateDownloadScreenState extends State<ComicCreateDownloadScreen> {
final List<int> _selected = [];

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("下载 - ${widget.comic.title}"),
actions: [
downloadIcon(),
],
),
body: ListView(
children: [
..._buildChapters(widget.comic),
],
),
);
}

List<Widget> _buildChapters(ComicDetail comic) {
return comic.chapters
.map((chapter) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.only(
top: 15,
bottom: 5,
left: 10,
right: 10,
),
child: SelectableText(chapter.title),
),
Center(
child: Wrap(
alignment: WrapAlignment.spaceAround,
spacing: 10,
runSpacing: 5,
children: [
...chapter.data.map(
(e) => Container(
margin: const EdgeInsets.all(3),
child: MaterialButton(
onPressed: () {
if (_selected.contains(e.chapterId)) {
_selected.remove(e.chapterId);
} else {
_selected.add(e.chapterId);
}
setState(() {});
},
color: _selected.contains(e.chapterId)
? Colors.blueGrey
: Colors.white,
child: Text(
e.chapterTitle,
style: const TextStyle(color: Colors.black),
),
),
),
)
],
),
),
],
))
.toList();
}

Widget downloadIcon() {
return IconButton(
onPressed: () {
if (_selected.isEmpty) {
defaultToast(context, "请选择章节");
return;
}
List<ComicChapter> list = [];
for (var element in widget.comic.chapters) {
ComicChapter chapter = ComicChapter(title: element.title, data: []);
for (var value in element.data) {
if (_selected.contains(value.chapterId)) {
chapter.data.add(value);
}
}
if (chapter.data.isNotEmpty) {
list.add(chapter);
}
}
var request = ComicDetail(
id: widget.comic.id,
title: widget.comic.title,
direction: widget.comic.direction,
isLong: widget.comic.isLong,
isAnimeHome: widget.comic.isAnimeHome,
cover: widget.comic.cover,
description: widget.comic.description,
lastUpdateTime: widget.comic.lastUpdateTime,
lastUpdateChapterName: widget.comic.lastUpdateChapterName,
copyright: widget.comic.copyright,
firstLetter: widget.comic.firstLetter,
comicPy: widget.comic.comicPy,
hidden: widget.comic.hidden,
hotNum: widget.comic.hotNum,
hitNum: widget.comic.hitNum,
uid: widget.comic.uid,
isLock: widget.comic.isLock,
lastUpdateChapterId: widget.comic.lastUpdateChapterId,
types: widget.comic.types,
status: widget.comic.status,
authors: widget.comic.authors,
subscribeNum: widget.comic.subscribeNum,
chapters: list,
isNeedLogin: widget.comic.isNeedLogin,
isHideChapter: widget.comic.isHideChapter,
);
download(request);
},
icon: const Icon(Icons.check),
);
}

void download(ComicDetail request) async {
try {
await native.createDownload(buff: request);
defaultToast(context, "success");
Navigator.pop(context);
} catch (e, s) {
print("$e\n$s");
defaultToast(context, "失败 : $e");
}
}
}
17 changes: 14 additions & 3 deletions lib/screens/comic_detail_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:uuid/uuid.dart';
import '../commons.dart';
import '../const.dart';
import '../utils.dart';
import 'comic_create_download_screen.dart';
import 'comic_reader_screen.dart';
import 'components/comment_pager.dart';
import 'components/content_loading.dart';
Expand Down Expand Up @@ -110,6 +111,19 @@ class _ComicDetailScreenState extends State<ComicDetailScreen> with RouteAware {
appBar: AppBar(
title: Text(comic.title),
actions: [
IconButton(
icon: const Icon(Icons.download),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ComicCreateDownloadScreen(
comic: comic,
),
),
);
},
),
SubscribedIcon(objType: 0, objId: widget.comicId),
],
),
Expand Down Expand Up @@ -234,9 +248,6 @@ class _ComicDetailScreenState extends State<ComicDetailScreen> with RouteAware {
margin: EdgeInsets.all(3),
child: MaterialButton(
onPressed: () {
print("=========");
print(comic.id);
print(e.chapterId);
Navigator.push(
context,
MaterialPageRoute(
Expand Down
Loading

0 comments on commit 431d67f

Please sign in to comment.