-
Notifications
You must be signed in to change notification settings - Fork 0
/
chat_thread.dart
56 lines (53 loc) · 1.48 KB
/
chat_thread.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import 'package:flutter/material.dart';
class ChatThread extends StatefulWidget {
final String name;
const ChatThread({Key? key, required this.name}) : super(key: key);
@override
State<ChatThread> createState() => _ChatThreadState();
}
class _ChatThreadState extends State<ChatThread> {
@override
Widget build(BuildContext context) {
return GestureDetector(
onLongPressStart: (details) {
final offset = details.globalPosition;
showMenu(
context: context,
position: RelativeRect.fromLTRB(
offset.dx,
offset.dy,
MediaQuery.of(context).size.width - offset.dx,
MediaQuery.of(context).size.height - offset.dy,
),
items: [
PopupMenuItem(
child: ListTile(
leading: Icon(Icons.edit_outlined),
title: Text('Rename'),
),
value: 'rename',
),
PopupMenuItem(
child: ListTile(
leading: Icon(Icons.delete_outline),
title: Text('Delete'),
),
value: 'delete',
),
],
elevation: 8.0,
).then((value) {
if (value == 'rename') {
// Handle edit option
} else if (value == 'delete') {
// Handle delete option
}
});
},
child: ListTile(
title: Text(widget.name),
onTap: () {},
),
);
}
}