PayButton class abstract
A widget that handles the API logic to facilitate the integration.
This widget provides an alternative UI-based integration path that wraps the API calls of the payment libraries and includes them as part of the lifecycle of the widget. As a result of that:
- The widget only shows if the Pay.userCanPay method returns
true
, or displays the childOnError widget and calls the onError function otherwise. - Tapping the button automatically triggers the Pay.showPaymentSelector method which starts the payment process.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- PayButton
- Implementers
Constructors
-
PayButton({Key? key, required PayProvider buttonProvider, required PaymentConfiguration paymentConfiguration, void onPaymentResult(Map<
String, dynamic> result)?, double width = 0, double height = 0, EdgeInsets margin = const EdgeInsets.all(0), void onError(Object? error)?, Widget? childOnError, Widget? loadingIndicator}) - Initializes the button and the payment client that handles the requests.
Properties
-
Specifies the payment provider supported by the button
final
- childOnError → Widget?
-
A replacement widget shown instead of the button when the payment process
errors. This can be used to show a different checkout button or an error
message.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double
-
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- loadingIndicator → Widget?
-
An optional widget to show while the payment provider checks whether
a user can pay with it and the button loads.
final
- margin → EdgeInsets
-
final
- onError → void Function(Object? error)?
-
A function called when there's an error in the payment process.
final
-
onPaymentResult
→ void Function(Map<
String, dynamic> result)? -
A function called when the payment process yields a result.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- width → double
-
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< PayButton> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited