ComposeMultiFab
android multi-fab that made with jetpack-compose
Download
implementation "io.github.jisungbin:multifab:${version}"
Usage
@Composable
fun MultiFloatingActionButton(
modifier: Modifier = Modifier,
items: List<MultiFabItem>,
fabState: MutableState<MultiFabState> = rememberMultiFabState(),
fabIcon: FabIcon,
fabOption: FabOption = FabOption(),
onFabItemClicked: (fabItem: MultiFabItem) -> Unit,
stateChanged: (fabState: MultiFabState) -> Unit = {}
)
MultiFabItem
/**
* @param id Cannot be duplicated with the [id] value of another [MultiFabItem].
*/
data class MultiFabItem(
val id: Int,
@DrawableRes val iconRes: Int,
val label: String = ""
)
FabOption
/**
* Affects all fabs including sub fabs.
*/
@Composable
fun FabOption(
backgroundTint: Color = MaterialTheme.colors.secondary,
iconTint: Color = contentColorFor(backgroundTint),
showLabels: Boolean = false
): FabOption
FabIcon
/**
* Affects the main fab icon.
*
* @param iconRes [MultiFloatingActionButton]'s main icon
* @param iconRotate If is not null, the [iconRes] rotates as much as [iconRotate] when [MultiFloatingActionButton] is in [MultiFabState.Expand] state.
*/
fun FabIcon(@DrawableRes iconRes: Int, iconRotate: Float? = null): FabIcon