Skip to content

Commit

Permalink
made content padding and shape customizable
Browse files Browse the repository at this point in the history
  • Loading branch information
michalgwo committed Jan 15, 2025
1 parent 3a958b1 commit e9a44aa
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.unit.Dp
Expand All @@ -46,6 +47,8 @@ public fun CompassButton(
colors: ButtonColors = ButtonDefaults.elevatedButtonColors(),
contentDescription: String = stringResource(Res.string.compass),
size: Dp = 48.dp,
contentPadding: PaddingValues = PaddingValues(8.dp),
shape: Shape = CircleShape,
needlePainter: Painter = painterResource(Res.drawable.compass_needle),
) {
val coroutineScope = rememberCoroutineScope()
Expand All @@ -57,9 +60,9 @@ public fun CompassButton(
}
onClick()
},
shape = CircleShape,
shape = shape,
colors = colors,
contentPadding = PaddingValues(8.dp),
contentPadding = contentPadding,
) {
Image(
painter = needlePainter,
Expand All @@ -82,6 +85,8 @@ public fun DisappearingCompassButton(
colors: ButtonColors = ButtonDefaults.elevatedButtonColors(),
contentDescription: String = stringResource(Res.string.compass),
size: Dp = 48.dp,
contentPadding: PaddingValues = PaddingValues(8.dp),
shape: Shape = CircleShape,
needlePainter: Painter = painterResource(Res.drawable.compass_needle),
visibilityDuration: Duration = 1.seconds,
enterTransition: EnterTransition = fadeIn(),
Expand Down Expand Up @@ -117,6 +122,8 @@ public fun DisappearingCompassButton(
colors = colors,
contentDescription = contentDescription,
size = size,
contentPadding = contentPadding,
shape = shape,
needlePainter = needlePainter,
)
}
Expand Down

0 comments on commit e9a44aa

Please sign in to comment.