fixed nullable mess with editor ids
This commit is contained in:
@@ -2,20 +2,31 @@ import "package:flutter/material.dart";
|
||||
import "package:prod/models/editor.dart";
|
||||
import "package:prod/models/globalModel.dart";
|
||||
import "package:provider/provider.dart";
|
||||
import "package:process_run/shell.dart";
|
||||
|
||||
class LauncherButton extends StatelessWidget {
|
||||
const LauncherButton(this.eid, {super.key});
|
||||
final String? eid;
|
||||
const LauncherButton(this.eid, this.path, {super.key});
|
||||
final String eid;
|
||||
final String path;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// print("EDITOR ID: $eid");
|
||||
GlobalModel gm = Provider.of<GlobalModel>(context, listen: false);
|
||||
final Editor edt = gm.nthEdt(gm.id2EdtMap[eid]!);
|
||||
return eid == null
|
||||
final Editor edt = gm.nthEdt(gm.getEdtPosFromID(eid));
|
||||
// print("GRABBED EDITOR: ${edt.name}");
|
||||
return eid == ""
|
||||
? Container()
|
||||
: Expanded(
|
||||
flex: 1,
|
||||
child: TextButton(child: Text("${edt.sname}"), onPressed: () {}),
|
||||
child: TextButton(
|
||||
child: Text("${edt.sname}"),
|
||||
onPressed: () {
|
||||
Shell().run(
|
||||
"${edt.commandTemplate.replaceAll('\$path', path)}",
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user