Fix QR offscreen not scrollable w/Thomas' code

This commit is contained in:
Andrew 2024-06-15 14:08:20 +09:30
parent 2f9dbe27c8
commit bd679b0889

View File

@ -6,13 +6,19 @@ import android.view.View
import android.view.ViewGroup
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.rememberNestedScrollInteropConnection
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
@ -88,6 +94,27 @@ fun NewConversationScreen(
) {
Column(modifier = Modifier.background(LocalColors.current.backgroundSecondary)) {
AppBar(stringResource(R.string.dialog_new_conversation_title), onClose = delegate::onDialogClosePressed)
Surface(
modifier = Modifier.nestedScroll(rememberNestedScrollInteropConnection())
) {
Column(
modifier = Modifier.verticalScroll(rememberScrollState())
) {
Items(accountId, delegate)
}
}
}
}
/**
* Items of the NewConversationHome screen. Use in a [Column]
*/
@Suppress("UnusedReceiverParameter")
@Composable
fun ColumnScope.Items(
accountId: String,
delegate: NewConversationDelegate
) {
ItemButton(textId = R.string.messageNew, icon = R.drawable.ic_message, onClick = delegate::onNewMessageSelected)
Divider(startIndent = LocalDimensions.current.dividerIndent)
ItemButton(textId = R.string.activity_create_group_title, icon = R.drawable.ic_group, onClick = delegate::onCreateGroupSelected)
@ -100,10 +127,7 @@ fun NewConversationScreen(
.padding(horizontal = LocalDimensions.current.marginMedium)
.padding(top = LocalDimensions.current.itemSpacingMedium)
) {
Text(
text = stringResource(R.string.accountIdYours),
style = xl
)
Text(stringResource(R.string.accountIdYours), style = xl)
Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingTiny))
Text(
text = stringResource(R.string.qrYoursDescription),
@ -113,5 +137,4 @@ fun NewConversationScreen(
Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingSmall))
QrImage(string = accountId, Modifier.contentDescription(R.string.AccessibilityId_qr_code))
}
}
}