mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
improve ui
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
"Confirm": "确认",
|
||||
"Are you sure you want to delete this comic?": "您确定要删除这部漫画吗?",
|
||||
"Are you sure you want to delete @a selected comics?": "您确定要删除 @a 部漫画吗?",
|
||||
"Add comic source": "添加漫画来源",
|
||||
"Add comic source": "添加漫画源",
|
||||
"Select file": "选择文件",
|
||||
"View list": "查看列表",
|
||||
"Open help": "打开帮助",
|
||||
@@ -102,8 +102,8 @@
|
||||
"Auto page turning interval": "自动翻页间隔",
|
||||
"Theme Mode": "主题模式",
|
||||
"System": "系统",
|
||||
"Light": "明亮",
|
||||
"Dark": "黑暗",
|
||||
"Light": "浅色",
|
||||
"Dark": "深色",
|
||||
"Theme Color": "主题颜色",
|
||||
"Red": "红色",
|
||||
"Pink": "粉色",
|
||||
@@ -215,7 +215,21 @@
|
||||
"Authorization Required": "需要身份验证",
|
||||
"Sync": "同步",
|
||||
"The folder is Linked to @source": "文件夹已关联到 @source",
|
||||
"Source Folder": "源收藏夹"
|
||||
"Source Folder": "源收藏夹",
|
||||
"Use a config file": "使用配置文件",
|
||||
"Comic Source list": "漫画源列表",
|
||||
"View": "查看",
|
||||
"Copy": "复制",
|
||||
"Copied": "已复制",
|
||||
"Search History": "搜索历史",
|
||||
"Clear Search History": "清除搜索历史",
|
||||
"Search in": "搜索于",
|
||||
"Clear History": "清除历史",
|
||||
"Are you sure you want to clear your history?": "确定要清除您的历史记录吗?",
|
||||
"No Explore Pages": "没有探索页面",
|
||||
"Add a comic source in home page": "在主页添加一个漫画源",
|
||||
"Please check your settings": "请检查您的设置",
|
||||
"No Category Pages": "没有分类页面"
|
||||
},
|
||||
"zh_TW": {
|
||||
"Home": "首頁",
|
||||
@@ -263,7 +277,7 @@
|
||||
"Confirm": "確認",
|
||||
"Are you sure you want to delete this comic?": "您確定要刪除這部漫畫嗎?",
|
||||
"Are you sure you want to delete @a selected comics?": "您確定要刪除 @a 部漫畫嗎?",
|
||||
"Add comic source": "添加漫畫來源",
|
||||
"Add comic source": "添加漫畫源",
|
||||
"Select file": "選擇文件",
|
||||
"View list": "查看列表",
|
||||
"Open help": "打開幫助",
|
||||
@@ -320,8 +334,8 @@
|
||||
"Auto page turning interval": "自動翻頁間隔",
|
||||
"Theme Mode": "主題模式",
|
||||
"System": "系統",
|
||||
"Light": "明亮",
|
||||
"Dark": "黑暗",
|
||||
"Light": "浅色",
|
||||
"Dark": "深色",
|
||||
"Theme Color": "主題顏色",
|
||||
"Red": "紅色",
|
||||
"Pink": "粉色",
|
||||
@@ -433,6 +447,20 @@
|
||||
"Authorization Required": "需要身份驗證",
|
||||
"Sync": "同步",
|
||||
"The folder is Linked to @source": "文件夾已關聯到 @source",
|
||||
"Source Folder": "源收藏夾"
|
||||
"Source Folder": "源收藏夾",
|
||||
"Use a config file": "使用配置文件",
|
||||
"Comic Source list": "漫畫源列表",
|
||||
"View": "查看",
|
||||
"Copy": "複製",
|
||||
"Copied": "已複製",
|
||||
"Search History": "搜索歷史",
|
||||
"Clear Search History": "清除搜索歷史",
|
||||
"Search in": "搜索於",
|
||||
"Clear History": "清除歷史",
|
||||
"Are you sure you want to clear your history?": "確定要清除您的歷史記錄嗎?",
|
||||
"No Explore Pages": "沒有探索頁面",
|
||||
"Add a comic source in home page": "在主頁添加一個漫畫源",
|
||||
"Please check your settings": "請檢查您的設定",
|
||||
"No Category Pages": "沒有分類頁面"
|
||||
}
|
||||
}
|
@@ -25,7 +25,8 @@ class ComicTile extends StatelessWidget {
|
||||
onTap!();
|
||||
return;
|
||||
}
|
||||
App.mainNavigatorKey?.currentContext?.to(() => ComicPage(id: comic.id, sourceKey: comic.sourceKey));
|
||||
App.mainNavigatorKey?.currentContext
|
||||
?.to(() => ComicPage(id: comic.id, sourceKey: comic.sourceKey));
|
||||
}
|
||||
|
||||
void onLongPress(BuildContext context) {
|
||||
@@ -50,7 +51,8 @@ class ComicTile extends StatelessWidget {
|
||||
icon: Icons.chrome_reader_mode_outlined,
|
||||
text: 'Details'.tl,
|
||||
onClick: () {
|
||||
App.mainNavigatorKey?.currentContext?.to(() => ComicPage(id: comic.id, sourceKey: comic.sourceKey));
|
||||
App.mainNavigatorKey?.currentContext
|
||||
?.to(() => ComicPage(id: comic.id, sourceKey: comic.sourceKey));
|
||||
},
|
||||
),
|
||||
MenuEntry(
|
||||
@@ -82,13 +84,17 @@ class ComicTile extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
var type = appdata.settings['comicDisplayMode'];
|
||||
|
||||
Widget child = type == 'detailed' ? _buildDetailedMode(context) : _buildBriefMode(context);
|
||||
Widget child = type == 'detailed'
|
||||
? _buildDetailedMode(context)
|
||||
: _buildBriefMode(context);
|
||||
|
||||
var isFavorite = appdata.settings['showFavoriteStatusOnTile']
|
||||
? LocalFavoritesManager().isExist(comic.id, ComicType(comic.sourceKey.hashCode))
|
||||
? LocalFavoritesManager()
|
||||
.isExist(comic.id, ComicType(comic.sourceKey.hashCode))
|
||||
: false;
|
||||
var history = appdata.settings['showHistoryStatusOnTile']
|
||||
? HistoryManager().findSync(comic.id, ComicType(comic.sourceKey.hashCode))
|
||||
? HistoryManager()
|
||||
.findSync(comic.id, ComicType(comic.sourceKey.hashCode))
|
||||
: null;
|
||||
if (history?.page == 0) {
|
||||
history!.page = 1;
|
||||
@@ -132,7 +138,8 @@ class ComicTile extends StatelessWidget {
|
||||
constraints: const BoxConstraints(minWidth: 24),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: CustomPaint(
|
||||
painter: _ReadingHistoryPainter(history.page, history.maxPage),
|
||||
painter:
|
||||
_ReadingHistoryPainter(history.page, history.maxPage),
|
||||
),
|
||||
)
|
||||
],
|
||||
@@ -205,7 +212,9 @@ class ComicTile extends StatelessWidget {
|
||||
badge: badge ?? comic.language,
|
||||
tags: comic.tags,
|
||||
maxLines: 2,
|
||||
enableTranslate: ComicSource.find(comic.sourceKey)?.enableTagsTranslate ?? false,
|
||||
enableTranslate: ComicSource.find(comic.sourceKey)
|
||||
?.enableTagsTranslate ??
|
||||
false,
|
||||
rating: comic.stars,
|
||||
),
|
||||
),
|
||||
@@ -237,7 +246,9 @@ class ComicTile extends StatelessWidget {
|
||||
Positioned.fill(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.secondaryContainer,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.secondaryContainer,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
@@ -338,7 +349,9 @@ class ComicTile extends StatelessWidget {
|
||||
}
|
||||
appdata.saveData();
|
||||
context.showMessage(message: 'Blocked'.tl);
|
||||
comicTileContext.findAncestorStateOfType<_SliverGridComicsState>()!.update();
|
||||
comicTileContext
|
||||
.findAncestorStateOfType<_SliverGridComicsState>()!
|
||||
.update();
|
||||
},
|
||||
child: Text('Block'.tl),
|
||||
),
|
||||
@@ -379,7 +392,8 @@ class _ComicDescription extends StatelessWidget {
|
||||
s = s.replaceAll("\n", " ");
|
||||
}
|
||||
}
|
||||
var enableTranslate = App.locale.languageCode == 'zh' && this.enableTranslate;
|
||||
var enableTranslate =
|
||||
App.locale.languageCode == 'zh' && this.enableTranslate;
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
@@ -396,7 +410,9 @@ class _ComicDescription extends StatelessWidget {
|
||||
if (subtitle != "")
|
||||
Text(
|
||||
subtitle,
|
||||
style: TextStyle(fontSize: 10.0, color: context.colorScheme.onSurface.withOpacity(0.7)),
|
||||
style: TextStyle(
|
||||
fontSize: 10.0,
|
||||
color: context.colorScheme.onSurface.withOpacity(0.7)),
|
||||
maxLines: 1,
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -433,13 +449,18 @@ class _ComicDescription extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: s == "Unavailable"
|
||||
? Theme.of(context).colorScheme.errorContainer
|
||||
: Theme.of(context).colorScheme.secondaryContainer,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||
: Theme.of(context)
|
||||
.colorScheme
|
||||
.secondaryContainer,
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(8)),
|
||||
),
|
||||
child: Center(
|
||||
widthFactor: 1,
|
||||
child: Text(
|
||||
enableTranslate ? TagsTranslation.translateTag(s) : s.split(':').last,
|
||||
enableTranslate
|
||||
? TagsTranslation.translateTag(s)
|
||||
: s.split(':').last,
|
||||
style: const TextStyle(fontSize: 12),
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -510,17 +531,20 @@ class _ReadingHistoryPainter extends CustomPainter {
|
||||
textDirection: TextDirection.ltr,
|
||||
);
|
||||
textPainter.layout();
|
||||
textPainter.paint(canvas, Offset((size.width - textPainter.width) / 2, (size.height - textPainter.height) / 2));
|
||||
textPainter.paint(
|
||||
canvas,
|
||||
Offset((size.width - textPainter.width) / 2,
|
||||
(size.height - textPainter.height) / 2));
|
||||
} else if (page == maxPage) {
|
||||
// 在中央绘制勾
|
||||
final paint = Paint()
|
||||
..color = Colors.white
|
||||
..strokeWidth = 2
|
||||
..style = PaintingStyle.stroke;
|
||||
canvas.drawLine(
|
||||
Offset(size.width * 0.2, size.height * 0.5), Offset(size.width * 0.45, size.height * 0.75), paint);
|
||||
canvas.drawLine(
|
||||
Offset(size.width * 0.45, size.height * 0.75), Offset(size.width * 0.85, size.height * 0.3), paint);
|
||||
canvas.drawLine(Offset(size.width * 0.2, size.height * 0.5),
|
||||
Offset(size.width * 0.45, size.height * 0.75), paint);
|
||||
canvas.drawLine(Offset(size.width * 0.45, size.height * 0.75),
|
||||
Offset(size.width * 0.85, size.height * 0.3), paint);
|
||||
} else {
|
||||
// 在左上角绘制page, 在右下角绘制maxPage
|
||||
final textPainter = TextPainter(
|
||||
@@ -546,13 +570,18 @@ class _ReadingHistoryPainter extends CustomPainter {
|
||||
textDirection: TextDirection.ltr,
|
||||
);
|
||||
textPainter2.layout();
|
||||
textPainter2.paint(canvas, Offset(size.width - textPainter2.width, size.height - textPainter2.height));
|
||||
textPainter2.paint(
|
||||
canvas,
|
||||
Offset(size.width - textPainter2.width,
|
||||
size.height - textPainter2.height));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(covariant CustomPainter oldDelegate) {
|
||||
return oldDelegate is! _ReadingHistoryPainter || oldDelegate.page != page || oldDelegate.maxPage != maxPage;
|
||||
return oldDelegate is! _ReadingHistoryPainter ||
|
||||
oldDelegate.page != page ||
|
||||
oldDelegate.maxPage != maxPage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -663,16 +692,22 @@ class _SliverGridComics extends StatelessWidget {
|
||||
onLastItemBuild?.call();
|
||||
}
|
||||
var badge = badgeBuilder?.call(comics[index]);
|
||||
var isSelected = selection == null ? false : selection![comics[index]] ?? false;
|
||||
var isSelected =
|
||||
selection == null ? false : selection![comics[index]] ?? false;
|
||||
var comic = ComicTile(
|
||||
comic: comics[index],
|
||||
badge: badge,
|
||||
menuOptions: menuBuilder?.call(comics[index]),
|
||||
onTap: onTap != null ? () => onTap!(comics[index]) : null,
|
||||
);
|
||||
if(selection == null) {
|
||||
return comic;
|
||||
}
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? Theme.of(context).colorScheme.surfaceContainer : null,
|
||||
color: isSelected
|
||||
? Theme.of(context).colorScheme.surfaceContainer
|
||||
: null,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
margin: const EdgeInsets.all(4),
|
||||
@@ -797,7 +832,9 @@ class ComicListState extends State<ComicList> {
|
||||
decoration: InputDecoration(
|
||||
labelText: "Page".tl,
|
||||
),
|
||||
inputFormatters: <TextInputFormatter>[FilteringTextInputFormatter.digitsOnly],
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
FilteringTextInputFormatter.digitsOnly
|
||||
],
|
||||
onChanged: (v) {
|
||||
value = v;
|
||||
},
|
||||
@@ -810,13 +847,15 @@ class ComicListState extends State<ComicList> {
|
||||
if (page == null) {
|
||||
context.showMessage(message: "Invalid page".tl);
|
||||
} else {
|
||||
if (page > 0 && (_maxPage == null || page <= _maxPage!)) {
|
||||
if (page > 0 &&
|
||||
(_maxPage == null || page <= _maxPage!)) {
|
||||
setState(() {
|
||||
_error = null;
|
||||
_page = page;
|
||||
});
|
||||
} else {
|
||||
context.showMessage(message: "Invalid page".tl);
|
||||
context.showMessage(
|
||||
message: "Invalid page".tl);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -828,7 +867,8 @@ class ComicListState extends State<ComicList> {
|
||||
);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
|
||||
child: Text("Page $_page / ${_maxPage ?? '?'}"),
|
||||
),
|
||||
),
|
||||
@@ -959,7 +999,8 @@ class ComicListState extends State<ComicList> {
|
||||
comics: _data[_page] ?? const [],
|
||||
menuBuilder: widget.menuBuilder,
|
||||
),
|
||||
if (_data[_page]!.length > 6 && _maxPage != 1) _buildSliverPageSelector(),
|
||||
if (_data[_page]!.length > 6 && _maxPage != 1)
|
||||
_buildSliverPageSelector(),
|
||||
if (widget.trailingSliver != null) widget.trailingSliver!,
|
||||
],
|
||||
);
|
||||
@@ -1120,15 +1161,20 @@ class _RatingWidgetState extends State<RatingWidget> {
|
||||
if (!widget.selectable) {
|
||||
return;
|
||||
}
|
||||
if (dx >= widget.size * widget.count + widget.padding * (widget.count - 1)) {
|
||||
if (dx >=
|
||||
widget.size * widget.count + widget.padding * (widget.count - 1)) {
|
||||
value = widget.maxRating;
|
||||
} else {
|
||||
for (double i = 1; i < widget.count + 1; i++) {
|
||||
if (dx > widget.size * i + widget.padding * (i - 1) && dx < widget.size * i + widget.padding * i) {
|
||||
if (dx > widget.size * i + widget.padding * (i - 1) &&
|
||||
dx < widget.size * i + widget.padding * i) {
|
||||
value = i * (widget.maxRating / widget.count);
|
||||
break;
|
||||
} else if (dx > widget.size * (i - 1) + widget.padding * (i - 1) && dx < widget.size * i + widget.padding * i) {
|
||||
value = (dx - widget.padding * (i - 1)) / (widget.size * widget.count) * widget.maxRating;
|
||||
} else if (dx > widget.size * (i - 1) + widget.padding * (i - 1) &&
|
||||
dx < widget.size * i + widget.padding * i) {
|
||||
value = (dx - widget.padding * (i - 1)) /
|
||||
(widget.size * widget.count) *
|
||||
widget.maxRating;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1156,7 +1202,8 @@ class _RatingWidgetState extends State<RatingWidget> {
|
||||
if (widget.count / fullStars() == widget.maxRating / value) {
|
||||
return 0;
|
||||
}
|
||||
return (value % (widget.maxRating / widget.count)) / (widget.maxRating / widget.count);
|
||||
return (value % (widget.maxRating / widget.count)) /
|
||||
(widget.maxRating / widget.count);
|
||||
}
|
||||
|
||||
List<Widget> buildRow() {
|
||||
|
@@ -31,8 +31,9 @@ class Select extends StatelessWidget {
|
||||
var size = renderBox.size;
|
||||
showMenu(
|
||||
elevation: 3,
|
||||
color: context.colorScheme.surface,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
color: context.brightness == Brightness.light
|
||||
? const Color(0xFFF6F6F6)
|
||||
: const Color(0xFF1E1E1E),
|
||||
context: context,
|
||||
useRootNavigator: true,
|
||||
constraints: BoxConstraints(
|
||||
@@ -41,8 +42,8 @@ class Select extends StatelessWidget {
|
||||
),
|
||||
position: RelativeRect.fromLTRB(
|
||||
offset.dx,
|
||||
offset.dy + size.height,
|
||||
offset.dx + size.height,
|
||||
offset.dy + size.height + 2,
|
||||
offset.dx + size.height + 2,
|
||||
offset.dy,
|
||||
),
|
||||
items: values
|
||||
|
@@ -136,6 +136,8 @@ class ComicSource {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
static bool get isEmpty => _sources.isEmpty;
|
||||
|
||||
/// Name of this source.
|
||||
final String name;
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
import 'dart:io' as io;
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter_qjs/flutter_qjs.dart';
|
||||
import 'package:venera/foundation/app.dart';
|
||||
import 'package:venera/foundation/appdata.dart';
|
||||
import 'package:venera/foundation/consts.dart';
|
||||
|
@@ -30,8 +30,15 @@ class CategoriesPage extends StatelessWidget {
|
||||
.toList();
|
||||
|
||||
if(categories.isEmpty) {
|
||||
var msg = "No Category Pages".tl;
|
||||
msg += '\n';
|
||||
if(ComicSource.isEmpty) {
|
||||
msg += "Add a comic source in home page".tl;
|
||||
} else {
|
||||
msg += "Please check your settings".tl;
|
||||
}
|
||||
return NetworkError(
|
||||
message: "No Category Pages".tl,
|
||||
message: msg,
|
||||
retry: () {
|
||||
controller.update();
|
||||
},
|
||||
@@ -248,36 +255,19 @@ class _CategoryPage extends StatelessWidget {
|
||||
|
||||
Widget buildTag(String tag, ClickTagCallback onClick,
|
||||
[String? namespace, String? param]) {
|
||||
String translateTag(String tag) {
|
||||
/*
|
||||
// TODO: Implement translation
|
||||
if (enableTranslation) {
|
||||
if (namespace != null) {
|
||||
tag = TagsTranslation.translationTagWithNamespace(tag, namespace);
|
||||
} else {
|
||||
tag = tag.translateTagsToCN;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
return tag;
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8, 6, 8, 6),
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
return Material(
|
||||
elevation: 0.6,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(4)),
|
||||
color: context.colorScheme.surfaceContainerLow,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||
color: context.colorScheme.primaryContainer.withOpacity(0.72),
|
||||
child: InkWell(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(4)),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||
onTap: () => onClick(tag, param),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 8),
|
||||
child: Text(translateTag(tag)),
|
||||
child: Text(tag),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@@ -327,7 +327,7 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
}
|
||||
|
||||
Widget buildDescription() {
|
||||
if (comic.description == null) {
|
||||
if (comic.description == null || comic.description!.trim().isEmpty) {
|
||||
return const SliverPadding(padding: EdgeInsets.zero);
|
||||
}
|
||||
return SliverToBoxAdapter(
|
||||
@@ -392,6 +392,27 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
child: InkWell(
|
||||
borderRadius: borderRadius,
|
||||
onTap: onTap,
|
||||
onLongPress: () {
|
||||
Clipboard.setData(ClipboardData(text: text));
|
||||
context.showMessage(message: "Copied".tl);
|
||||
},
|
||||
onSecondaryTapDown: (details) {
|
||||
showMenuX(context, details.globalPosition, [
|
||||
MenuEntry(
|
||||
icon: Icons.remove_red_eye,
|
||||
text: "View".tl,
|
||||
onClick: onTap,
|
||||
),
|
||||
MenuEntry(
|
||||
icon: Icons.copy,
|
||||
text: "Copy".tl,
|
||||
onClick: () {
|
||||
Clipboard.setData(ClipboardData(text: text));
|
||||
context.showMessage(message: "Copied".tl);
|
||||
},
|
||||
),
|
||||
]);
|
||||
},
|
||||
child: Text(text).padding(padding),
|
||||
),
|
||||
);
|
||||
@@ -406,6 +427,26 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
}
|
||||
}
|
||||
|
||||
String formatTime(String time) {
|
||||
if (int.tryParse(time) != null) {
|
||||
var t = int.tryParse(time);
|
||||
if (t! > 1000000000000) {
|
||||
return DateTime.fromMillisecondsSinceEpoch(t)
|
||||
.toString()
|
||||
.substring(0, 19);
|
||||
} else {
|
||||
return DateTime.fromMillisecondsSinceEpoch(t * 1000)
|
||||
.toString()
|
||||
.substring(0, 19);
|
||||
}
|
||||
}
|
||||
if (time.contains('T') || time.contains('Z')) {
|
||||
var t = DateTime.parse(time);
|
||||
return t.toString().substring(0, 19);
|
||||
}
|
||||
return time;
|
||||
}
|
||||
|
||||
Widget buildWrap({required List<Widget> children}) {
|
||||
return Wrap(
|
||||
runSpacing: 8,
|
||||
@@ -464,14 +505,14 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
buildWrap(
|
||||
children: [
|
||||
buildTag(text: 'Upload Time'.tl, isTitle: true),
|
||||
buildTag(text: comic.uploadTime!),
|
||||
buildTag(text: formatTime(comic.uploadTime!)),
|
||||
],
|
||||
),
|
||||
if (comic.updateTime != null)
|
||||
buildWrap(
|
||||
children: [
|
||||
buildTag(text: 'Update Time'.tl, isTitle: true),
|
||||
buildTag(text: comic.updateTime!),
|
||||
buildTag(text: formatTime(comic.updateTime!)),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
@@ -575,7 +616,7 @@ abstract mixin class _ComicPageActions {
|
||||
|
||||
void quickFavorite() {
|
||||
var folder = appdata.settings['quickFavorite'];
|
||||
if(folder is! String) {
|
||||
if (folder is! String) {
|
||||
return;
|
||||
}
|
||||
LocalFavoritesManager().addComic(
|
||||
@@ -1037,7 +1078,7 @@ class _ComicThumbnailsState extends State<_ComicThumbnails> {
|
||||
if (!isInitialLoading && next == null) {
|
||||
return;
|
||||
}
|
||||
if(isLoading) return;
|
||||
if (isLoading) return;
|
||||
Future.microtask(() {
|
||||
setState(() {
|
||||
isLoading = true;
|
||||
@@ -1610,7 +1651,9 @@ class _SelectDownloadChapterState extends State<_SelectDownloadChapter> {
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: FilledButton(
|
||||
onPressed: selected.isEmpty ? null : () {
|
||||
onPressed: selected.isEmpty
|
||||
? null
|
||||
: () {
|
||||
widget.finishSelect(selected);
|
||||
context.pop();
|
||||
},
|
||||
|
@@ -40,7 +40,7 @@ class ComicSourcePage extends StatefulWidget {
|
||||
}
|
||||
controller?.close();
|
||||
if (shouldUpdate.isEmpty) {
|
||||
if(!implicit) {
|
||||
if (!implicit) {
|
||||
App.rootContext.showMessage(message: "No Update Available".tl);
|
||||
}
|
||||
return;
|
||||
@@ -95,24 +95,12 @@ class _BodyState extends State<_Body> {
|
||||
return SmoothCustomScrollView(
|
||||
slivers: [
|
||||
buildCard(context),
|
||||
buildSettings(),
|
||||
for (var source in ComicSource.all()) buildSource(context, source),
|
||||
SliverPadding(padding: EdgeInsets.only(bottom: context.padding.bottom)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildSettings() {
|
||||
return SliverToBoxAdapter(
|
||||
child: ListTile(
|
||||
leading: const Icon(Icons.update_outlined),
|
||||
title: Text("Check updates".tl),
|
||||
onTap: () => ComicSourcePage.checkComicSourceUpdate(false),
|
||||
trailing: const Icon(Icons.arrow_right),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildSource(BuildContext context, ComicSource source) {
|
||||
return SliverToBoxAdapter(
|
||||
child: Column(
|
||||
@@ -181,11 +169,12 @@ class _BodyState extends State<_Body> {
|
||||
trailing: Select(
|
||||
current: (current as String).ts(source.key),
|
||||
values: (item.value['options'] as List)
|
||||
.map<String>(
|
||||
(e) => ((e['text'] ?? e['value']) as String).ts(source.key))
|
||||
.map<String>((e) =>
|
||||
((e['text'] ?? e['value']) as String).ts(source.key))
|
||||
.toList(),
|
||||
onTap: (i) {
|
||||
source.data['settings'][key] = item.value['options'][i]['value'];
|
||||
source.data['settings'][key] =
|
||||
item.value['options'][i]['value'];
|
||||
source.saveData();
|
||||
setState(() {});
|
||||
},
|
||||
@@ -209,7 +198,8 @@ class _BodyState extends State<_Body> {
|
||||
source.data['settings'][key] ?? item.value['default'] ?? '';
|
||||
yield ListTile(
|
||||
title: Text((item.value['title'] as String).ts(source.key)),
|
||||
subtitle: Text(current, maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
subtitle:
|
||||
Text(current, maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
trailing: IconButton(
|
||||
icon: const Icon(Icons.edit),
|
||||
onPressed: () {
|
||||
@@ -231,8 +221,7 @@ class _BodyState extends State<_Body> {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
catch(e, s) {
|
||||
} catch (e, s) {
|
||||
Log.error("ComicSourcePage", "Failed to build a setting\n$e\n$s");
|
||||
}
|
||||
}
|
||||
@@ -305,8 +294,13 @@ class _BodyState extends State<_Body> {
|
||||
}
|
||||
|
||||
Widget buildCard(BuildContext context) {
|
||||
Widget buildButton({required Widget child, required VoidCallback onPressed}) {
|
||||
return Button.normal(
|
||||
onPressed: onPressed,
|
||||
child: child,
|
||||
).fixHeight(32);
|
||||
}
|
||||
return SliverToBoxAdapter(
|
||||
child: Card.outlined(
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
@@ -321,39 +315,52 @@ class _BodyState extends State<_Body> {
|
||||
decoration: InputDecoration(
|
||||
hintText: "URL",
|
||||
border: const UnderlineInputBorder(),
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 12),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
suffix: IconButton(
|
||||
onPressed: () => handleAddSource(url),
|
||||
icon: const Icon(Icons.check))),
|
||||
onChanged: (value) {
|
||||
url = value;
|
||||
},
|
||||
onSubmitted: handleAddSource)
|
||||
.paddingHorizontal(16)
|
||||
.paddingBottom(32),
|
||||
Row(
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: _selectFile, child: Text("Select file".tl))
|
||||
.paddingLeft(8),
|
||||
const Spacer(),
|
||||
TextButton(
|
||||
onSubmitted: handleAddSource,
|
||||
).paddingHorizontal(16).paddingBottom(8),
|
||||
ListTile(
|
||||
title: Text("Comic Source list".tl),
|
||||
trailing: buildButton(
|
||||
child: Text("View".tl),
|
||||
onPressed: () {
|
||||
showPopUpWidget(
|
||||
App.rootContext, _ComicSourceList(handleAddSource));
|
||||
App.rootContext,
|
||||
_ComicSourceList(handleAddSource),
|
||||
);
|
||||
},
|
||||
child: Text("View list".tl)),
|
||||
const Spacer(),
|
||||
TextButton(onPressed: help, child: Text("Open help".tl))
|
||||
.paddingRight(8),
|
||||
],
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text("Use a config file".tl),
|
||||
trailing: buildButton(
|
||||
onPressed: _selectFile,
|
||||
child: Text("Select".tl),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text("Help".tl),
|
||||
trailing: buildButton(
|
||||
onPressed: help,
|
||||
child: Text("Open".tl),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text("Check updates".tl),
|
||||
trailing: buildButton(
|
||||
onPressed: () => ComicSourcePage.checkComicSourceUpdate(false),
|
||||
child: Text("Check".tl),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
).paddingHorizontal(12),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -372,8 +379,7 @@ class _BodyState extends State<_Body> {
|
||||
}
|
||||
|
||||
void help() {
|
||||
launchUrlString(
|
||||
"https://github.com/venera-app/venera/blob/master/doc/comic_source.md");
|
||||
launchUrlString("https://github.com/venera-app/venera-configs");
|
||||
}
|
||||
|
||||
Future<void> handleAddSource(String url) async {
|
||||
|
@@ -93,8 +93,15 @@ class _ExplorePageState extends State<ExplorePage>
|
||||
Widget buildBody(String i) => _SingleExplorePage(i, key: Key(i));
|
||||
|
||||
Widget buildEmpty() {
|
||||
var msg = "No Explore Pages".tl;
|
||||
msg += '\n';
|
||||
if(ComicSource.isEmpty) {
|
||||
msg += "Add a comic source in home page".tl;
|
||||
} else {
|
||||
msg += "Please check your settings".tl;
|
||||
}
|
||||
return NetworkError(
|
||||
message: "No Explore Pages".tl,
|
||||
message: msg,
|
||||
retry: () {
|
||||
setState(() {
|
||||
pages = ComicSource.all()
|
||||
|
@@ -187,7 +187,7 @@ class _LocalFavoritesPageState extends State<_LocalFavoritesPage> {
|
||||
});
|
||||
}),
|
||||
MenuEntry(
|
||||
icon: Icons.update,
|
||||
icon: Icons.download,
|
||||
text: "Download All".tl,
|
||||
onClick: () async {
|
||||
int count = 0;
|
||||
|
@@ -305,13 +305,24 @@ class _SearchPageState extends State<SearchPage> {
|
||||
),
|
||||
);
|
||||
}
|
||||
return ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
title: Text(appdata.searchHistory[index - 2]),
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
search(appdata.searchHistory[index - 2]);
|
||||
},
|
||||
);
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
// color: context.colorScheme.surfaceContainer,
|
||||
border: Border(
|
||||
left: BorderSide(
|
||||
color: context.colorScheme.outlineVariant,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
child: Text(appdata.searchHistory[index - 2], style: ts.s14),
|
||||
),
|
||||
).paddingBottom(8).paddingHorizontal(4);
|
||||
},
|
||||
childCount: 2 + appdata.searchHistory.length,
|
||||
),
|
||||
@@ -490,7 +501,7 @@ class SearchOptionWidget extends StatelessWidget {
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: Text(option.label.ts(sourceKey)),
|
||||
),
|
||||
if(option.type == 'select')
|
||||
if (option.type == 'select')
|
||||
Wrap(
|
||||
runSpacing: 8,
|
||||
spacing: 8,
|
||||
@@ -504,7 +515,7 @@ class SearchOptionWidget extends StatelessWidget {
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
if(option.type == 'multi-select')
|
||||
if (option.type == 'multi-select')
|
||||
Wrap(
|
||||
runSpacing: 8,
|
||||
spacing: 8,
|
||||
@@ -514,7 +525,7 @@ class SearchOptionWidget extends StatelessWidget {
|
||||
isSelected: (jsonDecode(value) as List).contains(e.key),
|
||||
onTap: () {
|
||||
var list = jsonDecode(value) as List;
|
||||
if(list.contains(e.key)) {
|
||||
if (list.contains(e.key)) {
|
||||
list.remove(e.key);
|
||||
} else {
|
||||
list.add(e.key);
|
||||
@@ -524,7 +535,7 @@ class SearchOptionWidget extends StatelessWidget {
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
if(option.type == 'dropdown')
|
||||
if (option.type == 'dropdown')
|
||||
Select(
|
||||
current: option.options[value],
|
||||
values: option.options.values.toList(),
|
||||
|
@@ -134,7 +134,9 @@ class _DoubleLineSelectSettingsState extends State<_DoubleLineSelectSettings> {
|
||||
builder: (context) {
|
||||
return ContentDialog(
|
||||
title: "Help".tl,
|
||||
content: Text(widget.help!).paddingHorizontal(16).fixWidth(double.infinity),
|
||||
content: Text(widget.help!)
|
||||
.paddingHorizontal(16)
|
||||
.fixWidth(double.infinity),
|
||||
actions: [
|
||||
Button.filled(
|
||||
onPressed: context.pop,
|
||||
@@ -159,8 +161,9 @@ class _DoubleLineSelectSettingsState extends State<_DoubleLineSelectSettings> {
|
||||
var rect = offset & size;
|
||||
showMenu(
|
||||
elevation: 3,
|
||||
color: context.colorScheme.surface,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
color: context.brightness == Brightness.light
|
||||
? const Color(0xFFF6F6F6)
|
||||
: const Color(0xFF1E1E1E),
|
||||
context: context,
|
||||
position: RelativeRect.fromRect(
|
||||
rect,
|
||||
@@ -230,7 +233,9 @@ class _EndSelectorSelectSettingState extends State<_EndSelectorSelectSetting> {
|
||||
builder: (context) {
|
||||
return ContentDialog(
|
||||
title: "Help".tl,
|
||||
content: Text(widget.help!).paddingHorizontal(16).fixWidth(double.infinity),
|
||||
content: Text(widget.help!)
|
||||
.paddingHorizontal(16)
|
||||
.fixWidth(double.infinity),
|
||||
actions: [
|
||||
Button.filled(
|
||||
onPressed: context.pop,
|
||||
@@ -461,11 +466,15 @@ class _MultiPagesFilterState extends State<_MultiPagesFilter> {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return SimpleDialog(
|
||||
title: const Text("Add"),
|
||||
return ContentDialog(
|
||||
title: "Add".tl,
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: canAdd.entries
|
||||
.map((e) => InkWell(
|
||||
child: ListTile(title: Text(e.value), key: Key(e.key)),
|
||||
.map(
|
||||
(e) => ListTile(
|
||||
title: Text(e.value),
|
||||
key: Key(e.key),
|
||||
onTap: () {
|
||||
context.pop();
|
||||
setState(() {
|
||||
@@ -473,10 +482,13 @@ class _MultiPagesFilterState extends State<_MultiPagesFilter> {
|
||||
});
|
||||
updateSetting();
|
||||
},
|
||||
))
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
void updateSetting() {
|
||||
|
@@ -190,7 +190,6 @@ class IOSDirectoryPicker {
|
||||
final String? path = await _channel.invokeMethod('selectDirectory');
|
||||
return path;
|
||||
} catch (e) {
|
||||
print("Error selecting directory: $e");
|
||||
// 返回报错信息
|
||||
return e.toString();
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@ version: 1.0.5+105
|
||||
|
||||
environment:
|
||||
sdk: '>=3.5.0 <4.0.0'
|
||||
flutter: 3.24.4
|
||||
flutter: 3.24.5
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
|
Reference in New Issue
Block a user