Skip to content

Commit 3924742

Browse files
committed
2 parents 7ad09ff + 151c4e0 commit 3924742

File tree

6 files changed

+42
-13
lines changed

6 files changed

+42
-13
lines changed

.idea/discord.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/filebrowser/utils/utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ class Utils {
1919
String hour = '${dateTime.hour}';
2020
String minute = '${dateTime.minute}';
2121
String second = '${dateTime.second}';
22-
return '$day/$month/$year $hour/$minute/$second';
22+
return '$day/$month/$year $hour:$minute:$second';
2323
}
2424
}

lib/modules/module_core.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import 'package:corecoder_develop/util/modules_manager.dart';
44
import 'package:flutter/material.dart';
55

66
import '../main.dart';
7-
class CoreModule extends Module { //TODO doesnt work
7+
class CoreModule extends Module {
88

99
@override
1010
CoreModule()

lib/screens/editor/editor.dart

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,17 @@ class _EditorPageState extends State<EditorPage> {
109109
return children;
110110
}
111111

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 {
113123
List<Document> docs = List.empty(growable: true);
114124

115125
// Add folders from the solution file
@@ -216,7 +226,10 @@ class _EditorPageState extends State<EditorPage> {
216226
controller: ScrollController(),
217227
child: Container(
218228
constraints: BoxConstraints(
219-
minHeight: MediaQuery.of(context).size.height * 2),
229+
minHeight: MediaQuery
230+
.of(context)
231+
.size
232+
.height * 2),
220233
child: field,
221234
)));
222235
}
@@ -332,11 +345,17 @@ class _EditorPageState extends State<EditorPage> {
332345

333346
@override
334347
Widget build(BuildContext context) {
348+
var _tapPosition;
349+
350+
void _storePosition(TapDownDetails details) {
351+
_tapPosition = details.globalPosition;
352+
}
353+
335354
project = ModalRoute.of(context)!.settings.arguments as CCSolution;
336355
var query = MediaQuery.of(context);
337356
if (documentList.isEmpty) {
338357
// Populate the file browser tree once
339-
initializeTreeView();
358+
refreshFileBrowser();
340359
}
341360
var tabController = TabbedViewController(
342361
tabs,
@@ -394,6 +413,19 @@ class _EditorPageState extends State<EditorPage> {
394413
drawer: MyDrawer(documentList, project, (String filepath) {
395414
openFile(filepath);
396415
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+
}
397429
}),
398430
appBar: AppBar(
399431
title: null,

lib/screens/editor/editor_drawer.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,9 @@ class MyDrawer extends StatelessWidget {
2727
final CCSolution project;
2828
final List<Document> documentList;
2929
final void Function(String filepath) onFileTap;
30+
final void Function(String filepath) onFileLongTap;
3031

31-
const MyDrawer(this.documentList, this.project, this.onFileTap);
32-
33-
void onFileLongTap(String filepath){
34-
35-
}
32+
const MyDrawer(this.documentList, this.project, this.onFileTap, this.onFileLongTap);
3633

3734
@override
3835
Widget build(BuildContext context) {

lib/screens/homepage/homepage.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'dart:io';
22

3+
import 'package:corecoder_develop/filebrowser/utils/utils.dart';
34
import 'package:corecoder_develop/screens/homepage/homepage_project_create.dart';
45
import 'package:corecoder_develop/screens/settings/plugins_browser.dart';
56
import 'package:corecoder_develop/screens/settings/settings.dart';
@@ -147,9 +148,8 @@ class _HomePageState extends State<HomePage> {
147148
),
148149
),
149150
subtitle: Text(
150-
(p.type == HistoryItemType.solution ? p.solution!.desc : "") +
151151
"Last Modified: " +
152-
p.dateModified.toString()),
152+
Utils.getFormattedDateTime(dateTime: p.dateModified)),
153153
trailing: PopupMenuButton<String>(
154154
onSelected: (String result) {
155155
switch (result) {

0 commit comments

Comments
 (0)