Skip to content

Commit

Permalink
Optimize jetpack compose by using lambdas
Browse files Browse the repository at this point in the history
  • Loading branch information
LunarX committed Oct 28, 2024
1 parent 66c73fd commit a0a99ee
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private fun ImportFilesScreen(
)
},
topButton = { modifier ->
SendButton(isImporting, importProgress, modifier)
SendButton({ isImporting }, { importProgress }, modifier)
},
) {
ImportedFilesCard(
Expand All @@ -121,12 +121,8 @@ private fun ImportFilesScreen(
}

@Composable
private fun SendButton(isImporting: Boolean, importProgress: Float, modifier: Modifier) {
val progress: (() -> Float)? = if (isImporting) {
{ importProgress }
} else {
null
}
private fun SendButton(isImporting: () -> Boolean, importProgress: () -> Float, modifier: Modifier) {
val progress: (() -> Float)? = if (isImporting()) importProgress else null

LargeButton(
modifier = modifier,
Expand Down

0 comments on commit a0a99ee

Please sign in to comment.