fixed nullable mess with editor ids
Some checks failed
Build CI / AMD64 Build (push) Has been cancelled
Build CI / ARM64 Build (push) Has been cancelled

This commit is contained in:
2026-02-28 15:20:26 +05:30
parent 07f222a87e
commit 4f0503ca50
8 changed files with 67 additions and 53 deletions

View File

@@ -7,7 +7,7 @@ import "package:yaru/yaru.dart";
import "package:process_run/shell.dart";
class EditorCard extends StatelessWidget {
const EditorCard(this.id, {super.key});
const EditorCard(id, {super.key}) : id = id + 1;
final int id;
@override

View File

@@ -23,8 +23,8 @@ class EditorSelector extends StatelessWidget {
quarterTurns: turns,
),
onSelected: (a) {
print("$a");
prj.setEditor(turns, a);
// print("$a");
prj.setEditor(turns, a ?? "");
gm.updatePrj(id, prj);
},

View File

@@ -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)}",
);
},
),
);
}
}

View File

@@ -76,10 +76,16 @@ class ProjectCard extends StatelessWidget {
Row(
children: [
Column(
children: [LauncherButton(prj.e0), LauncherButton(prj.e1)],
children: [
LauncherButton(prj.e0, prj.path.path),
LauncherButton(prj.e1, prj.path.path),
],
),
Column(
children: [LauncherButton(prj.e2), LauncherButton(prj.e3)],
children: [
LauncherButton(prj.e2, prj.path.path),
LauncherButton(prj.e3, prj.path.path),
],
),
],
),