Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fun TokenInfoScreen(
val viewModel = hiltViewModel<TokenInfoViewModel>()
val state by viewModel.stateFlow.collectAsStateWithLifecycle()
AppBarWithTitle(
title = {
titleContent = {
state.token.dataOrNull?.let { token ->
TokenIconWithName(
token = token,
Expand All @@ -62,7 +62,8 @@ fun TokenInfoScreen(
}
},
titleAlignment = Alignment.CenterHorizontally,
rightContents = {
onBackIconClicked = { navigator.pop() },
endContent = {
state.token.dataOrNull?.let {
if (!state.isCashReserve) {
AppBarDefaults.Share {
Expand All @@ -71,7 +72,6 @@ fun TokenInfoScreen(
}
}
}
AppBarDefaults.Close { navigator.pop() }
},
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,11 @@ object AppBarDefaults {
fun AppBarWithTitle(
modifier: Modifier = Modifier,
title: String = "",
titleContent: (@Composable () -> Unit)? = null,
titleAlignment: Alignment.Horizontal = Alignment.Start,
contentPadding: PaddingValues = AppBarDefaults.ContentPadding,
onBackIconClicked: (() -> Unit)? = null,
endContent: @Composable () -> Unit = { },
endContent: @Composable RowScope.() -> Unit = { },
) {
val navigator = LocalCodeNavigator.current
val flowDismissStyle = LocalFlowDismissStyle.current
Expand Down Expand Up @@ -217,16 +218,17 @@ fun AppBarWithTitle(
}
},
titleRegion = {
AppBarDefaults.Title(text = title)
if (titleContent != null) titleContent() else AppBarDefaults.Title(text = title)
},
titleAlignment = titleAlignment,
// The caller's end actions always render; a Close (when the leading control resolves to
// one) is appended after them so it sits furthest toward the screen edge — the
// conventional dismiss position. [TopAppBarBase] already lays these out in an
// [EndActionSlotHolder], so a back arrow never has to share the leading slot with a close.
rightContents = {
EndActionSlotHolder {
if (showClose) {
AppBarDefaults.Close { onBackIconClicked() }
} else {
endContent()
}
endContent()
if (showClose) {
AppBarDefaults.Close { onBackIconClicked() }
}
},
)
Expand Down
Loading