@@ -109,7 +109,17 @@ class _EditorPageState extends State<EditorPage> {
109
109
return children;
110
110
}
111
111
112
- void initializeTreeView () async {
112
+ //TODO: Add file under directory
113
+ //TODO: Rename file
114
+ //TODO: Move file
115
+
116
+ void deleteFileOrFolder (String filepath) async {
117
+ var file = File (filepath);
118
+ file.delete ();
119
+ refreshFileBrowser ();
120
+ }
121
+
122
+ void refreshFileBrowser () async {
113
123
List <Document > docs = List .empty (growable: true );
114
124
115
125
// Add folders from the solution file
@@ -216,7 +226,10 @@ class _EditorPageState extends State<EditorPage> {
216
226
controller: ScrollController (),
217
227
child: Container (
218
228
constraints: BoxConstraints (
219
- minHeight: MediaQuery .of (context).size.height * 2 ),
229
+ minHeight: MediaQuery
230
+ .of (context)
231
+ .size
232
+ .height * 2 ),
220
233
child: field,
221
234
)));
222
235
}
@@ -332,11 +345,17 @@ class _EditorPageState extends State<EditorPage> {
332
345
333
346
@override
334
347
Widget build (BuildContext context) {
348
+ var _tapPosition;
349
+
350
+ void _storePosition (TapDownDetails details) {
351
+ _tapPosition = details.globalPosition;
352
+ }
353
+
335
354
project = ModalRoute .of (context)! .settings.arguments as CCSolution ;
336
355
var query = MediaQuery .of (context);
337
356
if (documentList.isEmpty) {
338
357
// Populate the file browser tree once
339
- initializeTreeView ();
358
+ refreshFileBrowser ();
340
359
}
341
360
var tabController = TabbedViewController (
342
361
tabs,
@@ -394,6 +413,19 @@ class _EditorPageState extends State<EditorPage> {
394
413
drawer: MyDrawer (documentList, project, (String filepath) {
395
414
openFile (filepath);
396
415
Navigator .pop (context);
416
+ }, (String filepath) async {
417
+ var selection = await showMenu (context: context, position: const RelativeRect .fromLTRB (1 , 1 , 1 , 1 ), items: < PopupMenuEntry <String >> [
418
+ const PopupMenuItem <String >(
419
+ value: "delete" ,
420
+ child: Text ('Delete item' ),
421
+ ),
422
+ ]);
423
+ //TODO: Menu should show up at tap location
424
+ //TODO: Refactor menu into separate file
425
+ switch (selection) {
426
+ case 'delete' :
427
+ deleteFileOrFolder (filepath);
428
+ }
397
429
}),
398
430
appBar: AppBar (
399
431
title: null ,
0 commit comments