-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathtransactions_screen.dart
More file actions
77 lines (73 loc) · 2.74 KB
/
Copy pathtransactions_screen.dart
File metadata and controls
77 lines (73 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import 'package:bb_mobile/core/themes/app_theme.dart';
import 'package:bb_mobile/core/utils/build_context_x.dart';
import 'package:bb_mobile/core/widgets/bb_pullable_body.dart';
import 'package:bb_mobile/core/widgets/navbar/top_bar.dart';
import 'package:bb_mobile/core/widgets/text/text.dart';
import 'package:bb_mobile/features/transactions/presentation/blocs/transactions_cubit.dart';
import 'package:bb_mobile/features/transactions/ui/transactions_router.dart';
import 'package:bb_mobile/features/transactions/ui/widgets/tx_list.dart';
import 'package:bb_mobile/features/transactions/ui/widgets/txs_filter_row.dart';
import 'package:bb_mobile/features/transactions/ui/widgets/txs_syncing_indicator.dart';
import 'package:bb_mobile/features/wallet/presentation/bloc/wallet_bloc.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:gap/gap.dart';
import 'package:go_router/go_router.dart';
class TransactionsScreen extends StatelessWidget {
const TransactionsScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
forceMaterialTransparency: true,
automaticallyImplyLeading: false,
titleSpacing: 0,
title: TopBar(
title: context.loc.transactionTitle,
onBack: () {
context.pop();
},
actionIcon: Icons.file_download,
onAction: () =>
context.pushNamed(TransactionsRoute.exportTransactions.name),
),
backgroundColor: context.appColors.surface,
elevation: 0,
),
body: const _Screen(),
);
}
}
class _Screen extends StatelessWidget {
const _Screen();
@override
Widget build(BuildContext context) {
final err = context.select((TransactionsCubit cubit) => cubit.state.err);
return BBPullableBody(
onRefresh: () async {
// Wait for the chain sync (bitcoin + liquid + swaps) to actually
// finish before reloading the local tx list.
await context.read<WalletBloc>().refresh();
if (!context.mounted) return;
await context.read<TransactionsCubit>().loadTxs();
},
slivers: [
const SliverToBoxAdapter(child: TxsFilterRow()),
const SliverToBoxAdapter(child: TxsSyncingIndicator()),
if (err != null)
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: BBText(
context.loc.transactionError(err.toString()),
style: context.font.bodyLarge,
color: context.appColors.error,
),
),
),
const SliverToBoxAdapter(child: Gap(16.0)),
const TxList(sliver: true),
],
);
}
}