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,
);
}

View File

@@ -77,6 +77,7 @@ class ManageProject extends StatelessWidget {
),
),
),
SliverList.list(children: [Row(children: [])]),
SliverList.list(
children: [
@@ -109,9 +110,7 @@ class ManageProject extends StatelessWidget {
nameController.text,
langController.text,
File(pathController.text),
prj.editors,
prj.isGit,
prj.enableTerminal,
),
);
ScaffoldMessenger.of(context).showSnackBar(

View File

@@ -0,0 +1,21 @@
import "package:flutter/material.dart";
import "package:prod/models/editor.dart";
import "package:yaru/yaru.dart";
class Editorselector extends StatelessWidget {
const Editorselector(this.turns, {super.key});
final int turns;
@override
Widget build(BuildContext context) {
return Row(
children: [
RotatedBox(
child: Icon(Icons.rounded_corner_rounded),
quarterTurns: this.turns,
),
// YaruPopupMenuButton<Editor>(child: ,),
],
);
}
}

View File

@@ -57,8 +57,6 @@ class ProjFAB extends StatelessWidget {
nameController.text,
languageController.text,
locationController.text,
[],
true,
),
);

View File

@@ -14,25 +14,33 @@ class ProjectCard extends StatelessWidget {
Widget build(BuildContext context) {
GlobalModel gm = Provider.of<GlobalModel>(context);
final Project prj = gm.nthPrj(id);
return YaruBanner(
padding: .only(
left: kYaruPagePadding,
top: kYaruPagePadding * 0.5,
bottom: kYaruPagePadding,
right: kYaruPagePadding,
),
return InkWell(
onHover: (st) => gm.setHoverShow(id, st),
onTap: () {
// var shell = Shell();
// Editor edt1 = gm.editors[0];
// String comm = edt1.commandTemplate.replaceAll("\$path", prj.path.path);
// shell.run(comm);
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(content: Text("Launched "), duration: Duration(seconds: 3)),
// );
Navigator.pushNamed(context, "/manageprj", arguments: id);
borderRadius: .circular(kYaruContainerRadius),
onTap: () async {
await Navigator.pushNamed(context, "/manageprj", arguments: id);
},
child: Center(
child: Card(
// decoration: BoxDecoration(
// border: Border.all(color: Theme.of(context).dividerColor),
// borderRadius: .circular(kYaruContainerRadius),
// ),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
kYaruContainerRadius,
).inner(const EdgeInsets.all(4)),
side: BorderSide(color: Theme.of(context).dividerColor, width: 0),
),
color: Colors.white,
shadowColor: Colors.transparent,
child: Row(
mainAxisAlignment: .spaceBetween,
children: [
Container(
padding: .only(
top: kYaruPagePadding * 0.5,
left: kYaruPagePadding * 0.5,
),
child: Column(
mainAxisAlignment: .start,
crossAxisAlignment: .start,
@@ -45,11 +53,13 @@ class ProjectCard extends StatelessWidget {
Row(
spacing: 10,
children: [
Text("${prj.language}"),
Text("${prj.language}", overflow: .ellipsis),
prj.isGit ? Icon(Icons.commit) : Container(),
],
),
gm.getHoverShow(id) ? Text("${prj.path.path}") : Container(),
gm.getHoverShow(id)
? Text("${prj.path.path}", overflow: .ellipsis)
: Container(),
// gm.getHoverShow(id)
// ? IconButton(
// icon: Icon(Icons.close),
@@ -62,6 +72,40 @@ class ProjectCard extends StatelessWidget {
],
),
),
Row(
children: [
Column(
children: [
Expanded(
flex: 1,
child: TextButton(child: Text("Ze"), onPressed: () {}),
),
Expanded(
flex: 1,
child: TextButton(child: Text("Ze"), onPressed: () {}),
),
],
),
Column(
children: [
Expanded(
child: TextButton(child: Text("Ze"), onPressed: () {}),
),
true
? Expanded(
child: TextButton(
child: Text("Ze"),
onPressed: () {},
),
)
: Container(),
],
),
],
),
],
),
),
);
}
}