Filter & Effects
A filter and effects system similar to Tailwind CSS, allowing you to apply various visual effects to your components.
Overview
This document describes the Filter
and Effects
functionality in FlutterWind, which provides Tailwind CSS-like filter classes for Flutter applications.
Available Filters
FlutterWind now supports the following filter effects:
- Blur Effects
- Brightness/Contrast Adjustments
- Drop Shadows
- Backdrop Filters
- Transform Utilities
Usage
All filter effects can be applied using the .className()
extension method on any Flutter widget.
Blur Effects
Apply blur effects to any widget using the blur-{amount}
class:
Available blur values:
blur-none
: No blur (0px)blur-sm
: Light blur (4px)blur-md
: Medium blur (8px)blur-lg
: Large blur (12px)blur-xl
: Extra large blur (16px)blur-2xl
: 2x extra large blur (24px)blur-3xl
: 3x extra large blur (32px)
You can also use arbitrary values with the syntax: blur-[10px]
Brightness Adjustments
Adjust the brightness of any widget using the brightness-{amount}
class:
Available brightness values:
brightness-0
: 0% brightnessbrightness-50
: 50% brightnessbrightness-75
: 75% brightnessbrightness-90
: 90% brightnessbrightness-95
: 95% brightnessbrightness-100
: Normal brightness (100%)brightness-105
: 105% brightnessbrightness-110
: 110% brightnessbrightness-125
: 125% brightnessbrightness-150
: 150% brightnessbrightness-200
: 200% brightness
You can also use arbitrary values with the syntax: brightness-[125]
Contrast Adjustments
Adjust the contrast of any widget using the contrast-{amount}
class:
Available contrast values:
contrast-0
: 0% contrastcontrast-50
: 50% contrastcontrast-75
: 75% contrastcontrast-90
: 90% contrastcontrast-95
: 95% contrastcontrast-100
: Normal contrast (100%)contrast-105
: 105% contrastcontrast-110
: 110% contrastcontrast-125
: 125% contrastcontrast-150
: 150% contrastcontrast-200
: 200% contrast
You can also use arbitrary values with the syntax: contrast-[125]
Drop Shadows
Apply drop shadows to any widget using the drop-shadow-{size}
class:
Available drop shadow sizes:
drop-shadow-sm
: Small shadowdrop-shadow-md
: Medium shadowdrop-shadow-lg
: Large shadowdrop-shadow-xl
: Extra large shadowdrop-shadow-2xl
: 2x extra large shadow
You can also use arbitrary values with the syntax: drop-shadow-[0_4px_6px_rgba(0,0,0,0.1)]
Backdrop Filters
Apply backdrop filters (effects that apply to the content behind an element) using the backdrop-blur-{amount}
class:
Backdrop blur uses the same size values as regular blur.
Configuration
You can customize the filter values in your Tailwind configuration file:
Transform Utilities
FlutterWind provides Tailwind CSS-like transform utilities for Flutter applications. These utilities allow you to apply various transformations to your widgets.
Scale
Scale widgets using the scale-{amount}
class:
Available scale values:
scale-0
: Scale to 0 (invisible)scale-50
: Scale to 50%scale-75
: Scale to 75%scale-90
: Scale to 90%scale-95
: Scale to 95%scale-100
: Normal scale (100%)scale-105
: Scale to 105%scale-110
: Scale to 110%scale-125
: Scale to 125%scale-150
: Scale to 150%scale-200
: Scale to 200%
You can also scale X and Y axes independently:
scale-x-{amount}
: Scale horizontallyscale-y-{amount}
: Scale vertically
Arbitrary values can be used with the syntax: scale-[125]
, scale-x-[125]
, or scale-y-[125]
Rotate
Rotate widgets using the rotate-{amount}
class:
Available rotation values:
rotate-0
: No rotation (0 degrees)rotate-1
: Rotate 1 degreerotate-2
: Rotate 2 degreesrotate-3
: Rotate 3 degreesrotate-6
: Rotate 6 degreesrotate-12
: Rotate 12 degreesrotate-45
: Rotate 45 degreesrotate-90
: Rotate 90 degreesrotate-180
: Rotate 180 degrees
Negative rotations are also available with the -
prefix:
-rotate-1
: Rotate -1 degree-rotate-2
: Rotate -2 degrees-rotate-3
: Rotate -3 degrees-rotate-6
: Rotate -6 degrees-rotate-12
: Rotate -12 degrees-rotate-45
: Rotate -45 degrees-rotate-90
: Rotate -90 degrees-rotate-180
: Rotate -180 degrees
Arbitrary values can be used with the syntax: rotate-[30deg]
or -rotate-[30deg]
Translate
Translate (move) widgets using the translate-x-{amount}
and translate-y-{amount}
classes:
Available translation values:
translate-x-0
: No horizontal translationtranslate-x-1
: Translate 4px horizontallytranslate-x-2
: Translate 8px horizontallytranslate-x-4
: Translate 16px horizontallytranslate-x-8
: Translate 32px horizontallytranslate-x-12
: Translate 48px horizontallytranslate-x-16
: Translate 64px horizontally
Similar values are available for vertical translation with translate-y-{amount}
.
Negative translations are also available with the -
prefix:
-translate-x-1
: Translate -4px horizontally-translate-x-2
: Translate -8px horizontally- etc.
Arbitrary values can be used with the syntax: translate-x-[10px]
or translate-y-[25%]
Skew
Skew widgets using the skew-x-{amount}
and skew-y-{amount}
classes:
Available skew values:
skew-x-0
: No horizontal skewskew-x-1
: Skew 1 degree horizontallyskew-x-2
: Skew 2 degrees horizontallyskew-x-3
: Skew 3 degrees horizontallyskew-x-6
: Skew 6 degrees horizontallyskew-x-12
: Skew 12 degrees horizontally
Similar values are available for vertical skew with skew-y-{amount}
.
Negative skews are also available with the -
prefix:
-skew-x-1
: Skew -1 degree horizontally-skew-x-2
: Skew -2 degrees horizontally- etc.
Arbitrary values can be used with the syntax: skew-x-[15deg]
or skew-y-[15deg]
Transform Origin
Set the origin point for transformations using the origin-{position}
class:
Available origin values:
origin-center
: Center of the element (default)origin-top
: Top center of the elementorigin-top-right
: Top right corner of the elementorigin-right
: Right center of the elementorigin-bottom-right
: Bottom right corner of the elementorigin-bottom
: Bottom center of the elementorigin-bottom-left
: Bottom left corner of the elementorigin-left
: Left center of the elementorigin-top-left
: Top left corner of the element
Arbitrary values can be used with the syntax: origin-[25%_75%]
Configuration
You can customize the transform values in your Tailwind configuration file:
Example
See the complete example in example/filter_effects_example.dart
.