Skip to content

Commit

Permalink
Guidelines recommend mandatory event functions excluded from trailing (
Browse files Browse the repository at this point in the history
…#1208)

Co-authored-by: Ashley Davies <[email protected]>
  • Loading branch information
ashdavies and ashdavies authored Oct 4, 2024
1 parent 113550a commit ef5216d
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ internal fun LauncherScreen(
items(state.entries) { entry ->
LauncherItem(
item = entry,
modifier = Modifier.padding(24.dp),
onClick = OnClick("launcher_goto", mapOf("screen" to entry.screen)) {
eventSink(NavEvent.GoTo(entry.screen))
},
modifier = Modifier.padding(24.dp),
)
}
}
Expand Down Expand Up @@ -116,8 +116,8 @@ private fun LauncherTopAppBar(modifier: Modifier = Modifier) {
@ExperimentalMaterial3Api
private fun LauncherItem(
item: LauncherScreen.State.Item,
modifier: Modifier = Modifier,
onClick: () -> Unit,
modifier: Modifier = Modifier,
) {
Card(
modifier = modifier.clickable(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,20 @@ internal fun BoxSetListScreen(
private fun BoxSetListScreen(
boxSetList: ImmutableList<BoxSet>,
contentPadding: PaddingValues,
onClick: (BoxSet) -> Unit,
modifier: Modifier = Modifier,
columnCount: Int = DEFAULT_COLUMN_COUNT,
onClick: (BoxSet) -> Unit,
) {
LazyVerticalGrid(
columns = GridCells.Fixed(columnCount),
modifier = modifier.padding(4.dp),
contentPadding = contentPadding,
) {
items(boxSetList) {
BoxSetCard(it) { onClick(it) }
items(boxSetList) { boxSet ->
BoxSetCard(
boxSet = boxSet,
onClick = { onClick(boxSet) },
)
}
}
}
Expand All @@ -96,8 +99,8 @@ private fun BoxSetListScreen(
@ExperimentalMaterial3Api
private fun BoxSetCard(
boxSet: BoxSet,
modifier: Modifier = Modifier,
onClick: () -> Unit,
modifier: Modifier = Modifier,
) {
Box(
modifier = modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ private fun BackIconButton(onClick: () -> Unit) {
private fun DetailsScreen(
cards: ImmutableList<Card>,
contentPadding: PaddingValues,
onClick: (Card) -> Unit,
modifier: Modifier = Modifier,
columnCount: Int = DEFAULT_COLUMN_COUNT,
onClick: (Card) -> Unit,
) {
LazyVerticalGrid(
columns = GridCells.Fixed(columnCount),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ private const val CAMERA_ANIMATE_DURATION = 2_000
@Composable
internal actual fun RouteMap(
state: RouteMapState,
modifier: Modifier,
onEndPosition: (LatLng) -> Unit,
modifier: Modifier,
) {
val cameraPositionState = rememberCameraPositionState()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ public fun Circuit.Builder.addRoutePresenter(context: PlatformContext): Circuit.

public fun Circuit.Builder.addRouteUi(): Circuit.Builder {
return addUi<RouteScreen, RouteScreen.State> { state, modifier ->
RouteScreen(state, modifier) { state.eventSink(RouteScreen.Event.OnEndPosition(it)) }
RouteScreen(
state = state,
onEndPosition = { state.eventSink(RouteScreen.Event.OnEndPosition(it)) },
modifier = modifier,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ internal data class RouteMapState(
@Composable
internal expect fun RouteMap(
state: RouteMapState,
modifier: Modifier = Modifier,
onEndPosition: (LatLng) -> Unit,
modifier: Modifier = Modifier,
)

internal data class LatLng(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ internal object RouteScreen : Screen {
@Composable
internal fun RouteScreen(
state: RouteScreen.State,
modifier: Modifier = Modifier,
onEndPosition: (LatLng) -> Unit,
modifier: Modifier = Modifier,
) {
RouteMap(
state = state.mapState,
modifier = modifier,
onEndPosition = onEndPosition,
modifier = modifier,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import androidx.compose.ui.Modifier
@Composable
internal actual fun RouteMap(
state: RouteMapState,
modifier: Modifier,
onEndPosition: (LatLng) -> Unit,
modifier: Modifier,
) {
Text("Unsupported Platform")
}

0 comments on commit ef5216d

Please sign in to comment.