From 66c2fbc64d84f6b85ce2605ff1231ca13d724b2e Mon Sep 17 00:00:00 2001 From: ruben beck Date: Mon, 9 Oct 2023 12:39:50 +0200 Subject: [PATCH] add refunds to warnings --- .../widgets/app_bar/account_required_actions.dart | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/routes/home/widgets/app_bar/account_required_actions.dart b/lib/routes/home/widgets/app_bar/account_required_actions.dart index 077432273..aba04278d 100644 --- a/lib/routes/home/widgets/app_bar/account_required_actions.dart +++ b/lib/routes/home/widgets/app_bar/account_required_actions.dart @@ -6,12 +6,15 @@ import 'package:c_breez/bloc/backup/backup_state.dart'; import 'package:c_breez/bloc/ext/block_builder_extensions.dart'; import 'package:c_breez/bloc/lsp/lsp_bloc.dart'; import 'package:c_breez/bloc/lsp/lsp_state.dart'; +import 'package:c_breez/bloc/refund/refund_bloc.dart'; import 'package:c_breez/routes/home/widgets/app_bar/warning_action.dart'; import 'package:c_breez/routes/home/widgets/enable_backup_dialog.dart'; import 'package:c_breez/routes/home/widgets/rotator.dart'; +import 'package:c_breez/routes/subswap/swap/get_refund/get_refund_page.dart'; import 'package:c_breez/services/injector.dart'; import 'package:c_breez/widgets/backup_in_progress_dialog.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; class AccountRequiredActionsIndicator extends StatelessWidget { const AccountRequiredActionsIndicator({ @@ -24,6 +27,8 @@ class AccountRequiredActionsIndicator extends StatelessWidget { return BlocBuilder3( builder: (context, accState, lspState, backupState) { final navigatorState = Navigator.of(context); + final refundBloc = context.read(); + final refundState = refundBloc.state; List warnings = []; int walletBalance = accState.walletBalance; @@ -99,6 +104,16 @@ class AccountRequiredActionsIndicator extends StatelessWidget { ); } + if (refundState.refundables != null && refundState.refundables!.isNotEmpty) { + warnings.add( + WarningAction( + () { + showDialog(context: context, builder: (_) => GetRefundPage(refundBloc: refundBloc)); + }, + ), + ); + } + if (warnings.isEmpty) {} return Row(