Basic Widget Style Documentation
This utility provides styling system for basic widget layouts in Flutter using Mix.
Overview
The basicWidgetStyle function provides a consistent way to generate different widgets across your Flutter app, relying on the Enum definition from your mix_tokens.dart file.
Parameters
context: BuildContext for accessing screen dimensionstype: Required WidgetType enum valuewidthScale: Scale factor for widget width (default: 1)height: Optional custom heightborderRadius: Optional custom border radiuspadding: Optional custom paddingcolor: Optional background color
Default Values
- Height: 50 (except for header)
- Color:
Colors.transparent - BorderRadius: From
Tokens.borderRadiusBase - Padding: Calculated using
Tokens.getPadding(screenWidth)
Usage Example
final headerStyle = basicWidgetStyle(
context,
type: WidgetType.header,
widthScale: 0.8,
);
final cardStyle = basicWidgetStyle(
context,
type: WidgetType.card,
height: 100,
color: Colors.blue,
);
Dependencies
- Flutter
- Material
- mix package
- Your project’s
mix_tokens.dart
Notes
- All styles inherit from baseStyle with flexible and expanded properties
- Header height adjusts automatically based on screen width
- Card style includes background color option
- Default style provides basic container properties
- Ensure
Tokens.textSizesandTokens.fontFamilyPrimaryare available in yourmix_tokens.dartfile.