Skip to content
Get started
Menu
Get started

Accordion

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

Transfer arrival instructions, expanded receipt details and a saved payment method with secondary actions.Transfer arrival instructions, expanded receipt details and a saved payment method with secondary actions.
Accordion variants
Transfer arrival instructions, expanded receipt details and a saved payment method with secondary actions at 200 percent text.
200% text
example/lib/screens/gallery_nav_controls.dart
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: single item, grouped items.

The default. The section keeps its own state. initiallyExpanded: true starts it open.

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.'),
);

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.

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.

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.'),
);
Situation Variant / composition Payment example
Supporting payment instructions single item Keep one optional instruction collapsed under its title.

Use Task list for progress.

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: Keep one optional instruction collapsed under its title.

Don’t: Hide the main Pay action inside a collapsed item.

  • 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.
  • 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.

ParameterTypeDefaultDescription
children:requiredList<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.

ParameterTypeDefaultDescription
title:requiredString—title for this section.
child:requiredWidget—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:boolfalseinitiallyExpanded 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.