Section constructor
const
Section({
- Key? key,
- Widget? customHeader,
- bool initiallyExpanded = true,
- bool expandable = false,
- required Widget child,
- BarBackButtonMode backButton = BarBackButtonMode.never,
- Widget? title,
- Widget? subtitle,
- Widget? header,
- String? titleText,
- String? subtitleText,
- String? headerText,
- List<
Widget> leading = const [], - List<
Widget> trailing = const [],
Constructs a new Section instance.
The child parameter is required and defines the main content area. All other parameters are optional and customize the header and behavior.
If customHeader is provided, the widget initializes a GlassSection with the custom header and converts the child to a sliver if necessary. Otherwise, it initializes a BarSection using the provided title, subtitle, leading, trailing, and back button configurations.
Defaults:
initiallyExpanded: true (section starts expanded if expandable).expandable: false (non-collapsible by default).backButton: BarBackButtonMode.never (no back button shown).leadingandtrailing: Empty lists [].
The key parameter is inherited from StatelessWidget for widget identification in the tree.
Implementation
const Section({
super.key,
this.customHeader,
this.initiallyExpanded = true,
this.expandable = false,
required this.child,
this.backButton = BarBackButtonMode.never,
this.title,
this.subtitle,
this.header,
this.titleText,
this.subtitleText,
this.headerText,
this.leading = const [],
this.trailing = const [],
});