-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e322527
commit e3ee079
Showing
1 changed file
with
69 additions
and
0 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
...kotlin/com/makeevrserg/empireprojekt/mobile/core/ui/components/topbar/AstraLargeAppBar.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.makeevrserg.empireprojekt.mobile.core.ui.components.topbar | ||
|
||
import androidx.compose.foundation.layout.RowScope | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.ChevronLeft | ||
import androidx.compose.material3.CenterAlignedTopAppBar | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.IconButton | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.TopAppBarDefaults | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.text.style.TextOverflow | ||
import androidx.compose.ui.unit.dp | ||
import com.makeevrserg.empireprojekt.mobile.core.ui.theme.AppTheme | ||
|
||
@Composable | ||
fun AstraCenterAlignedTopAppBar( | ||
title: String = "", | ||
onBackClicked: (() -> Unit)? = null, | ||
actions: @Composable RowScope.() -> Unit = {} | ||
) { | ||
AstraCenterAlignedTopAppBar( | ||
onBackClicked = onBackClicked, | ||
actions = actions, | ||
title = { | ||
Text( | ||
text = title, | ||
style = AppTheme.typography.body1, | ||
color = AppTheme.materialColor.onPrimary, | ||
textAlign = TextAlign.Center, | ||
overflow = TextOverflow.Ellipsis, | ||
maxLines = 1, | ||
) | ||
}, | ||
) | ||
} | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun AstraCenterAlignedTopAppBar( | ||
title: @Composable () -> Unit, | ||
onBackClicked: (() -> Unit)? = null, | ||
actions: @Composable RowScope.() -> Unit = {} | ||
) { | ||
CenterAlignedTopAppBar( | ||
actions = actions, | ||
colors = TopAppBarDefaults.centerAlignedTopAppBarColors( | ||
containerColor = Color.Transparent, | ||
), | ||
title = title, | ||
navigationIcon = { | ||
onBackClicked?.let { | ||
IconButton(onClick = it) { | ||
Icon( | ||
imageVector = Icons.Default.ChevronLeft, | ||
contentDescription = null, | ||
tint = AppTheme.materialColor.onPrimary, | ||
modifier = Modifier.size(24.dp) | ||
) | ||
} | ||
} | ||
} | ||
) | ||
} |