look ahead

This commit is contained in:
davmar
2026-09-10 00:35:54 +02:00
parent 91d6dc9e54
commit 5b22fc8694
20 changed files with 2942 additions and 799 deletions
+21 -5
View File
@@ -61,6 +61,7 @@ class _TransactionsScreenState extends State<TransactionsScreen> {
var _showCalendar = false;
var _flowFilter = TxFlowFilter.all;
var _amountRange = const TxAmountRange();
var _recurringOnly = false;
/// Query actually used for filtering (Enter, or live once ≥3 chars).
String _activeQuery = '';
@@ -96,11 +97,15 @@ class _TransactionsScreenState extends State<TransactionsScreen> {
bool get _hasListFilters =>
_labelFilters.isNotEmpty ||
_flowFilter != TxFlowFilter.all ||
_amountRange.isActive;
_amountRange.isActive ||
_recurringOnly;
bool _matchesExtraFilters(BankTransaction tx) =>
txMatchesFlow(tx, _flowFilter) &&
txMatchesAmountRange(tx, _amountRange);
bool _matchesExtraFilters(BankTransaction tx, TxMetaController meta) {
if (!txMatchesFlow(tx, _flowFilter)) return false;
if (!txMatchesAmountRange(tx, _amountRange)) return false;
if (_recurringOnly && !meta.metaFor(tx).recurring) return false;
return true;
}
void _goMonth(int delta) {
final next = addMonths(_month, delta);
@@ -167,6 +172,7 @@ class _TransactionsScreenState extends State<TransactionsScreen> {
amountRange: _amountRange,
query: _activeQuery,
monthOnly: _searchInMonthOnly,
recurringOnly: _recurringOnly,
),
);
if (result == null || !mounted) return;
@@ -178,6 +184,7 @@ class _TransactionsScreenState extends State<TransactionsScreen> {
_flowFilter = result.flow;
_amountRange = result.amountRange;
_searchInMonthOnly = result.monthOnly;
_recurringOnly = result.recurringOnly;
if (!_searchInMonthOnly) {
_showCalendar = false;
_selectedDay = null;
@@ -339,7 +346,7 @@ class _TransactionsScreenState extends State<TransactionsScreen> {
_activeQuery,
labelIds: _labelFilters,
))
if (_matchesExtraFilters(tx)) tx,
if (_matchesExtraFilters(tx, metaController)) tx,
];
// Labels on the current result that aren't part of the active label filter.
@@ -675,6 +682,15 @@ class _TransactionsScreenState extends State<TransactionsScreen> {
);
},
),
if (_recurringOnly)
InputChip(
visualDensity: VisualDensity.compact,
avatar: const Icon(Icons.event_repeat, size: 14),
label: const Text('Recurring'),
onDeleted: () {
setState(() => _recurringOnly = false);
},
),
for (final id in _labelFilters)
if (id == kUncategorizedFilterId)
InputChip(