LinearGradient Class - Painting Library - Dart API
Maybe your like
A 2D linear gradient.
This class is used by BoxDecoration to represent linear gradients. This abstracts out the arguments to the ui.Gradient.linear constructor from the dart:ui library.
A gradient has two anchor points, begin and end. The begin point corresponds to 0.0, and the end point corresponds to 1.0. These points are expressed in fractions, so that the same gradient can be reused with varying sized boxes without changing the parameters. (This contrasts with ui.Gradient.linear, whose arguments are expressed in logical pixels.)
The colors are described by a list of Color objects. There must be at least two colors. The stops list, if specified, must have the same length as colors. It specifies fractions of the vector from start to end, between 0.0 and 1.0, for each color. If it is null, a uniform distribution is assumed.
The region of the canvas before begin and after end is colored according to tileMode.
Typically this class is used with BoxDecoration, which does the painting. To use a LinearGradient to paint on a canvas directly, see createShader.
This sample draws a picture with a gradient sweeping through different colors, by having a Container display a BoxDecoration with a LinearGradient. link
To create a local project with this code sample, run: flutter create --sample=painting.LinearGradient.1 mysample
See also:
- RadialGradient, which displays a gradient in concentric circles, and has an example which shows a different way to use Gradient objects.
- SweepGradient, which displays a gradient in a sweeping arc around a center point.
- BoxDecoration, which can take a LinearGradient in its BoxDecoration.gradient property.
Tag » A Linear Gradient Color
-
CSS Gradients - W3Schools
-
CSS Linear-gradient() Function - W3Schools
-
Linear-gradient() - CSS : Feuilles De Style En Cascade | MDN
-
CSS Gradient — Generator, Maker, And Background
-
UiGradients - Beautiful Colored Gradients
-
Generate A CSS Color Gradient - ColorSpace
-
LinearGradient - Expo Documentation
-
CSS Linear Gradient Explained With Examples - FreeCodeCamp
-
CSS Gradients - CSS-Tricks
-
Creating Complex Gradients With React-native-linear-gradient
-
36 Beautiful Color Gradients For Your Next Design Project
-
Setting Backgrounds & Gradients - Learn To Code HTML & CSS