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
@@ -2,6 +2,7 @@ import 'dart:math';
|
||||
|
||||
import 'package:PiliPlus/common/widgets/interactiveviewer_gallery/hero_dialog_route.dart';
|
||||
import 'package:PiliPlus/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart';
|
||||
import 'package:PiliPlus/common/widgets/marquee.dart';
|
||||
import 'package:PiliPlus/grpc/im.dart';
|
||||
import 'package:PiliPlus/http/dynamics.dart';
|
||||
import 'package:PiliPlus/http/search.dart';
|
||||
@@ -34,7 +35,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart' hide ContextExtensionss;
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class PageUtils {
|
||||
abstract class PageUtils {
|
||||
static final RouteObserver<PageRoute> routeObserver =
|
||||
RouteObserver<PageRoute>();
|
||||
|
||||
@@ -44,7 +45,7 @@ class PageUtils {
|
||||
ValueChanged<int>? onDismissed,
|
||||
int? quality,
|
||||
}) {
|
||||
return Navigator.of(Get.context!).push(
|
||||
return Get.key.currentState!.push<void>(
|
||||
HeroDialogRoute(
|
||||
builder: (context) => InteractiveviewerGallery(
|
||||
sources: imgList,
|
||||
@@ -558,23 +559,23 @@ class PageUtils {
|
||||
}
|
||||
}
|
||||
|
||||
static void onHorizontalPreview(
|
||||
GlobalKey<ScaffoldState> key,
|
||||
static void onHorizontalPreviewState(
|
||||
ScaffoldState state,
|
||||
TickerProvider vsync,
|
||||
List<String> imgList,
|
||||
List<SourceModel> imgList,
|
||||
int index,
|
||||
) {
|
||||
final ctr = AnimationController(
|
||||
vsync: vsync,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
)..forward();
|
||||
key.currentState?.showBottomSheet(
|
||||
state.showBottomSheet(
|
||||
constraints: const BoxConstraints(),
|
||||
(context) {
|
||||
return FadeTransition(
|
||||
opacity: Tween<double>(begin: 0, end: 1).animate(ctr),
|
||||
child: InteractiveviewerGallery(
|
||||
sources: imgList.map((url) => SourceModel(url: url)).toList(),
|
||||
sources: imgList,
|
||||
initIndex: index,
|
||||
onClose: (value) async {
|
||||
if (!value) {
|
||||
@@ -594,12 +595,30 @@ class PageUtils {
|
||||
);
|
||||
},
|
||||
enableDrag: false,
|
||||
elevation: 0,
|
||||
elevation: 0.0,
|
||||
backgroundColor: Colors.transparent,
|
||||
sheetAnimationStyle: const AnimationStyle(duration: Duration.zero),
|
||||
);
|
||||
}
|
||||
|
||||
static void onHorizontalPreview(
|
||||
BuildContext context,
|
||||
List<SourceModel> imgList,
|
||||
int index,
|
||||
) {
|
||||
final scaffoldState = Scaffold.maybeOf(context);
|
||||
if (scaffoldState != null) {
|
||||
onHorizontalPreviewState(
|
||||
scaffoldState,
|
||||
ContextSingleTicker(scaffoldState.context),
|
||||
imgList,
|
||||
index,
|
||||
);
|
||||
} else {
|
||||
imageView(imgList: imgList, initialPage: index);
|
||||
}
|
||||
}
|
||||
|
||||
static void inAppWebview(
|
||||
String url, {
|
||||
bool off = false,
|
||||
|
||||
Reference in New Issue
Block a user