Fluid 1.3.0
Material Design for QtQuick and Qml
Loading...
Searching...
No Matches
fab.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
2// SPDX-License-Identifier: MPL-2.0
3
4#pragma once
5
6#include <QtCore/qobject.h>
7#include <QtQml/qqmlregistration.h>
8
9#include "elevationtokens.h"
10#include "shapetokens.h"
11#include "statetokens.h"
12
13// Component values map to the AndroidX Material 3 generated tokens:
14// https://android.googlesource.com/platform/frameworks/support/+/5ba2cdd61be7b6945db999b238d14f3c626136fb/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/
15// FabPrimaryTokens.kt, FabMediumTokens.kt, and FabLargeTokens.kt.
16
17namespace Fluid {
18
20struct Fab
21{
22 Q_GADGET
23 QML_ANONYMOUS
24
25 Q_PROPERTY(qreal containerHeight READ containerHeight CONSTANT FINAL)
26 Q_PROPERTY(Fluid::ShapeValue containerShape READ containerShape CONSTANT FINAL)
27 Q_PROPERTY(qreal containerWidth READ containerWidth CONSTANT FINAL)
28 Q_PROPERTY(qreal iconSize READ iconSize CONSTANT FINAL)
29 Q_PROPERTY(qreal mediumContainerHeight READ mediumContainerHeight CONSTANT FINAL)
31 Q_PROPERTY(qreal mediumContainerWidth READ mediumContainerWidth CONSTANT FINAL)
32 Q_PROPERTY(qreal mediumIconSize READ mediumIconSize CONSTANT FINAL)
33 Q_PROPERTY(qreal largeContainerHeight READ largeContainerHeight CONSTANT FINAL)
35 Q_PROPERTY(qreal largeContainerWidth READ largeContainerWidth CONSTANT FINAL)
36 Q_PROPERTY(qreal largeIconSize READ largeIconSize CONSTANT FINAL)
37 Q_PROPERTY(qreal containerElevation READ containerElevation CONSTANT FINAL)
38 Q_PROPERTY(qreal focusContainerElevation READ focusContainerElevation CONSTANT FINAL)
39 Q_PROPERTY(qreal hoverContainerElevation READ hoverContainerElevation CONSTANT FINAL)
40 Q_PROPERTY(qreal pressedContainerElevation READ pressedContainerElevation CONSTANT FINAL)
41 Q_PROPERTY(qreal loweredContainerElevation READ loweredContainerElevation CONSTANT FINAL)
42 Q_PROPERTY(
44 Q_PROPERTY(
47 FINAL)
48 Q_PROPERTY(qreal hoverStateLayerOpacity READ hoverStateLayerOpacity CONSTANT FINAL)
49 Q_PROPERTY(qreal focusStateLayerOpacity READ focusStateLayerOpacity CONSTANT FINAL)
50 Q_PROPERTY(qreal pressedStateLayerOpacity READ pressedStateLayerOpacity CONSTANT FINAL)
51
52public:
53 constexpr qreal containerHeight() const
54 {
55 return 56.0;
56 }
57 constexpr ShapeValue containerShape() const
58 {
59 return ShapeTokens{ }.cornerLarge();
60 }
61 constexpr qreal containerWidth() const
62 {
63 return 56.0;
64 }
65 constexpr qreal iconSize() const
66 {
67 return 24.0;
68 }
69 constexpr qreal mediumContainerHeight() const
70 {
71 return 80.0;
72 }
74 {
76 }
77 constexpr qreal mediumContainerWidth() const
78 {
79 return 80.0;
80 }
81 constexpr qreal mediumIconSize() const
82 {
83 return 28.0;
84 }
85 constexpr qreal largeContainerHeight() const
86 {
87 return 96.0;
88 }
90 {
91 return ShapeTokens{ }.cornerExtraLarge();
92 }
93 constexpr qreal largeContainerWidth() const
94 {
95 return 96.0;
96 }
97 constexpr qreal largeIconSize() const
98 {
99 return 32.0;
100 }
101 constexpr qreal containerElevation() const
102 {
103 return ElevationTokens{ }.level3();
104 }
105 constexpr qreal focusContainerElevation() const
106 {
107 return ElevationTokens{ }.level3();
108 }
109 constexpr qreal hoverContainerElevation() const
110 {
111 return ElevationTokens{ }.level4();
112 }
113 constexpr qreal pressedContainerElevation() const
114 {
115 return ElevationTokens{ }.level3();
116 }
117 constexpr qreal loweredContainerElevation() const
118 {
119 return ElevationTokens{ }.level1();
120 }
121 constexpr qreal loweredFocusContainerElevation() const
122 {
123 return ElevationTokens{ }.level1();
124 }
125 constexpr qreal loweredHoverContainerElevation() const
126 {
127 return ElevationTokens{ }.level2();
128 }
129 constexpr qreal loweredPressedContainerElevation() const
130 {
131 return ElevationTokens{ }.level1();
132 }
133 constexpr qreal hoverStateLayerOpacity() const
134 {
136 }
137 constexpr qreal focusStateLayerOpacity() const
138 {
140 }
141 constexpr qreal pressedStateLayerOpacity() const
142 {
144 }
145};
146
147} // namespace Fluid
Material Design 3 system elevation tokens.
Material Design 3 Expressive floating action button tokens.
Definition fab.h:21
constexpr qreal iconSize() const
Definition fab.h:65
qreal loweredPressedContainerElevation
Definition fab.h:47
qreal containerElevation
Definition fab.h:37
qreal focusStateLayerOpacity
Definition fab.h:49
qreal hoverContainerElevation
Definition fab.h:39
qreal largeContainerWidth
Definition fab.h:35
qreal focusContainerElevation
Definition fab.h:38
Fluid::ShapeValue largeContainerShape
Definition fab.h:34
qreal pressedContainerElevation
Definition fab.h:40
constexpr qreal largeContainerHeight() const
Definition fab.h:85
qreal loweredFocusContainerElevation
Definition fab.h:43
qreal largeContainerHeight
Definition fab.h:33
constexpr qreal focusContainerElevation() const
Definition fab.h:105
qreal loweredHoverContainerElevation
Definition fab.h:45
QML_ANONYMOUSqreal containerHeight
Definition fab.h:25
qreal mediumContainerWidth
Definition fab.h:31
qreal hoverStateLayerOpacity
Definition fab.h:48
Fluid::ShapeValue containerShape
Definition fab.h:26
constexpr qreal loweredHoverContainerElevation() const
Definition fab.h:125
constexpr qreal largeContainerWidth() const
Definition fab.h:93
constexpr qreal hoverContainerElevation() const
Definition fab.h:109
constexpr ShapeValue largeContainerShape() const
Definition fab.h:89
constexpr qreal mediumContainerHeight() const
Definition fab.h:69
constexpr qreal pressedStateLayerOpacity() const
Definition fab.h:141
constexpr qreal largeIconSize() const
Definition fab.h:97
qreal mediumIconSize
Definition fab.h:32
constexpr ShapeValue mediumContainerShape() const
Definition fab.h:73
constexpr qreal hoverStateLayerOpacity() const
Definition fab.h:133
qreal mediumContainerHeight
Definition fab.h:29
constexpr qreal loweredContainerElevation() const
Definition fab.h:117
qreal loweredContainerElevation
Definition fab.h:41
constexpr qreal loweredPressedContainerElevation() const
Definition fab.h:129
constexpr qreal loweredFocusContainerElevation() const
Definition fab.h:121
qreal pressedStateLayerOpacity
Definition fab.h:50
constexpr qreal containerWidth() const
Definition fab.h:61
qreal iconSize
Definition fab.h:28
constexpr qreal mediumContainerWidth() const
Definition fab.h:77
constexpr qreal mediumIconSize() const
Definition fab.h:81
qreal containerWidth
Definition fab.h:27
constexpr qreal containerElevation() const
Definition fab.h:101
constexpr ShapeValue containerShape() const
Definition fab.h:57
constexpr qreal pressedContainerElevation() const
Definition fab.h:113
Fluid::ShapeValue mediumContainerShape
Definition fab.h:30
qreal largeIconSize
Definition fab.h:36
constexpr qreal focusStateLayerOpacity() const
Definition fab.h:137
Material Design 3 system shape tokens.
Definition shapetokens.h:48
Fluid::ShapeValue cornerLarge
Definition shapetokens.h:60
Fluid::ShapeValue cornerLargeIncreased
Definition shapetokens.h:62
Fluid::ShapeValue cornerExtraLarge
Definition shapetokens.h:53
Material Design 3 system state tokens.
Definition statetokens.h:18
qreal focusStateLayerOpacity
Definition statetokens.h:23
qreal hoverStateLayerOpacity
Definition statetokens.h:24
qreal pressedStateLayerOpacity
Definition statetokens.h:25