Thread
#compose
    Sololo

    Sololo

    10 months ago
    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?
    Damian Zawadzki

    Damian Zawadzki

    10 months ago
    could you provide more info? Error from preview tab for instance?
    Sololo

    Sololo

    10 months ago
    @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!
    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
    Damian Zawadzki

    Damian Zawadzki

    10 months ago
    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.
    Sololo

    Sololo

    10 months ago
    not work! there is no issue, no error, only one preview card
    Philip S

    Philip S

    10 months ago
    @Sololo
    PreviewUserInfoProvider
    must be a public class for it to work
    Sololo

    Sololo

    10 months ago
    @Philip S brilliant !!! Thanks bro.