Configuration System
A configuration system similar to Tailwind CSS, allowing you to customize the default values and behavior of the framework.
Overview
The FlutterWind configuration system allows you to customize the default values and behavior of the framework to match your design system. Similar to Tailwind CSS, FlutterWind provides a way to define your theme, including colors, spacing, typography, and more.
Configuration Options
FlutterWind supports the following configuration categories:
Colors
Define your color palette with support for different shades:
Spacing
Define your spacing scale for margins, padding, and gaps:
Breakpoints
Define responsive breakpoints for different screen sizes:
Typography
Configure font sizes, weights, and families:
Border Radius
Define border radius values:
Box Shadows
Define shadow presets:
Filter Effects
Configure blur, brightness, contrast, and drop shadow values:
Configuration File
FlutterWind looks for a flutterwind.yaml
file in your project root directory. This file should contain your custom configuration:
Loading Configuration
FlutterWind automatically loads the configuration when your app starts. You can also manually load or update the configuration:
Accessing Configuration Values
You can access configuration values programmatically:
Default Values
FlutterWind comes with sensible defaults based on Tailwind CSS. If you don't provide a custom configuration, these defaults will be used. When you provide a partial configuration, it will be merged with the defaults, overriding only the values you specify.
Implementation Details
The configuration system is implemented in the TailwindConfig
class, which provides static properties for different configuration categories and methods for parsing and updating configuration values from YAML.
The updateFromYaml
method merges your custom configuration with the default values, allowing for partial configuration updates while maintaining backward compatibility.
Color values are parsed from hex strings to Flutter's Color
objects, and other values are converted to appropriate types (double, int, etc.) as needed.