fluttersdk_wind library
Wind - Utility-First Styling for Flutter
Wind is a utility-first styling framework for Flutter, inspired by TailwindCSS. It translates Tailwind-style utility class strings into Flutter widget trees, allowing you to build UIs using familiar CSS-like syntax directly in your widgets.
Core Concepts
- Utility Classes: Style widgets using
classNamestrings like'flex gap-4 p-6 bg-blue-500 rounded-lg' - W-Prefixed Widgets: Use
WDiv,WText,WButton,WInput, and other W-widgets that acceptclassName - Responsive Design: Apply breakpoint-specific styles with
sm:,md:,lg:,xl:,2xl:prefixes - State-Based Styling: Use
hover:,focus:,disabled:,loading:prefixes for interactive states - Dark Mode: Toggle themes and use
dark:prefix for dark-mode-specific styles - Platform-Specific: Target platforms with
ios:,android:,web:,mobile:prefixes
Getting Started
import 'package:flutter/material.dart';
import 'package:fluttersdk_wind/fluttersdk_wind.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return WindTheme(
data: WindThemeData(),
child: MaterialApp(
home: Scaffold(
body: WDiv(
className: 'flex flex-col gap-4 p-6 bg-gray-100 min-h-screen',
children: [
WText(
'Hello Wind!',
className: 'text-3xl font-bold text-blue-600',
),
WDiv(
className: 'bg-white rounded-xl shadow-lg p-6 hover:shadow-xl',
child: WText(
'Build UIs faster with utility-first styling',
className: 'text-gray-600',
),
),
WButton(
onTap: () => print('Clicked!'),
className: 'bg-blue-600 hover:bg-blue-700 text-white px-6 py-3 rounded-lg',
child: Text('Get Started'),
),
],
),
),
),
);
}
}
For complete documentation, visit the Wind documentation.
Classes
- DateRange
- Represents a date range with start and end dates.
- PopoverController
- Controller for programmatic popover control
-
SelectOption<
T> - SelectOption - Data Model for WSelect
- WActionHandler
- Bridges JSON action definitions to Dart callback handlers in the dynamic module.
- WAnchor
- The Foundational State Wrapper
- WBadge
- A Utility-First Badge / Label Component
- WBreakpoint
- Declarative Breakpoint-Keyed Builder
- WButton
- The Utility-First Button Component
- WCard
- A Surface Container for Card-Style Layouts
- WCheckbox
- A Utility-First Checkbox Component
- WDatePicker
- WDatePicker - Utility-First Date Picker Component
- WDiv
- The Fundamental Building Block of Wind
- WDynamic
- Main widget for rendering dynamic UI from JSON configuration.
- WDynamicConfig
-
Configuration for
WindDynamicrendering. - WDynamicController
- Controller for external access to WDynamic state.
- WDynamicState
- Reactive state store for dynamic widget values.
- WFormCheckbox
- A Wind-styled checkbox that integrates with Flutter's Form validation.
- WFormDatePicker
- A Wind-styled date picker that integrates with Flutter's Form validation.
- WFormInput
- A Wind-styled input that integrates with Flutter's Form validation.
-
WFormMultiSelect<
T> - A Wind-styled multi-select that integrates with Flutter's Form validation.
-
WFormSelect<
T> - A Wind-styled single-select that integrates with Flutter's Form validation.
- WIcon
- The Utility-First Icon Component
- WImage
- The Utility-First Image Component
- Wind
- Wind framework-level facade for debug-tooling integration.
- WindAnchorState
- The State Snapshot
- WindAnchorStateProvider
- The State Propagator
- WindAnimationWrapper
- Wraps a widget in the appropriate animation based on WindAnimationType.
- WindCompoundVariant
- A Single Compound-Variant Rule for WindRecipe
- WindContext
- The styling context context
- WindParser
- The Core Parsing Engine
- WindParserInterface
- Interface for specialized Wind CSS parsers.
- WindRecipe
-
A Tailwind-Variants
tv()Equivalent for Wind - WindSlotCompoundVariant
- A Single Compound-Variant Rule for WindSlotRecipe
- WindSlotRecipe
-
A Tailwind-Variants Multi-Part (
slots) Recipe for Wind - WindStyle
- The Immutable Style Object
- WindTheme
- The Theme Provider
- WindThemeController
- Theme Controller
- WindThemeData
- Theme Configuration
- WInput
- The Utility-First Input Component
- WKeyboardActions
- A Wind-styled wrapper that adds keyboard actions (Done button, navigation) to input fields, especially for iOS numeric keyboards.
- WPopover
- WPopover - Flexible Popover Component
-
WRadio<
T> - A Utility-First Radio Button Component
-
WSelect<
T> - The Utility-First Select Component
- WSpacer
- WSpacer - Lightweight Spacing Widget
- WSvg
- The Utility-First SVG Component
- WSwitch
- A Utility-First Toggle Switch Component
- WTabs
- A Utility-First Tabs Component
- WText
- The Utility-First Text Component
Enums
- InputType
- Input type enum for WInput widget
- PopoverAlignment
- Popover Alignment Options
- WDatePickerMode
- Date picker selection mode.
- WindAnimationType
- Animation types for animate-* classes
- WindDisplayType
- WindOverflow
- Overflow behavior types
- WindPositionType
- Position types for positioned elements e.g., relative, absolute
- WindTextTransform
- WKeyboardPlatform
-
Platform gate for
WKeyboardActionstoolbar visibility.
Extensions
- WindContextExtension on BuildContext
- Wind Context Extensions
Constants
-
borderRadius
→ const Map<
String, double> - Default border radius values for Wind theme
-
borderWidths
→ const Map<
String, double> - Default border width values for Wind theme
-
colors
→ const Map<
String, dynamic> -
containers
→ const Map<
String, int> -
fontFamilies
→ const Map<
String, String> - Default font family configurations for Wind theme.
-
fontSizes
→ const Map<
String, double> -
fontWeights
→ const Map<
String, FontWeight> -
leading
→ const Map<
String, double> -
screens
→ const Map<
String, int> -
tracking
→ const Map<
String, double> - windPxUnit → const double
- The pixel unit used for sizing calculations.
- windRemUnit → const int
- The REM unit used for sizing calculations.
Functions
-
applyOpacity(
Color color, double opacity) → Color - Applies opacity to a Color.
-
computeEffectiveAlignment(
{required PopoverAlignment requested, required Offset triggerPosition, required Size triggerSize, required Size popoverSize, required Size screenSize, required Offset offset}) → PopoverAlignment - Computes effective alignment by flipping when overflow would occur.
-
computeHorizontalClamp(
{required PopoverAlignment alignment, required Offset triggerPosition, required Size triggerSize, required double popoverWidth, required Size screenSize, required Offset offset, double margin = 8}) → double -
Computes a horizontal correction (dx) that pulls the overlay back inside the
viewport when the resolved
alignmentwould still place part of it off-screen after computeEffectiveAlignment has already swapped the anchored side. -
hexToColor(
String code) → Color - Color Utility: Hex Parser
-
invertMaterialColor(
MaterialColor color) → MaterialColor - Color Utility: Inverter
-
parseColorOpacity(
String colorClass) → ({String colorPart, double? opacity}) - Parses a color class with optional opacity modifier.
-
wColor(
BuildContext context, String colorName, {int shade = 500, String? darkColorName, int darkShade = 500}) → Color? - Global Color Resolver
-
wFontSize(
BuildContext context, String sizeName) → double? - Returns a font size by name.
-
wFontWeight(
BuildContext context, String weightName) → FontWeight? - Returns a font weight by name.
-
wrapWithAnimation(
{required Widget child, WindAnimationType? animationType, Duration? duration, Curve? curve}) → Widget - Helper function to wrap a widget with animation if animationType is set.
-
wScreen(
BuildContext context, String name) → int? - Returns the pixel value for a breakpoint name.
-
wScreenCurrent(
BuildContext context) → String - Returns the current active breakpoint name.
-
wScreenIs(
BuildContext context, String name) → bool - Checks if the current screen width is at least the given breakpoint.
-
wSpacing(
BuildContext context, num multiplier) → double - Returns a spacing value based on the multiplier.
-
wStyle(
BuildContext context, String className) → WindStyle - Style Parser Helper
Typedefs
- CreateOptionBuilder = Widget Function(BuildContext context, String query, VoidCallback onCreate)
- Signature for building the "create option" button.
- DateDisplayFormat = String Function(DateTime date)
- Signature for custom display format function.
- EmptyStateBuilder = Widget Function(BuildContext context, String query)
- Signature for building the empty state.
- ImageErrorBuilder = Widget Function(BuildContext context, Object error, StackTrace? stackTrace)
- Signature for building a custom error widget.
- ImageLoadingBuilder = Widget Function(BuildContext context, Widget child, ImageChunkEvent? loadingProgress)
- Signature for building a custom loading widget.
- LoadingBuilder = Widget Function(BuildContext context)
- Signature for building the loading indicator.
-
MultiSelectTriggerBuilder<
T> = Widget Function(BuildContext context, List< SelectOption< selectedOptions, bool isOpen)T> > - Signature for building a custom trigger widget for multi-select WSelect.
- PopoverContentBuilder = Widget Function(BuildContext context, VoidCallback close)
- Builder for the popover content.
- PopoverTriggerBuilder = Widget Function(BuildContext context, bool isOpen, bool isHovering)
- Builder for the trigger widget.
-
SelectedChipBuilder<
T> = Widget Function(BuildContext context, SelectOption< T> option, VoidCallback onRemove) - Signature for building a selected chip/tag in multi-select mode.
-
SelectItemBuilder<
T> = Widget Function(BuildContext context, SelectOption< T> option, bool isSelected, bool isHovered) - Signature for building a custom item widget for WSelect.
-
SelectTriggerBuilder<
T> = Widget Function(BuildContext context, SelectOption< T> ? selectedOption, bool isOpen) - Signature for building a custom trigger widget for WSelect.
-
WWidgetBuilder
= Widget Function(Map<
String, dynamic> props, List<Widget> children) - Builder function for custom widget types.