UI: New checked Switch color, Less padding between HistoryItem title and description. (v1.0.1)
This commit is contained in:
parent
6536064685
commit
c9ddc69588
7 changed files with 29 additions and 40 deletions
|
|
@ -72,7 +72,7 @@ fun BookInfoChangeCoverBottomSheet(
|
|||
onEvent(BookInfoEvent.OnShowHideChangeCoverBottomSheet)
|
||||
},
|
||||
sheetState = rememberModalBottomSheetState(true),
|
||||
windowInsets = WindowInsets(0, 0, 0, 0),
|
||||
contentWindowInsets = { WindowInsets(0, 0, 0, 0) },
|
||||
containerColor = MaterialTheme.colorScheme.surfaceContainerLow
|
||||
) {
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ fun BookInfoDetailsBottomSheet(
|
|||
onEvent(BookInfoEvent.OnShowHideDetailsBottomSheet)
|
||||
},
|
||||
sheetState = rememberModalBottomSheetState(true),
|
||||
windowInsets = WindowInsets(0, 0, 0, 0),
|
||||
contentWindowInsets = { WindowInsets(0, 0, 0, 0) },
|
||||
containerColor = MaterialTheme.colorScheme.surfaceContainerLow
|
||||
) {
|
||||
BookInfoDetailsBottomSheetItem(
|
||||
|
|
|
|||
|
|
@ -120,7 +120,6 @@ fun HistoryItem(
|
|||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
Spacer(modifier = Modifier.height(2.dp))
|
||||
Text(
|
||||
pattern.format(date),
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
|
|
|
|||
|
|
@ -41,10 +41,10 @@ import ua.acclorite.book_story.presentation.components.CategoryTitle
|
|||
import ua.acclorite.book_story.presentation.data.MainEvent
|
||||
import ua.acclorite.book_story.presentation.data.MainState
|
||||
import ua.acclorite.book_story.presentation.screens.reader.data.ReaderEvent
|
||||
import ua.acclorite.book_story.presentation.screens.settings.components.CheckboxWithTitle
|
||||
import ua.acclorite.book_story.presentation.screens.settings.components.ChipsWithTitle
|
||||
import ua.acclorite.book_story.presentation.screens.settings.components.ColorPickerWithTitle
|
||||
import ua.acclorite.book_story.presentation.screens.settings.components.SliderWithTitle
|
||||
import ua.acclorite.book_story.presentation.screens.settings.components.SwitchWithTitle
|
||||
|
||||
/**
|
||||
* Settings bottom sheet. Has General and Colors categories.
|
||||
|
|
@ -110,7 +110,7 @@ fun ReaderSettingsBottomSheet(
|
|||
onEvent(ReaderEvent.OnShowHideSettingsBottomSheet)
|
||||
},
|
||||
sheetState = rememberModalBottomSheetState(true),
|
||||
windowInsets = WindowInsets(0, 0, 0, 0),
|
||||
contentWindowInsets = { WindowInsets(0, 0, 0, 0) },
|
||||
containerColor = MaterialTheme.colorScheme.surfaceContainerLow
|
||||
) {
|
||||
ReaderSettingsBottomSheetTabRow(
|
||||
|
|
@ -252,7 +252,7 @@ fun ReaderSettingsBottomSheet(
|
|||
)
|
||||
}
|
||||
item {
|
||||
CheckboxWithTitle(
|
||||
SwitchWithTitle(
|
||||
selected = mainState.value.paragraphIndentation!!,
|
||||
title = stringResource(id = R.string.paragraph_indentation_option)
|
||||
) {
|
||||
|
|
@ -306,7 +306,6 @@ fun ReaderSettingsBottomSheet(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.padding
|
|||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Switch
|
||||
import androidx.compose.material3.SwitchDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
|
|
@ -19,9 +20,16 @@ import androidx.compose.ui.unit.dp
|
|||
|
||||
/**
|
||||
* Checkbox with title.
|
||||
*
|
||||
* @param selected Whether [Switch] has checked state.
|
||||
* @param title Title.
|
||||
* @param description Optional description.
|
||||
* @param horizontalPadding Horizontal padding.
|
||||
* @param verticalPadding Vertical padding.
|
||||
* @param onClick Triggers when user clicks anywhere on this composable.
|
||||
*/
|
||||
@Composable
|
||||
fun CheckboxWithTitle(
|
||||
fun SwitchWithTitle(
|
||||
selected: Boolean,
|
||||
title: String,
|
||||
description: String? = null,
|
||||
|
|
@ -36,15 +44,12 @@ fun CheckboxWithTitle(
|
|||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Column(Modifier.weight(1f), verticalArrangement = Arrangement.Center) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(
|
||||
text = title,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
style = MaterialTheme.typography.titleMedium
|
||||
)
|
||||
}
|
||||
description?.let {
|
||||
Text(
|
||||
text = it,
|
||||
|
|
@ -55,27 +60,13 @@ fun CheckboxWithTitle(
|
|||
}
|
||||
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
|
||||
Switch(
|
||||
checked = selected,
|
||||
onCheckedChange = null
|
||||
onCheckedChange = null,
|
||||
colors = SwitchDefaults.colors(
|
||||
checkedThumbColor = MaterialTheme.colorScheme.primary,
|
||||
checkedTrackColor = MaterialTheme.colorScheme.secondaryContainer,
|
||||
)
|
||||
)
|
||||
}
|
||||
//
|
||||
// Row(
|
||||
// Modifier
|
||||
// .fillMaxWidth()
|
||||
// .clickable {
|
||||
// onClick()
|
||||
// }
|
||||
// .padding(horizontal = horizontalPadding, vertical = verticalPadding),
|
||||
// verticalAlignment = Alignment.CenterVertically,
|
||||
// ) {
|
||||
// Checkbox(
|
||||
// checked = selected,
|
||||
// onCheckedChange = null,
|
||||
// )
|
||||
// Spacer(modifier = Modifier.width(24.dp))
|
||||
// CategoryTitle(title = title, padding = 0.dp)
|
||||
// }
|
||||
}
|
||||
|
|
@ -38,8 +38,8 @@ import ua.acclorite.book_story.presentation.data.MainEvent
|
|||
import ua.acclorite.book_story.presentation.data.MainState
|
||||
import ua.acclorite.book_story.presentation.data.MainViewModel
|
||||
import ua.acclorite.book_story.presentation.data.Navigator
|
||||
import ua.acclorite.book_story.presentation.screens.settings.components.CheckboxWithTitle
|
||||
import ua.acclorite.book_story.presentation.screens.settings.components.ChipsWithTitle
|
||||
import ua.acclorite.book_story.presentation.screens.settings.components.SwitchWithTitle
|
||||
import ua.acclorite.book_story.presentation.screens.settings.data.SettingsEvent
|
||||
import ua.acclorite.book_story.presentation.screens.settings.data.SettingsViewModel
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ private fun GeneralSettings(
|
|||
}
|
||||
|
||||
item {
|
||||
CheckboxWithTitle(
|
||||
SwitchWithTitle(
|
||||
selected = state.value.checkForUpdates!!,
|
||||
title = stringResource(id = R.string.check_for_updates_option),
|
||||
description = stringResource(id = R.string.check_for_updates_option_desc)
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ import ua.acclorite.book_story.presentation.data.MainEvent
|
|||
import ua.acclorite.book_story.presentation.data.MainState
|
||||
import ua.acclorite.book_story.presentation.data.MainViewModel
|
||||
import ua.acclorite.book_story.presentation.data.Navigator
|
||||
import ua.acclorite.book_story.presentation.screens.settings.components.CheckboxWithTitle
|
||||
import ua.acclorite.book_story.presentation.screens.settings.components.ChipsWithTitle
|
||||
import ua.acclorite.book_story.presentation.screens.settings.components.SliderWithTitle
|
||||
import ua.acclorite.book_story.presentation.screens.settings.components.SwitchWithTitle
|
||||
|
||||
@Composable
|
||||
fun ReaderSettingsRoot() {
|
||||
|
|
@ -227,7 +227,7 @@ private fun ReaderSettings(
|
|||
)
|
||||
}
|
||||
item {
|
||||
CheckboxWithTitle(
|
||||
SwitchWithTitle(
|
||||
selected = state.value.paragraphIndentation!!,
|
||||
title = stringResource(id = R.string.paragraph_indentation_option)
|
||||
) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue