mirror of
https://github.com/venera-app/venera.git
synced 2025-09-28 08:17:25 +00:00
improve ui
This commit is contained in:
@@ -56,13 +56,16 @@ class _CategoryComicsPageState extends State<CategoryComicsPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var topPadding = context.padding.top + 56.0;
|
||||
return Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: Appbar(
|
||||
title: Text(widget.category),
|
||||
),
|
||||
body: ComicList(
|
||||
key: Key(widget.category + optionsValue.toString()),
|
||||
leadingSliver: buildOptions().toSliver(),
|
||||
errorLeading: SizedBox(height: topPadding),
|
||||
leadingSliver: buildOptions().paddingTop(topPadding).toSliver(),
|
||||
loadPage: (i) => data.load(
|
||||
widget.category,
|
||||
widget.param,
|
||||
|
@@ -92,6 +92,9 @@ class _ComicPageState extends LoadingState<ComicPage, ComicDetails>
|
||||
@override
|
||||
Future<Res<ComicDetails>> loadData() async {
|
||||
var comicSource = ComicSource.find(widget.sourceKey);
|
||||
if(comicSource == null) {
|
||||
return const Res.error('Comic source not found');
|
||||
}
|
||||
isAddToLocalFav = LocalFavoritesManager().isExist(
|
||||
widget.id,
|
||||
ComicType(widget.sourceKey.hashCode),
|
||||
|
@@ -206,6 +206,7 @@ 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),
|
||||
trailing: IconButton(
|
||||
icon: const Icon(Icons.edit),
|
||||
onPressed: () {
|
||||
|
@@ -71,11 +71,16 @@ class NetworkFavoritePage extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _NormalFavoritePage extends StatelessWidget {
|
||||
_NormalFavoritePage(this.data);
|
||||
class _NormalFavoritePage extends StatefulWidget {
|
||||
const _NormalFavoritePage(this.data);
|
||||
|
||||
final FavoriteData data;
|
||||
|
||||
@override
|
||||
State<_NormalFavoritePage> createState() => _NormalFavoritePageState();
|
||||
}
|
||||
|
||||
class _NormalFavoritePageState extends State<_NormalFavoritePage> {
|
||||
final comicListKey = GlobalKey<ComicListState>();
|
||||
|
||||
@override
|
||||
@@ -95,7 +100,7 @@ class _NormalFavoritePage extends StatelessWidget {
|
||||
)
|
||||
: null,
|
||||
),
|
||||
title: Text(data.title),
|
||||
title: Text(widget.data.title),
|
||||
),
|
||||
errorLeading: Appbar(
|
||||
leading: Tooltip(
|
||||
@@ -110,10 +115,10 @@ class _NormalFavoritePage extends StatelessWidget {
|
||||
)
|
||||
: null,
|
||||
),
|
||||
title: Text(data.title),
|
||||
title: Text(widget.data.title),
|
||||
),
|
||||
loadPage: data.loadComic == null ? null : (i) => data.loadComic!(i),
|
||||
loadNext: data.loadNext == null ? null : (next) => data.loadNext!(next),
|
||||
loadPage: widget.data.loadComic == null ? null : (i) => widget.data.loadComic!(i),
|
||||
loadNext: widget.data.loadNext == null ? null : (next) => widget.data.loadNext!(next),
|
||||
menuBuilder: (comic) {
|
||||
return [
|
||||
MenuEntry(
|
||||
@@ -280,7 +285,7 @@ class _MultiFolderFavoritesPageState extends State<_MultiFolderFavoritesPage> {
|
||||
}
|
||||
}),
|
||||
maxCrossAxisExtent: 450,
|
||||
itemHeight: 64,
|
||||
itemHeight: 52,
|
||||
),
|
||||
if (widget.data.addFolder != null)
|
||||
SliverToBoxAdapter(
|
||||
@@ -342,17 +347,13 @@ class _FolderTile extends StatelessWidget {
|
||||
return Material(
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8, 8, 16, 8),
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 8),
|
||||
child: Row(
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 16,
|
||||
),
|
||||
Icon(
|
||||
Icons.folder,
|
||||
size: 35,
|
||||
size: 28,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
const SizedBox(
|
||||
@@ -370,15 +371,11 @@ class _FolderTile extends StatelessWidget {
|
||||
),
|
||||
if (deleteFolder != null)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.delete_forever_outlined),
|
||||
icon: const Icon(Icons.delete_outline),
|
||||
onPressed: () => onDeleteFolder(context),
|
||||
)
|
||||
else
|
||||
const Icon(Icons.arrow_right),
|
||||
if (deleteFolder == null)
|
||||
const SizedBox(
|
||||
width: 8,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@@ -85,7 +85,7 @@ class _HistoryPageState extends State<HistoryPage> {
|
||||
e.subtitle,
|
||||
null,
|
||||
getDescription(e),
|
||||
e.type.comicSource?.key ?? "Invalid",
|
||||
e.type.comicSource?.key ?? "Invalid:${e.type.value}",
|
||||
null,
|
||||
null,
|
||||
);
|
||||
@@ -100,10 +100,17 @@ class _HistoryPageState extends State<HistoryPage> {
|
||||
icon: Icons.remove,
|
||||
text: 'Remove'.tl,
|
||||
onClick: () {
|
||||
HistoryManager().remove(
|
||||
c.id,
|
||||
ComicType(c.sourceKey.hashCode),
|
||||
);
|
||||
if(c.sourceKey.startsWith("Invalid")) {
|
||||
HistoryManager().remove(
|
||||
c.id,
|
||||
ComicType(int.parse(c.sourceKey.split(':')[1])),
|
||||
);
|
||||
} else {
|
||||
HistoryManager().remove(
|
||||
c.id,
|
||||
ComicType(c.sourceKey.hashCode),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
];
|
||||
|
@@ -38,23 +38,23 @@ class _RankingPageState extends State<RankingPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var topPadding = context.padding.top + 56;
|
||||
return Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: Appbar(
|
||||
title: Text("Ranking".tl),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ComicList(
|
||||
loadPage: data.rankingData!.load == null
|
||||
? null
|
||||
: (i) => data.rankingData!.load!(optionValue, i),
|
||||
loadNext: data.rankingData!.loadWithNext == null
|
||||
? null
|
||||
: (i) => data.rankingData!.loadWithNext!(optionValue, i),
|
||||
),
|
||||
),
|
||||
],
|
||||
body: ComicList(
|
||||
key: Key(optionValue),
|
||||
errorLeading: SizedBox(height: topPadding),
|
||||
leadingSliver:
|
||||
buildOptions().sliverPadding(EdgeInsets.only(top: topPadding)),
|
||||
loadPage: data.rankingData!.load == null
|
||||
? null
|
||||
: (i) => data.rankingData!.load!(optionValue, i),
|
||||
loadNext: data.rankingData!.loadWithNext == null
|
||||
? null
|
||||
: (i) => data.rankingData!.loadWithNext!(optionValue, i),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user