fixing profile page not scrolling when the screen is small

This commit is contained in:
Adam Brown 2023-01-10 21:49:22 +00:00
parent e069084b23
commit 6639f9ff31
1 changed files with 47 additions and 44 deletions

View File

@ -6,7 +6,9 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.CameraAlt
import androidx.compose.material.icons.filled.Settings
@ -68,15 +70,15 @@ private fun ProfilePage(context: Context, viewModel: ProfileState, profile: Page
IconButton(onClick = { context.startActivity(Intent(context, SettingsActivity::class.java)) }) {
Icon(imageVector = Icons.Filled.Settings, contentDescription = "Settings")
}
}
val scrollState = rememberScrollState()
when (val state = profile.content) {
is Lce.Loading -> CenteredLoading()
is Lce.Error -> GenericError { viewModel.dispatch(ProfileAction.ComponentLifecycle.Visible) }
is Lce.Content -> {
val configuration = LocalConfiguration.current
val content = state.value
Column {
Column(modifier = Modifier.verticalScroll(scrollState).padding(top = 32.dp)) {
Spacer(modifier = Modifier.fillMaxHeight(0.05f))
Box(modifier = Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) {
val fallbackLabel = content.me.displayName ?: content.me.userId.value
@ -122,6 +124,7 @@ private fun ProfilePage(context: Context, viewModel: ProfileState, profile: Page
}
}
}
}
@Composable
private fun SpiderItemScope.Invitations(viewModel: ProfileState, invitations: Page.Invitations) {