TAccordion class
A customizable Accordion (ExpansionTile) widget for Flutter UI.
The TAccordion provides a collapsible panel that expands or collapses
when tapped, revealing or hiding the provided child widget.
Features:
- Customizable title and trailing icon
- Optional border and background decoration
- Animated icon rotation to indicate expansion
- Supports dynamic theming via
TThemeManager - Optional divider at the bottom of the expanded content
Parameters:
title: The main label displayed in the accordion header.child: The widget displayed when the accordion is expanded.initiallyExpanded: Whether the accordion starts in expanded state.borderColor: Color of the bottom divider when expanded (optional).borderWidth: Thickness of the bottom divider when expanded (default is0.5).showDivider: Whether to display a divider below thechildcontent (default istrue).enableDecoration: Iftrue, wraps the accordion with a decorated container (e.g., border, background color).decoration: CustomBoxDecorationfor the container (used ifenableDecorationistrue).trailing: Custom trailing widget (e.g., custom arrow icon). Defaults to an animatedIcons.keyboard_arrow_up.titleStyle: CustomTextStylefor the title.padding: Reserved for future use (currently unused).
Example:
TAccordion(
title: "Order Details",
child: Column(
children: [
Text("Order ID: 12345"),
Text("Status: Shipped"),
],
),
initiallyExpanded: false,
enableDecoration: true,
trailing: Icon(Icons.expand_more),
)
Notes:
- The trailing icon automatically rotates when expanded/collapsed.
- The widget integrates with
TThemeManagerfor dynamic theming support. paddingis included for API consistency but currently not applied.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- TAccordion
Constructors
- TAccordion({Key? key, required String title, required Widget? child, bool initiallyExpanded = false, Color? borderColor, double borderWidth = 0.5, bool showDivider = true, bool enableDecoration = false, BoxDecoration? decoration, TextStyle? titleStyle, Widget? trailing, EdgeInsets? padding})
-
const
Properties
- borderColor → Color?
-
final
- borderWidth → double
-
final
- child → Widget?
-
final
- decoration → BoxDecoration?
-
final
- enableDecoration → bool
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- initiallyExpanded → bool
-
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- padding → EdgeInsets?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showDivider → bool
-
final
- title → String
-
final
- titleStyle → TextStyle?
-
final
- trailing → Widget?
-
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< TAccordion> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited