Allow Exporting transaction history to a CSV file (#3230)

* Allow Exporting transaction history to a CSV file

* fix: improve safety for share dialog bounds and navigation pop
This commit is contained in:
Omar Hatem
2026-05-18 16:53:06 +02:00
committed by GitHub
parent 491a692cd6
commit 4125c5fe80
38 changed files with 538 additions and 48 deletions
@@ -1,4 +1,5 @@
import 'package:cake_wallet/bitcoin/bitcoin.dart';
import 'package:cake_wallet/core/csv_export_service.dart';
import 'package:cake_wallet/entities/balance_display_mode.dart';
import 'package:cake_wallet/order/order_source_description.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/anonpay_transaction_row.dart';
@@ -65,6 +66,8 @@ class TransactionsPage extends StatelessWidget {
}),
HeaderRow(
dashboardViewModel: dashboardViewModel,
onExportCsv: () =>
CsvExportService().exportToCsv(dashboardViewModel.items, context),
key: ValueKey('transactions_page_header_row_key'),
),
Expanded(
@@ -5,9 +5,10 @@ import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
class HeaderRow extends StatelessWidget {
HeaderRow({required this.dashboardViewModel, super.key});
HeaderRow({required this.dashboardViewModel, this.onExportCsv, super.key});
final DashboardViewModel dashboardViewModel;
final VoidCallback? onExportCsv;
@override
Widget build(BuildContext context) {
@@ -28,31 +29,62 @@ class HeaderRow extends StatelessWidget {
fontWeight: FontWeight.w500,
color: Theme.of(context).colorScheme.onSurface),
),
Semantics(
container: true,
child: GestureDetector(
key: ValueKey('transactions_page_header_row_transaction_filter_button_key'),
onTap: () {
showPopUp<void>(
context: context,
builder: (context) => FilterWidget(filterItems: dashboardViewModel.filterItems),
);
},
child: Semantics(
label: 'Transaction Filter',
button: true,
enabled: true,
child: Container(
height: 36,
width: 36,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).colorScheme.surfaceContainer,
Row(
children: [
if (onExportCsv != null)
Padding(
padding: const EdgeInsets.only(right: 8),
child: GestureDetector(
key: ValueKey('transactions_page_header_row_export_csv_button_key'),
onTap: onExportCsv,
child: Semantics(
label: S.of(context).export_csv,
button: true,
enabled: true,
child: Container(
height: 36,
width: 36,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).colorScheme.surfaceContainer,
),
child: Icon(
Icons.file_download_outlined,
color: Theme.of(context).colorScheme.onSurface,
size: 20,
),
),
),
),
),
Semantics(
container: true,
child: GestureDetector(
key: ValueKey('transactions_page_header_row_transaction_filter_button_key'),
onTap: () {
showPopUp<void>(
context: context,
builder: (context) =>
FilterWidget(filterItems: dashboardViewModel.filterItems),
);
},
child: Semantics(
label: 'Transaction Filter',
button: true,
enabled: true,
child: Container(
height: 36,
width: 36,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).colorScheme.surfaceContainer,
),
child: filterIcon,
),
),
child: filterIcon,
),
),
),
],
)
],
),