division
A flutter widget with the goal of simplifying styling and to reduce nesting, inspired by CSS
Getting Started
The
Division
widget has 3 properties. A style
property, a gesture
property and a child
property. As simple as that!Division(style: StyleClass, gesture: GestureClass, child, Widget);
Simple example
Import
Simple usage
Style property
The style property expects a
StyleClass
which is a class holding all the styling for the widget.StyleClass
To add a style to the
StyleClass
, use the ..[style] syntax. The two dots is used to not return [style], but the StyleClass
Align
align
parameters support [String] value ('center', 'left', 'bottomRight'...), [List<double>]
value ([dx, dy]), [double] value (same value for dx and dy) and [Alignment].Align child
align
parameters support [String] value ('center', 'left', 'bottomRight'...), [List<double>]
value ([dx, dy]), [double] value (same value for dx and dy) and [Alignment].
If
If
all
is defined, non of the other properties will have an effect.If
horizontal
and vertical
is defined, top
, bottom
, left
, and right
will have no effect.Margin
If
If
all
is defined, non of the other properties will have an effect.If
horizontal
and vertical
is defined, top
, bottom
, left
, and right
will have no effect.Background color
color
parameter supports HEX ('#xxxxxx'), RGB ([int, int, int]), RGBA ([int, int, int, double]) and [Color].Gradient
Choose between 3 gradient variants.
To change to use radians do:
sweepGradient()
by default does not use radians for the startAngle
and the endAngle
. By default 0.25 equals 45 degrees, 1 equals one full turn etc.To change to use radians do:
StyleClass(useRadians: true)..
.color
parameter supports HEX ('#xxxxxx'), RGB ([int, int, int]), RGBA ([int, int, int, double]) and [Color].align
parameters support [String] value ('center', 'left', 'bottomRight'...), [List<double>]
value ([dx, dy]), [double] value (same value for dx and dy) and [Alignment].Border
Choose between
all
or left
, right
, top
and bottom
.color
parameter supports HEX ('#xxxxxx'), RGB ([int, int, int]), RGBA ([int, int, int, double]) and [Color].Border radius
Eigther use the
If the
all
property to apply to all corners, or user topLeft
, topRight
, bottomLeft
and bottomRight
.If the
all
property is defined, the other properties will have no effect.Box shadow
color
parameter supports HEX ('#xxxxxx'), RGB ([int, int, int]), RGBA ([int, int, int, double]) and [Color].If defined while the elevation property is defined, the last one defined will be the style applied.
offset
is given in the format [double dx, double dy]
Elevation
Scale the widget
Offset
Offsets the widget
Rotate
Rotates the widget.
By default one turn equals 1. To change to radians:
By default one turn equals 1. To change to radians:
StyleClass(useRadians: true)..
Ripple
Material ripple effect
Still a [beta] feature with known issues.
Animate
Animates the widget when one of its style properties changes.
I am considering to implement a
duration
is given in milliseconds.I am considering to implement a
only
parameter to choose to only animate certain properties.Add
Adds a
By default the added
StyleClass
to a StyleClass
.By default the added
StyleClass
does not override already set style. Change override to true, to override already set style.Width, minWidth, maxWidth, Height, minHeight, maxHeight
Gesture property
The gesture property expects a
GestureClass
which is a class holding all the gestures for the widget.GeursteClass
To add a style to the
GestureClass
, use the ..[gesture] syntax. The two dots is used to not return the [gesture], but the GestureClass
The
GestureClass
takes all the same parameters as the GestureDetector
widget.Child property
Widget child