mirror of
https://github.com/Iconica-Development/flutter_timeline.git
synced 2025-05-19 10:33:44 +02:00
fix: reaction deletion correct popup position
This commit is contained in:
parent
06df2b7649
commit
03b14924a2
1 changed files with 12 additions and 7 deletions
|
@ -329,18 +329,23 @@ class _TimelinePostScreenState extends State<TimelinePostScreen> {
|
||||||
in post.reactions ?? <TimelinePostReaction>[]) ...[
|
in post.reactions ?? <TimelinePostReaction>[]) ...[
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onLongPress: () async {
|
onLongPressStart: (details) async {
|
||||||
if (reaction.creatorId == widget.userId ||
|
if (reaction.creatorId == widget.userId ||
|
||||||
widget.options.allowAllDeletion) {
|
widget.options.allowAllDeletion) {
|
||||||
|
var overlay = Overlay.of(context)
|
||||||
|
.context
|
||||||
|
.findRenderObject()! as RenderBox;
|
||||||
|
var position = RelativeRect.fromRect(
|
||||||
|
Rect.fromPoints(
|
||||||
|
details.globalPosition,
|
||||||
|
details.globalPosition,
|
||||||
|
),
|
||||||
|
Offset.zero & overlay.size,
|
||||||
|
);
|
||||||
// Show popup menu for deletion
|
// Show popup menu for deletion
|
||||||
var value = await showMenu<String>(
|
var value = await showMenu<String>(
|
||||||
context: context,
|
context: context,
|
||||||
position: const RelativeRect.fromLTRB(
|
position: position,
|
||||||
100.0,
|
|
||||||
200.0,
|
|
||||||
100.0,
|
|
||||||
100.0,
|
|
||||||
),
|
|
||||||
items: [
|
items: [
|
||||||
PopupMenuItem<String>(
|
PopupMenuItem<String>(
|
||||||
value: 'delete',
|
value: 'delete',
|
||||||
|
|
Loading…
Reference in a new issue