Maps a FAB size and variant to Material 3 metrics and scheme colors, for the regular and the extended FAB alike.
More...
|
| namespace | detail |
| | The table lookups behind the templates, taking the enumerator as an index. Call the templated functions of fab_style instead.
|
|
| template<typename SizeType> |
| float | getContainerSize (SizeType size) |
| | Width and height of the container of a FAB at its default size: 40 dp for Small, 56 dp for Medium, 96 dp for Large.
|
| template<typename SizeType> |
| float | getIconFontSize (SizeType size) |
| | Font size of the icon of a regular FAB: 24 dp for Small and Medium, 36 dp for Large.
|
| template<typename SizeType> |
| float | getLabelFontSize (SizeType size) |
| | Font size shared by the label and the icon of an extended FAB: 18 dp for Small, 24 dp for Medium, 36 dp for Large.
|
| template<typename SizeType> |
| float | getBorderRadius (SizeType size) |
| | Corner radius of the container: the Medium, Large and ExtraLarge shape of the active theme for a Small, Medium and Large FAB.
|
| template<typename VariantType> |
| utility::graphic::Color32Bit | getContainerColor (VariantType variant, bool lowered) |
| | Fill color of the container of a FAB.
|
| template<typename VariantType> |
| utility::graphic::Color32Bit | getContentColor (VariantType variant) |
| | Color of the icon and of the label of a FAB: Primary for the Surface variant, the "on container" role of the others.
|
Maps a FAB size and variant to Material 3 metrics and scheme colors, for the regular and the extended FAB alike.
components::FloatingActionButton and components::ExtendedFloatingActionButton each declare their own Size (Small, Medium, Large) and Variant (Surface, Primary, Secondary, Tertiary) enumerations with the same enumerators in the same order. The functions are therefore templated on the enumeration type and resolve through one shared table, indexed by the integer value of the enumerator.
float getContainerSize(SizeType size)
Width and height of the container of a FAB at its default size: 40 dp for Small, 56 dp for Medium,...
- See also
- guillaume::systems::FloatingActionButton, guillaume::systems::ExtendedFloatingActionButton, guillaume::systems::button_style
◆ getBorderRadius()
template<typename SizeType>
| float guillaume::systems::fab_style::getBorderRadius |
( |
SizeType | size | ) |
|
Corner radius of the container: the Medium, Large and ExtraLarge shape of the active theme for a Small, Medium and Large FAB.
- Template Parameters
-
| SizeType | The Size enumeration of the FAB component. |
- Parameters
-
- Returns
- The radius, in dp.
- Exceptions
-
| std::runtime_error | If the size is not a valid enumerator. |
Definition at line 170 of file fab_style.hpp.
◆ getContainerColor()
template<typename VariantType>
| utility::graphic::Color32Bit guillaume::systems::fab_style::getContainerColor |
( |
VariantType | variant, |
|
|
bool | lowered ) |
Fill color of the container of a FAB.
Primary, Secondary and Tertiary use the matching container role of the active scheme. Surface has no role of its own: it uses the surface color tinted for elevation level 3, or level 1 when lowered.
- Template Parameters
-
| VariantType | The Variant enumeration of the FAB component. |
- Parameters
-
| variant | The FAB variant. |
| lowered | True for a FAB drawn at the lowered elevation. Only the Surface variant changes color with it. |
- Returns
- The container color, without any hover or press tint.
- Exceptions
-
| std::runtime_error | If the variant is not a valid enumerator. |
Definition at line 189 of file fab_style.hpp.
◆ getContainerSize()
template<typename SizeType>
| float guillaume::systems::fab_style::getContainerSize |
( |
SizeType | size | ) |
|
Width and height of the container of a FAB at its default size: 40 dp for Small, 56 dp for Medium, 96 dp for Large.
An extended FAB uses it as its height; its width follows the label.
- Template Parameters
-
| SizeType | The Size enumeration of the FAB component. |
- Parameters
-
- Returns
- The extent, in dp.
- Exceptions
-
| std::runtime_error | If the size is not a valid enumerator. |
Definition at line 130 of file fab_style.hpp.
◆ getContentColor()
template<typename VariantType>
| utility::graphic::Color32Bit guillaume::systems::fab_style::getContentColor |
( |
VariantType | variant | ) |
|
Color of the icon and of the label of a FAB: Primary for the Surface variant, the "on container" role of the others.
- Template Parameters
-
| VariantType | The Variant enumeration of the FAB component. |
- Parameters
-
- Returns
- The content color, from the active color scheme.
- Exceptions
-
| std::runtime_error | If the variant is not a valid enumerator. |
Definition at line 204 of file fab_style.hpp.
◆ getIconFontSize()
template<typename SizeType>
| float guillaume::systems::fab_style::getIconFontSize |
( |
SizeType | size | ) |
|
Font size of the icon of a regular FAB: 24 dp for Small and Medium, 36 dp for Large.
- Template Parameters
-
| SizeType | The Size enumeration of the FAB component. |
- Parameters
-
- Returns
- The font size, in dp.
- Exceptions
-
| std::runtime_error | If the size is not a valid enumerator. |
Definition at line 143 of file fab_style.hpp.
◆ getLabelFontSize()
template<typename SizeType>
| float guillaume::systems::fab_style::getLabelFontSize |
( |
SizeType | size | ) |
|
Font size shared by the label and the icon of an extended FAB: 18 dp for Small, 24 dp for Medium, 36 dp for Large.
- Template Parameters
-
| SizeType | The Size enumeration of the FAB component. |
- Parameters
-
- Returns
- The font size, in dp.
- Exceptions
-
| std::runtime_error | If the size is not a valid enumerator. |
Definition at line 156 of file fab_style.hpp.