From dffd0db65325d2a4d0ae6a5a8d95a11acd4f1395 Mon Sep 17 00:00:00 2001 From: Diego Beraldin Date: Sun, 17 Sep 2023 20:05:40 +0200 Subject: [PATCH] fix(common-ui): position of title in create post and comment sheets --- .../createcomment/CreateCommentScreen.kt | 50 +++++++++--------- .../commonui/createpost/CreatePostScreen.kt | 51 ++++++++++--------- 2 files changed, 55 insertions(+), 46 deletions(-) diff --git a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createcomment/CreateCommentScreen.kt b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createcomment/CreateCommentScreen.kt index 63b7e0bd7..fa94a0665 100644 --- a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createcomment/CreateCommentScreen.kt +++ b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createcomment/CreateCommentScreen.kt @@ -4,6 +4,7 @@ import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height @@ -100,31 +101,34 @@ class CreateCommentScreen( topBar = { TopAppBar( title = { - Column( - modifier = Modifier.fillMaxWidth().padding(top = Spacing.s), - verticalArrangement = Arrangement.spacedBy(Spacing.s), - horizontalAlignment = Alignment.CenterHorizontally - ) { - BottomSheetHandle() - Text( - text = stringResource(MR.strings.create_comment_title), - style = MaterialTheme.typography.titleLarge, - color = MaterialTheme.colorScheme.onBackground, - ) - } - }, - actions = { - IconButton( - content = { - Icon( - imageVector = Icons.Default.Send, - contentDescription = null, + Box { + Column( + modifier = Modifier.fillMaxWidth().padding(top = Spacing.s), + verticalArrangement = Arrangement.spacedBy(Spacing.s), + horizontalAlignment = Alignment.CenterHorizontally + ) { + BottomSheetHandle() + Text( + text = stringResource(MR.strings.create_comment_title), + style = MaterialTheme.typography.titleLarge, + color = MaterialTheme.colorScheme.onBackground, ) - }, - onClick = { - model.reduce(CreateCommentMviModel.Intent.Send) } - ) + Row { + Spacer(modifier = Modifier.weight(1f)) + IconButton( + content = { + Icon( + imageVector = Icons.Default.Send, + contentDescription = null, + ) + }, + onClick = { + model.reduce(CreateCommentMviModel.Intent.Send) + } + ) + } + } }, ) }, diff --git a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createpost/CreatePostScreen.kt b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createpost/CreatePostScreen.kt index a90d29dba..0fec080ba 100644 --- a/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createpost/CreatePostScreen.kt +++ b/core-commonui/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/commonui/createpost/CreatePostScreen.kt @@ -1,7 +1,9 @@ package com.github.diegoberaldin.raccoonforlemmy.core.commonui.createpost import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height @@ -84,31 +86,34 @@ class CreatePostScreen( topBar = { TopAppBar( title = { - Column( - modifier = Modifier.fillMaxWidth().padding(top = Spacing.s), - verticalArrangement = Arrangement.spacedBy(Spacing.s), - horizontalAlignment = Alignment.CenterHorizontally - ) { - BottomSheetHandle() - Text( - text = stringResource(MR.strings.create_post_title), - style = MaterialTheme.typography.titleLarge, - color = MaterialTheme.colorScheme.onBackground, - ) - } - }, - actions = { - IconButton( - content = { - Icon( - imageVector = Icons.Default.Send, - contentDescription = null, + Box { + Column( + modifier = Modifier.fillMaxWidth().padding(top = Spacing.s), + verticalArrangement = Arrangement.spacedBy(Spacing.s), + horizontalAlignment = Alignment.CenterHorizontally + ) { + BottomSheetHandle() + Text( + text = stringResource(MR.strings.create_post_title), + style = MaterialTheme.typography.titleLarge, + color = MaterialTheme.colorScheme.onBackground, ) - }, - onClick = { - model.reduce(CreatePostMviModel.Intent.Send) } - ) + Row { + Spacer(modifier = Modifier.weight(1f)) + IconButton( + content = { + Icon( + imageVector = Icons.Default.Send, + contentDescription = null, + ) + }, + onClick = { + model.reduce(CreatePostMviModel.Intent.Send) + } + ) + } + } }, ) },