Code
References people copy into a banking app.



PaymentCode('TRX-DEMO-42');Variants
Section titled “Variants”Variants: code, pre, samp, kbd.
Which variant when
Section titled “Which variant when”| 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.
States
Section titled “States”The code display renders the supplied reference or technical text. A host copy action reports its own success or failure.
Do and don’t
Section titled “Do and don’t”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.
Content guidelines
Section titled “Content guidelines”Preserve the reference exactly. Use synthetic identifiers in examples and keep credentials out of technical samples.
Accessibility
Section titled “Accessibility”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.
| Parameter | Type | Default | Description |
|---|---|---|---|
textrequiredpositional | String | — | Literal value. |
kind: | PaymentCodeKind | PaymentCodeKind.code | Presentation kind. |
multiline: | bool | false | Allow multiple lines. |
noWrap: | bool | false | Keep one line and scroll inside the block; an edge fade shows there is more. |
size: | PaymentSize | PaymentSize.medium | Text 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.
| Value | Description |
|---|---|
code | Inline reference tag. |
pre | Multiline block. |
samp | Host output without a fill. |
kbd | Nonselectable 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.
| Value | Description |
|---|---|
small | Module headers, table or chip rows; never the main action. |
medium | Default, today's visual size. |
large | One primary action on a full-screen wide view. |
See also
Section titled “See also”Code wraps by default. noWrap keeps one line and scrolls inside the block; an edge fade shows there is more.