@@ -87,7 +87,8 @@ fun BottomButtonsBlock(
87
87
showNullDataButtonAsContainer : Boolean = false,
88
88
columnarFab : (@Composable ColumnScope .() -> Unit )? = null,
89
89
actions : @Composable RowScope .() -> Unit ,
90
- isPrimaryButtonEnabled : Boolean = true
90
+ isPrimaryButtonEnabled : Boolean = true,
91
+ showColumnarFabInRow : Boolean = false,
91
92
) {
92
93
AnimatedContent (
93
94
targetState = targetState,
@@ -97,9 +98,7 @@ fun BottomButtonsBlock(
97
98
) { (isNull, inside) ->
98
99
if (isNull) {
99
100
val button = @Composable {
100
- EnhancedFloatingActionButton (
101
- onClick = onSecondaryButtonClick,
102
- onLongClick = onSecondaryButtonLongClick,
101
+ Row (
103
102
modifier = Modifier
104
103
.windowInsetsPadding(
105
104
WindowInsets .navigationBars.union(
@@ -109,14 +108,24 @@ fun BottomButtonsBlock(
109
108
)
110
109
)
111
110
.padding(16 .dp),
112
- content = {
113
- Spacer (Modifier .width(16 .dp))
114
- Icon (secondaryButtonIcon, null )
115
- Spacer (Modifier .width(16 .dp))
116
- Text (secondaryButtonText)
117
- Spacer (Modifier .width(16 .dp))
111
+ horizontalArrangement = Arrangement .spacedBy(8 .dp),
112
+ verticalAlignment = Alignment .CenterVertically
113
+ ) {
114
+ EnhancedFloatingActionButton (
115
+ onClick = onSecondaryButtonClick,
116
+ onLongClick = onSecondaryButtonLongClick,
117
+ content = {
118
+ Spacer (Modifier .width(16 .dp))
119
+ Icon (secondaryButtonIcon, null )
120
+ Spacer (Modifier .width(16 .dp))
121
+ Text (secondaryButtonText)
122
+ Spacer (Modifier .width(16 .dp))
123
+ }
124
+ )
125
+ if (showColumnarFabInRow && columnarFab != null ) {
126
+ Column { columnarFab() }
118
127
}
119
- )
128
+ }
120
129
}
121
130
if (showNullDataButtonAsContainer) {
122
131
Row (
@@ -136,7 +145,9 @@ fun BottomButtonsBlock(
136
145
modifier = Modifier .drawHorizontalStroke(true ),
137
146
actions = actions,
138
147
floatingActionButton = {
139
- Row {
148
+ Row (
149
+ horizontalArrangement = Arrangement .spacedBy(8 .dp)
150
+ ) {
140
151
AnimatedVisibility (visible = isSecondaryButtonVisible) {
141
152
EnhancedFloatingActionButton (
142
153
onClick = onSecondaryButtonClick,
@@ -152,43 +163,45 @@ fun BottomButtonsBlock(
152
163
)
153
164
}
154
165
}
166
+ AnimatedVisibility (visible = showColumnarFabInRow) {
167
+ columnarFab?.let {
168
+ Column { it() }
169
+ }
170
+ }
155
171
AnimatedVisibility (visible = isPrimaryButtonVisible) {
156
- Row {
157
- Spacer (Modifier .width(8 .dp))
158
- EnhancedFloatingActionButton (
159
- onClick = if (isPrimaryButtonEnabled) onPrimaryButtonClick
160
- else null ,
161
- onLongClick = if (isPrimaryButtonEnabled) onPrimaryButtonLongClick
162
- else null ,
163
- containerColor = takeColorFromScheme {
164
- if (isPrimaryButtonEnabled) primaryContainer
165
- else surfaceContainerHighest
166
- },
167
- contentColor = takeColorFromScheme {
168
- if (isPrimaryButtonEnabled) onPrimaryContainer
169
- else outline
170
- }
171
- ) {
172
- AnimatedContent (
173
- targetState = primaryButtonIcon to primaryButtonText,
174
- transitionSpec = { fadeIn() + scaleIn() togetherWith fadeOut() + scaleOut() }
175
- ) { (icon, text) ->
176
- Row (
177
- verticalAlignment = Alignment .CenterVertically ,
178
- horizontalArrangement = Arrangement .Center
179
- ) {
180
- if (text.isNotEmpty()) {
181
- Spacer (Modifier .width(16 .dp))
182
- }
183
- Icon (
184
- imageVector = icon,
185
- contentDescription = null
186
- )
187
- if (text.isNotEmpty()) {
188
- Spacer (Modifier .width(16 .dp))
189
- Text (text)
190
- Spacer (Modifier .width(16 .dp))
191
- }
172
+ EnhancedFloatingActionButton (
173
+ onClick = if (isPrimaryButtonEnabled) onPrimaryButtonClick
174
+ else null ,
175
+ onLongClick = if (isPrimaryButtonEnabled) onPrimaryButtonLongClick
176
+ else null ,
177
+ containerColor = takeColorFromScheme {
178
+ if (isPrimaryButtonEnabled) primaryContainer
179
+ else surfaceContainerHighest
180
+ },
181
+ contentColor = takeColorFromScheme {
182
+ if (isPrimaryButtonEnabled) onPrimaryContainer
183
+ else outline
184
+ }
185
+ ) {
186
+ AnimatedContent (
187
+ targetState = primaryButtonIcon to primaryButtonText,
188
+ transitionSpec = { fadeIn() + scaleIn() togetherWith fadeOut() + scaleOut() }
189
+ ) { (icon, text) ->
190
+ Row (
191
+ verticalAlignment = Alignment .CenterVertically ,
192
+ horizontalArrangement = Arrangement .Center
193
+ ) {
194
+ if (text.isNotEmpty()) {
195
+ Spacer (Modifier .width(16 .dp))
196
+ }
197
+ Icon (
198
+ imageVector = icon,
199
+ contentDescription = null
200
+ )
201
+ if (text.isNotEmpty()) {
202
+ Spacer (Modifier .width(16 .dp))
203
+ Text (text)
204
+ Spacer (Modifier .width(16 .dp))
192
205
}
193
206
}
194
207
}
@@ -223,7 +236,10 @@ fun BottomButtonsBlock(
223
236
EnhancedFloatingActionButton (
224
237
onClick = onSecondaryButtonClick,
225
238
onLongClick = onSecondaryButtonLongClick,
226
- containerColor = MaterialTheme .colorScheme.tertiaryContainer
239
+ containerColor = takeColorFromScheme {
240
+ if (isPrimaryButtonVisible) tertiaryContainer
241
+ else primaryContainer
242
+ }
227
243
) {
228
244
Icon (
229
245
imageVector = secondaryButtonIcon,
0 commit comments