Skip to content

Commit d661a42

Browse files
authored
Merge pull request #28 from Hanprogramer/dev
v0.0.4
2 parents 0e2c862 + ca7d13d commit d661a42

12 files changed

+593
-389
lines changed

lib/main.dart

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import 'dart:io';
22

3+
import 'package:archive/archive.dart';
34
import 'package:corecoder_develop/screens/editor/editor.dart';
45
import 'package:corecoder_develop/screens/settings/plugins_browser.dart';
56
import 'package:corecoder_develop/util/cc_project_structure.dart';
7+
import 'package:corecoder_develop/util/plugins_manager.dart';
68
import 'package:corecoder_develop/util/theme_manager.dart';
79
import 'package:flutter/material.dart';
810
import 'package:flutter/services.dart';
@@ -12,7 +14,6 @@ import 'package:shared_preferences/shared_preferences.dart';
1214
import 'screens/homepage/homepage.dart';
1315
import 'screens/editor/editor_drawer.dart';
1416
import 'package:bitsdojo_window/bitsdojo_window.dart';
15-
1617
void main() async {
1718
runApp(const CoreCoderApp());
1819
if (CoreCoderApp.isDesktop) {
@@ -30,12 +31,16 @@ const borderColor = Color(0xFF3BBA73);
3031

3132
class CoreCoderApp extends StatefulWidget {
3233
const CoreCoderApp({Key? key}) : super(key: key);
33-
static const String version = "v0.0.3.1";
34-
static bool isDesktop = (Platform.isWindows || Platform.isLinux || Platform.isMacOS);
35-
static bool isLandscape(BuildContext context){
34+
static const String version = "v0.0.4";
35+
static bool isDesktop =
36+
(Platform.isWindows || Platform.isLinux || Platform.isMacOS);
37+
38+
static bool isLandscape(BuildContext context) {
3639
var q = MediaQuery.of(context);
37-
return q.orientation == Orientation.landscape || q.size.width > q.size.height;
40+
return q.orientation == Orientation.landscape ||
41+
q.size.width > q.size.height;
3842
}
43+
3944
@override
4045
State<StatefulWidget> createState() {
4146
return CoreCoderAppState();
@@ -81,11 +86,10 @@ class CoreCoderAppState extends State<CoreCoderApp> {
8186
// debugPrint(result as String);
8287
// });
8388
}
84-
85-
8689
}
90+
8791
static final Future<SharedPreferences> _pref =
88-
SharedPreferences.getInstance();
92+
SharedPreferences.getInstance();
8993

9094
@override
9195
Widget build(BuildContext context) {
@@ -109,33 +113,33 @@ class CoreCoderAppState extends State<CoreCoderApp> {
109113
child: Column(
110114
children: [
111115
// The title bar
112-
if(CoreCoderApp.isDesktop)
113-
WindowTitleBarBox(
114-
child: Row(children: [
115-
Expanded(
116-
child: MoveWindow(
117-
child: Row(children: [
118-
const SizedBox(
119-
width: 16.0,
120-
),
121-
Image.asset(
122-
"assets/logo.png",
123-
isAntiAlias: true,
124-
filterQuality: FilterQuality.high,
125-
width: 20,
126-
height: 20,
127-
),
128-
const SizedBox(
129-
width: 16.0,
130-
),
131-
Text(
132-
"CoreCoder:Develop ${CoreCoderApp.version}",
133-
style: Theme.of(context).textTheme.bodyText1!,
134-
)
135-
]),
136-
)),
137-
const WindowButtons()
138-
])),
116+
if (CoreCoderApp.isDesktop)
117+
WindowTitleBarBox(
118+
child: Row(children: [
119+
Expanded(
120+
child: MoveWindow(
121+
child: Row(children: [
122+
const SizedBox(
123+
width: 16.0,
124+
),
125+
Image.asset(
126+
"assets/logo.png",
127+
isAntiAlias: true,
128+
filterQuality: FilterQuality.high,
129+
width: 20,
130+
height: 20,
131+
),
132+
const SizedBox(
133+
width: 16.0,
134+
),
135+
Text(
136+
"CoreCoder:Develop ${CoreCoderApp.version}",
137+
style: Theme.of(context).textTheme.bodyText1!,
138+
)
139+
]),
140+
)),
141+
const WindowButtons()
142+
])),
139143
if (widget != null) Expanded(child: widget)
140144
],
141145
));

lib/modules/jsapi.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,12 @@ class CoreCoder {
139139
var _onCreate = obj.getProperty('onCreate');
140140
if (_onCreate.isObject) {
141141
onCreate = (Map<String, dynamic> args) async {
142+
debugPrint("[Template onCreate] Creating JSObject");
142143
var optionsObj = JSObject.make(context,
143144
JSClass.create(JSClassDefinition(className: "OptionsObj")));
145+
debugPrint("[Template onCreate] Iterating through keys");
144146
for (var key in args.keys) {
147+
debugPrint("[Template onCreate] $key");
145148
var value = args[key];
146149
if (value is String) {
147150
optionsObj.setProperty(key, JSValue.makeString(context, value),
@@ -154,10 +157,12 @@ class CoreCoder {
154157
}
155158
}
156159
JSValuePointer? err;
160+
debugPrint("[Template onCreate] Calling JS Function");
157161
JSValue result = _onCreate.toObject().callAsFunction(
158162
JSObject(context, _obj),
159163
JSValuePointer.array([optionsObj.toValue()]),
160164
exception: err);
165+
debugPrint("[Template onCreate] Checking result error.");
161166
if (err != null && err.getValue(context).isObject) {
162167
var errObj = err.getValue(context).toObject();
163168
var name = errObj.getProperty("name").string;

lib/modules/module_jsplugins.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ class JsModule extends Module {
222222
ModulesManager modulesManager, BuildContext buildContext) async {
223223
this.buildContext = buildContext;
224224
context =
225-
jscore.JSContext.createInGroup(group: jscore.JSContextGroup.create());
225+
jscore.JSContext.createInGroup(group: null);
226226
globalObj = context.globalObject;
227227
_globalObjPtr = globalObj.pointer;
228228
CoreCoder.module = this;

0 commit comments

Comments
 (0)