Fluent2Style typedef
Fluent2Style = DesignStyle
How one part looks, as Material's ButtonStyle is: every slot resolves for the part's states
(WidgetState.disabled, WidgetState.hovered, WidgetState.focused, WidgetState.pressed,
WidgetState.selected, WidgetState.error).
A part reads each slot from its own style: first, then from its component theme on Fluent2ThemeData, then
from Fluent's own (moved by the theme's density). A slot
that is null, or resolves to null for the states at hand, falls through to the next.
| slot | what it sets |
|---|---|
| fill | the face or plate |
| foreground | the words and icons on it |
| edge | the rim's colour, at Fluent's width |
| overlay | the wash over the face while hovered, focused or pressed |
| side | the whole rim, colour and width; it wins over edge |
| shape | the outline: a Flutter border on the corner scale, or any OutlinedBorder |
| padding | the room between the rim and what stands inside |
| minimumSize | the least the face stands; the touch target stays 48 on touch, 44 elsewhere |
| textStyle | the words' style, merged over Fluent's (its colour comes from foreground) |
| iconSize | an icon's size |
Each part's doc says which slots it reads. Its shape animates when a state changes it, as a Material 3 button's
does. It is ui_core's DesignStyle, so every look's parts take the same
style, read the same way: build one as Fluent2Style(...) or
DesignStyle(...).
Fluent2Button(
'Send',
onPressed: () {},
style: Fluent2Style(
shape: WidgetStateProperty.resolveWith(
(states) => states.contains(WidgetState.pressed)
? const StadiumBorder()
: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(8))),
),
padding: const WidgetStatePropertyAll(EdgeInsets.symmetric(horizontal: 20)),
),
)
Implementation
typedef Fluent2Style = DesignStyle;