tx history improved layout (wip)
What changed, and why it matters
This commit is a cosmetic work-in-progress change to the transaction history screen. It adds a shorter version of the transaction list (showing only the first 3 non-date items) for use in a compact layout. There is no security-relevant behavior visible in the diff.
No security action needed; treat as routine UI refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch introduces a short boolean parameter to HistorySection and a new computed itemsShort property on DashboardViewModelBase that filters out DateSectionItem entries and takes the first 3 ActionListItem entries. AssetsHistorySection now passes short: true. This is purely UI/presentation logic; no data handling, cryptography, networking, permissions, or secrets are touched.
Changed components
lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dartlib/new-ui/widgets/coins_page/assets_history/history_section.dartlib/view_model/dashboard/dashboard_view_model.dartInspect captured patch +19 / −7
diff --git a/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart b/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart
index 998ebc13..e57f46c7 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/assets_history_section.dart
@@ -43,6 +43,7 @@ class _AssetsHistorySectionState extends State<AssetsHistorySection> {
S.current.history,
HistorySection(
dashboardViewModel: widget.dashboardViewModel,
+ short: true,
)),
if (isNFTACtivatedChain(widget.dashboardViewModel.wallet.type,
chainId: widget.dashboardViewModel.wallet.chainId))
diff --git a/lib/new-ui/widgets/coins_page/assets_history/history_section.dart b/lib/new-ui/widgets/coins_page/assets_history/history_section.dart
index 32d99020..e4ecd623 100644
--- a/lib/new-ui/widgets/coins_page/assets_history/history_section.dart
+++ b/lib/new-ui/widgets/coins_page/assets_history/history_section.dart
@@ -1,3 +1,5 @@
+import 'dart:math';
+
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/new-ui/widgets/coins_page/assets_history/anonpay_history_tile.dart';
@@ -22,16 +24,19 @@ import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:intl/intl.dart';
class HistorySection extends StatelessWidget {
- const HistorySection({super.key, required this.dashboardViewModel});
+ const HistorySection({super.key, required this.dashboardViewModel, required this.short});
final DashboardViewModel dashboardViewModel;
+ final bool short;
@override
Widget build(BuildContext context) {
+ final items = short ? dashboardViewModel.itemsShort : dashboardViewModel.items;
+
return SliverPadding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
sliver: Observer(
- builder: (_) => (dashboardViewModel.items.isEmpty)
+ builder: (_) => (items.isEmpty)
? SliverPadding(
padding: EdgeInsets.only(top: 24),
sliver: SliverToBoxAdapter(
@@ -48,14 +53,14 @@ class HistorySection extends StatelessWidget {
)
: SliverList(
delegate: SliverChildBuilderDelegate(
- childCount: dashboardViewModel.items.length,
+ childCount: items.length,
(context, index) => Observer(builder: (_) {
- final prevItem = index == 0 ? null : dashboardViewModel.items[index - 1];
+ final prevItem = index == 0 ? null : items[index - 1];
final topPadding = index == 0 ? 0.0 : 18.0;
- final item = dashboardViewModel.items[index];
- final nextItem = index == dashboardViewModel.items.length - 1
+ final item = items[index];
+ final nextItem = index == items.length - 1
? null
- : dashboardViewModel.items[index + 1];
+ : items[index + 1];
final roundedBottom = (nextItem == null || nextItem is DateSectionItem);
final roundedTop = (prevItem == null || prevItem is DateSectionItem);
diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart
index d97d119a..1a2e476e 100644
--- a/lib/view_model/dashboard/dashboard_view_model.dart
+++ b/lib/view_model/dashboard/dashboard_view_model.dart
@@ -5,6 +5,7 @@ import 'dart:io' show Platform;
import 'package:cake_wallet/.secrets.g.dart' as secrets;
import 'package:cake_wallet/bitcoin/bitcoin.dart';
import 'package:cake_wallet/core/key_service.dart';
+import 'package:cake_wallet/view_model/dashboard/date_section_item.dart';
import "package:cw_core/balance_card_style_settings.dart";
import 'package:cake_wallet/core/trade_monitor.dart';
import 'package:cake_wallet/entities/auto_generate_subaddress_status.dart';
@@ -715,6 +716,11 @@ abstract class DashboardViewModelBase with Store {
return formattedItemsList(_items);
}
+ static const shortHistoryLength = 3;
+
+ @computed
+ List<ActionListItem> get itemsShort => items.where((item)=>item is! DateSectionItem).take(3).toList();
+
@observable
WalletBase<Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo> wallet;
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.