Carousel view theme in YAML
A scrolling row of large items that stretch and shrink as you swipe. It configures Flutter's CarouselViewThemeData. Set it under spring.flutter.theme.components.carousel-view. You can also set it inside a named theme, under spring.flutter.theme.themes.<name>.components.carousel-view. The Material starter, spring_boot_starter_flutter_material, reads it: an app without that package in its dependencies shows nothing of it.
Example
spring:
flutter:
theme:
components:
carousel-view:
padding: { horizontal: 16, vertical: 8 }
elevation: level2
shape: large
item-clip-behavior: none
overlay-color:
default: $colors.primary
hovered:
color: $colors.primary
alpha: 90%
disabled:
color: $colors.on-surface
alpha: 12%
Properties
Every property is optional. One you leave out keeps Flutter's value.
| Property | Type | Values | States | What it does | Flutter field |
|---|---|---|---|---|---|
padding |
insets | 16, h, v, l, t, r, b, or a map |
no | The amount of space to surround each carousel item with. | CarouselViewThemeData.padding |
background-color |
color | #RRGGBB, a color name, $colors.primary, or an object { color, mix, alpha } |
no | The background color for each carousel item. | CarouselViewThemeData.backgroundColor |
elevation |
elevation | level0 to level5, or a number |
no | The z-coordinate of each carousel item. | CarouselViewThemeData.elevation |
shape |
shape | a token (small), a radius, or a map |
no | The shape of each carousel item's material. Defines each item's shape. | CarouselViewThemeData.shape |
item-clip-behavior |
choice | none, hard-edge, anti-alias, anti-alias-with-save-layer |
no | The clip behavior for each carousel item. The item content will be clipped (or not) according to this option. | CarouselViewThemeData.itemClipBehavior |
overlay-color |
color | #RRGGBB, a color name, $colors.primary, or an object { color, mix, alpha } |
yes | The highlight color to indicate the carousel items are in pressed, hovered or focused states. | CarouselViewThemeData.overlayColor |
Values per state
A property with yes in the States column takes one value, or a map with a value for each state the widget can be in: default, hovered, focused, pressed, disabled, selected, error, dragged and scrolled-under. The widget uses the value of the strongest state it is in, in that order (disabled first), and then default. A state you leave out keeps Flutter's value. See Styles and states.
Read it in Dart
The Material starter sets ThemeData.carouselViewTheme from these properties. In a widget, read the result with:
final theme = Theme.of(context).carouselViewTheme;
See also
- All component themes
- Themes from properties
- Theme overview
- Colors
- Shape, spacing and elevation
- Styles and states
- Tokens and references
- Root theme properties
- All properties of the starter
Property descriptions are adapted from the documentation of the Flutter SDK (3.50.0), copyright The Flutter Authors, BSD 3-Clause license.