Skip to content
Get started
Menu
Get started

Promotions

PromoCard shows one promotion; PromoSlot places it with loading, ready, empty and error states. Every promotion is labeled.

Your app loads the campaigns, decides what the CTA, dismiss and “Why this?” do and whether a dismissed offer stays hidden, and runs any tracking.

Gallery promotions in Indonesian: a sponsored card labeled Bersponsor · Bank Contoh with a Kenapa ini? link, title, terms and a Lihat penawaran button, and an own promo labeled Promo with a dismiss button.
Sponsored and own promotions (Indonesian)
The same promotions at 200% text; the sponsor label wraps onto a second line.
At 200% the label wraps, never truncates
PromoSlot(
state: offersState, // loading / ready / empty / error
content: const PromoContent(
id: 'cb-10',
kind: PromoKind.sponsored,
advertiser: 'Bank Contoh',
title: 'Cashback 10% on bills',
ctaLabel: 'See offer',
),
onAction: (promo) => host.openOffer(promo.id),
onDismiss: (promo) => host.hidePromo(promo.id),
onAbout: (promo) => host.explainPlacement(promo.id),
);
  • Every promotion is labeled “Sponsored · advertiser” or “Promo”, and the label wraps rather than truncates: who paid for a placement must always be visible.
  • Empty and failed slots collapse by default (collapseWhenEmpty).
  • The kit never fetches campaigns, counts impressions, applies discounts or changes a quote. To use an ad network, load its content in your app and pass it in; native-ad SDK views and their policies remain your integration.
  • Keep promotions out of the path between the total and the pay button.
  • PromoContent.icon is accepted but not drawn in the current design.

The explanation behind “Why this?” / “Kenapa ini?” is longer than a tooltip’s one line, so onAbout opens a sheet. The sheet has a title, the text and one full-width primary Close, its completion action:

example/lib/screens/gallery_kit.dart
onAbout: (promo) => showPaymentSheet<void>(
context: context,
builder: (sheet) => PaymentSheet(
header: PaymentSheetHeader(title: 'Why you see this'),
body: Text('Bank Contoh paid for this placement. …'),
footer: PaymentButton(
label: 'Close',
onPressed: () => Navigator.pop(sheet),
),
),
),

PromoSlot

class PromoSlot extends StatelessWidget · lib/src/promo/promo.dart

A placement that can be loading, filled, empty or failed.

Empty and failed slots collapse by default (collapseWhenEmpty): a missing offer should not leave a hole or an error in a checkout. Turn it off where the slot is the content, such as an offers page.

ParameterTypeDefaultDescription
state:requiredPromoSlotState——
onAction:requiredFutureOr<void> Function(PromoContent content)——
content:PromoContent?——
onDismiss:ValueChanged<PromoContent>?——
onAbout:ValueChanged<PromoContent>?——
onRetry:FutureOr<void> Function()?——
layout:PromoLayoutPromoLayout.card—
collapseWhenEmpty:booltrue—

PromoSlotState

enum PromoSlotState · lib/src/promo/promo.dart

Where a promotion slot is while the host loads it.

ValueDescription
loading—
ready—
empty—
error—

PromoCard

class PromoCard extends StatelessWidget · lib/src/promo/promo.dart

A clearly labeled promotion with a call to action and optional dismiss.

onAction and onDismiss go to the host, which decides what the CTA does and whether a dismissed promo stays hidden. Promotions never sit between the customer and the pay button, and never change a quote.

ParameterTypeDefaultDescription
content:requiredPromoContent——
onAction:requiredFutureOr<void> Function()——
onDismiss:VoidCallback?——
onAbout:VoidCallback?—Opens the host's "why am I seeing this" explanation.
layout:PromoLayoutPromoLayout.card—

PromoContent

class PromoContent · lib/src/promo/promo.dart

Host-supplied promotion. The kit renders it and reports taps; it never fetches campaigns, tracks impressions or applies discounts itself.

ParameterTypeDefaultDescription
id:requiredString——
kind:requiredPromoKind——
title:requiredString——
ctaLabel:requiredString——
message:String?——
advertiser:String?—Who paid for a sponsored placement.
icon:IconData?—Kept for compatibility. Cards no longer draw it: a generic icon beside the title adds nothing the title does not already say.
media:Widget?—Optional image or illustration supplied by the host (already loaded or with its own loading state). Decorative: excluded from semantics. Prefer PaymentImage with empty alt; the card labels the promotion.
terms:String?—Short conditions, e.g. "Until 31 Dec. Min. purchase Rp50.000".

PromoKind

enum PromoKind · lib/src/promo/promo.dart

Whether content is paid placement or the host's own offer. Both are always labeled; a sponsored item also names who paid for it.

ValueDescription
sponsored—
promotion—

PromoLayout

enum PromoLayout · lib/src/promo/promo.dart

ValueDescription
card—
banner—

Why this and the quiet banner CTA use inline PaymentLink actions.

Pass PaymentImage with empty alt for decorative media; the card labels the promotion.

Applied promo codes use PaymentChip with a separate remove action. The applied live announcement remains.