mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
Compare commits
10 Commits
3a9d634edf
...
master
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7fa48cec29 | ||
e549a18dbf | |||
c17c4abb5b | |||
af57bc31b1 | |||
16449a1440 | |||
a7c1983f35 | |||
4c257d7178 | |||
![]() |
e179c8f67f | ||
![]() |
c4b85471c1 | ||
![]() |
a898b57d96 |
@@ -16,6 +16,7 @@
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:hardwareAccelerated="true"
|
||||
android:enableOnBackInvokedCallback="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||
the Android process has started. This theme is visible to the user
|
||||
|
@@ -17,6 +17,7 @@ ImageProvider? _findImageProvider(Comic comic) {
|
||||
comic.cover,
|
||||
sourceKey: comic.sourceKey,
|
||||
cid: comic.id,
|
||||
fallbackToLocalCover: comic is FavoriteItem,
|
||||
);
|
||||
}
|
||||
return image;
|
||||
|
@@ -7,6 +7,7 @@ class NetworkError extends StatelessWidget {
|
||||
this.retry,
|
||||
this.withAppbar = true,
|
||||
this.buttonText,
|
||||
this.action,
|
||||
});
|
||||
|
||||
final String message;
|
||||
@@ -17,6 +18,8 @@ class NetworkError extends StatelessWidget {
|
||||
|
||||
final String? buttonText;
|
||||
|
||||
final Widget? action;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var cfe = CloudflareException.fromString(message);
|
||||
@@ -67,12 +70,19 @@ class NetworkError extends StatelessWidget {
|
||||
child: Text('Verify'.tl),
|
||||
)
|
||||
else
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
if (action != null)
|
||||
action!.paddingRight(8),
|
||||
FilledButton(
|
||||
onPressed: retry,
|
||||
child: Text(buttonText ?? 'Retry'.tl),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (withAppbar) {
|
||||
body = Column(
|
||||
|
@@ -7,8 +7,11 @@ class PaneItemEntry {
|
||||
|
||||
IconData activeIcon;
|
||||
|
||||
PaneItemEntry(
|
||||
{required this.label, required this.icon, required this.activeIcon});
|
||||
PaneItemEntry({
|
||||
required this.label,
|
||||
required this.icon,
|
||||
required this.activeIcon,
|
||||
});
|
||||
}
|
||||
|
||||
class PaneActionEntry {
|
||||
@@ -18,20 +21,24 @@ class PaneActionEntry {
|
||||
|
||||
VoidCallback onTap;
|
||||
|
||||
PaneActionEntry(
|
||||
{required this.label, required this.icon, required this.onTap});
|
||||
PaneActionEntry({
|
||||
required this.label,
|
||||
required this.icon,
|
||||
required this.onTap,
|
||||
});
|
||||
}
|
||||
|
||||
class NaviPane extends StatefulWidget {
|
||||
const NaviPane(
|
||||
{required this.paneItems,
|
||||
const NaviPane({
|
||||
required this.paneItems,
|
||||
required this.paneActions,
|
||||
required this.pageBuilder,
|
||||
this.initialPage = 0,
|
||||
this.onPageChanged,
|
||||
required this.observer,
|
||||
required this.navigatorKey,
|
||||
super.key});
|
||||
super.key,
|
||||
});
|
||||
|
||||
final List<PaneItemEntry> paneItems;
|
||||
|
||||
@@ -187,7 +194,8 @@ class NaviPaneState extends State<NaviPane>
|
||||
child: buildLeft(),
|
||||
),
|
||||
Positioned.fill(
|
||||
left: _kFoldedSideBarWidth * ((value - 1).clamp(0, 1)) +
|
||||
left:
|
||||
_kFoldedSideBarWidth * ((value - 1).clamp(0, 1)) +
|
||||
(_kSideBarWidth - _kFoldedSideBarWidth) *
|
||||
((value - 2).clamp(0, 1)),
|
||||
child: buildMainView(),
|
||||
@@ -202,6 +210,10 @@ class NaviPaneState extends State<NaviPane>
|
||||
Widget buildMainView() {
|
||||
return HeroControllerScope(
|
||||
controller: MaterialApp.createMaterialHeroController(),
|
||||
child: NavigatorPopHandler(
|
||||
onPopWithResult: (result) {
|
||||
widget.navigatorKey.currentState?.maybePop(result);
|
||||
},
|
||||
child: Navigator(
|
||||
observers: [widget.observer],
|
||||
key: widget.navigatorKey,
|
||||
@@ -212,6 +224,7 @@ class NaviPaneState extends State<NaviPane>
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -239,7 +252,7 @@ class NaviPaneState extends State<NaviPane>
|
||||
icon: Icon(action.icon),
|
||||
onPressed: action.onTap,
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -261,9 +274,7 @@ class NaviPaneState extends State<NaviPane>
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: List<Widget>.generate(
|
||||
widget.paneItems.length,
|
||||
(index) {
|
||||
children: List<Widget>.generate(widget.paneItems.length, (index) {
|
||||
return Expanded(
|
||||
child: _SingleBottomNaviWidget(
|
||||
enabled: currentPage == index,
|
||||
@@ -274,8 +285,7 @@ class NaviPaneState extends State<NaviPane>
|
||||
key: ValueKey(index),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -286,7 +296,8 @@ class NaviPaneState extends State<NaviPane>
|
||||
const paddingHorizontal = 12.0;
|
||||
return Material(
|
||||
child: Container(
|
||||
width: _kFoldedSideBarWidth +
|
||||
width:
|
||||
_kFoldedSideBarWidth +
|
||||
(_kSideBarWidth - _kFoldedSideBarWidth) * ((value - 2).clamp(0, 1)),
|
||||
height: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(horizontal: paddingHorizontal),
|
||||
@@ -323,9 +334,7 @@ class NaviPaneState extends State<NaviPane>
|
||||
key: ValueKey(index + widget.paneItems.length),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
)
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -334,12 +343,13 @@ class NaviPaneState extends State<NaviPane>
|
||||
}
|
||||
|
||||
class _SideNaviWidget extends StatelessWidget {
|
||||
const _SideNaviWidget(
|
||||
{required this.enabled,
|
||||
const _SideNaviWidget({
|
||||
required this.enabled,
|
||||
required this.entry,
|
||||
required this.onTap,
|
||||
required this.showTitle,
|
||||
super.key});
|
||||
super.key,
|
||||
});
|
||||
|
||||
final bool enabled;
|
||||
|
||||
@@ -368,18 +378,18 @@ class _SideNaviWidget extends StatelessWidget {
|
||||
? Row(
|
||||
children: [icon, const SizedBox(width: 12), Text(entry.label)],
|
||||
)
|
||||
: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: icon,
|
||||
),
|
||||
: Align(alignment: Alignment.centerLeft, child: icon),
|
||||
),
|
||||
).paddingVertical(4);
|
||||
}
|
||||
}
|
||||
|
||||
class _PaneActionWidget extends StatelessWidget {
|
||||
const _PaneActionWidget(
|
||||
{required this.entry, required this.showTitle, super.key});
|
||||
const _PaneActionWidget({
|
||||
required this.entry,
|
||||
required this.showTitle,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final PaneActionEntry entry;
|
||||
|
||||
@@ -399,21 +409,19 @@ class _PaneActionWidget extends StatelessWidget {
|
||||
? Row(
|
||||
children: [icon, const SizedBox(width: 12), Text(entry.label)],
|
||||
)
|
||||
: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: icon,
|
||||
),
|
||||
: Align(alignment: Alignment.centerLeft, child: icon),
|
||||
),
|
||||
).paddingVertical(4);
|
||||
}
|
||||
}
|
||||
|
||||
class _SingleBottomNaviWidget extends StatefulWidget {
|
||||
const _SingleBottomNaviWidget(
|
||||
{required this.enabled,
|
||||
const _SingleBottomNaviWidget({
|
||||
required this.enabled,
|
||||
required this.entry,
|
||||
required this.onTap,
|
||||
super.key});
|
||||
super.key,
|
||||
});
|
||||
|
||||
final bool enabled;
|
||||
|
||||
@@ -482,8 +490,9 @@ class _SingleBottomNaviWidgetState extends State<_SingleBottomNaviWidget>
|
||||
Widget buildContent() {
|
||||
final value = controller.value;
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final icon =
|
||||
Icon(widget.enabled ? widget.entry.activeIcon : widget.entry.icon);
|
||||
final icon = Icon(
|
||||
widget.enabled ? widget.entry.activeIcon : widget.entry.icon,
|
||||
);
|
||||
return Center(
|
||||
child: Container(
|
||||
width: 64,
|
||||
@@ -570,8 +579,11 @@ class NaviObserver extends NavigatorObserver implements Listenable {
|
||||
}
|
||||
|
||||
class _NaviPopScope extends StatelessWidget {
|
||||
const _NaviPopScope(
|
||||
{required this.child, this.popGesture = false, required this.action});
|
||||
const _NaviPopScope({
|
||||
required this.child,
|
||||
this.popGesture = false,
|
||||
required this.action,
|
||||
});
|
||||
|
||||
final Widget child;
|
||||
final bool popGesture;
|
||||
@@ -581,15 +593,7 @@ class _NaviPopScope extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget res = App.isIOS
|
||||
? child
|
||||
: PopScope(
|
||||
canPop: App.isAndroid ? false : true,
|
||||
onPopInvokedWithResult: (value, result) {
|
||||
action();
|
||||
},
|
||||
child: child,
|
||||
);
|
||||
Widget res = child;
|
||||
if (popGesture) {
|
||||
res = GestureDetector(
|
||||
onPanStart: (details) {
|
||||
@@ -606,7 +610,8 @@ class _NaviPopScope extends StatelessWidget {
|
||||
}
|
||||
panStartAtEdge = false;
|
||||
},
|
||||
child: res);
|
||||
child: res,
|
||||
);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@@ -237,7 +237,7 @@ class _AppScrollBarState extends State<AppScrollBar> {
|
||||
|
||||
double viewHeight = 0;
|
||||
|
||||
final _scrollIndicatorSize = App.isDesktop ? 42.0 : 64.0;
|
||||
final _scrollIndicatorSize = App.isDesktop ? 36.0 : 54.0;
|
||||
|
||||
late final VerticalDragGestureRecognizer _dragGestureRecognizer;
|
||||
|
||||
@@ -354,7 +354,7 @@ class _ScrollIndicatorPainter extends CustomPainter {
|
||||
Offset(size.width, 0),
|
||||
radius: Radius.circular(size.width),
|
||||
);
|
||||
canvas.drawShadow(path, shadowColor, 4, true);
|
||||
canvas.drawShadow(path, shadowColor, 2, true);
|
||||
var backgroundPaint = Paint()
|
||||
..color = backgroundColor
|
||||
..style = PaintingStyle.fill;
|
||||
|
@@ -13,7 +13,7 @@ export "widget_utils.dart";
|
||||
export "context.dart";
|
||||
|
||||
class _App {
|
||||
final version = "1.5.0";
|
||||
final version = "1.5.1";
|
||||
|
||||
bool get isAndroid => Platform.isAndroid;
|
||||
|
||||
|
@@ -2,6 +2,7 @@ import 'dart:math';
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:venera/foundation/app.dart';
|
||||
|
||||
const double _kBackGestureWidth = 20.0;
|
||||
const int _kMaxDroppedSwipePageForwardAnimationTime = 800;
|
||||
@@ -115,7 +116,14 @@ mixin _AppRouteTransitionMixin<T> on PageRoute<T> {
|
||||
|
||||
@override
|
||||
Widget buildTransitions(BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child) {
|
||||
return SlidePageTransitionBuilder().buildTransitions(
|
||||
PageTransitionsBuilder builder;
|
||||
if (App.isAndroid) {
|
||||
builder = PredictiveBackPageTransitionsBuilder();
|
||||
} else {
|
||||
builder = SlidePageTransitionBuilder();
|
||||
}
|
||||
|
||||
return builder.buildTransitions(
|
||||
this,
|
||||
context,
|
||||
animation,
|
||||
|
@@ -1,6 +1,8 @@
|
||||
import 'dart:async' show Future;
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:venera/foundation/comic_type.dart';
|
||||
import 'package:venera/foundation/local.dart';
|
||||
import 'package:venera/network/images.dart';
|
||||
import 'package:venera/utils/io.dart';
|
||||
import 'base_image_provider.dart';
|
||||
@@ -11,7 +13,12 @@ class CachedImageProvider
|
||||
/// Image provider for normal image.
|
||||
///
|
||||
/// [url] is the url of the image. Local file path is also supported.
|
||||
const CachedImageProvider(this.url, {this.headers, this.sourceKey, this.cid});
|
||||
const CachedImageProvider(this.url, {
|
||||
this.headers,
|
||||
this.sourceKey,
|
||||
this.cid,
|
||||
this.fallbackToLocalCover = false,
|
||||
});
|
||||
|
||||
final String url;
|
||||
|
||||
@@ -21,6 +28,9 @@ class CachedImageProvider
|
||||
|
||||
final String? cid;
|
||||
|
||||
// Use local cover if network image fails to load.
|
||||
final bool fallbackToLocalCover;
|
||||
|
||||
static int loadingCount = 0;
|
||||
|
||||
static const _kMaxLoadingCount = 8;
|
||||
@@ -49,6 +59,24 @@ class CachedImageProvider
|
||||
}
|
||||
throw "Error: Empty response body.";
|
||||
}
|
||||
catch(e) {
|
||||
if (fallbackToLocalCover && sourceKey != null && cid != null) {
|
||||
final localComic = LocalManager().find(
|
||||
cid!,
|
||||
ComicType.fromKey(sourceKey!),
|
||||
);
|
||||
if (localComic != null) {
|
||||
var file = localComic.coverFile;
|
||||
if (await file.exists()) {
|
||||
var data = await file.readAsBytes();
|
||||
if (data.isNotEmpty) {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
rethrow;
|
||||
}
|
||||
finally {
|
||||
loadingCount--;
|
||||
}
|
||||
|
@@ -248,7 +248,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
|
||||
MediaQuery.of(context).viewPadding.top <= 0 ||
|
||||
MediaQuery.of(context).viewPadding.top > 50;
|
||||
|
||||
if (isPaddingCheckError) {
|
||||
if (isPaddingCheckError && Platform.isAndroid) {
|
||||
widget = MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(
|
||||
viewPadding: const EdgeInsets.only(
|
||||
|
@@ -77,8 +77,10 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
|
||||
@override
|
||||
void onReadEnd() {
|
||||
history ??=
|
||||
HistoryManager().find(widget.id, ComicType(widget.sourceKey.hashCode));
|
||||
history ??= HistoryManager().find(
|
||||
widget.id,
|
||||
ComicType(widget.sourceKey.hashCode),
|
||||
);
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -93,6 +95,32 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget buildError() {
|
||||
final isDownloaded = LocalManager().isDownloaded(
|
||||
widget.id,
|
||||
ComicType.fromKey(widget.sourceKey),
|
||||
);
|
||||
Widget? action;
|
||||
if (isDownloaded) {
|
||||
action = FilledButton.tonal(
|
||||
child: Text("Read".tl),
|
||||
onPressed: () {
|
||||
final localComic = LocalManager().find(
|
||||
widget.id,
|
||||
ComicType.fromKey(widget.sourceKey),
|
||||
);
|
||||
if (localComic == null) {
|
||||
context.showMessage(message: "Local comic not found".tl);
|
||||
return;
|
||||
}
|
||||
localComic.read();
|
||||
},
|
||||
);
|
||||
}
|
||||
return NetworkError(message: error!, retry: retry, action: action);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
scrollController.addListener(onScroll);
|
||||
@@ -114,7 +142,8 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
ComicDetails get comic => data!;
|
||||
|
||||
void onScroll() {
|
||||
var offset = scrollController.position.pixels -
|
||||
var offset =
|
||||
scrollController.position.pixels -
|
||||
scrollController.position.minScrollExtent;
|
||||
var showFAB = offset > 0;
|
||||
if (showFAB != this.showFAB) {
|
||||
@@ -145,9 +174,11 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
floatingActionButton: showFAB
|
||||
? FloatingActionButton(
|
||||
onPressed: () {
|
||||
scrollController.animateTo(0,
|
||||
scrollController.animateTo(
|
||||
0,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
curve: Curves.ease);
|
||||
curve: Curves.ease,
|
||||
);
|
||||
},
|
||||
child: const Icon(Icons.arrow_upward),
|
||||
)
|
||||
@@ -164,7 +195,9 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
buildThumbnails(),
|
||||
buildRecommend(),
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.only(bottom: context.padding.bottom + 80), // Add additional padding for FAB
|
||||
padding: EdgeInsets.only(
|
||||
bottom: context.padding.bottom + 80,
|
||||
), // Add additional padding for FAB
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -190,12 +223,9 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
initialPage: history?.page,
|
||||
initialChapter: history?.ep,
|
||||
initialChapterGroup: history?.group,
|
||||
history: history ??
|
||||
History.fromModel(
|
||||
model: localComic,
|
||||
ep: 0,
|
||||
page: 0,
|
||||
),
|
||||
history:
|
||||
history ??
|
||||
History.fromModel(model: localComic, ep: 0, page: 0),
|
||||
author: localComic.subTitle ?? '',
|
||||
tags: localComic.tags,
|
||||
);
|
||||
@@ -215,8 +245,10 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
widget.id,
|
||||
ComicType(widget.sourceKey.hashCode),
|
||||
);
|
||||
history =
|
||||
HistoryManager().find(widget.id, ComicType(widget.sourceKey.hashCode));
|
||||
history = HistoryManager().find(
|
||||
widget.id,
|
||||
ComicType(widget.sourceKey.hashCode),
|
||||
);
|
||||
return comicSource.loadComicInfo!(widget.id);
|
||||
}
|
||||
|
||||
@@ -225,11 +257,7 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
isLiked = comic.isLiked ?? false;
|
||||
isFavorite = comic.isFavorite ?? false;
|
||||
if (comic.chapters == null) {
|
||||
isDownloaded = LocalManager().isDownloaded(
|
||||
comic.id,
|
||||
comic.comicType,
|
||||
0,
|
||||
);
|
||||
isDownloaded = LocalManager().isDownloaded(comic.id, comic.comicType, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +270,9 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: showMoreActions, icon: const Icon(Icons.more_horiz))
|
||||
onPressed: showMoreActions,
|
||||
icon: const Icon(Icons.more_horiz),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -288,8 +318,10 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
children: [
|
||||
SelectableText(comic.title, style: ts.s18),
|
||||
if (comic.subTitle != null)
|
||||
SelectableText(comic.subTitle!, style: ts.s14)
|
||||
.paddingVertical(4),
|
||||
SelectableText(
|
||||
comic.subTitle!,
|
||||
style: ts.s14,
|
||||
).paddingVertical(4),
|
||||
Text(
|
||||
(ComicSource.find(comic.sourceKey)?.name) ?? '',
|
||||
style: ts.s12,
|
||||
@@ -338,7 +370,8 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
icon: const Icon(Icons.favorite_border),
|
||||
activeIcon: const Icon(Icons.favorite),
|
||||
isActive: isLiked,
|
||||
text: ((data!.likesCount != null)
|
||||
text:
|
||||
((data!.likesCount != null)
|
||||
? (data!.likesCount! + (isLiked ? 1 : 0))
|
||||
: (isLiked ? 'Liked'.tl : 'Like'.tl))
|
||||
.toString(),
|
||||
@@ -383,9 +416,11 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
Expanded(
|
||||
child: hasHistory
|
||||
? FilledButton(
|
||||
onPressed: continueRead, child: Text("Continue".tl))
|
||||
: FilledButton(onPressed: read, child: Text("Read".tl)),
|
||||
onPressed: continueRead,
|
||||
child: Text("Continue".tl),
|
||||
)
|
||||
: FilledButton(onPressed: read, child: Text("Read".tl)),
|
||||
),
|
||||
],
|
||||
).paddingHorizontal(16).paddingVertical(8),
|
||||
if (history != null)
|
||||
@@ -417,14 +452,15 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
math.min(ep - 1, comic.chapters!.length - 1),
|
||||
);
|
||||
} else {
|
||||
groupName = comic.chapters!.groups.elementAt(group - 1);
|
||||
groupName = comic.chapters!.groups.elementAt(
|
||||
group - 1,
|
||||
);
|
||||
epName = comic.chapters!
|
||||
.getGroupByIndex(group - 1)
|
||||
.values
|
||||
.elementAt(ep - 1);
|
||||
}
|
||||
}
|
||||
catch(e) {
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
text = groupName == null
|
||||
@@ -453,9 +489,7 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
return SliverLazyToBoxAdapter(
|
||||
child: Column(
|
||||
children: [
|
||||
ListTile(
|
||||
title: Text("Description".tl),
|
||||
),
|
||||
ListTile(title: Text("Description".tl)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: SelectableText(comic.description!).fixWidth(double.infinity),
|
||||
@@ -539,10 +573,7 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
);
|
||||
} else {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: color,
|
||||
borderRadius: borderRadius,
|
||||
),
|
||||
decoration: BoxDecoration(color: color, borderRadius: borderRadius),
|
||||
child: Text(text).padding(padding),
|
||||
);
|
||||
}
|
||||
@@ -552,13 +583,13 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
if (int.tryParse(time) != null) {
|
||||
var t = int.tryParse(time);
|
||||
if (t! > 1000000000000) {
|
||||
return DateTime.fromMillisecondsSinceEpoch(t)
|
||||
.toString()
|
||||
.substring(0, 19);
|
||||
return DateTime.fromMillisecondsSinceEpoch(
|
||||
t,
|
||||
).toString().substring(0, 19);
|
||||
} else {
|
||||
return DateTime.fromMillisecondsSinceEpoch(t * 1000)
|
||||
.toString()
|
||||
.substring(0, 19);
|
||||
return DateTime.fromMillisecondsSinceEpoch(
|
||||
t * 1000,
|
||||
).toString().substring(0, 19);
|
||||
}
|
||||
}
|
||||
if (time.contains('T') || time.contains('Z')) {
|
||||
@@ -583,17 +614,11 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ListTile(
|
||||
title: Text("Information".tl),
|
||||
),
|
||||
ListTile(title: Text("Information".tl)),
|
||||
if (comic.stars != null)
|
||||
Row(
|
||||
children: [
|
||||
StarRating(
|
||||
value: comic.stars!,
|
||||
size: 24,
|
||||
onTap: starRating,
|
||||
),
|
||||
StarRating(value: comic.stars!, size: 24, onTap: starRating),
|
||||
const SizedBox(width: 8),
|
||||
Text(comic.stars!.toStringAsFixed(2)),
|
||||
],
|
||||
@@ -671,24 +696,19 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
if (comic.recommend == null || comic.recommend!.isEmpty) {
|
||||
return const SliverPadding(padding: EdgeInsets.zero);
|
||||
}
|
||||
return SliverMainAxisGroup(slivers: [
|
||||
SliverToBoxAdapter(
|
||||
child: ListTile(
|
||||
title: Text("Related".tl),
|
||||
),
|
||||
),
|
||||
return SliverMainAxisGroup(
|
||||
slivers: [
|
||||
SliverToBoxAdapter(child: ListTile(title: Text("Related".tl))),
|
||||
SliverGridComics(comics: comic.recommend!),
|
||||
]);
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildComments() {
|
||||
if (comic.comments == null || comic.comments!.isEmpty) {
|
||||
return const SliverPadding(padding: EdgeInsets.zero);
|
||||
}
|
||||
return _CommentsPart(
|
||||
comments: comic.comments!,
|
||||
showMore: showComments,
|
||||
);
|
||||
return _CommentsPart(comments: comic.comments!, showMore: showComments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -793,8 +813,8 @@ class _SelectDownloadChapterState extends State<_SelectDownloadChapter> {
|
||||
itemBuilder: (context, i) {
|
||||
return CheckboxListTile(
|
||||
title: Text(widget.eps[i]),
|
||||
value: selected.contains(i) ||
|
||||
widget.downloadedEps.contains(i),
|
||||
value:
|
||||
selected.contains(i) || widget.downloadedEps.contains(i),
|
||||
onChanged: widget.downloadedEps.contains(i)
|
||||
? null
|
||||
: (v) {
|
||||
@@ -805,7 +825,8 @@ class _SelectDownloadChapterState extends State<_SelectDownloadChapter> {
|
||||
selected.add(i);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -813,9 +834,7 @@ class _SelectDownloadChapterState extends State<_SelectDownloadChapter> {
|
||||
height: 50,
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
color: context.colorScheme.outlineVariant,
|
||||
),
|
||||
top: BorderSide(color: context.colorScheme.outlineVariant),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
@@ -880,8 +899,12 @@ class _ComicPageLoadingPlaceHolder extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget buildContainer(double? width, double? height,
|
||||
{Color? color, double? radius}) {
|
||||
Widget buildContainer(
|
||||
double? width,
|
||||
double? height, {
|
||||
Color? color,
|
||||
double? radius,
|
||||
}) {
|
||||
return Container(
|
||||
height: height,
|
||||
width: width,
|
||||
@@ -923,13 +946,9 @@ class _ComicPageLoadingPlaceHolder extends StatelessWidget {
|
||||
if (context.width < changePoint)
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: buildContainer(null, 36, radius: 18),
|
||||
),
|
||||
Expanded(child: buildContainer(null, 36, radius: 18)),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: buildContainer(null, 36, radius: 18),
|
||||
),
|
||||
Expanded(child: buildContainer(null, 36, radius: 18)),
|
||||
],
|
||||
).paddingHorizontal(16),
|
||||
const Divider(),
|
||||
@@ -938,7 +957,7 @@ class _ComicPageLoadingPlaceHolder extends StatelessWidget {
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2.4,
|
||||
).fixHeight(24).fixWidth(24),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -948,11 +967,7 @@ class _ComicPageLoadingPlaceHolder extends StatelessWidget {
|
||||
Widget child;
|
||||
if (cover != null) {
|
||||
child = AnimatedImage(
|
||||
image: CachedImageProvider(
|
||||
cover!,
|
||||
sourceKey: sourceKey,
|
||||
cid: cid,
|
||||
),
|
||||
image: CachedImageProvider(cover!, sourceKey: sourceKey, cid: cid),
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
fit: BoxFit.cover,
|
||||
|
@@ -512,6 +512,18 @@ class _LocalFavoritesPageState extends State<_LocalFavoritesPage> {
|
||||
);
|
||||
},
|
||||
),
|
||||
if (selectedComics.length == 1)
|
||||
MenuEntry(
|
||||
icon: Icons.chrome_reader_mode_outlined,
|
||||
text: "Read".tl,
|
||||
onClick: () {
|
||||
final c = selectedComics.keys.first as FavoriteItem;
|
||||
App.rootContext.to(() => ReaderWithLoading(
|
||||
id: c.id,
|
||||
sourceKey: c.sourceKey,
|
||||
));
|
||||
},
|
||||
),
|
||||
]),
|
||||
],
|
||||
)
|
||||
|
@@ -2,11 +2,11 @@ name: venera
|
||||
description: "A comic app."
|
||||
publish_to: 'none'
|
||||
|
||||
version: 1.5.0+150
|
||||
version: 1.5.1+151
|
||||
|
||||
environment:
|
||||
sdk: '>=3.8.0 <4.0.0'
|
||||
flutter: 3.35.2
|
||||
flutter: 3.35.3
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
|
Reference in New Issue
Block a user