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 {
|
||||
final String id;
|
||||
final String sname;
|
||||
final String name;
|
||||
final String command;
|
||||
final String commandTemplate;
|
||||
// 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) {
|
||||
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() {
|
||||
@@ -39,9 +52,10 @@ class Editor {
|
||||
!data.containsKey("commandTemplate") ||
|
||||
!data.containsKey("id")) {
|
||||
print("Found invalid editor config when parsing: $data");
|
||||
return Editor("null", "null", "null", "null");
|
||||
return Editor("!!", "null", "null", "null", "null");
|
||||
}
|
||||
return Editor(
|
||||
data["sname"] as String,
|
||||
data["name"] as String,
|
||||
data["command"] as String,
|
||||
data["commandTemplate"] as String,
|
||||
|
||||
@@ -17,12 +17,13 @@ class EditorEditor extends StatelessWidget {
|
||||
body: gm.lenEdt > 0
|
||||
? LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
int cols = (constraints.maxWidth / 200).floor();
|
||||
int cols = (constraints.maxWidth / 250).floor();
|
||||
return GridView.builder(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: cols,
|
||||
crossAxisSpacing: 10,
|
||||
mainAxisSpacing: 10,
|
||||
childAspectRatio: 1.5,
|
||||
),
|
||||
itemCount: gm.lenEdt,
|
||||
itemBuilder: (context, index) => EditorCard(index),
|
||||
|
||||
@@ -14,21 +14,50 @@ class EditorCard extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
GlobalModel gm = Provider.of<GlobalModel>(context);
|
||||
final Editor edt = gm.nthEdt(id);
|
||||
final String icon =
|
||||
"${edt.name.substring(0, 1).toUpperCase()}${edt.name.substring(1, 2).toLowerCase()}";
|
||||
return YaruBanner(
|
||||
onTap: () {
|
||||
gm.delEdt(id);
|
||||
},
|
||||
child: Center(
|
||||
padding: .only(
|
||||
left: kYaruPagePadding,
|
||||
top: kYaruPagePadding * 0.5,
|
||||
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(
|
||||
mainAxisAlignment: .start,
|
||||
mainAxisAlignment: .center,
|
||||
crossAxisAlignment: .start,
|
||||
children: [
|
||||
Text("${edt.name}", style: TextStyle(fontSize: 30)),
|
||||
Text("${edt.command}"),
|
||||
Text("${edt.commandTemplate}"),
|
||||
Flexible(
|
||||
child: Text(
|
||||
"${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),
|
||||
overflow: .ellipsis,
|
||||
),
|
||||
// Row(
|
||||
// mainAxisAlignment: .spaceBetween,
|
||||
// children: [
|
||||
// Flexible(
|
||||
// child: Container(
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
|
||||
Reference in New Issue
Block a user