beautified editor list
All checks were successful
Build CI / Build (linux-arm64) (push) Successful in 1m48s
Build CI / Build (linux-amd64) (push) Successful in 7m3s

This commit is contained in:
2026-02-13 19:54:31 +05:30
parent 8a65f4ae1f
commit 85bc4450f9
5 changed files with 64 additions and 26 deletions

View File

@@ -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,