-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
646 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v0.1.14 | ||
v0.1.15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] 下载(缓存)漫画 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.