Merge pull request #309 from ouchadam/bug-allow-profile-to-scroll
Fix profile page not scrolling when the screen is small
This commit is contained in:
commit
2a17f9d165
|
@ -6,7 +6,9 @@ import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.CameraAlt
|
import androidx.compose.material.icons.filled.CameraAlt
|
||||||
import androidx.compose.material.icons.filled.Settings
|
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)) }) {
|
IconButton(onClick = { context.startActivity(Intent(context, SettingsActivity::class.java)) }) {
|
||||||
Icon(imageVector = Icons.Filled.Settings, contentDescription = "Settings")
|
Icon(imageVector = Icons.Filled.Settings, contentDescription = "Settings")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
val scrollState = rememberScrollState()
|
||||||
when (val state = profile.content) {
|
when (val state = profile.content) {
|
||||||
is Lce.Loading -> CenteredLoading()
|
is Lce.Loading -> CenteredLoading()
|
||||||
is Lce.Error -> GenericError { viewModel.dispatch(ProfileAction.ComponentLifecycle.Visible) }
|
is Lce.Error -> GenericError { viewModel.dispatch(ProfileAction.ComponentLifecycle.Visible) }
|
||||||
is Lce.Content -> {
|
is Lce.Content -> {
|
||||||
val configuration = LocalConfiguration.current
|
val configuration = LocalConfiguration.current
|
||||||
val content = state.value
|
val content = state.value
|
||||||
Column {
|
Column(modifier = Modifier.verticalScroll(scrollState).padding(top = 32.dp)) {
|
||||||
Spacer(modifier = Modifier.fillMaxHeight(0.05f))
|
Spacer(modifier = Modifier.fillMaxHeight(0.05f))
|
||||||
Box(modifier = Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) {
|
Box(modifier = Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) {
|
||||||
val fallbackLabel = content.me.displayName ?: content.me.userId.value
|
val fallbackLabel = content.me.displayName ?: content.me.userId.value
|
||||||
|
@ -122,6 +124,7 @@ private fun ProfilePage(context: Context, viewModel: ProfileState, profile: Page
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun SpiderItemScope.Invitations(viewModel: ProfileState, invitations: Page.Invitations) {
|
private fun SpiderItemScope.Invitations(viewModel: ProfileState, invitations: Page.Invitations) {
|
||||||
|
|
Loading…
Reference in New Issue