|
|
|
@ -3,6 +3,7 @@ import 'package:cake_wallet/view_model/send/output.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:cake_wallet/src/widgets/base_alert_dialog.dart';
|
|
|
|
|
import 'package:cake_wallet/generated/i18n.dart';
|
|
|
|
|
import 'package:cake_wallet/src/widgets/cake_scrollbar.dart';
|
|
|
|
|
|
|
|
|
|
class ConfirmSendingAlert extends BaseAlertDialog {
|
|
|
|
|
ConfirmSendingAlert({
|
|
|
|
@ -18,13 +19,7 @@ class ConfirmSendingAlert extends BaseAlertDialog {
|
|
|
|
|
@required this.rightButtonText,
|
|
|
|
|
@required this.actionLeftButton,
|
|
|
|
|
@required this.actionRightButton,
|
|
|
|
|
this.alertBarrierDismissible = true
|
|
|
|
|
}) {
|
|
|
|
|
itemCount = outputs.length;
|
|
|
|
|
recipientTitle = itemCount > 1
|
|
|
|
|
? S.current.transaction_details_recipient_address
|
|
|
|
|
: S.current.recipient_address;
|
|
|
|
|
}
|
|
|
|
|
this.alertBarrierDismissible = true});
|
|
|
|
|
|
|
|
|
|
final String alertTitle;
|
|
|
|
|
final String amount;
|
|
|
|
@ -40,9 +35,6 @@ class ConfirmSendingAlert extends BaseAlertDialog {
|
|
|
|
|
final VoidCallback actionRightButton;
|
|
|
|
|
final bool alertBarrierDismissible;
|
|
|
|
|
|
|
|
|
|
String recipientTitle;
|
|
|
|
|
int itemCount;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
String get titleText => alertTitle;
|
|
|
|
|
|
|
|
|
@ -65,10 +57,96 @@ class ConfirmSendingAlert extends BaseAlertDialog {
|
|
|
|
|
bool get barrierDismissible => alertBarrierDismissible;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget content(BuildContext context) {
|
|
|
|
|
return Container(
|
|
|
|
|
Widget content(BuildContext context) => ConfirmSendingAlertContent(
|
|
|
|
|
amount: amount,
|
|
|
|
|
amountValue: amountValue,
|
|
|
|
|
fiatAmountValue: fiatAmountValue,
|
|
|
|
|
fee: fee,
|
|
|
|
|
feeValue: feeValue,
|
|
|
|
|
feeFiatAmount: feeFiatAmount,
|
|
|
|
|
outputs: outputs
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class ConfirmSendingAlertContent extends StatefulWidget {
|
|
|
|
|
ConfirmSendingAlertContent({
|
|
|
|
|
@required this.amount,
|
|
|
|
|
@required this.amountValue,
|
|
|
|
|
@required this.fiatAmountValue,
|
|
|
|
|
@required this.fee,
|
|
|
|
|
@required this.feeValue,
|
|
|
|
|
@required this.feeFiatAmount,
|
|
|
|
|
@required this.outputs});
|
|
|
|
|
|
|
|
|
|
final String amount;
|
|
|
|
|
final String amountValue;
|
|
|
|
|
final String fiatAmountValue;
|
|
|
|
|
final String fee;
|
|
|
|
|
final String feeValue;
|
|
|
|
|
final String feeFiatAmount;
|
|
|
|
|
final List<Output> outputs;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
ConfirmSendingAlertContentState createState() => ConfirmSendingAlertContentState(
|
|
|
|
|
amount: amount,
|
|
|
|
|
amountValue: amountValue,
|
|
|
|
|
fiatAmountValue: fiatAmountValue,
|
|
|
|
|
fee: fee,
|
|
|
|
|
feeValue: feeValue,
|
|
|
|
|
feeFiatAmount: feeFiatAmount,
|
|
|
|
|
outputs: outputs
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class ConfirmSendingAlertContentState extends State<ConfirmSendingAlertContent> {
|
|
|
|
|
ConfirmSendingAlertContentState({
|
|
|
|
|
@required this.amount,
|
|
|
|
|
@required this.amountValue,
|
|
|
|
|
@required this.fiatAmountValue,
|
|
|
|
|
@required this.fee,
|
|
|
|
|
@required this.feeValue,
|
|
|
|
|
@required this.feeFiatAmount,
|
|
|
|
|
@required this.outputs}) {
|
|
|
|
|
|
|
|
|
|
itemCount = outputs.length;
|
|
|
|
|
recipientTitle = itemCount > 1
|
|
|
|
|
? S.current.transaction_details_recipient_address
|
|
|
|
|
: S.current.recipient_address;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final String amount;
|
|
|
|
|
final String amountValue;
|
|
|
|
|
final String fiatAmountValue;
|
|
|
|
|
final String fee;
|
|
|
|
|
final String feeValue;
|
|
|
|
|
final String feeFiatAmount;
|
|
|
|
|
final List<Output> outputs;
|
|
|
|
|
|
|
|
|
|
final double backgroundHeight = 160;
|
|
|
|
|
final double thumbHeight = 72;
|
|
|
|
|
ScrollController controller = ScrollController();
|
|
|
|
|
double fromTop = 0;
|
|
|
|
|
String recipientTitle;
|
|
|
|
|
int itemCount;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
controller.addListener(() {
|
|
|
|
|
fromTop = controller.hasClients
|
|
|
|
|
? (controller.offset / controller.position.maxScrollExtent *
|
|
|
|
|
(backgroundHeight - thumbHeight))
|
|
|
|
|
: 0;
|
|
|
|
|
setState(() {});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return Stack(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
clipBehavior: Clip.none,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
height: 200,
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
controller: controller,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Row(
|
|
|
|
@ -82,7 +160,10 @@ class ConfirmSendingAlert extends BaseAlertDialog {
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
|
fontFamily: 'Lato',
|
|
|
|
|
color: Theme.of(context).primaryTextTheme.title.color,
|
|
|
|
|
color: Theme.of(context)
|
|
|
|
|
.primaryTextTheme
|
|
|
|
|
.title
|
|
|
|
|
.color,
|
|
|
|
|
decoration: TextDecoration.none,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -95,7 +176,10 @@ class ConfirmSendingAlert extends BaseAlertDialog {
|
|
|
|
|
fontSize: 18,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontFamily: 'Lato',
|
|
|
|
|
color: Theme.of(context).primaryTextTheme.title.color,
|
|
|
|
|
color: Theme.of(context)
|
|
|
|
|
.primaryTextTheme
|
|
|
|
|
.title
|
|
|
|
|
.color,
|
|
|
|
|
decoration: TextDecoration.none,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -126,7 +210,10 @@ class ConfirmSendingAlert extends BaseAlertDialog {
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
|
fontFamily: 'Lato',
|
|
|
|
|
color: Theme.of(context).primaryTextTheme.title.color,
|
|
|
|
|
color: Theme.of(context)
|
|
|
|
|
.primaryTextTheme
|
|
|
|
|
.title
|
|
|
|
|
.color,
|
|
|
|
|
decoration: TextDecoration.none,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -139,7 +226,10 @@ class ConfirmSendingAlert extends BaseAlertDialog {
|
|
|
|
|
fontSize: 18,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontFamily: 'Lato',
|
|
|
|
|
color: Theme.of(context).primaryTextTheme.title.color,
|
|
|
|
|
color: Theme.of(context)
|
|
|
|
|
.primaryTextTheme
|
|
|
|
|
.title
|
|
|
|
|
.color,
|
|
|
|
|
decoration: TextDecoration.none,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -168,7 +258,10 @@ class ConfirmSendingAlert extends BaseAlertDialog {
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
|
fontFamily: 'Lato',
|
|
|
|
|
color: Theme.of(context).primaryTextTheme.title.color,
|
|
|
|
|
color: Theme.of(context)
|
|
|
|
|
.primaryTextTheme
|
|
|
|
|
.title
|
|
|
|
|
.color,
|
|
|
|
|
decoration: TextDecoration.none,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -220,8 +313,7 @@ class ConfirmSendingAlert extends BaseAlertDialog {
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
: Padding(
|
|
|
|
|
padding: EdgeInsets.only(top: 8),
|
|
|
|
|
child: Text(
|
|
|
|
@ -241,6 +333,14 @@ class ConfirmSendingAlert extends BaseAlertDialog {
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
if (itemCount > 1) CakeScrollbar(
|
|
|
|
|
backgroundHeight: backgroundHeight,
|
|
|
|
|
thumbHeight: thumbHeight,
|
|
|
|
|
fromTop: fromTop,
|
|
|
|
|
rightOffset: -15
|
|
|
|
|
)
|
|
|
|
|
]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|