GroupConditionalLayout class final

A conditional layout for groups that adapts based on specified conditions.

Allows defining different layouts for groups based on conditions like:

  • Screen size (single column vs multi-column)
  • Theme mode (different spacing/padding)
  • Content count (grid vs list)

Example:

final layout = GroupConditionalLayout(
  cases: [
    LayoutCaseItem(
      value: 'mobile',
      item: ListGroupLayout(),
    ),
    LayoutCaseItem(
      value: 'desktop',
      item: GridGroupLayout(columns: 3),
    ),
  ],
  defaultCase: 'desktop',
  condition: ScreenSize(),
);
Inheritance
Annotations
  • @JsonSerializable()

Constructors

GroupConditionalLayout.new({required List<LayoutCaseItem> cases, required String defaultCase, required Condition condition})
GroupConditionalLayout.fromJson(Map<String, dynamic> json)
factory

Properties

cases List<LayoutCaseItem>
finalinherited
condition → Condition
finalinherited
contentType Type
finalinherited
defaultCase String
finalinherited
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
schemaType String
The schema type of the content item.
finalinherited

Methods

build(BuildContext context, Group content) Widget
Builds the layout widget tree for the given content item.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

typeDescriptor → TypeDescriptor<GroupConditionalLayout>
final

Constants

schemaName → const String