Skip to content

Commit

Permalink
Disable "Send" Menu Until Funds Are Available
Browse files Browse the repository at this point in the history
Fixes #905
  • Loading branch information
erdemyerebasmaz committed Sep 18, 2024
1 parent 224a1f5 commit bd1d7f5
Showing 1 changed file with 41 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import 'package:breez_translations/breez_translations_locales.dart';
import 'package:c_breez/bloc/account/account_bloc.dart';
import 'package:c_breez/bloc/account/account_state.dart';
import 'package:c_breez/routes/home/widgets/bottom_actions_bar/bottom_action_item_image.dart';
import 'package:c_breez/routes/home/widgets/bottom_actions_bar/enter_payment_info_dialog.dart';
import 'package:c_breez/theme/theme_provider.dart' as theme;
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class SendOptionsBottomSheet extends StatefulWidget {
final GlobalKey firstPaymentItemKey;
Expand All @@ -21,37 +24,44 @@ class _SendOptionsBottomSheetState extends State<SendOptionsBottomSheet> {
Widget build(BuildContext context) {
final texts = context.texts();

return Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 8.0),
ListTile(
leading: const BottomActionItemImage(
iconAssetPath: "src/icon/paste.png",
),
title: Text(
texts.bottom_action_bar_paste_invoice,
style: theme.bottomSheetTextStyle,
),
onTap: () => _showEnterPaymentInfoDialog(context, widget.firstPaymentItemKey),
),
Divider(
height: 0.0,
color: Colors.white.withOpacity(0.2),
indent: 72.0,
),
ListTile(
leading: const BottomActionItemImage(
iconAssetPath: "src/icon/bitcoin.png",
),
title: Text(
texts.bottom_action_bar_send_btc_address,
style: theme.bottomSheetTextStyle,
),
onTap: () => _sendToBTCAddress(),
),
const SizedBox(height: 8.0)
],
return BlocBuilder<AccountBloc, AccountState>(
builder: (context, account) {
final hasBalance = account.balanceSat > 0;
return Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 8.0),
ListTile(
enabled: hasBalance,
leading: const BottomActionItemImage(
iconAssetPath: "src/icon/paste.png",
),
title: Text(
texts.bottom_action_bar_paste_invoice,
style: theme.bottomSheetTextStyle,
),
onTap: () => _showEnterPaymentInfoDialog(context, widget.firstPaymentItemKey),
),
Divider(
height: 0.0,
color: Colors.white.withOpacity(0.2),
indent: 72.0,
),
ListTile(
enabled: hasBalance,
leading: const BottomActionItemImage(
iconAssetPath: "src/icon/bitcoin.png",
),
title: Text(
texts.bottom_action_bar_send_btc_address,
style: theme.bottomSheetTextStyle,
),
onTap: () => _sendToBTCAddress(),
),
const SizedBox(height: 8.0)
],
);
},
);
}

Expand Down

0 comments on commit bd1d7f5

Please sign in to comment.