hopefully final fixes

This commit is contained in:
Matthew Fosse 2024-02-29 12:57:20 -08:00
parent bc6073692a
commit ef9e30b2e0
2 changed files with 81 additions and 30 deletions

View file

@ -2,6 +2,7 @@ import 'package:cake_wallet/bitcoin/bitcoin.dart';
import 'package:cake_wallet/src/screens/receive/widgets/lightning_input_form.dart'; import 'package:cake_wallet/src/screens/receive/widgets/lightning_input_form.dart';
import 'package:cake_wallet/src/screens/receive/widgets/qr_image.dart'; import 'package:cake_wallet/src/screens/receive/widgets/qr_image.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions_content_override.dart';
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart'; import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart'; import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
@ -29,6 +30,7 @@ import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:qr_flutter/qr_flutter.dart' as qr;
class LightningInvoicePage extends BasePage { class LightningInvoicePage extends BasePage {
LightningInvoicePage({ LightningInvoicePage({
@ -72,7 +74,6 @@ class LightningInvoicePage extends BasePage {
caption: S.of(context).clear, caption: S.of(context).clear,
onPressed: () { onPressed: () {
_formKey.currentState?.reset(); _formKey.currentState?.reset();
// lightningViewModel.reset();
}); });
Future<bool> _onNavigateBack(BuildContext context) async { Future<bool> _onNavigateBack(BuildContext context) async {
@ -235,39 +236,41 @@ class LightningInvoicePage extends BasePage {
showPopUp<void>( showPopUp<void>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
// return AlertWithTwoActions( return AlertWithTwoActionsContentOverride(
// alertTitle: S.of(context).invoice_created, alertTitle: S.of(context).invoice_created,
// alertContent: state.payload as String, alertContent: Center(
// rightButtonText: S.of(context).ok, child: AspectRatio(
// actionRightButton: () => Navigator.of(context).pop(), aspectRatio: 1.0,
// actionLeftButton: () async {
// Clipboard.setData(ClipboardData(text: state.payload as String));
// showBar<void>(context, S.of(context).copied_to_clipboard);
// },
// leftButtonText: S.of(context).copy,
// );
return Center(
child: AspectRatio(
aspectRatio: 1.0,
child: Container(
padding: EdgeInsets.all(5),
decoration: BoxDecoration(
border: Border.all(
width: 3,
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
),
),
child: Container( child: Container(
decoration: BoxDecoration( padding: EdgeInsets.all(5),
border: Border.all( decoration: BoxDecoration(
width: 3, border: Border.all(
color: Colors.white, width: 3,
), color: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
), ),
child: QrImage(data: state.payload as String)), ),
child: Container(
decoration: BoxDecoration(
border: Border.all(
width: 3,
color: Colors.white,
),
),
child: QrImage(
data: state.payload as String,
version: 14,
errorCorrectionLevel: qr.QrErrorCorrectLevel.L,
)),
),
), ),
), ),
rightButtonText: S.of(context).ok,
actionRightButton: () => Navigator.of(context).pop(),
actionLeftButton: () async {
Clipboard.setData(ClipboardData(text: state.payload as String));
showBar<void>(context, S.of(context).copied_to_clipboard);
},
leftButtonText: S.of(context).copy,
); );
}); });
} }

View file

@ -0,0 +1,48 @@
import 'dart:ui';
import 'package:cake_wallet/src/widgets/base_alert_dialog.dart';
import 'package:flutter/cupertino.dart';
class AlertWithTwoActionsContentOverride extends BaseAlertDialog {
AlertWithTwoActionsContentOverride({
required this.alertTitle,
required this.alertContent,
required this.leftButtonText,
required this.rightButtonText,
required this.actionLeftButton,
required this.actionRightButton,
this.alertBarrierDismissible = true,
this.isDividerExist = false,
});
final String alertTitle;
final Widget alertContent;
final String leftButtonText;
final String rightButtonText;
final VoidCallback actionLeftButton;
final VoidCallback actionRightButton;
final bool alertBarrierDismissible;
// final Color leftActionColor;
// final Color rightActionColor;
final bool isDividerExist;
@override
String get titleText => alertTitle;
@override
String get leftActionButtonText => leftButtonText;
@override
String get rightActionButtonText => rightButtonText;
@override
VoidCallback get actionLeft => actionLeftButton;
@override
VoidCallback get actionRight => actionRightButton;
@override
bool get barrierDismissible => alertBarrierDismissible;
@override
Widget content(BuildContext context) {
return alertContent;
}
@override
bool get isDividerExists => isDividerExist;
}