improve ui

This commit is contained in:
wgh19
2024-06-12 16:05:50 +08:00
parent d247455c19
commit 54b64fb19b

View File

@@ -73,9 +73,9 @@ class _IllustGalleryPageState extends State<IllustGalleryPage> {
@override @override
void dispose() { void dispose() {
if(IllustGalleryPage.cachedHistoryIds.length > 5) { if (IllustGalleryPage.cachedHistoryIds.length > 5) {
Network().sendHistory( Network().sendHistory(
IllustGalleryPage.cachedHistoryIds.toList().reversed.toList()); IllustGalleryPage.cachedHistoryIds.toList().reversed.toList());
IllustGalleryPage.cachedHistoryIds.clear(); IllustGalleryPage.cachedHistoryIds.clear();
} }
super.dispose(); super.dispose();
@@ -101,16 +101,49 @@ class _IllustGalleryPageState extends State<IllustGalleryPage> {
length++; length++;
} }
return PageView.builder( return Stack(
controller: controller, children: [
itemCount: length, Positioned.fill(
itemBuilder: (context, index) { child: PageView.builder(
if (index == illusts.length) { controller: controller,
return buildLast(); itemCount: length,
} itemBuilder: (context, index) {
return IllustPage(illusts[index], if (index == illusts.length) {
nextPage: nextPage, previousPage: previousPage); return buildLast();
}, }
return IllustPage(illusts[index],
nextPage: nextPage, previousPage: previousPage);
},
onPageChanged: (value) => setState(() {}),
),
),
if (controller.page! < length - 1 && length > 1)
Positioned(
right: 16,
top: 0,
bottom: 0,
child: Center(
child: IconButton(
icon: const Icon(FluentIcons.chevron_right),
onPressed: () {
nextPage();
},
)),
),
if (controller.page != 0 && length > 1)
Positioned(
left: 16,
top: 0,
bottom: 0,
child: Center(
child: IconButton(
icon: const Icon(FluentIcons.chevron_left),
onPressed: () {
previousPage();
},
)),
),
],
); );
} }
@@ -183,7 +216,7 @@ class _IllustPageState extends State<IllustPage> {
}); });
}; };
HistoryManager().addHistory(widget.illust); HistoryManager().addHistory(widget.illust);
if(appdata.account!.user.isPremium) { if (appdata.account!.user.isPremium) {
IllustGalleryPage.cachedHistoryIds.add(widget.illust.id); IllustGalleryPage.cachedHistoryIds.add(widget.illust.id);
} }
super.initState(); super.initState();
@@ -1014,7 +1047,7 @@ class _BottomBarState extends State<_BottomBar> with TickerProviderStateMixin {
Widget buildMoreActions() { Widget buildMoreActions() {
return Wrap( return Wrap(
runSpacing: 4, runSpacing: 8,
spacing: 8, spacing: 8,
children: [ children: [
Button( Button(