Scaffold back arrow should be pointing right when rtl
Mirror the arrow when rtl to fix. Fix: 266190692 Test: Manually with Settings Change-Id: Ia4dffcdaebf0ff1dd794b59390bea467b92417e9
This commit is contained in:
@@ -24,7 +24,12 @@ import androidx.compose.material.icons.outlined.FindInPage
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.composed
|
||||
import androidx.compose.ui.draw.scale
|
||||
import androidx.compose.ui.platform.LocalLayoutDirection
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.LayoutDirection
|
||||
import com.android.settingslib.spa.framework.compose.LocalNavController
|
||||
|
||||
/** Action that navigates back to last page. */
|
||||
@@ -50,6 +55,7 @@ private fun BackAction(contentDescription: String, onClick: () -> Unit) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.ArrowBack,
|
||||
contentDescription = contentDescription,
|
||||
modifier = Modifier.autoMirrored(),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -75,3 +81,10 @@ internal fun ClearAction(onClick: () -> Unit) {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun Modifier.autoMirrored() = composed {
|
||||
when (LocalLayoutDirection.current) {
|
||||
LayoutDirection.Rtl -> scale(scaleX = -1f, scaleY = 1f)
|
||||
else -> this
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user