StacCarouselView class

A Stac model representing Flutter's CarouselView widget.

Displays its children in a scrollable carousel, either as regular equally sized pages or with weighted widths defined by flexWeights.

{@tool snippet} Dart Example:

StacCarouselView(
  carouselType: StacCarouselViewType.weighted,
  padding: StacEdgeInsets.symmetric(horizontal: 12, vertical: 8),
  backgroundColor: '#FFFFFF',
  elevation: 5.0,
  overlayColor: '#FF0000',
  itemSnapping: true,
  shrinkExtent: 0.0,
  scrollDirection: StacAxis.horizontal,
  reverse: false,
  onTap: StacAction(type: 'callback', args: {'name': 'onItemTap'}),
  enableSplash: true,
  itemExtent: 300,
  flexWeights: [1, 7, 1],
  children: [
    StacImage(src: 'https://example.com/a.png'),
    StacImage(src: 'https://example.com/b.png'),
    StacImage(src: 'https://example.com/c.png'),
  ],
)

{@end-tool}

{@tool snippet} JSON Example:

{
  "type": "carouselView",
  "carouselType": "weighted",
  "padding": 12,
  "backgroundColor": "#FFFFFF",
  "elevation": 5.0,
  "overlayColor": "#FF0000",
  "itemSnapping": true,
  "shrinkExtent": 0.0,
  "scrollDirection": "horizontal",
  "reverse": false,
  "onTap": {"type": "callback", "name": "onItemTap"},
  "enableSplash": true,
  "itemExtent": 300,
  "flexWeights": [1, 7, 1],
  "children": [
    {"type": "image", "src": "https://example.com/a.png"},
    {"type": "image", "src": "https://example.com/b.png"},
    {"type": "image", "src": "https://example.com/c.png"}
  ]
}

{@end-tool}

See also:

Inheritance
Annotations
  • @JsonSerializable.new()

Constructors

StacCarouselView({StacCarouselViewType? carouselType, StacEdgeInsets? padding, StacColor? backgroundColor, double? elevation, StacColor? overlayColor, bool? itemSnapping, double? shrinkExtent, StacAxis? scrollDirection, bool? reverse, StacAction? onTap, bool? enableSplash, double? itemExtent, List<int>? flexWeights, List<StacWidget>? children})
Creates a StacCarouselView with the given properties.
const
StacCarouselView.fromJson(Map<String, dynamic> json)
Creates a StacCarouselView from a JSON map.
factory

Properties

backgroundColor → StacColor?
The background color of the carousel.
final
carouselType → StacCarouselViewType?
The type of the carousel. Defaults to StacCarouselViewType.regular.
final
children → List<StacWidget>?
The widgets below this widget in the tree.
final
elevation → double?
The z-coordinate at which to place this carousel.
final
enableSplash → bool?
Whether to enable splash effect on tap. Defaults to true.
final
flexWeights → List<int>?
The flex weights for the items in the carousel (weighted type only).
final
hashCode → int
The hash code for this object.
no setterinherited
itemExtent → double?
The extent of each item in the carousel (regular type only).
final
itemSnapping → bool?
Whether the items should snap into place. Defaults to false.
final
jsonData → Map<String, dynamic>?
Raw JSON data for this widget
finalinherited
onTap → StacAction?
The callback to invoke when an item is tapped.
final
overlayColor → StacColor?
The overlay color of the carousel items.
final
padding → StacEdgeInsets?
The amount of space by which to inset the carousel.
final
reverse → bool?
Whether the carousel scrolls in the reverse direction. Defaults to false.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scrollDirection → StacAxis?
The axis along which the carousel scrolls. Defaults to StacAxis.horizontal.
final
shrinkExtent → double?
The amount by which to shrink the carousel. Defaults to 0.0.
final
type → String
Widget type identifier.
no setteroverride

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
Converts this StacCarouselView instance to a JSON map.
override
toString() → String
A string representation of this object.
inherited

Operators

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