TxExpansionPanel class

带有展开箭头图标的单行 TxPanel,用于展开或折叠 panel 以显示或隐藏 children。

此小部件通常与 ListView 一起使用,以创建“展开折叠”列表条目。当与 ListView 等滚动 小部件一起使用时,必须将唯一的 PageStorageKey 指定为 key,以使 TxExpansionPanel 能够在滚动到视图中和从视图中滚动时保存和恢复其展开状态。

此类重写其 TxPanel 的 TxPanelThemeData.iconColor 和 TxPanelThemeData.textColor 主题属性。当磁贴展开和折叠时,这些颜色在值之间以动画形 式显示:在 iconColor、collapsedIconColor 之间以及 textColor 和 collapsedTextColor 之间。

Inheritance

Constructors

TxExpansionPanel({required Widget title, Key? key, Widget? leading, Widget? subtitle, Widget? footer, List<Widget>? collapsedChildren, ValueChanged<bool>? onExpansionChanged, List<Widget> children = const <Widget>[], Widget? trailing, bool initiallyExpanded = false, bool maintainState = false, EdgeInsetsGeometry? panelPadding, CrossAxisAlignment? expandedCrossAxisAlignment, Alignment? expandedAlignment, EdgeInsetsGeometry? collapsedPadding, Color? backgroundColor, Color? collapsedBackgroundColor, Color? textColor, Color? collapsedTextColor, Color? iconColor, Color? collapsedIconColor, ShapeBorder? shape, ShapeBorder? collapsedShape, Clip? clipBehavior, TxExpansionPanelController? controller, bool showControlText = true, String? collapseLabel, String? expandLabel, EdgeInsetsGeometry? childrenPadding, ExpansionPanelControlAffinity? controlAffinity, Decoration? childrenDecoration, bool? dense, VisualDensity? visualDensity, bool? enableFeedback, bool enabled = true, AnimationStyle? expansionAnimationStyle})
创建一个带有展开箭头图标的单行 TxPanel,该图标可展开或折叠磁贴以显示或隐藏 children。 initiallyExpanded 属性必须为非 null。
const

Properties

backgroundColor → Color?
展开时要显示在子列表后面的颜色。
final
children → List<Widget>
panel 展开时显示的小组件。
final
childrenDecoration → Decoration?
collapsedChildren 和 children 装饰器
final
childrenPadding → EdgeInsetsGeometry?
指定 children 的填充。
final
clipBehavior → Clip?
The content will be clipped (or not) according to this option.
final
collapsedBackgroundColor → Color?
如果不为 null,则定义子列表折叠时 panel 的背景色。
final
collapsedChildren → List<Widget>?
panel 折叠时显示的小组件。
final
collapsedIconColor → Color?
子列表折叠时 panel 的展开箭头图标的图标颜色。
final
collapsedPadding → EdgeInsetsGeometry?
指定 TxPanel 的填充。
final
collapsedShape → ShapeBorder?
子列表折叠时 panel 的边框形状。
final
collapsedTextColor → Color?
子列表折叠时磁贴标题的颜色。
final
collapseLabel → String?
收起按钮文字
final
controlAffinity → ExpansionPanelControlAffinity?
通常用于将扩展文字和箭头图标强制到leading、trailing或footer。
final
controller → TxExpansionPanelController?
如果提供,控制器可用于展开和折叠切片。
final
dense → bool?
Whether this list tile is part of a vertically dense list.
final
enabled → bool
此扩展磁贴是否为交互式磁贴。
final
enableFeedback → bool?
Whether detected gestures should provide acoustic and/or haptic feedback.
final
expandedAlignment → Alignment?
指定当 panel 展开时排列在列中的子项 children 的对齐方式。
final
expandedCrossAxisAlignment → CrossAxisAlignment?
指定展开 panel 时 children 中每个子项的对齐方式。
final
expandLabel → String?
展开按钮文字
final
expansionAnimationStyle → AnimationStyle?
用于覆盖展开动画曲线和持续时间。
final
参考TxPanel.footer
final
hashCode → int
The hash code for this object.
no setterinherited
iconColor → Color?
展开子列表时磁贴的展开箭头图标的图标颜色。
final
initiallyExpanded → bool
指定 panel 最初是展开 (true) 还是折叠 (false,默认值)。
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
leading → Widget?
参考TxPanel.leading
final
maintainState → bool
指定在 panel 展开和折叠时是否保持子项的状态。
final
onExpansionChanged → ValueChanged<bool>?
在 panel 展开或折叠时调用。
final
panelPadding → EdgeInsetsGeometry?
指定 TxExpansionPanel 的填充。。
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shape → ShapeBorder?
展开子列表时 panel 的边框形状。
final
showControlText → bool
是否显示控制文字
final
subtitle → Widget?
参考TxPanel.subtitle
final
textColor → Color?
展开子列表时 panel 标题的颜色。
final
title → Widget
参考TxPanel.title
final
trailing → Widget?
参考TxPanel.trailing
final
visualDensity → VisualDensity?
定义展开磁贴布局的紧凑程度。
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<TxExpansionPanel>
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