feat: Refactor routing and navigation structure with StatefulShellRoute
Test Suite / test (24.15.0) (push) Has been cancelled

- Introduced a new function `_shellBranchIndexForPath` to determine the index of the shell branch based on the path.
- Replaced `ShellRoute` with `StatefulShellRoute.indexedStack` for better state management during navigation.
- Updated `AppShell` to handle navigation path changes and integrate with the new routing structure.
- Organized routes into `StatefulShellBranch` for better modularity and clarity.
- Enhanced admin panel functionality with improved alias management and UI updates.
- Added new methods in `ReceiptImportSessionNotifier` for managing selected items and edits more efficiently.
- Improved UI components in receipt import and admin panels for better performance and user experience.
- Added PageStorageKeys to various ListViews to maintain scroll positions across navigation.
- Documented performance goals and profiling strategies in a new PERFORMANCE.md file.
This commit is contained in:
Nils-Johan Gynther
2026-05-08 12:51:38 +02:00
parent 73309cb110
commit 0873fa42bb
12 changed files with 625 additions and 285 deletions
@@ -186,6 +186,20 @@ class ReceiptImportSessionNotifier
unawaited(_persist());
}
void setImportedResult({
required List<ParsedReceiptItem> items,
required Map<int, ItemEdit> edits,
required Map<int, bool> selected,
}) {
final current = state ?? const ReceiptImportSession();
state = current.copyWith(
items: items,
edits: edits,
selected: selected,
);
unawaited(_persist());
}
void setEdit(int index, ItemEdit edit) {
if (state == null) return;
final edits = Map<int, ItemEdit>.from(state!.edits)..[index] = edit;
@@ -200,6 +214,25 @@ class ReceiptImportSessionNotifier
unawaited(_persist());
}
void setSelectedForIndexes(Iterable<int> indexes, bool value) {
if (state == null) return;
final selected = Map<int, bool>.from(state!.selected);
for (final index in indexes) {
selected[index] = value;
}
state = state!.copyWith(selected: selected);
unawaited(_persist());
}
void setSelectedForAll(int count, bool value) {
if (state == null) return;
final selected = <int, bool>{
for (var i = 0; i < count; i++) i: value,
};
state = state!.copyWith(selected: selected);
unawaited(_persist());
}
Future<void> restore() async {
final prefs = await SharedPreferences.getInstance();
final raw = prefs.getString(_storageKey);