Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e2643df authored by Chaohui Wang's avatar Chaohui Wang
Browse files

Fix ActionButtons alignment

Let the button text to fill the remaining space and align center, to fix
the alignment issue when button text is long.

Fix: 270208342
Test: Manually with Gallery
Test: Manually with Settings
Change-Id: I3be7d3fd5b1f575a467f0ff6289fd868ab2171ff
parent ef75be39
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
@@ -46,6 +45,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.android.settingslib.spa.framework.theme.SettingsDimension
@@ -100,14 +100,19 @@ private fun RowScope.ActionButton(actionButton: ActionButton) {
                contentDescription = null,
                modifier = Modifier.size(SettingsDimension.itemIconSize),
            )
            Spacer(Modifier.height(4.dp))
            Box(
                modifier = Modifier.padding(top = 4.dp).fillMaxHeight(),
                contentAlignment = Alignment.Center,
            ) {
                Text(
                    text = actionButton.text,
                    textAlign = TextAlign.Center,
                    style = MaterialTheme.typography.labelMedium,
                )
            }
        }
    }
}

@Composable
private fun ButtonDivider() {