Files
Prod/lib/widgets/launcherButton.dart
Phani Pavan K 4f0503ca50
Some checks failed
Build CI / AMD64 Build (push) Has been cancelled
Build CI / ARM64 Build (push) Has been cancelled
fixed nullable mess with editor ids
2026-02-28 15:20:26 +05:30

33 lines
976 B
Dart

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, 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.getEdtPosFromID(eid));
// print("GRABBED EDITOR: ${edt.name}");
return eid == ""
? Container()
: Expanded(
flex: 1,
child: TextButton(
child: Text("${edt.sname}"),
onPressed: () {
Shell().run(
"${edt.commandTemplate.replaceAll('\$path', path)}",
);
},
),
);
}
}