mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
Simplifying Cell and leaving responsibility to modifier and content
This commit is contained in:
parent
356b105b98
commit
b2c73ff7a2
@ -193,11 +193,11 @@ fun CellMetadata(
|
||||
) {
|
||||
state.apply {
|
||||
if (listOfNotNull(sent, received, error, senderInfo).isEmpty()) return
|
||||
Cell(
|
||||
margin = PaddingValues(horizontal = LocalDimensions.current.spacing),
|
||||
padding = PaddingValues(all = LocalDimensions.current.spacing)
|
||||
Cell(modifier = Modifier.padding(horizontal = LocalDimensions.current.spacing)) {
|
||||
Column(
|
||||
modifier = Modifier.padding(LocalDimensions.current.spacing),
|
||||
verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.smallSpacing)
|
||||
) {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.smallSpacing)) {
|
||||
TitledText(sent)
|
||||
TitledText(received)
|
||||
TitledErrorText(error)
|
||||
@ -220,7 +220,7 @@ fun CellButtons(
|
||||
onResend: (() -> Unit)? = null,
|
||||
onDelete: () -> Unit = {},
|
||||
) {
|
||||
Cell(margin = PaddingValues(horizontal = LocalDimensions.current.spacing)) {
|
||||
Cell(modifier = Modifier.padding(horizontal = LocalDimensions.current.spacing)) {
|
||||
Column {
|
||||
onReply?.let {
|
||||
LargeItemButton(
|
||||
@ -375,7 +375,7 @@ fun PreviewMessageDetails(
|
||||
fun FileDetails(fileDetails: List<TitledText>) {
|
||||
if (fileDetails.isEmpty()) return
|
||||
|
||||
Cell(margin = PaddingValues(horizontal = LocalDimensions.current.spacing)) {
|
||||
Cell(modifier = Modifier.padding(horizontal = LocalDimensions.current.spacing)) {
|
||||
FlowRow(
|
||||
modifier = Modifier.padding(horizontal = LocalDimensions.current.xsSpacing, vertical = LocalDimensions.current.spacing),
|
||||
verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.smallSpacing)
|
||||
|
@ -71,10 +71,10 @@ private fun RecoveryPasswordCell(
|
||||
mutableStateOf(false)
|
||||
}
|
||||
|
||||
Cell(
|
||||
padding = PaddingValues(all = LocalDimensions.current.smallSpacing)
|
||||
Cell {
|
||||
Column(
|
||||
modifier = Modifier.padding(LocalDimensions.current.smallSpacing)
|
||||
) {
|
||||
Column {
|
||||
Row {
|
||||
Text(
|
||||
stringResource(R.string.sessionRecoveryPassword),
|
||||
@ -152,10 +152,10 @@ private fun RecoveryPassword(mnemonic: String) {
|
||||
|
||||
@Composable
|
||||
private fun HideRecoveryPasswordCell(onHide: () -> Unit = {}) {
|
||||
Cell(
|
||||
padding = PaddingValues(all = LocalDimensions.current.smallSpacing)
|
||||
Cell {
|
||||
Row(
|
||||
modifier = Modifier.padding(LocalDimensions.current.smallSpacing)
|
||||
) {
|
||||
Row {
|
||||
Column(
|
||||
Modifier.weight(1f)
|
||||
) {
|
||||
|
@ -259,19 +259,15 @@ fun PrewviewItemButton() {
|
||||
@Composable
|
||||
fun Cell(
|
||||
modifier: Modifier = Modifier,
|
||||
padding: PaddingValues = PaddingValues(all = 0.dp),
|
||||
margin: PaddingValues = PaddingValues(all = 0.dp),
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.padding(margin)
|
||||
.background(
|
||||
color = LocalColors.current.backgroundSecondary,
|
||||
shape = MaterialTheme.shapes.small
|
||||
)
|
||||
.wrapContentHeight()
|
||||
.padding(padding)
|
||||
.fillMaxWidth(),
|
||||
) {
|
||||
content()
|
||||
|
Loading…
Reference in New Issue
Block a user