pref: 首页空页面按钮颜色 & 文案
This commit is contained in:
parent
98de76550c
commit
70ebbd3818
|
|
@ -82,6 +82,7 @@ import com.huanchengfly.tieba.post.ui.widgets.compose.Avatar
|
|||
import com.huanchengfly.tieba.post.ui.widgets.compose.Button
|
||||
import com.huanchengfly.tieba.post.ui.widgets.compose.ConfirmDialog
|
||||
import com.huanchengfly.tieba.post.ui.widgets.compose.LongClickMenu
|
||||
import com.huanchengfly.tieba.post.ui.widgets.compose.TextButton
|
||||
import com.huanchengfly.tieba.post.ui.widgets.compose.Toolbar
|
||||
import com.huanchengfly.tieba.post.ui.widgets.compose.accountNavIconIfCompact
|
||||
import com.huanchengfly.tieba.post.ui.widgets.compose.rememberDialogState
|
||||
|
|
@ -380,7 +381,7 @@ fun HomePage(
|
|||
val context = LocalContext.current
|
||||
val isLoading by viewModel.uiState.collectPartialAsState(
|
||||
prop1 = HomeUiState::isLoading,
|
||||
initial = false
|
||||
initial = true
|
||||
)
|
||||
val forums by viewModel.uiState.collectPartialAsState(
|
||||
prop1 = HomeUiState::forums,
|
||||
|
|
@ -577,15 +578,15 @@ fun EmptyScreen(
|
|||
.fillMaxWidth()
|
||||
.aspectRatio(2f)
|
||||
)
|
||||
Text(
|
||||
text = stringResource(id = R.string.title_empty),
|
||||
style = MaterialTheme.typography.h6,
|
||||
color = ExtendedTheme.colors.text,
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
if (!loggedIn) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.title_empty_login),
|
||||
style = MaterialTheme.typography.h6,
|
||||
color = ExtendedTheme.colors.text,
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
Text(
|
||||
text = stringResource(id = R.string.home_empty_login),
|
||||
style = MaterialTheme.typography.body1,
|
||||
color = ExtendedTheme.colors.textSecondary,
|
||||
textAlign = TextAlign.Center
|
||||
|
|
@ -599,9 +600,16 @@ fun EmptyScreen(
|
|||
) {
|
||||
Text(text = stringResource(id = R.string.button_login))
|
||||
}
|
||||
} else {
|
||||
Text(
|
||||
text = stringResource(id = R.string.title_empty),
|
||||
style = MaterialTheme.typography.h6,
|
||||
color = ExtendedTheme.colors.text,
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
}
|
||||
if (canOpenExplore) {
|
||||
Button(
|
||||
TextButton(
|
||||
onClick = onOpenExplore,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import androidx.compose.foundation.shape.RoundedCornerShape
|
|||
import androidx.compose.material.ButtonColors
|
||||
import androidx.compose.material.ButtonDefaults
|
||||
import androidx.compose.material.ButtonElevation
|
||||
import androidx.compose.material.ContentAlpha
|
||||
import androidx.compose.material.ExperimentalMaterialApi
|
||||
import androidx.compose.material.LocalContentAlpha
|
||||
import androidx.compose.material.MaterialTheme
|
||||
|
|
@ -22,6 +23,7 @@ import androidx.compose.runtime.getValue
|
|||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.Shape
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.huanchengfly.tieba.post.ui.common.theme.compose.ExtendedTheme
|
||||
|
|
@ -70,3 +72,33 @@ fun Button(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun TextButton(
|
||||
onClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
enabled: Boolean = true,
|
||||
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
|
||||
shape: Shape = RoundedCornerShape(100),
|
||||
border: BorderStroke? = null,
|
||||
color: Color = ExtendedTheme.colors.text,
|
||||
contentPadding: PaddingValues = ButtonDefaults.ContentPadding,
|
||||
content: @Composable RowScope.() -> Unit
|
||||
) {
|
||||
Button(
|
||||
onClick = onClick,
|
||||
modifier = modifier,
|
||||
enabled = enabled,
|
||||
interactionSource = interactionSource,
|
||||
shape = shape,
|
||||
border = border,
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = color.copy(alpha = 0.1f),
|
||||
contentColor = color,
|
||||
disabledBackgroundColor = color.copy(alpha = ContentAlpha.disabled * 0.1f),
|
||||
disabledContentColor = color.copy(alpha = ContentAlpha.disabled)
|
||||
),
|
||||
contentPadding = contentPadding,
|
||||
content = content
|
||||
)
|
||||
}
|
||||
|
|
@ -645,7 +645,8 @@
|
|||
<string name="link">链接</string>
|
||||
<string name="user">用户</string>
|
||||
<string name="title_empty">这里什么都没有</string>
|
||||
<string name="title_empty_login">请登录之后查看你的关注。\n或者你也可以先去逛逛发现?</string>
|
||||
<string name="home_empty_login">请登录之后查看你的关注。\n或者你也可以先去逛逛发现?</string>
|
||||
<string name="button_login">去登录</string>
|
||||
<string name="button_go_to_explore">随便看看</string>
|
||||
<string name="title_empty_login">你还未登录</string>
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Reference in New Issue