Customization Theme
The class responsible for defining the theme is called CheckoutTheme
.
Customization Theme Class Structure:
class CheckoutTheme(
val uiMode: UiMode = UiMode.AUTO,
val appearanceLight: Appearance ? = null,
val appearanceDark : Appearance ? = null,
val showPaymentDetails : Boolean = true,
)
Specifies the device theme mode, which can be set to:
Light
Dark
Auto (automatically adjusts based on system settings)
These are optional instances of the Appearance
class, which enable UI customization for light mode and dark mode, respectively.
The Appearance
class serves as the core inner class of CheckoutTheme
, containing objects that define various UI components.
The component names within Appearance
largely correspond to those described here.
A boolean field that determines whether the "Payment Details" section should be displayed or hidden.
All properties are optional and can be customized by the user.
If a property is not specified, the default value (as defined in the Figma design here) will be automatically applied.
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 steps similar to those outlined in the test app file.
Code Snippet:
val appearanceLight = CheckoutTheme.Appearance(
mainTitleText = CheckoutTheme.Text(
textColor = CheckoutTheme.Color(Color.WHITE),
R.font.roboto_bold
),
titleText = CheckoutTheme.Text(textColor = CheckoutTheme.Color(Color.BLACK)),
subtitleText = CheckoutTheme.Text(textColor = CheckoutTheme.Color(Color.BLACK)),
button = CheckoutTheme.Button(
rippleColor = CheckoutTheme.RippleColor(
color = Color.WHITE,
rippleColor = Color.BLACK,
colorDisabled = Color.GRAY
),
textColor = CheckoutTheme.Color(color = Color.BLACK),
fontType = R.font.roboto_bold
),
margins = Margins(left = 12, top = 4, right = 12, bottom = 4),
sdkBackgroundColor = CheckoutTheme.Color(color = Color.WHITE)
)
return CheckoutTheme(
uiMode = CheckoutTheme.UiMode.AUTO,
showPaymentDetails = showPaymentDetails,
appearanceLight = appearanceLight,
appearanceDark = appearanceDark,
)
Last updated