|
@@ -1,6 +1,7 @@
|
|
//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';
|
|
|
|
|
|
class FolderDrawer extends StatefulWidget {
|
|
class FolderDrawer extends StatefulWidget {
|
|
@@ -50,6 +51,19 @@ class _FolderDrawerState extends State<FolderDrawer> {
|
|
},
|
|
},
|
|
);
|
|
);
|
|
}).toList(),
|
|
}).toList(),
|
|
|
|
+ ListTile(
|
|
|
|
+ leading: Icon(Icons.add),
|
|
|
|
+ title: Text("New Mailbox"),
|
|
|
|
+ onTap: () {
|
|
|
|
+ showDialog(
|
|
|
|
+ context: context,
|
|
|
|
+ builder: (BuildContext context) {
|
|
|
|
+ return NewMailbox(apiService: widget.apiService);
|
|
|
|
+ },
|
|
|
|
+ );
|
|
|
|
+ // Navigator.of(context).pop();
|
|
|
|
+ },
|
|
|
|
+ ),
|
|
ListTile(
|
|
ListTile(
|
|
leading: Icon(Icons.refresh),
|
|
leading: Icon(Icons.refresh),
|
|
title: Text('Refresh Folders'),
|
|
title: Text('Refresh Folders'),
|
|
@@ -63,3 +77,40 @@ class _FolderDrawerState extends State<FolderDrawer> {
|
|
);
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+class NewMailbox extends StatelessWidget {
|
|
|
|
+ final ApiService apiService;
|
|
|
|
+ // final Function(String) onFolderCreated;
|
|
|
|
+ final TextEditingController _textFieldController = TextEditingController();
|
|
|
|
+
|
|
|
|
+ NewMailbox({required this.apiService});
|
|
|
|
+
|
|
|
|
+ @override
|
|
|
|
+ Widget build(BuildContext context) {
|
|
|
|
+ return AlertDialog(
|
|
|
|
+ title: const Text("Create a new Mailbox"),
|
|
|
|
+ content: TextField(
|
|
|
|
+ controller: _textFieldController,
|
|
|
|
+ decoration: const InputDecoration(
|
|
|
|
+ hintText: "EPIC FOLDER", // Your custom hint text here
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ actions: <Widget>[
|
|
|
|
+ TextButton(
|
|
|
|
+ onPressed: () {
|
|
|
|
+ print("Folder name: ${_textFieldController.text}");
|
|
|
|
+ String folderName = _textFieldController.text;
|
|
|
|
+
|
|
|
|
+ if (folderName.isNotEmpty) {
|
|
|
|
+ apiService.createFolder(folderName);
|
|
|
|
+ // onFolderCreated(folderName);
|
|
|
|
+ }
|
|
|
|
+ // apiService.createFolder(_textFieldController.text);
|
|
|
|
+ Navigator.of(context).pop();
|
|
|
|
+ },
|
|
|
|
+ child: const Text("Approve"),
|
|
|
|
+ ),
|
|
|
|
+ ],
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+}
|