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
val composeColors = theme.toComposeColors()
MaterialTheme(
colors = theme.toComposeColors(),
colors = composeColors,
content = content,
typography = typography(),
typography = typography(composeColors),
)
}

View File

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

View File

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

View File

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

View File

@ -209,7 +209,11 @@ private fun CloneInput(
onClose()
}
) {
Text("Cancel")
Text(
text = "Cancel",
color = MaterialTheme.colors.onBackground,
style = MaterialTheme.typography.body1,
)
}
PrimaryButton(
onClick = {
@ -275,7 +279,11 @@ private fun Cloning(cloneViewModel: CloneViewModel, cloneStatusValue: CloneStatu
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
import androidx.compose.foundation.layout.*
import androidx.compose.material.MaterialTheme
import androidx.compose.material.OutlinedTextField
import androidx.compose.material.Text
import androidx.compose.material.TextButton
import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
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.focusRequester
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 com.jetpackduba.gitnuro.keybindings.KeybindingOption
import com.jetpackduba.gitnuro.keybindings.matchesBinding
import com.jetpackduba.gitnuro.theme.outlinedTextFieldColors
import com.jetpackduba.gitnuro.theme.secondaryTextColor
import com.jetpackduba.gitnuro.theme.textButtonColors
import com.jetpackduba.gitnuro.ui.components.AdjustableOutlinedTextField
import com.jetpackduba.gitnuro.ui.components.PrimaryButton
@Composable
@ -33,7 +34,33 @@ fun NewBranchDialog(
horizontalAlignment = Alignment.CenterHorizontally,
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
.focusRequester(branchFieldFocusRequester)
.focusProperties {
@ -49,15 +76,7 @@ fun NewBranchDialog(
}
},
value = branchField,
singleLine = true,
label = {
Text(
"New branch name",
style = MaterialTheme.typography.body1.copy(MaterialTheme.colors.primaryVariant),
)
},
textStyle = MaterialTheme.typography.body1,
colors = outlinedTextFieldColors(),
maxLines = 1,
onValueChange = {
branchField = it
},
@ -74,7 +93,11 @@ fun NewBranchDialog(
onReject()
}
) {
Text("Cancel")
Text(
text = "Cancel",
color = MaterialTheme.colors.onBackground,
style = MaterialTheme.typography.body1,
)
}
PrimaryButton(
modifier = Modifier

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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