mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 03:59:23 +00:00
hopefully final fixes
This commit is contained in:
parent
bc6073692a
commit
ef9e30b2e0
2 changed files with 81 additions and 30 deletions
|
@ -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/qr_image.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/exchange_page_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/scollable_with_bottom_section.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart' as qr;
|
||||
|
||||
class LightningInvoicePage extends BasePage {
|
||||
LightningInvoicePage({
|
||||
|
@ -72,7 +74,6 @@ class LightningInvoicePage extends BasePage {
|
|||
caption: S.of(context).clear,
|
||||
onPressed: () {
|
||||
_formKey.currentState?.reset();
|
||||
// lightningViewModel.reset();
|
||||
});
|
||||
|
||||
Future<bool> _onNavigateBack(BuildContext context) async {
|
||||
|
@ -235,39 +236,41 @@ class LightningInvoicePage extends BasePage {
|
|||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
// return AlertWithTwoActions(
|
||||
// alertTitle: S.of(context).invoice_created,
|
||||
// alertContent: state.payload as String,
|
||||
// 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,
|
||||
// );
|
||||
|
||||
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,
|
||||
),
|
||||
),
|
||||
return AlertWithTwoActionsContentOverride(
|
||||
alertTitle: S.of(context).invoice_created,
|
||||
alertContent: Center(
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1.0,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
width: 3,
|
||||
color: Colors.white,
|
||||
),
|
||||
padding: EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
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,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
48
lib/src/widgets/alert_with_two_actions_content_override.dart
Normal file
48
lib/src/widgets/alert_with_two_actions_content_override.dart
Normal 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;
|
||||
}
|
Loading…
Reference in a new issue