-
Notifications
You must be signed in to change notification settings - Fork 0
flutter: Transactions Phase B1 — grouping persistence + unit test #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
9d1eeae
flutter: Share→SharePlus migration step 1 — switch to SharePlus.insta…
zensgit 6301183
flutter: clean QR widget placeholder + remove local Share stub; use s…
zensgit c1a00d2
flutter: fix use_build_context_synchronously in AcceptInvitationDialo…
zensgit 139d958
flutter: context cleanup batch 1 (right_click_copy, custom_theme_edit…
zensgit cb8f290
flutter: context safety fixes in ThemeShareDialog and DeleteFamilyDialog
zensgit f187d07
flutter: context cleanup batch 2 (admin template page + batch op bar)
zensgit 741b89f
flutter: fix AuditLogsScreen statistics type; continue context-safety…
zensgit 51c6be6
flutter: context cleanup batch 3 prep — refine messenger/navigator ca…
zensgit 39c2f5f
flutter: context cleanup batch 3 — move captures post-await + scoped …
zensgit a1e7950
flutter: context cleanup batch 3 — ThemeManagementScreen messenger/na…
zensgit d4124c3
flutter: add User Assets overview screen + route; fix analyzer blocke…
zensgit 3973474
flutter: transactions Phase A scaffold — add search/filter bar and gr…
zensgit bff7320
flutter: wire Dashboard RecentTransactions filter button to open Tran…
zensgit 50736fa
docs: Transactions Filters & Grouping Phase B design (draft)
zensgit 58110a6
flutter: stabilize transactions UI scaffold; fix tests (search bar + …
zensgit 3437c06
flutter: TransactionsScreen uses shared TransactionList with search/g…
zensgit c03b2fe
flutter: transactions Phase B1 — persist grouping and collapsed group…
zensgit b54a119
fix: remove stray closing brace in transaction_provider
zensgit d9fd115
flutter: transactions — add grouping menu wired to controller; keep n…
zensgit b675dde
Merge main into feature/transactions-phase-b1
zensgit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| # Transactions Filters & Grouping — Phase B Design (草案) | ||
|
|
||
| Purpose | ||
| - Deliver practical, performant filtering + grouping for transactions. | ||
| - Keep UI declarative, leverage existing providers; avoid duplicating domain rules. | ||
|
|
||
| Scope | ||
| - Filters: text (描述/备注/收款方), 日期范围, 类型(支出/收入/转账), 账户, 分类, 标签, 金额区间。 | ||
| - Grouping: 按 日期 / 分类 / 账户;每组显示小计,总计在页眉/页脚。 | ||
| - Persist: 轻量本地记忆最近一次筛选与分组(per-ledger)。 | ||
| - Non-goals: 复杂多级排序、跨家庭聚合、导出(独立PR)。 | ||
|
|
||
| UX Outline | ||
| - TransactionsScreen 顶部显示 FilterBar(收起/展开)。 | ||
| - FilterBar: | ||
| - 搜索框(回车触发)、“筛选”按钮打开面板(日期/类型/账户/分类/标签/金额)、“重置”按钮。 | ||
| - 右侧“分组切换”:日期/分类/账户;在移动端为 Segmented 形式。 | ||
| - 列表: | ||
| - 分组头包含:组名 + 小计金额(正/负色),可折叠。 | ||
| - 空状态支持“清空筛选”。 | ||
|
|
||
| State & Providers | ||
| - transactionControllerProvider(现有): | ||
| - 扩展:`applyFilter(TransactionQuery q)`、`clearFilter()`、`setGrouping(Grouping g)`、`toggleGroupCollapse(key)`。 | ||
| - 状态新增:`currentQuery`、`grouping`、`groupCollapse: Set<String>`。 | ||
| - Query 模型(新): | ||
| ```dart | ||
| class TransactionQuery { | ||
| final String? text; | ||
| final DateTimeRange? dateRange; | ||
| final Set<TransactionType>? types; | ||
| final Set<String>? accountIds; | ||
| final Set<String>? categoryIds; | ||
| final Set<String>? tagIds; | ||
| final double? amountMin; | ||
| final double? amountMax; | ||
| const TransactionQuery({ ... }); | ||
| TransactionQuery copyWith(...); | ||
| bool get isEmpty; | ||
| } | ||
| ``` | ||
| - Grouping(新枚举):`date | category | account`。 | ||
| - 组合选择器:账户/分类/标签用现有 providers 源数据,支持多选(Chip/BottomSheet)。 | ||
|
|
||
| Data Flow | ||
| - UI → controller.applyFilter(query) → 计算/筛选 in-memory(Phase B) | ||
| - 未来 Phase C:若列表很大,落地到服务端 query(分页 + 去抖)。 | ||
|
|
||
| API/Backend Impact | ||
| - Phase B:无服务端改动。 | ||
| - Phase C(另案):增量新增 `/transactions/search` 支持字段与分页;Rust 侧生成 SQLx 查询 + .sqlx 更新。 | ||
|
|
||
| Persistence | ||
| - SharedPreferences key: `tx_ui_<ledgerId>_{query,grouping}`; | ||
| - 在 initState 读取并应用。 | ||
|
|
||
| Accessibility & i18n | ||
| - 分组头可聚焦;筛选面板控件提供语义标签;所有文案纳入 i18n 字典(后续批量替换)。 | ||
|
|
||
| Performance | ||
| - 过滤与分组在内存进行: | ||
| - 先按日期预分桶(Map<Date, List>)复用; | ||
| - 计算小计 O(n); | ||
| - 大列表按需构建(ListView.builder)。 | ||
|
|
||
| Acceptance Criteria | ||
| - 可对任意组合条件过滤,切换分组视图,显示正确小计与总计。 | ||
| - 刷新后保留上次筛选/分组。 | ||
| - analyzer 0 hard errors;tests 通过。 | ||
|
|
||
| Phasing | ||
| - B1:完成 Query 模型 + 控制器 + UI 面板(不含服务端)。 | ||
| - B2:分组小计 + 折叠 + 持久化。 | ||
| - B3:微交互与过渡动画;边界测试。 | ||
|
|
||
| Risks / Out of Scope | ||
| - 非线性金额转换/多货币换算(另案)。 | ||
| - 高维度组合过滤在低端机的性能(必要时分页)。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The persistence keys 'tx_grouping' and 'tx_group_collapse' are not namespaced per ledger as mentioned in the PR description. Consider adding ledger context to these keys to support multiple ledgers properly.