added proper editor buttons to prj card, APP BROKEN HERE.
All checks were successful
Build CI / AMD64 Build (push) Successful in 1m55s
Build CI / ARM64 Build (push) Successful in 7m8s

This commit is contained in:
2026-02-27 18:23:52 +05:30
parent 50c52b7619
commit 07f222a87e
7 changed files with 120 additions and 60 deletions

View File

@@ -11,6 +11,7 @@ class GlobalModel extends ChangeNotifier {
late List<bool> hoverShow;
late List<Editor> editors;
late SharedPreferences prefs;
late Map<String, int> id2EdtMap;
bool importedData = false;
bool edited = false;
@@ -22,13 +23,17 @@ class GlobalModel extends ChangeNotifier {
String edtData = prefs.getString(kEditorsKey)!;
List<dynamic> data = jsonDecode(edtData);
editors = [];
for (var d in data) {
editors.add(Editor.fromJson(d));
id2EdtMap = {};
for (var (i, d) in data.indexed) {
var localEdt = Editor.fromJson(d);
editors.add(localEdt);
id2EdtMap[localEdt.id] = i;
}
} else {
editors = [];
prefs.setString(kEditorsKey, jsonEncode(editors));
}
print(id2EdtMap);
if (prefs.containsKey(kProjectsKey)) {
String prjData = prefs.getString(kProjectsKey)!;
@@ -60,6 +65,8 @@ class GlobalModel extends ChangeNotifier {
prefs.setString(kEditorsKey, jsonEncode(arst));
}
// Project management
void addPrj(Project prj) {
projects.add(prj);
hoverShow.add(false);
@@ -97,6 +104,7 @@ class GlobalModel extends ChangeNotifier {
void updatePrj(int index, Project prj) {
projects[index] = prj;
saveProjectState();
notifyListeners();
}
@@ -122,6 +130,10 @@ class GlobalModel extends ChangeNotifier {
return editors[index];
}
int? getFromID(String? id) {
return id2EdtMap[id];
}
// Editing controller
bool get isEdited {