[#914] Rectangle shapes

This commit is contained in:
Honza Rychnovský 2023-08-04 13:01:16 +02:00 committed by GitHub
parent 3c751a5893
commit 01b24f47ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 24 deletions

View File

@ -11,6 +11,7 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
@ -42,6 +43,7 @@ fun PrimaryButton(
enabled: Boolean = true
) {
Button(
shape = RectangleShape,
onClick = onClick,
modifier = modifier.then(
Modifier
@ -71,6 +73,7 @@ fun SecondaryButton(
enabled: Boolean = true
) {
Button(
shape = RectangleShape,
onClick = onClick,
modifier = modifier.then(
Modifier
@ -99,6 +102,7 @@ fun NavigationButton(
),
) {
Button(
shape = RectangleShape,
onClick = onClick,
modifier = modifier.then(
Modifier
@ -122,6 +126,7 @@ fun TertiaryButton(
enabled: Boolean = true
) {
Button(
shape = RectangleShape,
onClick = onClick,
modifier = modifier.then(
Modifier
@ -151,6 +156,7 @@ fun DangerousButton(
),
) {
Button(
shape = RectangleShape,
onClick = onClick,
modifier = modifier.then(
Modifier

View File

@ -4,13 +4,13 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
@ -32,8 +32,8 @@ fun Chip(
modifier: Modifier = Modifier
) {
Surface(
shape = RectangleShape,
modifier = modifier.then(Modifier.padding(4.dp)),
shape = RoundedCornerShape(8.dp),
color = MaterialTheme.colorScheme.secondary,
shadowElevation = 8.dp
) {
@ -65,8 +65,8 @@ fun Chip(
modifier: Modifier = Modifier
) {
Surface(
shape = RectangleShape,
modifier = modifier.padding(4.dp),
shape = RoundedCornerShape(8.dp),
color = MaterialTheme.colorScheme.secondary,
shadowElevation = 8.dp
) {

View File

@ -2,7 +2,6 @@ package co.electriccoin.zcash.ui.design.component
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.TextField
import androidx.compose.material3.TextFieldColors
import androidx.compose.material3.TextFieldDefaults
@ -13,7 +12,6 @@ import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.text.input.KeyboardType
@Suppress("LongParameterList")
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun FormTextField(
value: String,

View File

@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowDropDown
import androidx.compose.material3.DropdownMenu
@ -25,6 +24,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.unit.dp
import co.electriccoin.zcash.spackle.model.Index
@ -55,7 +55,7 @@ fun ChipDropDown(
.padding(4.dp)
.clickable { expanded = !expanded }
),
shape = RoundedCornerShape(8.dp),
shape = RectangleShape,
color = MaterialTheme.colorScheme.secondary,
contentColor = MaterialTheme.colorScheme.secondary,
tonalElevation = 8.dp,

View File

@ -46,6 +46,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
@ -393,9 +394,7 @@ private fun ChipGridWithText(
}
}
// TODO [#288]: TextField component can't do long-press backspace.
@Composable
@OptIn(ExperimentalMaterial3Api::class)
private fun NextWordTextField(
parseResult: ParseResult,
text: String,
@ -406,7 +405,7 @@ private fun NextWordTextField(
modifier = modifier
.fillMaxWidth()
.padding(dimens.spacingTiny),
shape = RoundedCornerShape(8.dp),
shape = RectangleShape,
color = MaterialTheme.colorScheme.secondary,
shadowElevation = 8.dp
) {
@ -500,7 +499,7 @@ private fun Warn(
if (parseResult is ParseResult.Warn) {
Surface(
modifier = modifier,
shape = RoundedCornerShape(8.dp),
shape = RectangleShape,
color = MaterialTheme.colorScheme.secondary,
shadowElevation = 4.dp
) {
@ -564,7 +563,7 @@ private fun RestoreBirthday(
keyboardType = KeyboardType.Number
),
keyboardActions = KeyboardActions(onAny = {}),
shape = RoundedCornerShape(8.dp),
shape = RectangleShape,
)
Spacer(

View File

@ -12,7 +12,6 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.Send
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.FloatingActionButton
import androidx.compose.material3.Icon
@ -26,12 +25,14 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import co.electriccoin.zcash.ui.R
import co.electriccoin.zcash.ui.design.component.Body
import co.electriccoin.zcash.ui.design.component.FormTextField
import co.electriccoin.zcash.ui.design.component.GradientSurface
import co.electriccoin.zcash.ui.design.component.NavigationButton
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
@Preview("Support")
@ -48,6 +49,19 @@ private fun PreviewSupport() {
}
}
@Preview("Support-Popup")
@Composable
private fun PreviewSupportPopup() {
ZcashTheme(darkTheme = true) {
GradientSurface {
SupportConfirmationDialog(
onConfirm = {},
onDismiss = {}
)
}
}
}
@Composable
fun Support(
snackbarHostState: SnackbarHostState,
@ -63,7 +77,10 @@ fun Support(
},
snackbarHost = { SnackbarHost(snackbarHostState) },
floatingActionButton = {
FloatingActionButton(onClick = { setShowDialog(true) }) {
FloatingActionButton(
shape = RectangleShape,
onClick = { setShowDialog(true) }
) {
Icon(
imageVector = Icons.Filled.Send,
contentDescription = stringResource(id = R.string.support_send)
@ -147,22 +164,21 @@ private fun SupportConfirmationDialog(
onDismiss: () -> Unit
) {
AlertDialog(
shape = RectangleShape,
onDismissRequest = onDismiss,
title = {
},
confirmButton = {
Button(
onClick = onConfirm
) {
Text(stringResource(id = R.string.support_confirmation_dialog_ok))
}
NavigationButton(
onClick = onConfirm,
text = stringResource(id = R.string.support_confirmation_dialog_ok)
)
},
dismissButton = {
Button(
onClick = onDismiss
) {
Text(stringResource(id = R.string.support_confirmation_dialog_cancel))
}
NavigationButton(
onClick = onDismiss,
text = stringResource(id = R.string.support_confirmation_dialog_cancel)
)
},
text = {
Text(stringResource(id = R.string.support_confirmation_explanation, stringResource(id = R.string.app_name)))