```private class PreviewUserInfoProvider : Preview...
# compose
s
Copy code
private class PreviewUserInfoProvider : PreviewParameterProvider<UserInfoBean> {
    override val values: Sequence<UserInfoBean>
        get() = sequenceOf(UserInfoBean("111", "111", ""))
}

@Preview(
    name = "user info layout",
    group = "node",
    showBackground = true,
    backgroundColor = 0xffffff
)
@Composable
fun PreviewUserInfo(@PreviewParameter(PreviewUserInfoProvider::class) info: UserInfoBean) {
//    UserInfoView(
//        modifier = Modifier.size(120.dp, 30.dp),
//        userInfoBean = info,
//        onUserClick = {})
    
    Text(text = info.nickName)
}
why it cannot be preview shown?
d
could you provide more info? Error from preview tab for instance?
s
Copy code
@Preview(
    name = "single node card",
    group = "node",
    widthDp = 200,
    heightDp = 320,
    showBackground = true,
    backgroundColor = 0xa04a82
)
@Composable
fun PreviewNodeCardItem() {
    NoteCardItem(MockNoteCardList.first(), {}, {}, {})
}
this could be previewed!
Copy code
private class PreviewUserInfoProvider : PreviewParameterProvider<UserInfoBean> {
    override val values: Sequence<UserInfoBean>
        get() = sequenceOf(
            UserInfoBean("123", "111", ""))
}

@Preview(
    name = "user info layout",
    group = "node",
    showBackground = true,
    backgroundColor = 0xffffff
)
@Composable
fun PreviewUserInfo(@PreviewParameter(PreviewUserInfoProvider::class) info: UserInfoBean) {
    NoteCardItem(MockNoteCardList.first(), {}, {}, {})
}
but this cannot be previewed !!!
@Damian Zawadzki there is no error
d
try to clean project, then invalidate cache in android studio, preview /design tab is not 100% stable.
there could be no comiple errors but there is icon in top right corner. When you click it, info window will pop up with possible messages from preview.
s
not work! there is no issue, no error, only one preview card
p
@Sololo
PreviewUserInfoProvider
must be a public class for it to work
­čĹŹ 1
Ô׼ 2
s
@Philip S brilliant !!! Thanks bro.