ESewaPaymentButton constructor
ESewaPaymentButton(
- ESewaPnp esewa, {
- Key? key,
- required double amount,
- required String productId,
- required String productName,
- required String callBackURL,
- required dynamic onSuccess(
- ESewaResult result
- required dynamic onFailure(
- ESewaPaymentException exception
- Widget labelBuilder()?,
- double? height,
- double? width,
- Color? color,
Implementation
ESewaPaymentButton(
this.esewa, {
Key? key,
required this.amount,
required this.productId,
required this.productName,
required this.callBackURL,
required this.onSuccess,
required this.onFailure,
this.labelBuilder,
this.height,
this.width,
this.color,
}) {
this._esewaLogo = color != null
? (color!.computeLuminance() > 0.5
? Image.asset(
"assets/esewa/logo_dark.png",
height: 24,
width: 54,
)
: Image.asset(
"assets/esewa/logo.png",
height: 24,
width: 54,
))
: Image.asset(
"assets/esewa/logo.png",
height: 24,
width: 54,
);
this._textColor = color != null
? (color!.computeLuminance() < 0.5
? Color(0xFFFFFFFF)
: Color(0xFF000000))
: Color(0xFFFFFFFF);
this._label = this.labelBuilder != null
? this.labelBuilder!(
this.amount,
_esewaLogo,
)
: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Pay now with ",
),
_esewaLogo!,
],
);
}