fix: 查看吧规偶现闪退
This commit is contained in:
parent
d1f4ea0e3f
commit
bb80c7055d
|
|
@ -22,6 +22,7 @@ import com.huanchengfly.tieba.post.R
|
||||||
import com.huanchengfly.tieba.post.arch.collectPartialAsState
|
import com.huanchengfly.tieba.post.arch.collectPartialAsState
|
||||||
import com.huanchengfly.tieba.post.arch.getOrNull
|
import com.huanchengfly.tieba.post.arch.getOrNull
|
||||||
import com.huanchengfly.tieba.post.arch.pageViewModel
|
import com.huanchengfly.tieba.post.arch.pageViewModel
|
||||||
|
import com.huanchengfly.tieba.post.ui.page.ProvideNavigator
|
||||||
import com.huanchengfly.tieba.post.ui.widgets.compose.Avatar
|
import com.huanchengfly.tieba.post.ui.widgets.compose.Avatar
|
||||||
import com.huanchengfly.tieba.post.ui.widgets.compose.BackNavigationIcon
|
import com.huanchengfly.tieba.post.ui.widgets.compose.BackNavigationIcon
|
||||||
import com.huanchengfly.tieba.post.ui.widgets.compose.ErrorScreen
|
import com.huanchengfly.tieba.post.ui.widgets.compose.ErrorScreen
|
||||||
|
|
@ -78,74 +79,79 @@ fun ForumRuleDetailPage(
|
||||||
initial = null
|
initial = null
|
||||||
)
|
)
|
||||||
|
|
||||||
StateScreen(
|
ProvideNavigator(navigator = navigator) {
|
||||||
modifier = Modifier.fillMaxSize(),
|
StateScreen(
|
||||||
isEmpty = data.isEmpty(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
isError = error != null,
|
isEmpty = data.isEmpty(),
|
||||||
isLoading = isLoading,
|
isError = error != null,
|
||||||
onReload = {
|
isLoading = isLoading,
|
||||||
viewModel.send(ForumRuleDetailUiIntent.Load(forumId))
|
onReload = {
|
||||||
},
|
viewModel.send(ForumRuleDetailUiIntent.Load(forumId))
|
||||||
errorScreen = { ErrorScreen(error = error.getOrNull()) }
|
},
|
||||||
) {
|
errorScreen = { ErrorScreen(error = error.getOrNull()) }
|
||||||
MyScaffold(
|
|
||||||
topBar = {
|
|
||||||
TitleCentredToolbar(
|
|
||||||
title = { Text(text = stringResource(id = R.string.title_forum_rule)) },
|
|
||||||
navigationIcon = {
|
|
||||||
BackNavigationIcon {
|
|
||||||
navigator.navigateUp()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
) {
|
) {
|
||||||
Column(
|
MyScaffold(
|
||||||
modifier = Modifier
|
topBar = {
|
||||||
.fillMaxWidth()
|
TitleCentredToolbar(
|
||||||
.padding(horizontal = 16.dp)
|
title = { Text(text = stringResource(id = R.string.title_forum_rule)) },
|
||||||
.verticalScroll(rememberScrollState()),
|
navigationIcon = {
|
||||||
verticalArrangement = Arrangement.spacedBy(16.dp)
|
BackNavigationIcon {
|
||||||
) {
|
navigator.navigateUp()
|
||||||
Text(text = title, style = MaterialTheme.typography.h5)
|
}
|
||||||
author?.let {
|
}
|
||||||
UserHeader(
|
|
||||||
avatar = {
|
|
||||||
Avatar(
|
|
||||||
data = StringUtil.getAvatarUrl(it.get { portrait }),
|
|
||||||
size = Sizes.Small,
|
|
||||||
contentDescription = null
|
|
||||||
)
|
|
||||||
},
|
|
||||||
name = {
|
|
||||||
Text(
|
|
||||||
text = StringUtil.getUsernameAnnotatedString(
|
|
||||||
LocalContext.current,
|
|
||||||
it.get { user_name },
|
|
||||||
it.get { name_show },
|
|
||||||
LocalContentColor.current
|
|
||||||
)
|
|
||||||
)
|
|
||||||
},
|
|
||||||
desc = (@Composable {
|
|
||||||
Text(text = publishTime)
|
|
||||||
}).takeIf { publishTime.isNotEmpty() }
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
) {
|
||||||
Column(
|
Column(
|
||||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 16.dp)
|
||||||
|
.verticalScroll(rememberScrollState()),
|
||||||
|
verticalArrangement = Arrangement.spacedBy(16.dp)
|
||||||
) {
|
) {
|
||||||
ProvideTextStyle(value = MaterialTheme.typography.body1) {
|
Text(text = title, style = MaterialTheme.typography.h5)
|
||||||
Text(text = preface)
|
author?.let {
|
||||||
data.fastForEach {
|
UserHeader(
|
||||||
if (it.title.isNotEmpty()) {
|
avatar = {
|
||||||
Text(text = it.title, style = MaterialTheme.typography.subtitle1)
|
Avatar(
|
||||||
}
|
data = StringUtil.getAvatarUrl(it.get { portrait }),
|
||||||
Column(
|
size = Sizes.Small,
|
||||||
verticalArrangement = Arrangement.spacedBy(4.dp)
|
contentDescription = null
|
||||||
) {
|
)
|
||||||
it.contentRenders.fastForEach { render ->
|
},
|
||||||
render.Render()
|
name = {
|
||||||
|
Text(
|
||||||
|
text = StringUtil.getUsernameAnnotatedString(
|
||||||
|
LocalContext.current,
|
||||||
|
it.get { user_name },
|
||||||
|
it.get { name_show },
|
||||||
|
LocalContentColor.current
|
||||||
|
)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
desc = (@Composable {
|
||||||
|
Text(text = publishTime)
|
||||||
|
}).takeIf { publishTime.isNotEmpty() }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Column(
|
||||||
|
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
|
) {
|
||||||
|
ProvideTextStyle(value = MaterialTheme.typography.body1) {
|
||||||
|
Text(text = preface)
|
||||||
|
data.fastForEach {
|
||||||
|
if (it.title.isNotEmpty()) {
|
||||||
|
Text(
|
||||||
|
text = it.title,
|
||||||
|
style = MaterialTheme.typography.subtitle1
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Column(
|
||||||
|
verticalArrangement = Arrangement.spacedBy(4.dp)
|
||||||
|
) {
|
||||||
|
it.contentRenders.fastForEach { render ->
|
||||||
|
render.Render()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue