Archie
05/06/2021, 5:07 PMCicero
05/06/2021, 6:02 PMArchie
05/06/2021, 7:24 PMCicero
05/06/2021, 7:25 PMCicero
05/06/2021, 7:26 PMArchie
05/07/2021, 5:35 AMArchie
05/08/2021, 4:06 PMScrollableTabRow
works and realize I could utilize the indicator
as it uses the sum of all the children’s width. I ended up with this. 🙂
Hope anyone trying to look into the same problem would see this and would help them. :)Cicero
05/08/2021, 4:37 PMCicero
05/08/2021, 4:37 PMCicero
05/08/2021, 4:38 PMCicero
05/08/2021, 4:38 PMCicero
05/08/2021, 4:38 PMArchie
05/08/2021, 5:01 PMIndicator
is filled in. As the indicator is drawn on top of the `TabItem`s. I kinda hope we could control whether the Indicator gets drawn on top or below.Cicero
05/08/2021, 5:12 PMCicero
05/08/2021, 5:12 PMCicero
05/08/2021, 5:12 PMCicero
05/08/2021, 5:14 PM@Composable
fun AppButton(
text: String,
modifier: Modifier = Modifier,
onClick: () -> Unit,
style: ButtonStyle,
icon: Painter? = null,
isAllCapitals: Boolean = false,
enabled: Boolean = true,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
elevation: ButtonElevation? = ButtonDefaults.elevation(Elevation),
colors: ButtonColors = ButtonBackgroundColor(style),
contentPadding: PaddingValues = ButtonDefaults.ContentPadding,
) {
Box(modifier = Modifier.defaultMinSize(minHeight = gu4_5)) {
Surface(
shape = RoundedCornerShape(if (style == Date) 0.dp else 4.dp),
color = colors.backgroundColor(true).value,
border = if (style == Date || !enabled) null else BorderStroke(
1.dp,
AppColor.ButtonBorder
),
elevation = elevation?.elevation(true, interactionSource)?.value ?: 0.dp,
modifier = modifier
.fillMaxWidth()
.clickable(
onClick = onClick,
enabled = enabled,
role = Role.Button,
interactionSource = interactionSource,
indication = null
)
) {
ProvideTextStyle(
value = MaterialTheme.typography.button
) {
Row(
modifier = Modifier
.defaultMinSize(
minWidth = ButtonDefaults.MinWidth
)
.indication(interactionSource, rememberRipple())
.padding(contentPadding),
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically,
content = {
if (icon != null) {
Image(
painter = icon,
contentDescription = null,
contentScale = ContentScale.Fit,
colorFilter = ButtonIconColor(style)
)
Spacer(
modifier = Modifier
.width(Dimens.ButtonSpaceBetweenIcon)
)
}
Text(
text = if (isAllCapitals) text.toUpperCase() else text,
style = ButtonTextStyle(style)
)
}
)
Box(
modifier = Modifier
.alpha(if (enabled) 0f else 0.6f)
.background(AppColor.Ghost)
.clip(MaterialTheme.shapes.small)
.matchParentSize()
.border(
BorderStroke(
1.dp,
AppColor.Ghost
)
)
)
}
}
}
}
Cicero
05/08/2021, 5:15 PMCicero
05/08/2021, 5:15 PMArchie
05/08/2021, 5:20 PMCicero
05/08/2021, 5:22 PMCicero
05/08/2021, 5:22 PMArchie
05/08/2021, 5:40 PM