added launch buttons
This commit is contained in:
@@ -6,26 +6,24 @@ class Project {
|
|||||||
final String name;
|
final String name;
|
||||||
final String language;
|
final String language;
|
||||||
final File path;
|
final File path;
|
||||||
final List<String> editors;
|
final Editor? e0;
|
||||||
|
final Editor? e1;
|
||||||
|
final Editor? e2;
|
||||||
|
final Editor? e3;
|
||||||
final bool isGit;
|
final bool isGit;
|
||||||
final bool enableTerminal;
|
|
||||||
|
|
||||||
Project(
|
Project(
|
||||||
this.name,
|
this.name,
|
||||||
this.language,
|
this.language,
|
||||||
this.path,
|
this.path,
|
||||||
this.editors,
|
this.isGit, {
|
||||||
this.isGit,
|
this.e0 = null,
|
||||||
this.enableTerminal,
|
this.e1 = null,
|
||||||
);
|
this.e2 = null,
|
||||||
|
this.e3 = null,
|
||||||
|
});
|
||||||
|
|
||||||
factory Project.newValidated(
|
factory Project.newValidated(String name, String lang, String path) {
|
||||||
String name,
|
|
||||||
String lang,
|
|
||||||
String path,
|
|
||||||
List<String> editors,
|
|
||||||
bool enableTerminal,
|
|
||||||
) {
|
|
||||||
final File fpath = File(path);
|
final File fpath = File(path);
|
||||||
print(fpath.absolute.path);
|
print(fpath.absolute.path);
|
||||||
if (fpath.existsSync()) {
|
if (fpath.existsSync()) {
|
||||||
@@ -36,28 +34,45 @@ class Project {
|
|||||||
String gitPath = p.join(path, ".git", "HEAD");
|
String gitPath = p.join(path, ".git", "HEAD");
|
||||||
final bool isGit = File(gitPath).existsSync();
|
final bool isGit = File(gitPath).existsSync();
|
||||||
|
|
||||||
return Project(name, lang, fpath, editors, isGit, enableTerminal);
|
return Project(name, lang, fpath, isGit);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return {
|
Map<String, dynamic> fin = {
|
||||||
"name": name,
|
"name": name,
|
||||||
"language": language,
|
"language": language,
|
||||||
"path": path.path,
|
"path": path.path,
|
||||||
"editors": editors,
|
|
||||||
"isGit": isGit,
|
"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) {
|
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(
|
return Project(
|
||||||
data["name"] as String,
|
data["name"] as String,
|
||||||
data["language"] as String,
|
data["language"] as String,
|
||||||
File(data["path"] as String),
|
File(data["path"] as String),
|
||||||
(data["editors"] as List<dynamic>).map((a) => a.toString()).toList(),
|
|
||||||
data["isGit"] as bool,
|
data["isGit"] as bool,
|
||||||
data["enableTerminal"] as bool,
|
e0: e0,
|
||||||
|
e1: e1,
|
||||||
|
e2: e2,
|
||||||
|
e3: e3,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ class ManageProject extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
SliverList.list(children: [Row(children: [])]),
|
||||||
|
|
||||||
SliverList.list(
|
SliverList.list(
|
||||||
children: [
|
children: [
|
||||||
@@ -109,9 +110,7 @@ class ManageProject extends StatelessWidget {
|
|||||||
nameController.text,
|
nameController.text,
|
||||||
langController.text,
|
langController.text,
|
||||||
File(pathController.text),
|
File(pathController.text),
|
||||||
prj.editors,
|
|
||||||
prj.isGit,
|
prj.isGit,
|
||||||
prj.enableTerminal,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
|||||||
21
lib/widgets/editorSelector.dart
Normal file
21
lib/widgets/editorSelector.dart
Normal 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: ,),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -57,8 +57,6 @@ class ProjFAB extends StatelessWidget {
|
|||||||
nameController.text,
|
nameController.text,
|
||||||
languageController.text,
|
languageController.text,
|
||||||
locationController.text,
|
locationController.text,
|
||||||
[],
|
|
||||||
true,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -14,25 +14,33 @@ class ProjectCard extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
GlobalModel gm = Provider.of<GlobalModel>(context);
|
GlobalModel gm = Provider.of<GlobalModel>(context);
|
||||||
final Project prj = gm.nthPrj(id);
|
final Project prj = gm.nthPrj(id);
|
||||||
return YaruBanner(
|
return InkWell(
|
||||||
padding: .only(
|
|
||||||
left: kYaruPagePadding,
|
|
||||||
top: kYaruPagePadding * 0.5,
|
|
||||||
bottom: kYaruPagePadding,
|
|
||||||
right: kYaruPagePadding,
|
|
||||||
),
|
|
||||||
onHover: (st) => gm.setHoverShow(id, st),
|
onHover: (st) => gm.setHoverShow(id, st),
|
||||||
onTap: () {
|
borderRadius: .circular(kYaruContainerRadius),
|
||||||
// var shell = Shell();
|
onTap: () async {
|
||||||
// Editor edt1 = gm.editors[0];
|
await Navigator.pushNamed(context, "/manageprj", arguments: id);
|
||||||
// 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);
|
|
||||||
},
|
},
|
||||||
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(
|
child: Column(
|
||||||
mainAxisAlignment: .start,
|
mainAxisAlignment: .start,
|
||||||
crossAxisAlignment: .start,
|
crossAxisAlignment: .start,
|
||||||
@@ -45,11 +53,13 @@ class ProjectCard extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
spacing: 10,
|
spacing: 10,
|
||||||
children: [
|
children: [
|
||||||
Text("${prj.language}"),
|
Text("${prj.language}", overflow: .ellipsis),
|
||||||
prj.isGit ? Icon(Icons.commit) : Container(),
|
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)
|
// gm.getHoverShow(id)
|
||||||
// ? IconButton(
|
// ? IconButton(
|
||||||
// icon: Icon(Icons.close),
|
// 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(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user