beautified editor list
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user