Accordion
PaymentAccordionItem hides secondary detail behind its title: how long a transfer takes, step-by-step payment instructions, buyer protection terms.



PaymentAccordion( children: [ const PaymentAccordionItem( title: 'When will my payment arrive?', child: Text('Most transfers arrive within a few minutes.'), ), const PaymentAccordionItem( title: 'Receipt details', subtitle: 'Keep a copy for your records', media: PaymentIcon( Icons.receipt_long_outlined, color: PaymentTextColor.secondary, ), initiallyExpanded: true, child: Text('The reference identifies this payment.'), ), PaymentAccordionItem( title: 'Saved method', actions: [ PaymentButton( label: 'Edit', size: PaymentSize.small, width: PaymentWidth.hug, variant: PaymentButtonVariant.secondary, onPressed: () {}, ), PaymentMenu( entries: [ PaymentMenuGroup( items: [ PaymentMenuItem(label: 'View details', onSelected: () {}), ], ), PaymentMenuGroup( items: [ PaymentMenuItem( label: 'Remove method', destructive: true, onSelected: () {}, ), ], ), ], ), ], child: const Text('Bank Contoh •••• 8890'), ), ], );Variants
Section titled “Variants”Variants: single item, grouped items.
Uncontrolled
Section titled “Uncontrolled”The default. The section keeps its own state. initiallyExpanded: true starts it open.
Controlled
Section titled “Controlled”Pass expanded with onExpandedChanged to own the state, for example to open the section from somewhere else on the screen.
PaymentAccordionItem( title: 'Buyer protection', subtitle: 'Provided by the merchant', expanded: showProtection, onExpandedChanged: (open) => setState(() => showProtection = open), child: const Text('Refunds are requested from the merchant.'),);Motion
Section titled “Motion”The chevron turns in 150 ms. The body’s height eases open in 220 ms and closed in 150 ms, so content below does not jump. Under reduced motion both changes are instant.
Variants, behavior and migration
Section titled “Variants, behavior and migration”Actions allow up to two small hug PaymentButtons and one PaymentMenu. They sit beside the toggle and do not expand the item. Actions stack below the header under 400 dp or at large text. Keep disabled content readable and fees visible. Use the media slot for a PaymentIcon or PaymentImage.
Migration: ExpandableSection is a deprecated alias; rename the constructor to PaymentAccordionItem.
Layout foundation
Section titled “Layout foundation”PaymentAccordionItem accepts media: a PaymentIcon or PaymentImage. The leading parameter is deprecated; migrate to media: PaymentIcon(icon).
const PaymentAccordionItem( title: 'Transfer details', media: PaymentIcon(Icons.info_outline, color: PaymentTextColor.secondary), child: Text('Use the virtual account before it expires.'),);Which variant when
Section titled “Which variant when”| Situation | Variant / composition | Payment example |
|---|---|---|
| Supporting payment instructions | single item | Keep one optional instruction collapsed under its title. |
Use Task list for progress.
States
Section titled “States”Use initiallyExpanded for local expansion state, or pass expanded and onExpandedChanged to control it from your app. Collapsing the item removes its body from the focus order.
Layout. Media and the chevron centre on the title’s first line, so a header that wraps at large text keeps them beside the title.
Do and don’t
Section titled “Do and don’t”Do: Keep one optional instruction collapsed under its title.
Don’t: Hide the main Pay action inside a collapsed item.
Content guidelines
Section titled “Content guidelines”- The title names what is inside, or asks the question it answers: “How to pay”, “How long does a transfer take?”.
- Never hide fees, the total or anything the person agrees to. The payment summary keeps every fee visible by design.
- Keep the body short. If it needs its own headings, it needs its own screen or sheet.
Accessibility
Section titled “Accessibility”- The header is a 48 dp minimum button that reports expanded or collapsed, with a “Show details” or “Hide details” hint.
- Collapsed content is removed from the tree, so Tab and screen readers never reach it.
PaymentAccordion
class PaymentAccordion extends StatelessWidget · lib/src/interaction/interaction.dart
A ruled list of disclosure items; items own their hairlines.
| Parameter | Type | Default | Description |
|---|---|---|---|
children:required | List<PaymentAccordionItem> | — | — |
PaymentAccordionItem
class PaymentAccordionItem extends StatefulWidget · lib/src/interaction/interaction.dart
A titled section whose body can be shown or hidden.
Works uncontrolled (initiallyExpanded) or controlled (expanded plus onExpandedChanged). Hidden content is removed from the tree, so it is never reachable by Tab or a screen reader. Do not hide fees here: the payment summary keeps every fee visible by design.
| Parameter | Type | Default | Description |
|---|---|---|---|
title:required | String | — | title for this section. |
child:required | Widget | — | child for this section. |
subtitle: | String? | — | subtitle for this section. |
leading: | IconData? | — | Legacy header glyph; use media. |
media: | Widget? | — | Header icon or image. |
expanded: | bool? | — | Controlled state. When null the section keeps its own state. |
initiallyExpanded: | bool | false | initiallyExpanded for this section. |
onExpandedChanged: | ValueChanged<bool>? | — | onExpandedChanged for this section. |
actions: | List<Widget> | const [] | actions for this section. |
ExpandableSection
typedef ExpandableSection = PaymentAccordionItem · lib/src/interaction/interaction.dart
Deprecated. Use PaymentAccordionItem.
Deprecated alias of PaymentAccordionItem.
See also
Section titled “See also”- Section
- Status and receipt, where payment instructions fold into one.