Reference
Theme properties, ad lifecycle events, and dependencies for the Koah Flutter SDK.
Dependencies
The package depends on the following Flutter packages:
- flutter
- clock
- device_info_plus
- flutter_secure_storage
- http
- meta
- package_info_plus
- url_launcher
- visibility_detector
Theme properties
Set these on a KoahTheme passed to KoahThemeProvider.
| Parameter | Type | Default | Description |
|---|---|---|---|
colorScheme | KoahColorScheme | auto | light, dark, or auto (follows the device via MediaQuery.platformBrightnessOf) |
accentColor | Color? | #0D0D0D | Accent for CTA buttons and accents. Text-on-accent is computed automatically for contrast β never expose it. |
fontFamily | String? | null (inherits from app) | Font family applied to all ad text |
cornerRadius | double | 19.0 | Card corner radius |
Event handling
Pass an onEvent callback to KoahCard to observe ad lifecycle events. KoahEvent is a sealed class β switch over it to handle the cases your surface cares about. See How Koah works for what each event means and when it fires.
KoahCard(
adContext: KoahAdContext.conversation(question: q, answer: a),
cacheKey: 'msg-1',
onEvent: (event) {
switch (event) {
case NoAdFill():
break; // no inventory
case AdServed():
break; // ad delivered
case ImpressionTracked():
break; // impression tracked
case AdViewed():
break; // viewed (1 continuous second at more than 50% visible)
case AdClicked():
break; // user tapped the CTA
case InAppBrowserClosed():
break; // user closed the in-app browser and returned to the app
case SlotTooSmall():
break; // served ad could not fit the slot; the card rendered nothing
}
},
)
Was this helpful?