项目作者: jisungbin

项目描述 :
android multi-fab that made with jetpack-compose
高级语言: Kotlin
项目地址: git://github.com/jisungbin/ComposeMultiFab.git
创建时间: 2021-09-18T14:33:54Z
项目社区:https://github.com/jisungbin/ComposeMultiFab

开源协议:MIT License

下载


ComposeMultiFab

android multi-fab that made with jetpack-compose


Download

  1. implementation "io.github.jisungbin:multifab:${version}"

Usage

  1. @Composable
  2. fun MultiFloatingActionButton(
  3. modifier: Modifier = Modifier,
  4. items: List<MultiFabItem>,
  5. fabState: MutableState<MultiFabState> = rememberMultiFabState(),
  6. fabIcon: FabIcon,
  7. fabOption: FabOption = FabOption(),
  8. onFabItemClicked: (fabItem: MultiFabItem) -> Unit,
  9. stateChanged: (fabState: MultiFabState) -> Unit = {}
  10. )

MultiFabItem

  1. /**
  2. * @param id Cannot be duplicated with the [id] value of another [MultiFabItem].
  3. */
  4. data class MultiFabItem(
  5. val id: Int,
  6. @DrawableRes val iconRes: Int,
  7. val label: String = ""
  8. )

FabOption

  1. /**
  2. * Affects all fabs including sub fabs.
  3. */
  4. @Composable
  5. fun FabOption(
  6. backgroundTint: Color = MaterialTheme.colors.secondary,
  7. iconTint: Color = contentColorFor(backgroundTint),
  8. showLabels: Boolean = false
  9. ): FabOption

FabIcon

  1. /**
  2. * Affects the main fab icon.
  3. *
  4. * @param iconRes [MultiFloatingActionButton]'s main icon
  5. * @param iconRotate If is not null, the [iconRes] rotates as much as [iconRotate] when [MultiFloatingActionButton] is in [MultiFabState.Expand] state.
  6. */
  7. fun FabIcon(@DrawableRes iconRes: Int, iconRotate: Float? = null): FabIcon

🤗 Happy Coding :)