This commit is contained in:
@@ -15,13 +15,16 @@ class EditorCard extends StatelessWidget {
|
||||
GlobalModel gm = Provider.of<GlobalModel>(context);
|
||||
final Editor edt = gm.nthEdt(id);
|
||||
return YaruBanner(
|
||||
onTap: () {},
|
||||
onTap: () {
|
||||
gm.delEdt(id);
|
||||
},
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: .start,
|
||||
crossAxisAlignment: .start,
|
||||
children: [
|
||||
Text("${edt.name}", style: TextStyle(fontSize: 30)),
|
||||
Text("${edt.command}"),
|
||||
Text("${edt.commandTemplate}"),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import "package:flutter/material.dart";
|
||||
import "package:prod/models/editor.dart";
|
||||
import "package:prod/models/globalModel.dart";
|
||||
import "package:provider/provider.dart";
|
||||
|
||||
class EditorFAB extends StatelessWidget {
|
||||
const EditorFAB({super.key});
|
||||
@@ -17,6 +19,68 @@ class EditorFAB extends StatelessWidget {
|
||||
// true,
|
||||
// ),
|
||||
// );
|
||||
TextEditingController nameController = TextEditingController();
|
||||
TextEditingController commandController = TextEditingController();
|
||||
TextEditingController commandTemplateController =
|
||||
TextEditingController();
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => SimpleDialog(
|
||||
title: Text("Add Editor"),
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextField(
|
||||
autofocus: true,
|
||||
controller: nameController,
|
||||
decoration: InputDecoration(labelText: "Editor Name"),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextField(
|
||||
controller: commandController,
|
||||
decoration: InputDecoration(labelText: "Command"),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextField(
|
||||
controller: commandTemplateController,
|
||||
decoration: InputDecoration(labelText: "Command Template"),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
child: const Text("Example: zed -n \$path"),
|
||||
padding: const EdgeInsets.all(9.0),
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: .end,
|
||||
children: [
|
||||
TextButton(
|
||||
child: Text("Cancel"),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
TextButton(
|
||||
child: Text("Add"),
|
||||
onPressed: () {
|
||||
Provider.of<GlobalModel>(context, listen: false).addEdt(
|
||||
Editor.create(
|
||||
nameController.text,
|
||||
commandController.text,
|
||||
commandTemplateController.text,
|
||||
),
|
||||
);
|
||||
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Icon(Icons.add),
|
||||
);
|
||||
|
||||
@@ -8,15 +8,58 @@ class ProjFAB extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
TextEditingController nameController = TextEditingController();
|
||||
TextEditingController locationController = TextEditingController();
|
||||
return FloatingActionButton(
|
||||
onPressed: () {
|
||||
Provider.of<GlobalModel>(context, listen: false).addPrj(
|
||||
Project.validated(
|
||||
"Kimi",
|
||||
"Rust",
|
||||
"/home/arrow/Gitted/cowin",
|
||||
[],
|
||||
true,
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => SimpleDialog(
|
||||
title: Text("Add Project"),
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextField(
|
||||
autofocus: true,
|
||||
controller: nameController,
|
||||
decoration: InputDecoration(labelText: "Project Name"),
|
||||
),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextField(
|
||||
controller: locationController,
|
||||
decoration: InputDecoration(labelText: "Path"),
|
||||
),
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: .end,
|
||||
children: [
|
||||
TextButton(
|
||||
child: Text("Cancel"),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
TextButton(
|
||||
child: Text("Add"),
|
||||
onPressed: () {
|
||||
Provider.of<GlobalModel>(context, listen: false).addPrj(
|
||||
Project.newValidated(
|
||||
nameController.text,
|
||||
"Rust",
|
||||
locationController.text,
|
||||
[],
|
||||
true,
|
||||
),
|
||||
);
|
||||
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import "package:flutter/material.dart";
|
||||
import "package:prod/models/editor.dart";
|
||||
import "package:prod/models/globalModel.dart";
|
||||
import "package:prod/models/project.dart";
|
||||
import "package:provider/provider.dart";
|
||||
@@ -16,32 +17,36 @@ class ProjectCard extends StatelessWidget {
|
||||
return YaruBanner(
|
||||
padding: .only(
|
||||
left: kYaruPagePadding,
|
||||
top: kYaruPagePadding,
|
||||
top: kYaruPagePadding * 0.5,
|
||||
bottom: kYaruPagePadding,
|
||||
right: kYaruPagePadding,
|
||||
),
|
||||
onHover: (st) => gm.setHoverShow(id, st),
|
||||
onTap: () {
|
||||
var shell = Shell();
|
||||
shell.run("konsole -e nvim ${prj.path.path}");
|
||||
Editor edt1 = gm.editors[0];
|
||||
String comm = edt1.commandTemplate.replaceAll("\$path", prj.path.path);
|
||||
shell.run(comm);
|
||||
},
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: .start,
|
||||
crossAxisAlignment: .start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: .spaceBetween,
|
||||
children: [
|
||||
Text("${prj.name}", style: TextStyle(fontSize: 30)),
|
||||
gm.getHoverShow(id)
|
||||
? ElevatedButton(
|
||||
child: Icon(Icons.close),
|
||||
onPressed: () => print("pressed delete"),
|
||||
)
|
||||
: Container(),
|
||||
],
|
||||
Text(
|
||||
"${prj.name}",
|
||||
style: TextStyle(fontSize: 30),
|
||||
overflow: .ellipsis,
|
||||
),
|
||||
// Row(
|
||||
// mainAxisAlignment: .spaceBetween,
|
||||
// children: [
|
||||
// Flexible(
|
||||
// child: Container(
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
@@ -50,6 +55,15 @@ class ProjectCard extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
gm.getHoverShow(id) ? Text("${prj.path.path}") : Container(),
|
||||
gm.getHoverShow(id)
|
||||
? IconButton(
|
||||
icon: Icon(Icons.close),
|
||||
onPressed: () => gm.delPrj(id),
|
||||
style: IconButton.styleFrom(
|
||||
overlayColor: Color(0xffff0000),
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -14,6 +14,7 @@ class SListTile extends StatelessWidget {
|
||||
leading: Icon(icon),
|
||||
title: Text(title),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.pushNamed(context, route);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user