refactor AppTopAppBar navigation icon to use ArrowBackIosNew and update styling properties
This commit is contained in:
@@ -10,11 +10,13 @@ import androidx.compose.foundation.layout.WindowInsets
|
|||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.ArrowBackIosNew
|
||||||
import androidx.compose.material3.CenterAlignedTopAppBar
|
import androidx.compose.material3.CenterAlignedTopAppBar
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
import androidx.compose.material3.IconButtonDefaults
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
@@ -94,17 +96,15 @@ fun AppTopAppBar(
|
|||||||
if (onNavigateBack != null) {
|
if (onNavigateBack != null) {
|
||||||
IconButton(
|
IconButton(
|
||||||
onClick = onNavigateBack,
|
onClick = onNavigateBack,
|
||||||
modifier = Modifier.padding(start = 8.dp),
|
modifier = Modifier
|
||||||
// This tells the button to paint its own circular background natively
|
.clip(CircleShape)
|
||||||
colors = IconButtonDefaults.iconButtonColors(
|
.background(MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.5f))
|
||||||
containerColor = MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.5f),
|
|
||||||
contentColor = MaterialTheme.colorScheme.primary
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = AppIcons.ArrowBack,
|
imageVector = Icons.Default.ArrowBackIosNew,
|
||||||
contentDescription = stringResource(R.string.cd_navigate_back)
|
contentDescription = "Back",
|
||||||
// Notice we removed the 'tint' here, as contentColor handles it perfectly now!
|
modifier = Modifier.size(18.dp),
|
||||||
|
tint = MaterialTheme.colorScheme.primary
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else if (navigationIcon != null) {
|
} else if (navigationIcon != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user