✨ Support more mouse related actions
This commit is contained in:
parent
1c26944a05
commit
e5381dd5e0
@ -47,16 +47,19 @@ class ChatListShell extends StatelessWidget {
|
|||||||
direction: Axis.horizontal,
|
direction: Axis.horizontal,
|
||||||
divider: ResizableDivider(
|
divider: ResizableDivider(
|
||||||
thickness: 0.3,
|
thickness: 0.3,
|
||||||
color: Theme.of(context).dividerColor,
|
color: Theme.of(context).dividerColor.withOpacity(0.3),
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
const ResizableChild(
|
const ResizableChild(
|
||||||
minSize: 280,
|
minSize: 280,
|
||||||
maxSize: 520,
|
maxSize: 520,
|
||||||
size: ResizableSize.pixels(320),
|
size: ResizableSize.pixels(360),
|
||||||
child: ChatList(),
|
child: ChatList(),
|
||||||
),
|
),
|
||||||
ResizableChild(child: child ?? const EmptyPagePlaceholder()),
|
ResizableChild(
|
||||||
|
minSize: 280,
|
||||||
|
child: child ?? const EmptyPagePlaceholder(),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_animate/flutter_animate.dart';
|
import 'package:flutter_animate/flutter_animate.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@ -34,6 +35,24 @@ class ChatEventList extends StatelessWidget {
|
|||||||
return a.createdAt.difference(b.createdAt).inMinutes <= 3;
|
return a.createdAt.difference(b.createdAt).inMinutes <= 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _openActions(BuildContext context, Event item) {
|
||||||
|
showModalBottomSheet(
|
||||||
|
useRootNavigator: true,
|
||||||
|
context: context,
|
||||||
|
builder: (context) => ChatEventAction(
|
||||||
|
channel: channel,
|
||||||
|
realm: channel.realm,
|
||||||
|
item: item,
|
||||||
|
onEdit: () {
|
||||||
|
onEdit(item);
|
||||||
|
},
|
||||||
|
onReply: () {
|
||||||
|
onReply(item);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CustomScrollView(
|
return CustomScrollView(
|
||||||
@ -65,7 +84,8 @@ class ChatEventList extends StatelessWidget {
|
|||||||
|
|
||||||
final item = chatController.currentEvents[index].data;
|
final item = chatController.currentEvents[index].data;
|
||||||
|
|
||||||
return GestureDetector(
|
return TapRegion(
|
||||||
|
child: GestureDetector(
|
||||||
behavior: HitTestBehavior.opaque,
|
behavior: HitTestBehavior.opaque,
|
||||||
child: Builder(builder: (context) {
|
child: Builder(builder: (context) {
|
||||||
final widget = ChatEvent(
|
final widget = ChatEvent(
|
||||||
@ -94,21 +114,15 @@ class ChatEventList extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
onLongPress: () {
|
onLongPress: () {
|
||||||
showModalBottomSheet(
|
_openActions(context, item!);
|
||||||
useRootNavigator: true,
|
|
||||||
context: context,
|
|
||||||
builder: (context) => ChatEventAction(
|
|
||||||
channel: channel,
|
|
||||||
realm: channel.realm,
|
|
||||||
item: item!,
|
|
||||||
onEdit: () {
|
|
||||||
onEdit(item);
|
|
||||||
},
|
|
||||||
onReply: () {
|
|
||||||
onReply(item);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
onTapInside: (event) {
|
||||||
|
if (event.buttons == kSecondaryMouseButton) {
|
||||||
|
_openActions(context, item!);
|
||||||
|
} else if (event.buttons == kMiddleMouseButton) {
|
||||||
|
onReply(item!);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -91,17 +91,21 @@ class _PostActionState extends State<PostAction> {
|
|||||||
|
|
||||||
setState(() => _isBusy = true);
|
setState(() => _isBusy = true);
|
||||||
|
|
||||||
|
final double width = hasMultipleAttachment ? 640 : 480;
|
||||||
|
|
||||||
final screenshot = ScreenshotController();
|
final screenshot = ScreenshotController();
|
||||||
final image = await screenshot.captureFromLongWidget(
|
final image = await screenshot.captureFromLongWidget(
|
||||||
MediaQuery(
|
MediaQuery(
|
||||||
data: MediaQuery.of(context),
|
data: MediaQuery.of(context).copyWith(
|
||||||
|
size: Size(width, double.infinity),
|
||||||
|
),
|
||||||
child: PostShareImage(item: widget.item),
|
child: PostShareImage(item: widget.item),
|
||||||
),
|
),
|
||||||
context: context,
|
context: context,
|
||||||
pixelRatio: 2,
|
pixelRatio: 2,
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
minWidth: 480,
|
minWidth: 480,
|
||||||
maxWidth: hasMultipleAttachment ? 640 : 480,
|
maxWidth: width,
|
||||||
minHeight: 640,
|
minHeight: 640,
|
||||||
maxHeight: double.infinity,
|
maxHeight: double.infinity,
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user