Skip to content

Commit

Permalink
show menu options on chat thread
Browse files Browse the repository at this point in the history
  • Loading branch information
Dat-TG committed Dec 9, 2023
1 parent d9ee9fc commit 80ab4ac
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 61 deletions.
1 change: 0 additions & 1 deletion lib/constants/app_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class AppThemeData {
contentTextStyle: _textTheme.titleMedium!.apply(color: _darkFillColor),
),
listTileTheme: ListTileThemeData(
tileColor: colorScheme.surface,
iconColor: colorScheme.primary,
textColor: colorScheme.onSurface,
),
Expand Down
56 changes: 56 additions & 0 deletions lib/core/widgets/chat_thread.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,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: () {},
),
);
}
}
79 changes: 19 additions & 60 deletions lib/core/widgets/main_drawer.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:boilerplate/core/widgets/chat_thread.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';

Expand Down Expand Up @@ -27,66 +28,24 @@ class MainDrawer extends StatelessWidget {
child: ListView(
padding: EdgeInsets.zero,
children: [
ListTile(
title: Text('ChatGPT Flutter App'),
onTap: () {},
),
ListTile(
title: Text('GraphQL in Flutter'),
onTap: () {},
),
ListTile(
title: Text('REST API Explanation'),
onTap: () {},
),
ListTile(
title: Text('Jitsi Meet in Flutter'),
onTap: () {},
),
ListTile(
title: Text('Websockets in Flutter'),
onTap: () {},
),
ListTile(
title: Text('ChatGPT Flutter App'),
onTap: () {},
),
ListTile(
title: Text('GraphQL in Flutter'),
onTap: () {},
),
ListTile(
title: Text('REST API Explanation'),
onTap: () {},
),
ListTile(
title: Text('Jitsi Meet in Flutter'),
onTap: () {},
),
ListTile(
title: Text('Websockets in Flutter'),
onTap: () {},
),
ListTile(
title: Text('ChatGPT Flutter App'),
onTap: () {},
),
ListTile(
title: Text('GraphQL in Flutter'),
onTap: () {},
),
ListTile(
title: Text('REST API Explanation'),
onTap: () {},
),
ListTile(
title: Text('Jitsi Meet in Flutter'),
onTap: () {},
),
ListTile(
title: Text('Websockets in Flutter'),
onTap: () {},
),
ChatThread(name: 'GraphQL in Flutter'),
ChatThread(name: 'REST API Explanation'),
ChatThread(name: 'Jitsi Meet in Flutter'),
ChatThread(name: 'Websockets in Flutter'),
ChatThread(name: 'ChatGPT Flutter App'),
ChatThread(name: 'GraphQL in Flutter'),
ChatThread(name: 'REST API Explanation'),
ChatThread(name: 'Jitsi Meet in Flutter'),
ChatThread(name: 'Websockets in Flutter'),
ChatThread(name: 'GraphQL in Flutter'),
ChatThread(name: 'REST API Explanation'),
ChatThread(name: 'Jitsi Meet in Flutter'),
ChatThread(name: 'Websockets in Flutter'),
ChatThread(name: 'ChatGPT Flutter App'),
ChatThread(name: 'GraphQL in Flutter'),
ChatThread(name: 'REST API Explanation'),
ChatThread(name: 'Jitsi Meet in Flutter'),
ChatThread(name: 'Websockets in Flutter'),
],
),
),
Expand Down
Empty file.

0 comments on commit 80ab4ac

Please sign in to comment.