GlassDisclosureGroup class

A collapsible disclosure accordion group rendered with liquid glass styling, providing direct parity with SwiftUI's DisclosureGroup.

GlassDisclosureGroup presents a header row with an interactive title, optional leading icon, and an animated disclosure chevron. Tapping toggles the visibility of its child rows with a smooth curve-driven height transition.

Modes

  1. Grouped mode (default constructor): Designed for placement inside GlassGroupedSection or GlassContainer.card. Shares the outer glass platter.
  2. Standalone mode (GlassDisclosureGroup.standalone): Manages its own independent GlassContainer layer with superellipse curvature.

Usage

GlassGroupedSection(
  header: const Text('PREFERENCES'),
  children: [
    GlassDisclosureGroup(
      leading: const Icon(CupertinoIcons.bell),
      title: const Text('Notifications'),
      initiallyExpanded: true,
      children: [
        GlassListTile(
          title: const Text('Allow Alerts'),
          trailing: CupertinoSwitch(value: true, onChanged: (v) {}),
        ),
        GlassListTile(
          title: const Text('Show Previews'),
          subtitle: const Text('When Unlocked'),
          trailing: GlassListTile.chevron,
        ),
      ],
    ),
  ],
)
Inheritance
Available extensions

Constructors

GlassDisclosureGroup({Key? key, required Widget title, required List<Widget> children, Widget? subtitle, Widget? leading, Widget? trailing, bool? isExpanded, bool initiallyExpanded = false, ValueChanged<bool>? onExpansionChanged, EdgeInsetsGeometry contentPadding = const EdgeInsets.symmetric(horizontal: 16, vertical: 12), EdgeInsetsGeometry? childrenPadding, Duration animationDuration = const Duration(milliseconds: 250), Curve animationCurve = Curves.easeInOutCubic, SpringDescription? spring, bool enableHaptics = true, bool showDividers = true, TextStyle? titleStyle, TextStyle? subtitleStyle, Color? leadingIconColor, Widget headerBuilder(BuildContext context, bool isExpanded, VoidCallback toggle)?})
Creates a GlassDisclosureGroup designed to be nested inside a GlassGroupedSection or GlassContainer.card.
const
GlassDisclosureGroup.standalone({Key? key, required Widget title, required List<Widget> children, Widget? subtitle, Widget? leading, Widget? trailing, bool? isExpanded, bool initiallyExpanded = false, ValueChanged<bool>? onExpansionChanged, EdgeInsetsGeometry contentPadding = const EdgeInsets.symmetric(horizontal: 16, vertical: 12), EdgeInsetsGeometry? childrenPadding, Duration animationDuration = const Duration(milliseconds: 250), Curve animationCurve = Curves.easeInOutCubic, SpringDescription? spring, bool enableHaptics = true, bool showDividers = true, TextStyle? titleStyle, TextStyle? subtitleStyle, Color? leadingIconColor, Widget headerBuilder(BuildContext context, bool isExpanded, VoidCallback toggle)?, LiquidGlassSettings? settings, GlassQuality? quality})
Creates a standalone GlassDisclosureGroup that renders inside its own independent GlassContainer.
const

Properties

animationCurve → Curve
Easing curve for the expansion and collapse animation.
final
animationDuration → Duration
Duration of the expansion and collapse animation.
final
children → List<Widget>
The list of child widgets revealed when expanded.
final
childrenPadding → EdgeInsetsGeometry?
Padding around the expanded children container.
final
contentPadding → EdgeInsetsGeometry
Padding for the header row.
final
enableHaptics → bool
Whether to trigger subtle haptic feedback when toggling expansion.
final
hashCode → int
The hash code for this object.
no setterinherited
headerBuilder → Widget Function(BuildContext context, bool isExpanded, VoidCallback toggle)?
Optional custom builder for the entire header row.
final
initiallyExpanded → bool
Initial expansion state when isExpanded is null.
final
isExpanded → bool?
Controlled expansion state.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
leading → Widget?
Optional leading widget (e.g. an Icon or CircleAvatar).
final
leadingIconColor → Color?
Tint applied to leading icon.
final
onExpansionChanged → ValueChanged<bool>?
Callback invoked when the expansion state changes.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
showDividers → bool
Whether to automatically insert GlassDividers between adjacent expanded children.
final
spring → SpringDescription?
Optional spring physics for the expansion and collapse animation.
final
subtitle → Widget?
Optional subtitle widget displayed under title.
final
subtitleStyle → TextStyle?
Custom text style for subtitle.
final
title → Widget
Primary title widget displayed in the disclosure header.
final
titleStyle → TextStyle?
Custom text style for title.
final
trailing → Widget?
Optional custom trailing widget.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<GlassDisclosureGroup>
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
glassContextMenu({Key? key, required List<Widget> actions, WidgetBuilder? previewBuilder, bool enabled = true, bool enableHaptics = true, double borderRadius = 32.0, double? previewBorderRadius, double rowBorderRadius = 16.0, BorderRadius? rowCorners, Color? originSlotColor, Color? backgroundColor, LiquidGlassSettings? settings, GlassQuality? quality, double backdropBlur = 0.0, Color? barrierColor, double menuWidth = 250.0, VoidCallback? onOpened, VoidCallback? onDismissed, Duration longPressDuration = const Duration(milliseconds: 700)}) → Widget

Available on Widget, provided by the GlassContextMenuExtension extension

Wraps this widget in a GlassContextMenu displaying actions on long-press or right-click.
glassFullScreenCover({required bool isPresented, VoidCallback? onDismiss, required WidgetBuilder content, bool enableSwipeToDismiss = true, double dismissThreshold = 140.0, LiquidGlassSettings? settings, GlassQuality? quality}) → Widget

Available on Widget, provided by the GlassFullScreenCoverExtension extension

Presents a full-viewport modal cover whenever isPresented is true.

Available on Widget, provided by the GlassNavigationTitleExtension extension

Annotates this widget with a navigation title that drives enclosing or descendant GlassAppBar / GlassAppBar.pinned bars (when their explicit title is null) as well as header accessibility semantics.
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