mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-16 07:06:14 +08:00
feat: custom horizontal preview
Closes #117 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:PiliPlus/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart';
|
||||
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
||||
import 'package:PiliPlus/grpc/app/main/community/reply/v1/reply.pb.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
@@ -58,6 +59,10 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
||||
dynamic get firstFloor =>
|
||||
widget.firstFloor ?? _videoReplyReplyController.firstFloor;
|
||||
|
||||
bool get _horizontalPreview =>
|
||||
context.orientation == Orientation.landscape &&
|
||||
_videoReplyReplyController.horizontalPreview;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -174,6 +179,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
||||
isTop: widget.isTop,
|
||||
onViewImage: widget.onViewImage,
|
||||
onDismissed: widget.onDismissed,
|
||||
callback: _getImageCallback,
|
||||
)
|
||||
: ReplyItem(
|
||||
replyItem: firstFloor,
|
||||
@@ -186,6 +192,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
||||
},
|
||||
onViewImage: widget.onViewImage,
|
||||
onDismissed: widget.onDismissed,
|
||||
callback: _getImageCallback,
|
||||
);
|
||||
} else if (index == 1) {
|
||||
return Divider(
|
||||
@@ -271,6 +278,23 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
||||
),
|
||||
);
|
||||
|
||||
get _getImageCallback => _horizontalPreview
|
||||
? (imgList, index) {
|
||||
_key.currentState?.showBottomSheet(
|
||||
(context) {
|
||||
return InteractiveviewerGallery(
|
||||
sources: imgList,
|
||||
initIndex: index,
|
||||
setStatusBar: false,
|
||||
);
|
||||
},
|
||||
enableDrag: false,
|
||||
elevation: 0,
|
||||
backgroundColor: Colors.transparent,
|
||||
);
|
||||
}
|
||||
: null;
|
||||
|
||||
void _onReply(dynamic item, int index) {
|
||||
dynamic oid = item?.oid.toInt();
|
||||
dynamic root = GlobalData().grpcReply ? item?.id.toInt() : item?.rpid;
|
||||
@@ -457,6 +481,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
||||
},
|
||||
onViewImage: widget.onViewImage,
|
||||
onDismissed: widget.onDismissed,
|
||||
callback: _getImageCallback,
|
||||
)
|
||||
: ReplyItem(
|
||||
replyItem: replyItem,
|
||||
@@ -477,6 +502,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel> {
|
||||
},
|
||||
onViewImage: widget.onViewImage,
|
||||
onDismissed: widget.onDismissed,
|
||||
callback: _getImageCallback,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user