added delete, and rename options(logic not implemented yet)
This commit is contained in:
parent
55de9ea8b9
commit
5a94b57182
@ -1,9 +1,9 @@
|
|||||||
//drawer with the folders for emails a.k.a mailboxes
|
//drawer with the folders for emails a.k.a mailboxes
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'api_service.dart';
|
import 'api_service.dart';
|
||||||
|
|
||||||
|
// ignore: must_be_immutable
|
||||||
class FolderDrawer extends StatefulWidget {
|
class FolderDrawer extends StatefulWidget {
|
||||||
ApiService apiService;
|
ApiService apiService;
|
||||||
Function(String) onFolderTap;
|
Function(String) onFolderTap;
|
||||||
@ -44,6 +44,13 @@ class _FolderDrawerState extends State<FolderDrawer> {
|
|||||||
return ListTile(
|
return ListTile(
|
||||||
leading: Icon(Icons.mail),
|
leading: Icon(Icons.mail),
|
||||||
title: Text(folder),
|
title: Text(folder),
|
||||||
|
trailing: IconButton(
|
||||||
|
icon: Icon(Icons.more_vert),
|
||||||
|
onPressed: () => {
|
||||||
|
///show options
|
||||||
|
_showOptions(context)
|
||||||
|
},
|
||||||
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
widget.onFolderTap(folder);
|
widget.onFolderTap(folder);
|
||||||
Navigator.pop(
|
Navigator.pop(
|
||||||
@ -76,6 +83,34 @@ class _FolderDrawerState extends State<FolderDrawer> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
void _showOptions(BuildContext context) async {
|
||||||
|
final RenderBox overlay = Overlay.of(context).context.findRenderObject() as RenderBox;
|
||||||
|
|
||||||
|
await showMenu<String>(
|
||||||
|
context: context,
|
||||||
|
position: RelativeRect.fromLTRB(100, 100, overlay.size.width, overlay.size.height),
|
||||||
|
items: <PopupMenuEntry<String>>[
|
||||||
|
PopupMenuItem<String>(
|
||||||
|
value: 'Rename',
|
||||||
|
child: Text('Rename Folder'),
|
||||||
|
),
|
||||||
|
PopupMenuItem<String>(
|
||||||
|
value: 'Delete',
|
||||||
|
child: Text('Delete Folder'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
).then((value) {
|
||||||
|
// Handle the action based on the selected menu item
|
||||||
|
if (value == 'Rename') {
|
||||||
|
// Logic for renaming the folder
|
||||||
|
print('Rename folder');
|
||||||
|
} else if (value == 'Delete') {
|
||||||
|
// Logic for deleting the folder
|
||||||
|
print('Delete folder');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class NewMailbox extends StatelessWidget {
|
class NewMailbox extends StatelessWidget {
|
||||||
|
Loading…
Reference in New Issue
Block a user