Pattern class abstract
You can construct a Pattern with three different ways:
- Directly with a Pattern type constructor:
final Pattern p1 = DiagonalStripesLight(bgColor: Colors.yellowAccent, fgColor: Colors.black);
- With the Pattern.fromValues factory constructor:
final Pattern p2 = Pattern.fromValues(patternType: PatternType.diagonalLight, bgColor: Colors.yellowAccent, fgColor: Colors.black);
- From a String representation in the form of "pattern_backgroundHex_foregroundHex":
final Pattern p3 = Pattern.fromString("diagonalLight_ffff00_000000");
Constructors
- Pattern({required PatternType patternType, required Color bgColor, required Color fgColor})
-
const
- Pattern.fromString(String stringDescription)
-
Instantiate a Pattern from a String representation in the form
of "pattern_backgroundHex_foregroundHex".
factory
- Pattern.fromValues({required PatternType patternType, required Color bgColor, required Color fgColor, int? featuresCount})
-
Instantiate a Pattern from a type, background and foreground colors.
factory
Properties
- bgColor → Color
-
The Pattern's background color.
final
- description → String
-
no setter
- fgColor → Color
-
The Pattern's foreground color (for the stripes, dots, squares, etc.).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- patternType → PatternType
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
paintOnCanvas(
Canvas canvas, Size size) → void - Paint the Pattern on the whole Canvas size.
-
paintOnCircle(
Canvas canvas, Size size, Offset center, double radius, {PatternScaleBehavior patternScaleBehavior = PatternScaleBehavior.container, Rect? customRect}) → void -
Paint the Pattern on a
Circle
, defined by acenter
Offset and aradius
. -
paintOnPath(
Canvas canvas, Size size, Path path, {PatternScaleBehavior patternScaleBehavior = PatternScaleBehavior.container, Rect? customRect}) → void - Paint the Pattern on a Path.
-
paintOnRect(
Canvas canvas, Size size, Rect rect, {PatternScaleBehavior patternScaleBehavior = PatternScaleBehavior.container, Rect? customRect}) → void - Paint the Pattern on a Rect.
-
paintOnRRect(
Canvas canvas, Size size, RRect rRect, {PatternScaleBehavior patternScaleBehavior = PatternScaleBehavior.container, Rect? customRect}) → void - Paint the Pattern on a RRect.
-
paintOnWidget(
Canvas canvas, Size size, {PatternScaleBehavior patternScaleBehavior = PatternScaleBehavior.container, Rect? customRect}) → void - Paint the Pattern on a widget.
-
paintWithPattern(
Canvas canvas, double x, double y, double width, double height) → void -
After clipping the canvas to the shape we want, paint the Pattern on the rectangle
defined by the provided
x
,y
,width
,height
. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- DEFAULT_DIAGONAL_STRIPES_COUNT → const int
- DEFAULT_DOTS_COUNT → const int
- DEFAULT_SQUARES_COUNT → const int
- DEFAULT_STRIPES_COUNT → const int