From a4e7ebe39ccd522430b350fab2f66f13c465f5ec Mon Sep 17 00:00:00 2001 From: Catrya <140891948+Catrya@users.noreply.github.com> Date: Thu, 14 May 2026 14:20:57 -0600 Subject: [PATCH] flatten pay-invoice and add-invoice screens - remove inner gray card wrapper from add-invoice screen - remove CustomCard and Material wrappers from pay-invoice screen - drop unused custom_card import - set scaffold background to dark1 on both screens - apply consistent padding with safe-area bottom inset --- .../screens/add_lightning_invoice_screen.dart | 79 +++++------ .../screens/pay_lightning_invoice_screen.dart | 133 +++++++++--------- 2 files changed, 100 insertions(+), 112 deletions(-) diff --git a/lib/features/order/screens/add_lightning_invoice_screen.dart b/lib/features/order/screens/add_lightning_invoice_screen.dart index 7036755ee..46fa809fe 100644 --- a/lib/features/order/screens/add_lightning_invoice_screen.dart +++ b/lib/features/order/screens/add_lightning_invoice_screen.dart @@ -67,55 +67,42 @@ class _AddLightningInvoiceScreenState (amount ?? 0) > 0; return Scaffold( - backgroundColor: AppTheme.backgroundDark, + backgroundColor: AppTheme.dark1, appBar: OrderAppBar(title: S.of(context)!.addLightningInvoice), body: Padding( - padding: EdgeInsets.only( - bottom: MediaQuery.of(context).viewPadding.bottom, - ), - child: Column( - children: [ - Expanded( - child: Container( - margin: const EdgeInsets.all(16), - padding: const EdgeInsets.all(20), - decoration: BoxDecoration( - color: AppTheme.backgroundCard, - borderRadius: BorderRadius.circular(16), - border: - Border.all(color: Colors.white.withValues(alpha: 0.1)), - ), - child: showLnAddressConfirmation - ? _buildLnAddressConfirmation( - orderIdValue: orderIdValue, - ) - : showNwcInvoice - ? _buildNwcInvoiceFlow( - amount: amount ?? 0, - fiatAmount: fiatAmount, - fiatCode: fiatCode, - orderIdValue: orderIdValue, - ) - : AddLightningInvoiceWidget( - controller: invoiceController, - onSubmit: () async { - final invoice = invoiceController.text.trim(); - if (invoice.isNotEmpty) { - await _submitInvoice(invoice, amount); - } - }, - onCancel: () async { - await _cancelOrder(); - }, - amount: amount ?? 0, - fiatAmount: fiatAmount, - fiatCode: fiatCode, - orderId: orderIdValue, - ), - ), - ), - ], + padding: EdgeInsets.fromLTRB( + 16, + 16, + 16, + 16 + MediaQuery.of(context).viewPadding.bottom, ), + child: showLnAddressConfirmation + ? _buildLnAddressConfirmation( + orderIdValue: orderIdValue, + ) + : showNwcInvoice + ? _buildNwcInvoiceFlow( + amount: amount ?? 0, + fiatAmount: fiatAmount, + fiatCode: fiatCode, + orderIdValue: orderIdValue, + ) + : AddLightningInvoiceWidget( + controller: invoiceController, + onSubmit: () async { + final invoice = invoiceController.text.trim(); + if (invoice.isNotEmpty) { + await _submitInvoice(invoice, amount); + } + }, + onCancel: () async { + await _cancelOrder(); + }, + amount: amount ?? 0, + fiatAmount: fiatAmount, + fiatCode: fiatCode, + orderId: orderIdValue, + ), ), ); }, diff --git a/lib/features/order/screens/pay_lightning_invoice_screen.dart b/lib/features/order/screens/pay_lightning_invoice_screen.dart index 68e67f55d..cfdbd00da 100644 --- a/lib/features/order/screens/pay_lightning_invoice_screen.dart +++ b/lib/features/order/screens/pay_lightning_invoice_screen.dart @@ -5,7 +5,6 @@ import 'package:mostro_mobile/core/app_theme.dart'; import 'package:mostro_mobile/features/order/providers/order_notifier_provider.dart'; import 'package:mostro_mobile/features/order/widgets/order_app_bar.dart'; import 'package:mostro_mobile/features/wallet/providers/nwc_provider.dart'; -import 'package:mostro_mobile/shared/widgets/custom_card.dart'; import 'package:mostro_mobile/shared/widgets/nwc_payment_widget.dart'; import 'package:mostro_mobile/shared/widgets/pay_lightning_invoice_widget.dart'; import 'package:mostro_mobile/generated/l10n.dart'; @@ -42,74 +41,76 @@ class _PayLightningInvoiceScreenState return Scaffold( backgroundColor: AppTheme.dark1, appBar: OrderAppBar(title: S.of(context)!.payLightningInvoice), - body: CustomCard( - padding: const EdgeInsets.all(16), - child: Material( - color: AppTheme.dark2, - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - if (showNwcPayment) ...[ - // NWC auto-payment flow - Text( - S.of(context)!.payInvoiceToContinue( - sats.toString(), - fiatCode, - fiatAmount, - widget.orderId, - ), - style: const TextStyle(color: AppTheme.cream1, fontSize: 18), - textAlign: TextAlign.center, - ), - const SizedBox(height: 24), - NwcPaymentWidget( - lnInvoice: lnInvoice, - sats: sats, - onPaymentSuccess: () { - // Payment succeeded — Mostro will update the order state - // automatically via the event stream. We just navigate home. - context.go('/'); - }, - onFallbackToManual: () { - setState(() => _manualMode = true); - }, + body: Padding( + padding: EdgeInsets.fromLTRB( + 16, + 16, + 16, + 16 + MediaQuery.of(context).viewPadding.bottom, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + if (showNwcPayment) ...[ + // NWC auto-payment flow + Text( + S.of(context)!.payInvoiceToContinue( + sats.toString(), + fiatCode, + fiatAmount, + widget.orderId, ), - const SizedBox(height: 20), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - ElevatedButton( - onPressed: () async { - context.go('/'); - await orderNotifier.cancelOrder(); - }, - style: ElevatedButton.styleFrom( - foregroundColor: Colors.white, - backgroundColor: Colors.red, - ), - child: Text(S.of(context)!.cancel), + style: const TextStyle(color: AppTheme.cream1, fontSize: 18), + textAlign: TextAlign.center, + ), + const SizedBox(height: 24), + NwcPaymentWidget( + lnInvoice: lnInvoice, + sats: sats, + onPaymentSuccess: () { + // Payment succeeded — Mostro will update the order state + // automatically via the event stream. We just navigate home. + context.go('/'); + }, + onFallbackToManual: () { + setState(() => _manualMode = true); + }, + ), + const SizedBox(height: 20), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ElevatedButton( + onPressed: () async { + context.go('/'); + await orderNotifier.cancelOrder(); + }, + style: ElevatedButton.styleFrom( + foregroundColor: Colors.white, + backgroundColor: Colors.red, ), - ], - ), - ] else ...[ - // Manual payment flow (original) - PayLightningInvoiceWidget( - onSubmit: () async { - context.go('/'); - }, - onCancel: () async { - context.go('/'); - await orderNotifier.cancelOrder(); - }, - lnInvoice: lnInvoice, - sats: sats, - fiatAmount: fiatAmount, - fiatCode: fiatCode, - orderId: widget.orderId, - ), - ], + child: Text(S.of(context)!.cancel), + ), + ], + ), + ] else ...[ + // Manual payment flow (original) + PayLightningInvoiceWidget( + onSubmit: () async { + context.go('/'); + }, + onCancel: () async { + context.go('/'); + await orderNotifier.cancelOrder(); + }, + lnInvoice: lnInvoice, + sats: sats, + fiatAmount: fiatAmount, + fiatCode: fiatCode, + orderId: widget.orderId, + ), ], - ), + ], ), ), );