mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +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
@@ -13,7 +13,6 @@ import 'package:PiliPlus/pages/video/reply_reply/view.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/num_utils.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:easy_debounce/easy_throttle.dart';
|
||||
@@ -22,15 +21,12 @@ import 'package:flutter/rendering.dart';
|
||||
import 'package:get/get.dart' hide ContextExtensionss;
|
||||
|
||||
abstract class CommonDynPageState<T extends StatefulWidget> extends State<T>
|
||||
with TickerProviderStateMixin {
|
||||
with SingleTickerProviderStateMixin {
|
||||
CommonDynController get controller;
|
||||
|
||||
late final scrollController = ScrollController()..addListener(listener);
|
||||
|
||||
late final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
bool get horizontalPreview => !isPortrait && controller.horizontalPreview;
|
||||
Function(List<String> imgList, int index)? imageCallback;
|
||||
|
||||
dynamic get arguments;
|
||||
|
||||
@@ -87,17 +83,6 @@ abstract class CommonDynPageState<T extends StatefulWidget> extends State<T>
|
||||
final size = MediaQuery.sizeOf(context);
|
||||
maxWidth = size.width;
|
||||
isPortrait = size.isPortrait;
|
||||
imageCallback = horizontalPreview
|
||||
? (imgList, index) {
|
||||
hideFab();
|
||||
PageUtils.onHorizontalPreview(
|
||||
scaffoldKey,
|
||||
this,
|
||||
imgList,
|
||||
index,
|
||||
);
|
||||
}
|
||||
: null;
|
||||
padding = MediaQuery.viewPaddingOf(context);
|
||||
}
|
||||
|
||||
@@ -193,7 +178,7 @@ abstract class CommonDynPageState<T extends StatefulWidget> extends State<T>
|
||||
onDelete: (item, subIndex) =>
|
||||
controller.onRemove(index, item, subIndex),
|
||||
upMid: controller.upMid,
|
||||
callback: imageCallback,
|
||||
onViewImage: hideFab,
|
||||
onCheckReply: (item) =>
|
||||
controller.onCheckReply(item, isManual: true),
|
||||
onToggleTop: (item) => controller.onToggleTop(
|
||||
@@ -270,7 +255,7 @@ abstract class CommonDynPageState<T extends StatefulWidget> extends State<T>
|
||||
arguments: arguments,
|
||||
);
|
||||
} else {
|
||||
ScaffoldState? scaffoldState = Scaffold.maybeOf(context);
|
||||
final scaffoldState = Scaffold.maybeOf(context);
|
||||
if (scaffoldState != null) {
|
||||
hideFab();
|
||||
scaffoldState.showBottomSheet(
|
||||
|
||||
@@ -62,8 +62,10 @@ abstract class CommonRichTextPubPageState<T extends CommonRichTextPubPage>
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
for (var i in pathList) {
|
||||
File(i).tryDel();
|
||||
if (Utils.isMobile) {
|
||||
for (var i in pathList) {
|
||||
File(i).tryDel();
|
||||
}
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import 'package:PiliPlus/http/reply.dart';
|
||||
import 'package:PiliPlus/models/common/reply/reply_sort_type.dart';
|
||||
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
||||
import 'package:PiliPlus/pages/video/reply_new/view.dart';
|
||||
import 'package:PiliPlus/services/account_service.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/reply_utils.dart';
|
||||
import 'package:PiliPlus/utils/request_utils.dart';
|
||||
@@ -21,14 +20,12 @@ import 'package:get/get.dart';
|
||||
import 'package:get/get_navigation/src/dialog/dialog_route.dart';
|
||||
|
||||
abstract class ReplyController<R> extends CommonListController<R, ReplyInfo> {
|
||||
RxInt count = (-1).obs;
|
||||
final RxInt count = (-1).obs;
|
||||
|
||||
late Rx<ReplySortType> sortType;
|
||||
late Rx<Mode> mode;
|
||||
late final Rx<ReplySortType> sortType;
|
||||
late final Rx<Mode> mode;
|
||||
|
||||
late final savedReplies = <Object, List<RichTextItem>?>{};
|
||||
|
||||
AccountService accountService = Get.find<AccountService>();
|
||||
final savedReplies = <Object, List<RichTextItem>?>{};
|
||||
|
||||
Int64? upMid;
|
||||
Int64? cursorNext;
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
import 'dart:io' show Platform;
|
||||
|
||||
import 'package:PiliPlus/pages/common/slide/common_slide_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
abstract class CommonCollapseSlidePage extends CommonSlidePage {
|
||||
const CommonCollapseSlidePage({super.key, super.enableSlide});
|
||||
}
|
||||
|
||||
abstract class CommonCollapseSlidePageState<T extends CommonCollapseSlidePage>
|
||||
extends CommonSlidePageState<T> {
|
||||
late bool isInit = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
init();
|
||||
}
|
||||
|
||||
void init() {
|
||||
if (Platform.isAndroid) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
isInit = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (Platform.isAndroid) {
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
if (isInit)
|
||||
const CustomScrollView(
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
),
|
||||
super.build(context),
|
||||
],
|
||||
);
|
||||
}
|
||||
return super.build(context);
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,7 @@ abstract class CommonSlidePage extends StatefulWidget {
|
||||
final bool enableSlide;
|
||||
}
|
||||
|
||||
abstract class CommonSlidePageState<T extends CommonSlidePage> extends State<T>
|
||||
with TickerProviderStateMixin {
|
||||
mixin CommonSlideMixin<T extends CommonSlidePage> on State<T>, TickerProvider {
|
||||
Offset? downPos;
|
||||
bool? isSliding;
|
||||
late double maxWidth;
|
||||
|
||||
Reference in New Issue
Block a user