Added new branch dialog design & fixed fonts colors

This commit is contained in:
Abdelilah El Aissaoui 2022-10-06 22:09:35 +02:00
parent 76b3526aed
commit 9971e410db
13 changed files with 100 additions and 35 deletions

View File

@ -25,11 +25,11 @@ fun AppTheme(
} }
appTheme = theme appTheme = theme
val composeColors = theme.toComposeColors()
MaterialTheme( MaterialTheme(
colors = theme.toComposeColors(), colors = composeColors,
content = content, content = content,
typography = typography(), typography = typography(composeColors),
) )
} }

View File

@ -1,5 +1,6 @@
package com.jetpackduba.gitnuro.theme package com.jetpackduba.gitnuro.theme
import androidx.compose.material.Colors
import androidx.compose.material.MaterialTheme import androidx.compose.material.MaterialTheme
import androidx.compose.material.Typography import androidx.compose.material.Typography
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
@ -25,42 +26,42 @@ val openSansFontFamily = FontFamily(
const val LETTER_SPACING = 0.5 const val LETTER_SPACING = 0.5
@Composable @Composable
fun typography() = Typography( fun typography(composeColors: Colors) = Typography(
defaultFontFamily = openSansFontFamily, defaultFontFamily = openSansFontFamily,
h1 = TextStyle( h1 = TextStyle(
fontSize = 32.sp, fontSize = 32.sp,
color = MaterialTheme.colors.onBackground, color = composeColors.onBackground,
letterSpacing = LETTER_SPACING.sp, letterSpacing = LETTER_SPACING.sp,
), ),
h2 = TextStyle( h2 = TextStyle(
fontSize = 24.sp, fontSize = 24.sp,
color = MaterialTheme.colors.onBackground, color = composeColors.onBackground,
letterSpacing = LETTER_SPACING.sp, letterSpacing = LETTER_SPACING.sp,
), ),
h3 = TextStyle( h3 = TextStyle(
fontSize = 20.sp, fontSize = 20.sp,
color = MaterialTheme.colors.onBackground, color = composeColors.onBackground,
letterSpacing = LETTER_SPACING.sp, letterSpacing = LETTER_SPACING.sp,
), ),
h4 = TextStyle( h4 = TextStyle(
fontSize = 17.sp, fontSize = 17.sp,
color = MaterialTheme.colors.onBackground, color = composeColors.onBackground,
letterSpacing = LETTER_SPACING.sp, letterSpacing = LETTER_SPACING.sp,
), ),
body1 = TextStyle( body1 = TextStyle(
fontSize = 15.sp, fontSize = 15.sp,
color = MaterialTheme.colors.onBackground, color = composeColors.onBackground,
letterSpacing = LETTER_SPACING.sp, letterSpacing = LETTER_SPACING.sp,
), ),
body2 = TextStyle( body2 = TextStyle(
fontSize = 13.sp, fontSize = 13.sp,
color = MaterialTheme.colors.onBackground, color = composeColors.onBackground,
fontWeight = FontWeight.Normal, fontWeight = FontWeight.Normal,
letterSpacing = LETTER_SPACING.sp, letterSpacing = LETTER_SPACING.sp,
), ),
caption = TextStyle( caption = TextStyle(
fontSize = 11.sp, fontSize = 11.sp,
color = MaterialTheme.colors.onBackground, color = composeColors.onBackground,
letterSpacing = LETTER_SPACING.sp, letterSpacing = LETTER_SPACING.sp,
) )
) )

View File

@ -91,7 +91,11 @@ fun RebaseStateLoaded(
}, },
colors = textButtonColors(), colors = textButtonColors(),
) { ) {
Text("Cancel") Text(
text = "Cancel",
color = MaterialTheme.colors.onBackground,
style = MaterialTheme.typography.body1,
)
} }
PrimaryButton( PrimaryButton(
modifier = Modifier.padding(end = 16.dp), modifier = Modifier.padding(end = 16.dp),

View File

@ -110,7 +110,11 @@ fun AuthorDialog(
onClose() onClose()
} }
) { ) {
Text("Cancel") Text(
text = "Cancel",
color = MaterialTheme.colors.onBackground,
style = MaterialTheme.typography.body1,
)
} }
PrimaryButton( PrimaryButton(
onClick = { onClick = {

View File

@ -209,7 +209,11 @@ private fun CloneInput(
onClose() onClose()
} }
) { ) {
Text("Cancel") Text(
text = "Cancel",
color = MaterialTheme.colors.onBackground,
style = MaterialTheme.typography.body1,
)
} }
PrimaryButton( PrimaryButton(
onClick = { onClick = {
@ -275,7 +279,11 @@ private fun Cloning(cloneViewModel: CloneViewModel, cloneStatusValue: CloneStatu
cloneViewModel.cancelClone() cloneViewModel.cancelClone()
} }
) { ) {
Text("Cancel") Text(
text = "Cancel",
color = MaterialTheme.colors.onBackground,
style = MaterialTheme.typography.body1,
)
} }
} }
} }

