mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 11:08:03 +08:00
tweaks (#1252)
* opt: cache * opt: MediaListPanel * feat: nested replyreply panel * tweaks * opt: abstract class * opt: PageStorageKey * opt: contextExt * opt: EpisodePanel * opt * opt: context instead GlobalKey * feat: jump to reply * refa: reply_reply * fix: jump * fix: index * update Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * opt: keepalive * reapply: nested replyreply * mod: spacing * opt: CommonSlidePageState * fix drag bottomsheet Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * opt reply jump Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * opt reply2reply Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * tweaks Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * tweaks Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * reapply: jumpToReply * fix: padding * fix: anim * fix some panels Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * opt: implements Scaffold * opt: remove keepalive * revert: GlobalKey * tweaks Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> --------- Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
committed by
GitHub
parent
b9a55ccbce
commit
37fb63c3b1
@@ -36,14 +36,13 @@ class NoteListPage extends CommonSlidePage {
|
||||
State<NoteListPage> createState() => _NoteListPageState();
|
||||
}
|
||||
|
||||
class _NoteListPageState extends CommonSlidePageState<NoteListPage> {
|
||||
class _NoteListPageState extends State<NoteListPage>
|
||||
with SingleTickerProviderStateMixin, CommonSlideMixin {
|
||||
late final _controller = Get.put(
|
||||
NoteListPageCtr(oid: widget.oid, upperMid: widget.upperMid),
|
||||
tag: widget.heroTag,
|
||||
);
|
||||
|
||||
final _key = GlobalKey<ScaffoldState>();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
Get.delete<NoteListPageCtr>(tag: widget.heroTag);
|
||||
@@ -54,7 +53,6 @@ class _NoteListPageState extends CommonSlidePageState<NoteListPage> {
|
||||
Widget buildPage(ThemeData theme) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
key: _key,
|
||||
body: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
@@ -92,6 +90,14 @@ class _NoteListPageState extends CommonSlidePageState<NoteListPage> {
|
||||
);
|
||||
}
|
||||
|
||||
late Key _key;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
_key = ValueKey(PrimaryScrollController.of(context).hashCode);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget buildList(ThemeData theme) {
|
||||
return refreshIndicator(
|
||||
@@ -101,7 +107,7 @@ class _NoteListPageState extends CommonSlidePageState<NoteListPage> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: CustomScrollView(
|
||||
controller: _controller.scrollController,
|
||||
key: _key,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
SliverPadding(
|
||||
@@ -129,30 +135,32 @@ class _NoteListPageState extends CommonSlidePageState<NoteListPage> {
|
||||
),
|
||||
),
|
||||
),
|
||||
child: FilledButton.tonal(
|
||||
style: FilledButton.styleFrom(
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
padding: EdgeInsets.zero,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(6)),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
if (!Accounts.main.isLogin) {
|
||||
SmartDialog.showToast('账号未登录');
|
||||
return;
|
||||
}
|
||||
_key.currentState?.showBottomSheet(
|
||||
constraints: const BoxConstraints(),
|
||||
(context) => WebviewPage(
|
||||
oid: widget.oid,
|
||||
title: widget.title,
|
||||
url:
|
||||
'https://www.bilibili.com/h5/note-app?oid=${widget.oid}&pagefrom=ugcvideo&is_stein_gate=${widget.isStein ? 1 : 0}',
|
||||
child: Builder(
|
||||
builder: (context) => FilledButton.tonal(
|
||||
style: FilledButton.styleFrom(
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
padding: EdgeInsets.zero,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(6)),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: const Text('开始记笔记'),
|
||||
),
|
||||
onPressed: () {
|
||||
if (!Accounts.main.isLogin) {
|
||||
SmartDialog.showToast('账号未登录');
|
||||
return;
|
||||
}
|
||||
Scaffold.of(context).showBottomSheet(
|
||||
constraints: const BoxConstraints(),
|
||||
(context) => WebviewPage(
|
||||
oid: widget.oid,
|
||||
title: widget.title,
|
||||
url:
|
||||
'https://www.bilibili.com/h5/note-app?oid=${widget.oid}&pagefrom=ugcvideo&is_stein_gate=${widget.isStein ? 1 : 0}',
|
||||
),
|
||||
);
|
||||
},
|
||||
child: const Text('开始记笔记'),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -169,15 +177,10 @@ class _NoteListPageState extends CommonSlidePageState<NoteListPage> {
|
||||
color: theme.colorScheme.outline.withValues(alpha: 0.1),
|
||||
);
|
||||
return switch (loadingState) {
|
||||
Loading() => SliverToBoxAdapter(
|
||||
child: IgnorePointer(
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (context, index) => const VideoReplySkeleton(),
|
||||
itemCount: 8,
|
||||
),
|
||||
),
|
||||
Loading() => SliverPrototypeExtentList.builder(
|
||||
prototypeItem: const VideoReplySkeleton(),
|
||||
itemBuilder: (_, _) => const VideoReplySkeleton(),
|
||||
itemCount: 8,
|
||||
),
|
||||
Success(:var response) =>
|
||||
response?.isNotEmpty == true
|
||||
|
||||
Reference in New Issue
Block a user