Skip to content

Instantly share code, notes, and snippets.

@GianpaMX
Created April 25, 2022 12:33
Show Gist options
  • Save GianpaMX/23ff6b7ddbc1650eed7feb7925684a47 to your computer and use it in GitHub Desktop.
Save GianpaMX/23ff6b7ddbc1650eed7feb7925684a47 to your computer and use it in GitHub Desktop.
@Composable
internal fun EditExpenseContent(
state: EditState,
onEditExpense: ((Expense) -> Unit)? = null,
onPayerClicked: ((Payer) -> Unit)? = null,
onAddNewPayerClicked: (() -> Unit)? = null,
onReceiverCheckedChange: ((Receiver) -> Unit)? = null,
onAddNewReceiverClick: (() -> Unit)? = null,
) {
var title by rememberSaveable { mutableStateOf(state.expense?.title.orEmpty()) }
val pagerState = rememberPagerState()
val coroutineScope = rememberCoroutineScope()
val onBack: () -> Unit = {
state.expense?.let { onEditExpense?.invoke(it.copy(title = title)) }
}
BackHandler(onBack = onBack)
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment