Collection class
A versatile collection widget for managing and displaying groups of items.
The Collection widget serves as a flexible container for rendering lists of components, supporting both static children and dynamic builder patterns. It is designed for use in scrollable views or as part of larger compositions.
- Inheritance
-
- Object
- Component
- StatelessComponent
- Collection
Constructors
-
Collection({Key? key, List<
Component> children = const [], Axis direction = Axis.vertical, double gap = 0, bool scrollable = false, String? padding}) -
Default constructor for creating a Collection with static children.
const
- Collection.builder({Key? key, required Component builder(BuildContext context, int index)?, required int? childCount, Axis direction = Axis.vertical, double gap = 0, bool scrollable = false, String? padding})
-
Creates a Collection using a builder for dynamic child generation.
const
Properties
- builder → Component Function(BuildContext context, int index)?
-
An optional builder function for dynamically generating children.
final
- childCount → int?
-
The total number of children when using a builder.
final
-
children
→ List<
Component> -
The list of static child components to render.
final
- direction → Axis
-
Layout direction (vertical or horizontal).
final
- gap → double
-
Gap between items.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one component replaces another component in the tree.
finalinherited
- padding → String?
-
Padding around the collection.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollable → bool
-
Whether to wrap items in a scrollable container.
final
Methods
-
build(
BuildContext context) → Component -
Describes the part of the user interface represented by this component.
override
-
createElement(
) → Element -
Creates a StatelessElement to manage this component's location in the tree.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
shouldRebuild(
covariant Component newComponent) → bool -
Implement this method to determine whether a rebuild can be skipped.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited