Customization Theme
The class responsible for defining the theme is called CheckoutTheme
. It utilizes additional component classes, including:
ButtonComponent
LabelComponent
TextFieldComponent
The CheckoutTheme
class consists of objects representing various UI components. While the component names generally align with those listed above, they also contain platform-specific fields for further customization.
Below is the structure of the Customization Theme
class:
class CheckoutTheme extends Equatable {
@_UiModeJsonConverter()
final CustomerUiMode uiMode;
final TextStyle? mainTitleText;
final TextStyle? titleText;
final TextStyle? subtitleText;
final TextStyle? feesTitleText;
final TextStyle? feesSubtitleText;
final TextStyle? dataLabelText;
final TextStyle? dataValueText;
final TextStyle? errorMessageText;
final TextFieldStyle? inputTextField;
final ButtonComponent? button;
final RippleColor? backButton;
final ButtonComponent? selectorButton;
final SwitchComponent? switchControl;
final Margins? margins;
final ColorState? sdkBackgroundColor;
final ColorState? modalBackgroundColor;
final ColorState? paymentItemBackgroundColor;
final ColorState? selectorIconColor;
final ColorState? savePhoneNumberIconColor;
}
Specifies the device Theme
mode, which can be set to one of the following:
light
– Forces the UI to use light mode.dark
– Forces the UI to use dark mode.auto
– Adapts the UI based on the device's system settings.
All properties in the CheckoutTheme
class are optional, allowing users to customize any of them as needed.
If a property is not set, the default value (as specified in the Figma design here) will be applied automatically.
General
Fees
Data
Other
switch
Colors of the switch background and its toggle in different states (on, off and disabled)
color
Main color integer value
Int
colorDisabled
Disabled stated color integer value
Int
color
Main color integer value
Int
rippleColor
Ripple color integer value
Int
colorDisaled
Disabled stated color integer value
Int
fontType
Font resource ID
Int
fontType
Button text font ID
Int
checkedThumbTintColor
Toggle color in checked state
Int
uncheckedThumbTintColor
Toggle color in unchecked state
Int
checkedTrackTintColor
Track color in checked state
Int
uncheckedTrackTintColor
Track color in unchecked state
Int
checkedTrackDecorationColor
Decoration color in checked state
Int
uncheckedTrackDecorationColor
Decoration color in unchecked state
Int
left
Int
top
Int
right
Int
bottom
Int
To build the theme
, the user must follow similar steps as described in the corresponding file of the test app.
Here is a code snippet demonstrating the process:
final checkoutTheme = ch.CheckoutTheme(
uiMode: ch.CustomerUiMode.dark,
titleText: ch.TextStyle(),
modalBackgroundColor: ch.ColorState(color: Colors.amber));
Last updated