added launch buttons
All checks were successful
Build CI / AMD64 Build (push) Successful in 2m0s
Build CI / ARM64 Build (push) Successful in 7m45s

This commit is contained in:
2026-02-25 23:58:41 +05:30
parent e912992a40
commit d3a00dc394
5 changed files with 137 additions and 60 deletions

View File

@@ -6,26 +6,24 @@ class Project {
final String name;
final String language;
final File path;
final List<String> editors;
final Editor? e0;
final Editor? e1;
final Editor? e2;
final Editor? e3;
final bool isGit;
final bool enableTerminal;
Project(
this.name,
this.language,
this.path,
this.editors,
this.isGit,
this.enableTerminal,
);
this.isGit, {
this.e0 = null,
this.e1 = null,
this.e2 = null,
this.e3 = null,
});
factory Project.newValidated(
String name,
String lang,
String path,
List<String> editors,
bool enableTerminal,
) {
factory Project.newValidated(String name, String lang, String path) {
final File fpath = File(path);
print(fpath.absolute.path);
if (fpath.existsSync()) {
@@ -36,28 +34,45 @@ class Project {
String gitPath = p.join(path, ".git", "HEAD");
final bool isGit = File(gitPath).existsSync();
return Project(name, lang, fpath, editors, isGit, enableTerminal);
return Project(name, lang, fpath, isGit);
}
Map<String, dynamic> toJson() {
return {
Map<String, dynamic> fin = {
"name": name,
"language": language,
"path": path.path,
"editors": editors,
"isGit": isGit,
"enableTerminal": enableTerminal,
};
if (e0 == null) {
fin["e0"] = e0;
}
if (e1 == null) {
fin["e1"] = e1;
}
if (e2 == null) {
fin["e2"] = e2;
}
if (e3 == null) {
fin["e3"] = e3;
}
return fin;
}
factory Project.fromJson(Map<String, dynamic> data) {
final Editor? e0 = data["e0"];
final Editor? e1 = data["e1"];
final Editor? e2 = data["e2"];
final Editor? e3 = data["e3"];
return Project(
data["name"] as String,
data["language"] as String,
File(data["path"] as String),
(data["editors"] as List<dynamic>).map((a) => a.toString()).toList(),
data["isGit"] as bool,
data["enableTerminal"] as bool,
e0: e0,
e1: e1,
e2: e2,
e3: e3,
);
}