ThemeBackgroundData class final
The background of a theme (or of one of its screens): a base
color, an image, an overlay, an animation of the image and the
transition to a new background.
background:
color: $colors.surface-container-lowest
image: { source: https://cdn.example.com/bg.jpg, fit: cover, blur: 4 }
overlay:
gradient: { type: linear, colors: [transparent, '#CC0A0C12'] }
animation: background-drift # an animations.* name
effect: drift # drift | zoom | pulse
transition: 400ms ease-out
frame-rate: 15 # or every-frame
screens:
login: { image: { source: packages/neon_ui/assets/images/login.jpg } }
Read it with context.theme.background; show it with
ThemeBackground. Values a theme does not set are null.
- Annotations
Constructors
-
ThemeBackgroundData({Color? color, ThemeBackgroundImage? image, ThemeBackgroundOverlay? overlay, String? animation, BackgroundEffect? effect, ThemeBackgroundTransition? transition, double? frameRate, Map<
String, ThemeBackgroundData> screens = const {}}) -
A background of the given parts.
const
Properties
- animation → String?
-
The name of the
animations.<name>that moves the image.final - color → Color?
-
The base color below everything;
null: the theme's surface.final - effect → BackgroundEffect?
-
How the image moves: BackgroundEffect.drift when only
animation is set.
final
- effectiveEffect → BackgroundEffect?
-
The effect to play: effect, else drift when there is an
animation, else none.
no setter
- frameRate → double?
-
How many times a second the moving image is drawn again
(
frame-rate); double.infinity (every-frame) at every frame of the screen;null: defaultFrameRate. A slow drift moves a pixel or two a second: drawn at every frame it keeps the whole screen repainting, which takes the time of scrolling and the battery.final - frameRateOrDefault → double
-
The frame rate to use: frameRate or defaultFrameRate.
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- image → ThemeBackgroundImage?
-
The image and how it fills the screen.
final
-
images
→ Iterable<
ThemeImage> -
Every image of the background, the screens' included.
no setter
- overlay → ThemeBackgroundOverlay?
-
What is painted over the image.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
screens
→ Map<
String, ThemeBackgroundData> -
The overrides of single screens, by canonical name.
final
- transition → ThemeBackgroundTransition?
-
The cross-fade to a new background;
null: defaultTransition.final - transitionOrDefault → ThemeBackgroundTransition
-
The fade to use: transition or defaultTransition.
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
screen(
String name) → ThemeBackgroundData -
The background of the screen
name: the keys ofscreens.<name>over this background's own; this one when the screen has none. The name is compared without case,-and_. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
parse(
ThemeProperties p) → ThemeBackgroundData? -
Reads
backgroundofp;nullwhen the theme has none. Throws a ThemePropertyException naming the property for a wrong value or key, ananimationthat is noanimations.*, or an image without a source. -
parseAt(
ThemeProperties p, String path) → ThemeBackgroundData? -
Reads the background written at
pathofp(the splash'sbackgroundhas the keys of the theme's, withoutscreens);nullwhen there is nothing atpath.
Constants
- defaultFrameRate → const double
- The frame rate when the theme sets none: 15 a second.
- defaultTransition → const ThemeBackgroundTransition
- The fade when the theme sets none: 300 ms, ease-out.