mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 12:09:43 +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/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,19 +236,9 @@ 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,
|
|
||||||
// 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(
|
child: AspectRatio(
|
||||||
aspectRatio: 1.0,
|
aspectRatio: 1.0,
|
||||||
child: Container(
|
child: Container(
|
||||||
|
@ -265,9 +256,21 @@ class LightningInvoicePage extends BasePage {
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: QrImage(data: state.payload as String)),
|
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