import 'package:gluestack_ui/gluestack_ui.dart';
GSAccordion(
animationDuration: Duration(milliseconds: 200),
size: GSAccordionSizes.$md,
type: GSAccordionTypes.multiple,
variant: GSAccordionVariants.filled,
isCollapsible: true,
children: const [
GSAccordionItem(
title: GSAccordionTitle(text: 'How do I place an order?'),
content: GSAccordionContent(
text: "To place an order, simply select the products you want, proceed to checkout, provide shipping and payment information, and finalize your purchase.",
),
),
GSAccordionItem(
title: GSAccordionTitle(text: 'What payment options do you accept?'),
content: GSAccordionContent(
text: "We accept all major credit cards, including Visa, Mastercard, and American Express. We also support payments through PayPal.",
),
),
],
)
import "package:gluestack_ui/gluestack_ui.dart"
Parameters | Type | Default | Description |
---|---|---|---|
action | "single" | "multiple" | "single" | Determines whether one or multiple items can be opened at the same time. |
isCollapsible | bool | false | When action is "single" or "multiple", allows closing content when clicking trigger for an open item. |
isDisabled | bool | false | When true, prevents the user from interacting with the accordion and all its items. |
variant | "filled" | "unfilled" | "unfilled" | It creates a box shadow around the accordion when variant is set to filled. |
size | "$sm | $md | $lg" | "$md" | It defines the size of the accordion. |
import 'package:gluestack_ui/gluestack_ui.dart';
GSBox(
style: GSStyle(width: 400, height: 350),
child: const GSAccordion(
size: GSAccordionSizes.$md,
type: GSAccordionTypes.multiple,
variant: GSAccordionVariants.filled,
isCollapsible: true,
prefixIconWhenTileExapanded: GSAccordionIcon(icon: Icons.remove),
prefixIconWhenTileCollapsed: GSAccordionIcon(icon: Icons.add),
itemPadding: EdgeInsets.all(12),
children: [
GSAccordionItem(
radius: 12,
title: GSAccordionTitle(
text: 'How do I place an order?',
),
content: GSAccordionContent(
text:
"To place an order, simply select the products you want, proceed to checkout, provide shipping and payment information, and finalize your purchase.",
),
),
GSAccordionItem(
radius: 12,
title: GSAccordionTitle(text: 'What payment options do you accept?'),
content: GSAccordionContent(
text:
"We accept all major credit cards, including Visa, Mastercard, and American Express.",
),
),
],
),
)
import 'package:gluestack_ui/gluestack_ui.dart';
GSBox(
style: GSStyle(width: 400, height: 240),
child: const GSAccordion(
size: GSAccordionSizes.$md,
type: GSAccordionTypes.multiple,
variant: GSAccordionVariants.filled,
isCollapsible: true,
suffixIconWhenTileExpanded: GSAccordionIcon(icon: Icons.remove),
suffixIconWhenTileCollapsed: GSAccordionIcon(icon: Icons.add),
itemPadding: EdgeInsets.all(5),
children: [
GSAccordionItem(
isDisabled: true,
title: GSAccordionTitle(
text: 'Disabled Item',
),
content: GSAccordionContent(
text: "Disabled item description...",
),
),
GSAccordionItem(
title: GSAccordionTitle(text: 'Is this accordion accessible?'),
content: GSAccordionContent(
text: "Yes, the accordion is accessible. It adheres to the WAI-ARIA design pattern. You can read more about it in the accessibility section of the docs.",
),
),
],
),
)
import 'package:gluestack_ui/gluestack_ui.dart';
GSBox(
style: GSStyle(width: 400, height: 350),
child: GSAccordion(
size: GSAccordionSizes.$md,
type: GSAccordionTypes.multiple,
variant: GSAccordionVariants.filled,
isCollapsible: true,
suffixIconWhenTileExpanded: const GSAccordionIcon(icon: Icons.remove),
suffixIconWhenTileCollapsed: const GSAccordionIcon(icon: Icons.add),
itemPadding: const EdgeInsets.all(5),
initialValues: const [false, false, true],
children: const [
GSAccordionItem(
title: GSAccordionTitle(
text: 'What is the default prop of the Accordion widget ?',
),
content: GSAccordionContent(
text:
"The defaultValue prop of the Accordion widget is used to define the open item by default. It is used when the Accordion component is uncontrolled",
),
),
GSAccordionItem(
title: GSAccordionTitle(text: 'Is this accordion accessible?'),
content: GSAccordionContent(
text:
"Yes, the accordion is accessible. It adheres to the WAI-ARIA design pattern. You can read more about it in the accessibility section of the docs.",
),
),
GSAccordionItem(
title: GSAccordionTitle(text: 'Is this accordion accessible?'),
content: GSAccordionContent(
text:
"Yes, the accordion is accessible. It adheres to the WAI-ARIA design pattern. You can read more about it in the accessibility section of the docs.",
),
),
],
),
),
import 'package:gluestack_ui/gluestack_ui.dart';
GSBox(
style: GSStyle(width: 500, height: 380),
child: const GSAccordion(
size: GSAccordionSizes.$md,
type: GSAccordionTypes.multiple,
variant: GSAccordionVariants.filled,
isCollapsible: true,
prefixIconWhenTileCollapsed: GSAccordionIcon(icon: Icons.add),
prefixIconWhenTileExapanded: GSAccordionIcon(icon: Icons.remove),
itemPadding: EdgeInsets.all(5),
children: [
GSAccordionItem(
title: GSAccordionTitle(
text: 'USA',
),
content: GSAccordion(
size: GSAccordionSizes.$md,
type: GSAccordionTypes.multiple,
variant: GSAccordionVariants.filled,
isCollapsible: true,
suffixIconWhenTileExpanded: GSAccordionIcon(icon: Icons.remove),
suffixIconWhenTileCollapsed: GSAccordionIcon(icon: Icons.add),
itemPadding: EdgeInsets.all(5),
children: [
GSAccordionItem(
title: GSAccordionTitle(
text: 'California',
),
content: GSAccordionContent(
text:
"Capital city of California is Sacramento. California has a GDP of 2.89 trillion dollars and follows Pacific Standard Time zone.",
),
),
GSAccordionItem(
title: GSAccordionTitle(
text: 'Nevada',
),
content: GSAccordionContent(
text:
"Nevada is located in a mountainous region that includes vast semiarid grasslands and sandy alkali deserts. It is the most arid state of the country.",
),
),
],
),
),
],
),
),