nice overview working
This commit is contained in:
@@ -12,6 +12,7 @@ import '../utils/navigation.dart';
|
||||
import '../widgets/empty_state.dart';
|
||||
import '../widgets/loading_view.dart';
|
||||
import '../widgets/responsive_body.dart';
|
||||
import '../widgets/skip_build_when_covered.dart';
|
||||
import 'transaction_detail_screen.dart';
|
||||
import 'transactions_screen.dart';
|
||||
|
||||
@@ -54,6 +55,10 @@ class _HomeBody extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Stay subscribed, but skip heavy scans while covered by another route
|
||||
// (e.g. transaction detail applying labels to many similar txs).
|
||||
context.watch<TxMetaController>();
|
||||
|
||||
if (bank.isLoading && bank.balance == null && !bank.hasData) {
|
||||
return const LoadingView(message: 'Checking bank link…');
|
||||
}
|
||||
@@ -89,16 +94,17 @@ class _HomeBody extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
final balance = bank.balance;
|
||||
final theme = Theme.of(context);
|
||||
final colors = theme.colorScheme;
|
||||
final meta = context.watch<TxMetaController>();
|
||||
final recent = bank.transactions.take(5).toList(growable: false);
|
||||
final categorized = bank.transactions
|
||||
.where((tx) => meta.metaFor(tx).hasLabel)
|
||||
.length;
|
||||
return SkipBuildWhenCovered(
|
||||
builder: (context) {
|
||||
final balance = bank.balance;
|
||||
final theme = Theme.of(context);
|
||||
final colors = theme.colorScheme;
|
||||
final meta = context.watch<TxMetaController>();
|
||||
final recent = bank.transactions.take(5).toList(growable: false);
|
||||
final categorized =
|
||||
meta.labeledTransactionCount(bank.transactions);
|
||||
|
||||
return ListView(
|
||||
return ListView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
padding: const EdgeInsets.only(top: 8, bottom: 32),
|
||||
children: [
|
||||
@@ -209,7 +215,7 @@ class _HomeBody extends StatelessWidget {
|
||||
leading: Builder(
|
||||
builder: (context) {
|
||||
final labels =
|
||||
meta.labelsFor(meta.metaFor(tx));
|
||||
meta.leafLabelsFor(meta.metaFor(tx));
|
||||
final label = labels.isEmpty ? null : labels.first;
|
||||
return Icon(
|
||||
label?.icon ?? Icons.receipt_long_outlined,
|
||||
@@ -247,6 +253,8 @@ class _HomeBody extends StatelessWidget {
|
||||
],
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user