fix: 编辑样式
This commit is contained in:
@@ -7,12 +7,6 @@ import androidx.compose.foundation.layout.Spacer
|
|||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material3.Checkbox
|
|
||||||
import androidx.compose.material3.CircularProgressIndicator
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.material3.OutlinedTextField
|
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.material3.TextButton
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
@@ -23,7 +17,13 @@ import androidx.compose.ui.unit.dp
|
|||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
import io.legado.app.ui.book.read.ReadBookIntent
|
import io.legado.app.ui.book.read.ReadBookIntent
|
||||||
import io.legado.app.ui.book.read.ReadBookUiState
|
import io.legado.app.ui.book.read.ReadBookUiState
|
||||||
|
import io.legado.app.ui.theme.LegadoTheme
|
||||||
|
import io.legado.app.ui.widget.components.AppTextField
|
||||||
|
import io.legado.app.ui.widget.components.button.series.SmallTonalButton
|
||||||
|
import io.legado.app.ui.widget.components.checkBox.AppCheckbox
|
||||||
import io.legado.app.ui.widget.components.modalBottomSheet.AppModalBottomSheet
|
import io.legado.app.ui.widget.components.modalBottomSheet.AppModalBottomSheet
|
||||||
|
import io.legado.app.ui.widget.components.progressIndicator.AppCircularProgressIndicator
|
||||||
|
import io.legado.app.ui.widget.components.text.AppText
|
||||||
import io.legado.app.utils.sendToClip
|
import io.legado.app.utils.sendToClip
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -56,22 +56,29 @@ fun ContentEditSheet(
|
|||||||
.padding(bottom = 16.dp),
|
.padding(bottom = 16.dp),
|
||||||
) {
|
) {
|
||||||
Row(modifier = Modifier.fillMaxWidth()) {
|
Row(modifier = Modifier.fillMaxWidth()) {
|
||||||
TextButton(onClick = {
|
SmallTonalButton(
|
||||||
onIntent(ReadBookIntent.SaveContentEdit(state.contentEditText, state.contentEditSaveToSource))
|
onClick = {
|
||||||
onDismissRequest()
|
onIntent(
|
||||||
}) {
|
ReadBookIntent.SaveContentEdit(
|
||||||
Text(stringResource(R.string.action_save))
|
state.contentEditText,
|
||||||
}
|
state.contentEditSaveToSource
|
||||||
TextButton(onClick = {
|
)
|
||||||
|
)
|
||||||
|
onDismissRequest()
|
||||||
|
},
|
||||||
|
text = stringResource(R.string.action_save)
|
||||||
|
)
|
||||||
|
SmallTonalButton(
|
||||||
|
onClick = {
|
||||||
onIntent(ReadBookIntent.ResetContentEdit)
|
onIntent(ReadBookIntent.ResetContentEdit)
|
||||||
}) {
|
},
|
||||||
Text(stringResource(R.string.reset))
|
text = stringResource(R.string.reset)
|
||||||
}
|
)
|
||||||
TextButton(onClick = {
|
SmallTonalButton(
|
||||||
|
onClick = {
|
||||||
context.sendToClip("${state.contentEditTitle}\n${state.contentEditText}")
|
context.sendToClip("${state.contentEditTitle}\n${state.contentEditText}")
|
||||||
}) {
|
}, text = stringResource(R.string.copy_all)
|
||||||
Text(stringResource(R.string.copy_all))
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(Modifier.height(8.dp))
|
Spacer(Modifier.height(8.dp))
|
||||||
@@ -83,30 +90,29 @@ fun ContentEditSheet(
|
|||||||
.height(200.dp),
|
.height(200.dp),
|
||||||
contentAlignment = Alignment.Center,
|
contentAlignment = Alignment.Center,
|
||||||
) {
|
) {
|
||||||
CircularProgressIndicator()
|
AppCircularProgressIndicator()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
OutlinedTextField(
|
AppTextField(
|
||||||
value = state.contentEditText,
|
value = state.contentEditText,
|
||||||
onValueChange = { onIntent(ReadBookIntent.SetContentEditText(it)) },
|
onValueChange = { onIntent(ReadBookIntent.SetContentEditText(it)) },
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.weight(1f, fill = false)
|
.weight(1f, fill = false)
|
||||||
.height(400.dp),
|
.height(400.dp),
|
||||||
textStyle = MaterialTheme.typography.bodyMedium,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.contentEditIsLocalTxt) {
|
if (state.contentEditIsLocalTxt) {
|
||||||
Spacer(Modifier.height(8.dp))
|
Spacer(Modifier.height(8.dp))
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
Checkbox(
|
AppCheckbox(
|
||||||
checked = state.contentEditSaveToSource,
|
checked = state.contentEditSaveToSource,
|
||||||
onCheckedChange = { onIntent(ReadBookIntent.SetContentEditSaveToSource(it)) },
|
onCheckedChange = { onIntent(ReadBookIntent.SetContentEditSaveToSource(it)) },
|
||||||
)
|
)
|
||||||
Text(
|
AppText(
|
||||||
text = stringResource(R.string.save_to_source),
|
text = stringResource(R.string.save_to_source),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = LegadoTheme.typography.bodyMedium,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user