View File

@ -1,10 +1,7 @@
package com.jetpackduba.gitnuro.ui.dialogs package com.jetpackduba.gitnuro.ui.dialogs
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.material.MaterialTheme import androidx.compose.material.*
import androidx.compose.material.OutlinedTextField
import androidx.compose.material.Text
import androidx.compose.material.TextButton
import androidx.compose.runtime.* import androidx.compose.runtime.*
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
@ -12,11 +9,15 @@ import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusProperties import androidx.compose.ui.focus.focusProperties
import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.input.key.onPreviewKeyEvent import androidx.compose.ui.input.key.onPreviewKeyEvent
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.jetpackduba.gitnuro.keybindings.KeybindingOption import com.jetpackduba.gitnuro.keybindings.KeybindingOption
import com.jetpackduba.gitnuro.keybindings.matchesBinding import com.jetpackduba.gitnuro.keybindings.matchesBinding
import com.jetpackduba.gitnuro.theme.outlinedTextFieldColors import com.jetpackduba.gitnuro.theme.outlinedTextFieldColors
import com.jetpackduba.gitnuro.theme.secondaryTextColor
import com.jetpackduba.gitnuro.theme.textButtonColors import com.jetpackduba.gitnuro.theme.textButtonColors
import com.jetpackduba.gitnuro.ui.components.AdjustableOutlinedTextField
import com.jetpackduba.gitnuro.ui.components.PrimaryButton import com.jetpackduba.gitnuro.ui.components.PrimaryButton
@Composable @Composable
@ -33,7 +34,33 @@ fun NewBranchDialog(
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center, verticalArrangement = Arrangement.Center,
) { ) {
OutlinedTextField( Icon(
painterResource("branch.svg"),
contentDescription = null,
modifier = Modifier
.size(64.dp)
.padding(vertical = 16.dp),
tint = MaterialTheme.colors.onBackground,
)
Text(
text = "Set branch name",
modifier = Modifier
.padding(bottom = 8.dp),
color = MaterialTheme.colors.onBackground,
style = MaterialTheme.typography.body1,
)
Text(
text = "Create a new branch and check it out",
modifier = Modifier
.padding(bottom = 16.dp),
color = MaterialTheme.colors.secondaryTextColor,
style = MaterialTheme.typography.body2,
textAlign = TextAlign.Center,
)
AdjustableOutlinedTextField(
modifier = Modifier modifier = Modifier
.focusRequester(branchFieldFocusRequester) .focusRequester(branchFieldFocusRequester)
.focusProperties { .focusProperties {
@ -49,15 +76,7 @@ fun NewBranchDialog(
} }
}, },
value = branchField, value = branchField,
singleLine = true, maxLines = 1,
label = {
Text(
"New branch name",
style = MaterialTheme.typography.body1.copy(MaterialTheme.colors.primaryVariant),
)
},
textStyle = MaterialTheme.typography.body1,
colors = outlinedTextFieldColors(),
onValueChange = { onValueChange = {
branchField = it branchField = it
}, },
@ -74,7 +93,11 @@ fun NewBranchDialog(
onReject() onReject()
} }
) { ) {
Text("Cancel") Text(
text = "Cancel",
color = MaterialTheme.colors.onBackground,
style = MaterialTheme.typography.body1,
)
} }
PrimaryButton( PrimaryButton(
modifier = Modifier modifier = Modifier

View File

@ -77,7 +77,11 @@ fun NewTagDialog(
onReject() onReject()
} }
) { ) {
Text("Cancel") Text(
text = "Cancel",
color = MaterialTheme.colors.onBackground,
style = MaterialTheme.typography.body1,
)
} }
PrimaryButton( PrimaryButton(
modifier = Modifier modifier = Modifier

View File

@ -98,7 +98,11 @@ fun PasswordDialog(
onReject() onReject()
} }
) { ) {
Text("Cancel") Text(
text = "Cancel",
color = MaterialTheme.colors.onBackground,
style = MaterialTheme.typography.body1,
)
} }
PrimaryButton( PrimaryButton(
modifier = Modifier modifier = Modifier

View File

@ -64,7 +64,11 @@ fun ResetBranchDialog(
onReject() onReject()
} }
) { ) {
Text("Cancel") Text(
text = "Cancel",
color = MaterialTheme.colors.onBackground,
style = MaterialTheme.typography.body1,
)
} }
PrimaryButton( PrimaryButton(
onClick = { onClick = {

View File

@ -76,7 +76,11 @@ fun StashWithMessageDialog(
onReject() onReject()
} }
) { ) {
Text("Cancel") Text(
text = "Cancel",
color = MaterialTheme.colors.onBackground,
style = MaterialTheme.typography.body1,
)
} }
PrimaryButton( PrimaryButton(
modifier = Modifier modifier = Modifier

View File

@ -127,7 +127,11 @@ fun UserPasswordDialog(
onReject() onReject()
} }
) { ) {
Text("Cancel") Text(
text = "Cancel",
color = MaterialTheme.colors.onBackground,
style = MaterialTheme.typography.body1,
)
} }
PrimaryButton( PrimaryButton(
modifier = Modifier modifier = Modifier

View File

@ -576,6 +576,7 @@ private fun DiffHeader(
Text( Text(
text = filePath, text = filePath,
style = MaterialTheme.typography.body2, style = MaterialTheme.typography.body2,
color = MaterialTheme.colors.onBackground,
maxLines = 1, maxLines = 1,
modifier = Modifier.padding(horizontal = 16.dp), modifier = Modifier.padding(horizontal = 16.dp),
) )
@ -692,6 +693,7 @@ private fun PathOnlyDiffHeader(
Text( Text(
text = filePath, text = filePath,
style = MaterialTheme.typography.body2, style = MaterialTheme.typography.body2,
color = MaterialTheme.colors.onBackground,
maxLines = 1, maxLines = 1,
modifier = Modifier.padding(horizontal = 16.dp), modifier = Modifier.padding(horizontal = 16.dp),
) )
@ -794,6 +796,7 @@ fun DiffLineText(text: String) {
.fillMaxSize(), .fillMaxSize(),
fontFamily = FontFamily.Monospace, fontFamily = FontFamily.Monospace,
style = MaterialTheme.typography.body2, style = MaterialTheme.typography.body2,
color = MaterialTheme.colors.onBackground,
overflow = TextOverflow.Visible, overflow = TextOverflow.Visible,
) )
@ -806,6 +809,7 @@ fun DiffLineText(text: String) {
Text( Text(
text = lineDelimiter, text = lineDelimiter,
maxLines = 1, maxLines = 1,
color = MaterialTheme.colors.onBackground,
) )
} }

View File

@ -701,6 +701,7 @@ fun SummaryEntry(
Text( Text(
text = count.toString(), text = count.toString(),
style = MaterialTheme.typography.body2, style = MaterialTheme.typography.body2,
color = MaterialTheme.colors.onBackground,
) )
Icon( Icon(