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,6 +43,9 @@ android {
|
|||||||
sourceCompatibility = JavaVersion.VERSION_17
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
targetCompatibility = JavaVersion.VERSION_17
|
targetCompatibility = JavaVersion.VERSION_17
|
||||||
}
|
}
|
||||||
|
kotlinOptions{
|
||||||
|
jvmTarget = JavaVersion.VERSION_17
|
||||||
|
}
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
debug {
|
debug {
|
||||||
|
@@ -277,7 +277,8 @@ class ComicTile extends StatelessWidget {
|
|||||||
onTap: _onTap,
|
onTap: _onTap,
|
||||||
onLongPress:
|
onLongPress:
|
||||||
enableLongPressed ? () => onLongPress(context) : null,
|
enableLongPressed ? () => onLongPress(context) : null,
|
||||||
onSecondaryTapDown: (detail) => onSecondaryTap(detail, context),
|
onSecondaryTapDown: (detail) =>
|
||||||
|
onSecondaryTap(detail, context),
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
child: const SizedBox.expand(),
|
child: const SizedBox.expand(),
|
||||||
),
|
),
|
||||||
@@ -296,7 +297,7 @@ class ComicTile extends StatelessWidget {
|
|||||||
var words = <String>[];
|
var words = <String>[];
|
||||||
var all = <String>[];
|
var all = <String>[];
|
||||||
all.addAll(comic.title.split(' ').where((element) => element != ''));
|
all.addAll(comic.title.split(' ').where((element) => element != ''));
|
||||||
if(comic.subtitle != null && comic.subtitle != "") {
|
if (comic.subtitle != null && comic.subtitle != "") {
|
||||||
all.add(comic.subtitle!);
|
all.add(comic.subtitle!);
|
||||||
}
|
}
|
||||||
all.addAll(comic.tags ?? []);
|
all.addAll(comic.tags ?? []);
|
||||||
@@ -332,7 +333,8 @@ class ComicTile extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
appdata.saveData();
|
appdata.saveData();
|
||||||
context.showMessage(message: 'Blocked'.tl);
|
context.showMessage(message: 'Blocked'.tl);
|
||||||
comicTileContext.findAncestorStateOfType<_SliverGridComicsState>()!
|
comicTileContext
|
||||||
|
.findAncestorStateOfType<_SliverGridComicsState>()!
|
||||||
.update();
|
.update();
|
||||||
},
|
},
|
||||||
child: Text('Block'.tl),
|
child: Text('Block'.tl),
|
||||||
@@ -370,6 +372,9 @@ class _ComicDescription extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (tags != null) {
|
if (tags != null) {
|
||||||
tags!.removeWhere((element) => element.removeAllBlank == "");
|
tags!.removeWhere((element) => element.removeAllBlank == "");
|
||||||
|
for (var s in tags!) {
|
||||||
|
s = s.replaceAll("\n", " ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var enableTranslate =
|
var enableTranslate =
|
||||||
App.locale.languageCode == 'zh' && this.enableTranslate;
|
App.locale.languageCode == 'zh' && this.enableTranslate;
|
||||||
@@ -384,50 +389,57 @@ class _ComicDescription extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
maxLines: maxLines,
|
maxLines: maxLines,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
|
softWrap: true,
|
||||||
),
|
),
|
||||||
if (subtitle != "")
|
if (subtitle != "")
|
||||||
Text(
|
Text(
|
||||||
subtitle,
|
subtitle,
|
||||||
style: const TextStyle(fontSize: 10.0),
|
style: TextStyle(
|
||||||
|
fontSize: 10.0,
|
||||||
|
color: context.colorScheme.onSurface.withOpacity(0.7)),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
|
softWrap: true,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 4,
|
height: 4,
|
||||||
),
|
),
|
||||||
if (tags != null)
|
if (tags != null)
|
||||||
Expanded(
|
LayoutBuilder(builder: (context, constraints) {
|
||||||
child: LayoutBuilder(
|
return Container(
|
||||||
builder: (context, constraints) => Padding(
|
constraints: const BoxConstraints(maxHeight: 45),
|
||||||
padding: EdgeInsets.only(bottom: constraints.maxHeight % 23),
|
|
||||||
child: Wrap(
|
child: Wrap(
|
||||||
runAlignment: WrapAlignment.start,
|
runAlignment: WrapAlignment.start,
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
crossAxisAlignment: WrapCrossAlignment.end,
|
crossAxisAlignment: WrapCrossAlignment.end,
|
||||||
|
spacing: 4,
|
||||||
|
runSpacing: 3,
|
||||||
children: [
|
children: [
|
||||||
for (var s in tags!)
|
for (var s in tags!)
|
||||||
Container(
|
Container(
|
||||||
margin: const EdgeInsets.fromLTRB(0, 0, 4, 3),
|
|
||||||
padding: const EdgeInsets.fromLTRB(3, 1, 3, 3),
|
padding: const EdgeInsets.fromLTRB(3, 1, 3, 3),
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
maxWidth: constraints.maxWidth * 0.45,
|
||||||
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: s == "Unavailable"
|
color: s == "Unavailable"
|
||||||
? Theme.of(context).colorScheme.errorContainer
|
? Theme.of(context).colorScheme.errorContainer
|
||||||
: Theme.of(context)
|
: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
.colorScheme
|
|
||||||
.secondaryContainer,
|
|
||||||
borderRadius:
|
borderRadius:
|
||||||
const BorderRadius.all(Radius.circular(8)),
|
const BorderRadius.all(Radius.circular(8)),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
enableTranslate ? TagsTranslation.translateTag(s) : s,
|
enableTranslate ? TagsTranslation.translateTag(s) : s,
|
||||||
style: const TextStyle(fontSize: 12),
|
style: const TextStyle(fontSize: 12),
|
||||||
|
softWrap: true,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
maxLines: 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
),
|
}),
|
||||||
),
|
|
||||||
const SizedBox(height: 2),
|
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
if (rating != null) StarRating(value: rating!, size: 18),
|
if (rating != null) StarRating(value: rating!, size: 18),
|
||||||
Row(
|
Row(
|
||||||
|
@@ -245,7 +245,7 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
|||||||
iconColor: context.useTextColor(Colors.red),
|
iconColor: context.useTextColor(Colors.red),
|
||||||
),
|
),
|
||||||
_ActionButton(
|
_ActionButton(
|
||||||
icon: const Icon(Icons.bookmark_border),
|
icon: const Icon(Icons.bookmark_outline_outlined),
|
||||||
activeIcon: const Icon(Icons.bookmark),
|
activeIcon: const Icon(Icons.bookmark),
|
||||||
isActive: isFavorite || isAddToLocalFav,
|
isActive: isFavorite || isAddToLocalFav,
|
||||||
text: 'Favorite'.tl,
|
text: 'Favorite'.tl,
|
||||||
@@ -514,8 +514,9 @@ abstract mixin class _ComicPageActions {
|
|||||||
cid: comic.id,
|
cid: comic.id,
|
||||||
type: comic.comicType,
|
type: comic.comicType,
|
||||||
isFavorite: isFavorite,
|
isFavorite: isFavorite,
|
||||||
onFavorite: (b) {
|
onFavorite: (local,network) {
|
||||||
isFavorite = b;
|
isFavorite=network??isFavorite;
|
||||||
|
isAddToLocalFav=local??isAddToLocalFav;
|
||||||
update();
|
update();
|
||||||
},
|
},
|
||||||
favoriteItem: FavoriteItem(
|
favoriteItem: FavoriteItem(
|
||||||
@@ -759,6 +760,7 @@ abstract mixin class _ComicPageActions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ActionButton extends StatelessWidget {
|
class _ActionButton extends StatelessWidget {
|
||||||
|
|
||||||
const _ActionButton({
|
const _ActionButton({
|
||||||
required this.icon,
|
required this.icon,
|
||||||
required this.text,
|
required this.text,
|
||||||
@@ -768,7 +770,6 @@ class _ActionButton extends StatelessWidget {
|
|||||||
this.isLoading,
|
this.isLoading,
|
||||||
this.iconColor,
|
this.iconColor,
|
||||||
});
|
});
|
||||||
|
|
||||||
final Widget icon;
|
final Widget icon;
|
||||||
|
|
||||||
final Widget? activeIcon;
|
final Widget? activeIcon;
|
||||||
@@ -782,7 +783,6 @@ class _ActionButton extends StatelessWidget {
|
|||||||
final bool? isLoading;
|
final bool? isLoading;
|
||||||
|
|
||||||
final Color? iconColor;
|
final Color? iconColor;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
@@ -824,6 +824,7 @@ class _ActionButton extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class _ComicChapters extends StatefulWidget {
|
class _ComicChapters extends StatefulWidget {
|
||||||
const _ComicChapters();
|
const _ComicChapters();
|
||||||
|
|
||||||
@@ -1118,7 +1119,7 @@ class _FavoritePanel extends StatefulWidget {
|
|||||||
/// if null, the comic source does not support favorite or support multiple favorite lists
|
/// if null, the comic source does not support favorite or support multiple favorite lists
|
||||||
final bool? isFavorite;
|
final bool? isFavorite;
|
||||||
|
|
||||||
final void Function(bool) onFavorite;
|
final void Function(bool?,bool?) onFavorite;
|
||||||
|
|
||||||
final FavoriteItem favoriteItem;
|
final FavoriteItem favoriteItem;
|
||||||
|
|
||||||
@@ -1262,10 +1263,12 @@ class _FavoritePanelState extends State<_FavoritePanel> {
|
|||||||
LocalFavoritesManager()
|
LocalFavoritesManager()
|
||||||
.deleteComicWithId(folder, widget.cid, widget.type);
|
.deleteComicWithId(folder, widget.cid, widget.type);
|
||||||
}
|
}
|
||||||
|
widget.onFavorite(false,null);
|
||||||
} else {
|
} else {
|
||||||
for (var folder in selectedLocalFolders) {
|
for (var folder in selectedLocalFolders) {
|
||||||
LocalFavoritesManager().addComic(folder, widget.favoriteItem);
|
LocalFavoritesManager().addComic(folder, widget.favoriteItem);
|
||||||
}
|
}
|
||||||
|
widget.onFavorite(true,null);
|
||||||
}
|
}
|
||||||
context.pop();
|
context.pop();
|
||||||
},
|
},
|
||||||
@@ -1281,7 +1284,9 @@ class _FavoritePanelState extends State<_FavoritePanel> {
|
|||||||
cid: widget.cid,
|
cid: widget.cid,
|
||||||
comicSource: comicSource,
|
comicSource: comicSource,
|
||||||
isFavorite: widget.isFavorite,
|
isFavorite: widget.isFavorite,
|
||||||
onFavorite: widget.onFavorite,
|
onFavorite: (network){
|
||||||
|
widget.onFavorite(null,network);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1332,6 +1337,7 @@ class _NetworkFavoritesState extends State<_NetworkFavorites> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
var res = await widget.comicSource.favoriteData!
|
var res = await widget.comicSource.favoriteData!
|
||||||
.addOrDelFavorite!(widget.cid, '', !isFavorite, null);
|
.addOrDelFavorite!(widget.cid, '', !isFavorite, null);
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
|
Reference in New Issue
Block a user