Skip to content

Commit

Permalink
Fixed UI issues in PasswordGenerator Screen
Browse files Browse the repository at this point in the history
  • Loading branch information
aritra-tech committed Mar 12, 2024
1 parent 2e782da commit 18e02c2
Showing 1 changed file with 39 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ import com.geekymusketeers.uncrack.ui.theme.BackgroundLight
import com.geekymusketeers.uncrack.ui.theme.OnPrimaryContainerLight
import com.geekymusketeers.uncrack.ui.theme.PrimaryLight
import com.geekymusketeers.uncrack.ui.theme.bold20
import com.geekymusketeers.uncrack.ui.theme.medium20
import com.geekymusketeers.uncrack.ui.theme.medium24
import com.geekymusketeers.uncrack.ui.theme.normal16

@OptIn(ExperimentalMaterial3Api::class)
@Composable
Expand Down Expand Up @@ -82,58 +83,58 @@ fun PasswordGenerator(

Text(
text = stringResource(id = R.string.password_length),
style = medium20.copy(OnPrimaryContainerLight)
style = medium24.copy(OnPrimaryContainerLight)
)

Spacer(modifier = Modifier.height(5.dp))

passwordLength?.let {
Slider(
modifier = Modifier.fillMaxWidth(),
value = it.toFloat(),
onValueChange = { password ->
passwordGeneratorViewModel.updatePasswordLength(password.toInt())
},
valueRange = 0f..32f,
colors = SliderDefaults.colors(PrimaryLight)
colors = SliderDefaults.colors(
activeTrackColor = PrimaryLight
)
)
}

Spacer(modifier = Modifier.height(20.dp))

Text(
text = stringResource(R.string.include),
style = medium20.copy(OnPrimaryContainerLight)
style = medium24.copy(OnPrimaryContainerLight)
)

Row(
modifier = Modifier
.fillMaxWidth()

SwitchItem(
label = stringResource(R.string.numbers),
checked = includeNumbers
) {
passwordGeneratorViewModel.updateIncludeNumbers(it)
}
SwitchItem(
label = stringResource(R.string.uppercase_letters),
checked = includeUppercase
) {
passwordGeneratorViewModel.updateIncludeUppercase(it)
}
SwitchItem(
label = stringResource(R.string.lowercase_letters),
checked = includeLowercase
) {
SwitchItem(
label = stringResource(R.string.numbers),
checked = includeNumbers
) {
passwordGeneratorViewModel.updateIncludeNumbers(it)
}
SwitchItem(
label = stringResource(R.string.uppercase_letters),
checked = includeUppercase
) {
passwordGeneratorViewModel.updateIncludeUppercase(it)
}
SwitchItem(
label = stringResource(R.string.lowercase_letters),
checked = includeLowercase
) {
passwordGeneratorViewModel.updateIncludeLowercase(it)
}
SwitchItem(
label = stringResource(R.string.special_symbols),
checked = includeSpecialChars
) {
passwordGeneratorViewModel.updateIncludeSpecialChars(it)
}
passwordGeneratorViewModel.updateIncludeLowercase(it)
}
SwitchItem(
label = stringResource(R.string.special_symbols),
checked = includeSpecialChars
) {
passwordGeneratorViewModel.updateIncludeSpecialChars(it)
}


Spacer(modifier = Modifier.weight(1f))

Expand Down Expand Up @@ -171,11 +172,15 @@ fun SwitchItem(
) {
Row(
modifier = modifier
.padding(vertical = 8.dp)
.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
verticalAlignment = Alignment.CenterVertically,
) {
Text(text = label, modifier = Modifier.weight(1f))
Text(
text = label,
style = normal16.copy(OnPrimaryContainerLight)
)

Spacer(modifier = Modifier.weight(1f))

Switch(
checked = checked,
Expand Down

0 comments on commit 18e02c2

Please sign in to comment.