1
1
import 'dart:async' ;
2
2
import 'dart:io' ;
3
3
4
- import 'package:corecoder_develop/util/custom_code_box.dart'
5
- show InnerField;
4
+ import 'package:corecoder_develop/util/custom_code_box.dart' show InnerField;
6
5
import 'package:corecoder_develop/screens/editor/editor_drawer.dart' ;
7
6
import 'package:corecoder_develop/util/modules_manager.dart' ;
8
7
import 'package:corecoder_develop/util/theme_manager.dart' ;
@@ -27,7 +26,7 @@ class _EditorPageState extends State<EditorPage> {
27
26
late CCSolution project;
28
27
List <Document > documentList = [];
29
28
List <TabData > tabs = [];
30
- Map <String ,TabData > fileEditors = {};
29
+ Map <String , TabData > fileEditors = {};
31
30
bool autoCompleteShown = false ;
32
31
List <String > autoComplete = < String > [
33
32
"var|hello" ,
@@ -37,7 +36,7 @@ class _EditorPageState extends State<EditorPage> {
37
36
];
38
37
double autoCompleteX = 0 ;
39
38
double autoCompleteY = 0 ;
40
- int ? selectedTab = null ;
39
+ int ? selectedTab;
41
40
42
41
@override
43
42
void initState () {
@@ -56,7 +55,7 @@ class _EditorPageState extends State<EditorPage> {
56
55
//..border = Border(bottom: BorderSide(color: Colors.green[700]!, width: 3))
57
56
..middleGap = 0
58
57
..color = ThemeManager .getThemeSchemeColor ("background" );
59
- themeData.menu.. textStyle = const TextStyle (color: Colors .white);
58
+ themeData.menu.textStyle = const TextStyle (color: Colors .white);
60
59
Radius radius = Radius .zero;
61
60
BorderRadiusGeometry ? borderRadius =
62
61
BorderRadius .only (topLeft: radius, topRight: radius);
@@ -71,10 +70,11 @@ class _EditorPageState extends State<EditorPage> {
71
70
shape: BoxShape .rectangle,
72
71
color: Colors .black38,
73
72
borderRadius: borderRadius)
74
- ..selectedStatus.decoration = BoxDecoration (
73
+ ..selectedStatus.decoration = const BoxDecoration (
75
74
color: Colors .black26,
76
75
border: Border (top: BorderSide (color: Colors .greenAccent, width: 3 )))
77
- ..highlightedStatus.decoration = BoxDecoration (color: Colors .black12);
76
+ ..highlightedStatus.decoration =
77
+ const BoxDecoration (color: Colors .black12);
78
78
return themeData;
79
79
}
80
80
@@ -163,7 +163,6 @@ class _EditorPageState extends State<EditorPage> {
163
163
late RestartableTimer autoSaveTimer;
164
164
165
165
void onAutoSave () async {
166
- debugPrint ("autosave" );
167
166
for (var tab in tabs) {
168
167
var field = (((tab.content as SingleChildScrollView ).child as Container )
169
168
.child as InnerField );
@@ -220,7 +219,7 @@ class _EditorPageState extends State<EditorPage> {
220
219
}
221
220
222
221
void openFile (String filepath) async {
223
- if (! fileEditors.containsKey (filepath)) {
222
+ if (! fileEditors.containsKey (filepath)) {
224
223
var filename = path.basename (filepath);
225
224
var content = await File (filepath).readAsString ();
226
225
//debugPrint(content);
@@ -238,10 +237,10 @@ class _EditorPageState extends State<EditorPage> {
238
237
tabs.add (tab);
239
238
selectedTab = tabs.length - 1 ;
240
239
});
241
- }else {
240
+ } else {
242
241
// Tab already exists
243
242
var tab = fileEditors[filepath];
244
- if (tab != null ){
243
+ if (tab != null ) {
245
244
setState (() {
246
245
selectedTab = tabs.indexOf (tab);
247
246
});
@@ -274,7 +273,7 @@ class _EditorPageState extends State<EditorPage> {
274
273
break ;
275
274
}
276
275
return Tooltip (
277
- verticalOffset: 64 ,
276
+ verticalOffset: 64 ,
278
277
message: desc,
279
278
child: InkWell (
280
279
//style: TextStyle(padding: MaterialStateProperty.all(EdgeInsets.zero)),
@@ -338,7 +337,7 @@ class _EditorPageState extends State<EditorPage> {
338
337
var tabController = TabbedViewController (
339
338
tabs,
340
339
);
341
- tabController.selectedIndex = tabs.isNotEmpty? selectedTab : null ;
340
+ tabController.selectedIndex = tabs.isNotEmpty ? selectedTab : null ;
342
341
final page = Stack (children: [
343
342
Column (//direction: Axis.vertical,
344
343
children: [
@@ -398,12 +397,15 @@ class _EditorPageState extends State<EditorPage> {
398
397
icon: const Icon (Icons .assessment_rounded),
399
398
tooltip: "Toggle Console" ,
400
399
),
401
- IconButton (
402
- onPressed: () => {Navigator .pop (context)},
403
- icon: const Icon (Icons .close),
404
- tooltip: "Close Project" ,
405
- ),
406
- IconButton (onPressed: () => {}, icon: const Icon (Icons .more_horiz)),
400
+ PopupMenuButton (
401
+ child: const Icon (Icons .more_horiz),
402
+ tooltip: "Menu" ,
403
+ padding: const EdgeInsets .all (32.0 ),
404
+ itemBuilder: (BuildContext context){
405
+ return < PopupMenuEntry > [
406
+ PopupMenuItem (child: const Text ("Close Project" ),onTap: ()=> Navigator .pop (context),)
407
+ ];
408
+ },),
407
409
const SizedBox (width: 16.0 ),
408
410
],
409
411
),
0 commit comments