spinner feedback to ui
This commit is contained in:
@@ -23,6 +23,8 @@ class HomeFilterWidgetCard extends StatelessWidget {
|
||||
this.onToggleDisplay,
|
||||
this.onEdit,
|
||||
this.dragHandle,
|
||||
this.precomputedStats,
|
||||
this.precomputedBudget,
|
||||
});
|
||||
|
||||
final HomeFilterWidget widgetConfig;
|
||||
@@ -31,6 +33,10 @@ class HomeFilterWidgetCard extends StatelessWidget {
|
||||
final VoidCallback? onEdit;
|
||||
final Widget? dragHandle;
|
||||
|
||||
/// When set, skips scanning all transactions in build.
|
||||
final TxFilterMetrics? precomputedStats;
|
||||
final HomeBudgetMetrics? precomputedBudget;
|
||||
|
||||
void _openTransactions(BuildContext context) {
|
||||
final filter = widgetConfig.filter;
|
||||
Navigator.of(context).push(
|
||||
@@ -95,12 +101,14 @@ class HomeFilterWidgetCard extends StatelessWidget {
|
||||
currency: currency,
|
||||
transactions: bank.transactions,
|
||||
meta: meta,
|
||||
precomputed: precomputedBudget,
|
||||
)
|
||||
: _StatsBody(
|
||||
widgetConfig: widgetConfig,
|
||||
currency: currency,
|
||||
transactions: bank.transactions,
|
||||
meta: meta,
|
||||
precomputed: precomputedStats,
|
||||
),
|
||||
),
|
||||
if (editing && onToggleDisplay != null)
|
||||
@@ -267,22 +275,25 @@ class _StatsBody extends StatelessWidget {
|
||||
required this.currency,
|
||||
required this.transactions,
|
||||
required this.meta,
|
||||
this.precomputed,
|
||||
});
|
||||
|
||||
final HomeFilterWidget widgetConfig;
|
||||
final String currency;
|
||||
final List<BankTransaction> transactions;
|
||||
final TxMetaController meta;
|
||||
final TxFilterMetrics? precomputed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final colors = theme.colorScheme;
|
||||
final metrics = computeTxFilterMetrics(
|
||||
all: transactions,
|
||||
meta: meta,
|
||||
filter: widgetConfig.filter,
|
||||
);
|
||||
final metrics = precomputed ??
|
||||
computeTxFilterMetrics(
|
||||
all: transactions,
|
||||
meta: meta,
|
||||
filter: widgetConfig.filter,
|
||||
);
|
||||
|
||||
// Prefer a single hero "Spent" figure when that's the main metric.
|
||||
final spentOnly = widgetConfig.showAmountOut &&
|
||||
@@ -383,22 +394,25 @@ class _BudgetBody extends StatelessWidget {
|
||||
required this.currency,
|
||||
required this.transactions,
|
||||
required this.meta,
|
||||
this.precomputed,
|
||||
});
|
||||
|
||||
final HomeFilterWidget widgetConfig;
|
||||
final String currency;
|
||||
final List<BankTransaction> transactions;
|
||||
final TxMetaController meta;
|
||||
final HomeBudgetMetrics? precomputed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final colors = theme.colorScheme;
|
||||
final budget = computeHomeBudgetMetrics(
|
||||
all: transactions,
|
||||
meta: meta,
|
||||
widget: widgetConfig,
|
||||
);
|
||||
final budget = precomputed ??
|
||||
computeHomeBudgetMetrics(
|
||||
all: transactions,
|
||||
meta: meta,
|
||||
widget: widgetConfig,
|
||||
);
|
||||
final progress = budget.progress.clamp(0.0, 1.0);
|
||||
final fillColor = budget.overBudget
|
||||
? AppTheme.expense
|
||||
|
||||
Reference in New Issue
Block a user