beautified editor list
This commit is contained in:
3
devtools_options.yaml
Normal file
3
devtools_options.yaml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
description: This file stores settings for Dart & Flutter DevTools.
|
||||||
|
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
|
||||||
|
extensions:
|
||||||
@@ -4,15 +4,28 @@ import "package:prod/models/rand.dart";
|
|||||||
|
|
||||||
class Editor {
|
class Editor {
|
||||||
final String id;
|
final String id;
|
||||||
|
final String sname;
|
||||||
final String name;
|
final String name;
|
||||||
final String command;
|
final String command;
|
||||||
final String commandTemplate;
|
final String commandTemplate;
|
||||||
// final Icon icon;
|
// final Icon icon;
|
||||||
|
|
||||||
const Editor(this.name, this.command, this.commandTemplate, this.id);
|
const Editor(
|
||||||
|
this.sname,
|
||||||
|
this.name,
|
||||||
|
this.command,
|
||||||
|
this.commandTemplate,
|
||||||
|
this.id,
|
||||||
|
);
|
||||||
|
|
||||||
factory Editor.create(String name, String command, String commandTemplate) {
|
factory Editor.create(String name, String command, String commandTemplate) {
|
||||||
return Editor(name, command, commandTemplate, getRandomString(5));
|
return Editor(
|
||||||
|
"${name.substring(0, 1).toUpperCase()}${name.substring(1, 2).toLowerCase()}",
|
||||||
|
name,
|
||||||
|
command,
|
||||||
|
commandTemplate,
|
||||||
|
getRandomString(5),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool validateCommand() {
|
bool validateCommand() {
|
||||||
@@ -39,9 +52,10 @@ class Editor {
|
|||||||
!data.containsKey("commandTemplate") ||
|
!data.containsKey("commandTemplate") ||
|
||||||
!data.containsKey("id")) {
|
!data.containsKey("id")) {
|
||||||
print("Found invalid editor config when parsing: $data");
|
print("Found invalid editor config when parsing: $data");
|
||||||
return Editor("null", "null", "null", "null");
|
return Editor("!!", "null", "null", "null", "null");
|
||||||
}
|
}
|
||||||
return Editor(
|
return Editor(
|
||||||
|
data["sname"] as String,
|
||||||
data["name"] as String,
|
data["name"] as String,
|
||||||
data["command"] as String,
|
data["command"] as String,
|
||||||
data["commandTemplate"] as String,
|
data["commandTemplate"] as String,
|
||||||
|
|||||||
@@ -17,12 +17,13 @@ class EditorEditor extends StatelessWidget {
|
|||||||
body: gm.lenEdt > 0
|
body: gm.lenEdt > 0
|
||||||
? LayoutBuilder(
|
? LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
int cols = (constraints.maxWidth / 200).floor();
|
int cols = (constraints.maxWidth / 250).floor();
|
||||||
return GridView.builder(
|
return GridView.builder(
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
crossAxisCount: cols,
|
crossAxisCount: cols,
|
||||||
crossAxisSpacing: 10,
|
crossAxisSpacing: 10,
|
||||||
mainAxisSpacing: 10,
|
mainAxisSpacing: 10,
|
||||||
|
childAspectRatio: 1.5,
|
||||||
),
|
),
|
||||||
itemCount: gm.lenEdt,
|
itemCount: gm.lenEdt,
|
||||||
itemBuilder: (context, index) => EditorCard(index),
|
itemBuilder: (context, index) => EditorCard(index),
|
||||||
|
|||||||
@@ -14,21 +14,50 @@ class EditorCard extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
GlobalModel gm = Provider.of<GlobalModel>(context);
|
GlobalModel gm = Provider.of<GlobalModel>(context);
|
||||||
final Editor edt = gm.nthEdt(id);
|
final Editor edt = gm.nthEdt(id);
|
||||||
|
final String icon =
|
||||||
|
"${edt.name.substring(0, 1).toUpperCase()}${edt.name.substring(1, 2).toLowerCase()}";
|
||||||
return YaruBanner(
|
return YaruBanner(
|
||||||
onTap: () {
|
padding: .only(
|
||||||
gm.delEdt(id);
|
left: kYaruPagePadding,
|
||||||
},
|
top: kYaruPagePadding * 0.5,
|
||||||
child: Center(
|
bottom: kYaruPagePadding,
|
||||||
|
right: kYaruPagePadding,
|
||||||
|
),
|
||||||
|
|
||||||
|
onTap: () => gm.delEdt(id),
|
||||||
|
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Text("$icon", style: TextStyle(fontSize: 50)),
|
||||||
|
VerticalDivider(width: 20, thickness: 2),
|
||||||
|
Flexible(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: .start,
|
mainAxisAlignment: .center,
|
||||||
crossAxisAlignment: .start,
|
crossAxisAlignment: .start,
|
||||||
children: [
|
children: [
|
||||||
Text("${edt.name}", style: TextStyle(fontSize: 30)),
|
Flexible(
|
||||||
Text("${edt.command}"),
|
child: Text(
|
||||||
Text("${edt.commandTemplate}"),
|
"${edt.name}",
|
||||||
|
style: TextStyle(fontSize: 25),
|
||||||
|
overflow: .ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text("${edt.commandTemplate}", overflow: .ellipsis),
|
||||||
|
// gm.getHoverShow(id) ? Text("${edt.path.path}") : Container(),
|
||||||
|
// gm.getHoverShow(id)
|
||||||
|
// ? IconButton(
|
||||||
|
// icon: Icon(Icons.close),
|
||||||
|
// onPressed: () => gm.deledt(id),
|
||||||
|
// style: IconButton.styleFrom(
|
||||||
|
// overlayColor: Color(0xffff0000),
|
||||||
|
// ),
|
||||||
|
// )
|
||||||
|
// : Container(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,15 +38,6 @@ class ProjectCard extends StatelessWidget {
|
|||||||
style: TextStyle(fontSize: 30),
|
style: TextStyle(fontSize: 30),
|
||||||
overflow: .ellipsis,
|
overflow: .ellipsis,
|
||||||
),
|
),
|
||||||
// Row(
|
|
||||||
// mainAxisAlignment: .spaceBetween,
|
|
||||||
// children: [
|
|
||||||
// Flexible(
|
|
||||||
// child: Container(
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
Row(
|
Row(
|
||||||
spacing: 10,
|
spacing: 10,
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
Reference in New Issue
Block a user