Thanks to visit codestin.com
Credit goes to github.com

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 @@ -21,21 +21,23 @@ import com.clerk.api.ui.ClerkTheme
import com.clerk.ui.core.appbar.ClerkTopAppBar
import com.clerk.ui.core.dimens.dp18
import com.clerk.ui.core.error.ClerkErrorSnackbar
import com.clerk.ui.core.footer.SecuredByClerkView
import com.clerk.ui.core.spacers.Spacers
import com.clerk.ui.theme.ClerkMaterialTheme

@Composable
fun ClerkThemedProfileScaffold(
modifier: Modifier = Modifier,
errorMessage: String? = null,
hasLogo: Boolean = false,
hasBackButton: Boolean = true,
title: String? = null,
onBackPressed: () -> Unit = {},
horizontalPadding: Dp = dp18,
backgroundColor: Color? = null,
bottomContent: (@Composable () -> Unit)? = null,
clerkTheme: ClerkTheme? = null,
content: @Composable ColumnScope.() -> Unit,
modifier: Modifier = Modifier,
errorMessage: String? = null,
hasLogo: Boolean = false,
hasBackButton: Boolean = true,
title: String? = null,
onBackPressed: () -> Unit = {},
horizontalPadding: Dp = dp18,
backgroundColor: Color? = null,
bottomContent: (@Composable () -> Unit)? = null,
clerkTheme: ClerkTheme? = null,
content: @Composable ColumnScope.() -> Unit,
) {
val snackbarHostState = remember { SnackbarHostState() }
LaunchedEffect(errorMessage) {
Expand All @@ -44,32 +46,36 @@ fun ClerkThemedProfileScaffold(

ClerkMaterialTheme(clerkTheme = clerkTheme) {
Scaffold(
modifier = Modifier.then(modifier),
snackbarHost = { ClerkErrorSnackbar(snackbarHostState, clerkTheme = clerkTheme) },
topBar = {
ClerkTopAppBar(
backgroundColor = ClerkMaterialTheme.colors.background,
hasLogo = hasLogo,
hasBackButton = hasBackButton,
title = title,
onBackPressed = onBackPressed,
clerkTheme = clerkTheme,
)
},
modifier = Modifier.then(modifier),
snackbarHost = { ClerkErrorSnackbar(snackbarHostState, clerkTheme = clerkTheme) },
topBar = {
ClerkTopAppBar(
backgroundColor = ClerkMaterialTheme.colors.background,
hasLogo = hasLogo,
hasBackButton = hasBackButton,
title = title,
onBackPressed = onBackPressed,
clerkTheme = clerkTheme,
)
},
) { innerPadding ->
Column(
modifier =
Modifier.fillMaxWidth()
.fillMaxSize()
.background(backgroundColor ?: ClerkMaterialTheme.colors.background)
.padding(innerPadding),
horizontalAlignment = Alignment.CenterHorizontally,
modifier =
Modifier.fillMaxWidth()
.fillMaxSize()
.background(backgroundColor ?: ClerkMaterialTheme.colors.background)
.padding(innerPadding),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Column(modifier = Modifier.padding(horizontal = horizontalPadding)) { content() }

Spacer(modifier = Modifier.weight(1f))

bottomContent?.invoke()

Spacers.Vertical.Spacer16()
SecuredByClerkView()
Spacers.Vertical.Spacer16()
}
}
}
Expand All @@ -80,11 +86,11 @@ fun ClerkThemedProfileScaffold(
private fun Preview() {
ClerkMaterialTheme {
ClerkThemedProfileScaffold(
title = "Security",
backgroundColor = ClerkMaterialTheme.colors.muted,
content = {
/* Content goes here */
},
title = "Security",
backgroundColor = ClerkMaterialTheme.colors.muted,
content = {
/* Content goes here */
},
)
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.