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 android.view.ViewGroup
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
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.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.Surface
import androidx.compose.material.Text import androidx.compose.material.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState import androidx.compose.runtime.collectAsState
import androidx.compose.ui.Modifier 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.res.stringResource
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.tooling.preview.PreviewParameter
@ -88,6 +94,27 @@ fun NewConversationScreen(
) { ) {
Column(modifier = Modifier.background(LocalColors.current.backgroundSecondary)) { Column(modifier = Modifier.background(LocalColors.current.backgroundSecondary)) {
AppBar(stringResource(R.string.dialog_new_conversation_title), onClose = delegate::onDialogClosePressed) 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) ItemButton(textId = R.string.messageNew, icon = R.drawable.ic_message, onClick = delegate::onNewMessageSelected)
Divider(startIndent = LocalDimensions.current.dividerIndent) Divider(startIndent = LocalDimensions.current.dividerIndent)
ItemButton(textId = R.string.activity_create_group_title, icon = R.drawable.ic_group, onClick = delegate::onCreateGroupSelected) 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(horizontal = LocalDimensions.current.marginMedium)
.padding(top = LocalDimensions.current.itemSpacingMedium) .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)) Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingTiny))
Text( Text(
text = stringResource(R.string.qrYoursDescription), text = stringResource(R.string.qrYoursDescription),
@ -114,4 +138,3 @@ fun NewConversationScreen(
QrImage(string = accountId, Modifier.contentDescription(R.string.AccessibilityId_qr_code)) QrImage(string = accountId, Modifier.contentDescription(R.string.AccessibilityId_qr_code))
} }
} }
}