An Android library that provides a Jetpack Compose wrapper on top of the Google Wallet button assets.
The library is hosted on Maven central and can be used by ensuring the following lines exist in each gradle file:
build.gradle:
repositories {
mavenCentral()
}
app/build.gradle:
dependencies {
implementation "com.google.wallet.button:compose-wallet-button:<version>"
}
// other imports omitted for brevity
// see full example in the "app" directory
import com.google.wallet.button.ButtonType
import com.google.wallet.button.WalletButton
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val onClick = { println("Button clicked") }
setContent {
// Default
WalletButton(onClick = onClick)
// Customized look
WalletButton(onClick = onClick, modifier = Modifier.width(350.dp))
// Condensed version
WalletButton(onClick = onClick, type = ButtonType.AddCondensed)
}
}
}