Skip to content
Get started
Menu
Get started

Code

References people copy into a banking app.

Inline reference codes, a keyboard key, sample output and long codes with wrapping and horizontal scrolling.Inline reference codes, a keyboard key, sample output and long codes with wrapping and horizontal scrolling.
Code
Inline reference codes, a keyboard key, sample output and long codes with wrapping and horizontal scrolling at 200 percent text.
200% text
example/lib/screens/gallery_content.dart
PaymentCode('TRX-DEMO-42');

Variants: code, pre, samp, kbd.

Situation Variant / composition Payment example
Virtual account number code Use a reference display with a host copy action; pre preserves line breaks.
Transaction ID in a row not PaymentCode Use InfoRow or a property list item with reference: true and a copy button.

Use Amount text for money. PaymentCode’s filled block is for multi-line technical text such as webhook payloads and debug output, plus the large VA number with its emphasis. A reference or ID inside a row uses reference: true on the row instead.

The code display renders the supplied reference or technical text. A host copy action reports its own success or failure.

Do: Use a reference display with a host copy action; pre preserves line breaks.

Don’t: Send the identifier to a transport from the component.

Preserve the reference exactly. Use synthetic identifiers in examples and keep credentials out of technical samples.

Provide a descriptive label for copy actions. Long code wraps by default or scrolls within the block when noWrap is set.

PaymentCode

class PaymentCode extends StatelessWidget · lib/src/layout/content.dart

Monospace, tabular text people read or copy.

ParameterTypeDefaultDescription
textrequiredpositionalString—Literal value.
kind:PaymentCodeKindPaymentCodeKind.codePresentation kind.
multiline:boolfalseAllow multiple lines.
noWrap:boolfalseKeep one line and scroll inside the block; an edge fade shows there is more.
size:PaymentSizePaymentSize.mediumText role size.
onCopy:Future<bool> Function(String value)?—Host copy callback; adds confirmation and failure feedback.
semanticLabel:String?—Spoken prefix before the value.

PaymentCodeKind

enum PaymentCodeKind · lib/src/layout/content.dart

Code presentation. Nothing else exists.

ValueDescription
codeInline reference tag.
preMultiline block.
sampHost output without a fill.
kbdNonselectable keyboard key.

PaymentSize

enum PaymentSize · lib/src/foundation/payment_tokens.dart

Visual size only; layout box and hit area stay at least 48×48 dp. Components document their heights.

ValueDescription
smallModule headers, table or chip rows; never the main action.
mediumDefault, today's visual size.
largeOne primary action on a full-screen wide view.

Code wraps by default. noWrap keeps one line and scrolls inside the block; an edge fade shows there is more.