添加业务逻辑
This commit is contained in:
@@ -35,13 +35,32 @@ import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.paging.Pager
|
||||
import androidx.paging.PagingConfig
|
||||
import androidx.paging.PagingData
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import com.aiosman.riderpro.ui.post.CommentsSection
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.data.comment.Comment
|
||||
import com.aiosman.riderpro.data.comment.CommentPagingSource
|
||||
import com.aiosman.riderpro.data.comment.CommentRemoteDataSource
|
||||
import com.aiosman.riderpro.data.comment.TestCommentServiceImpl
|
||||
import com.aiosman.riderpro.model.MomentItem
|
||||
import com.aiosman.riderpro.ui.index.tabs.moment.MomentViewModel.momentListPagingSource
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun CommentModalContent(onDismiss: () -> Unit = {}) {
|
||||
var commentSource = CommentPagingSource(
|
||||
CommentRemoteDataSource(TestCommentServiceImpl())
|
||||
)
|
||||
val commentsFlow: Flow<PagingData<Comment>> = Pager(
|
||||
config = PagingConfig(pageSize = 5, enablePlaceholders = false),
|
||||
pagingSourceFactory = { commentSource }
|
||||
).flow
|
||||
val comments = commentsFlow.collectAsLazyPagingItems()
|
||||
val insets = WindowInsets
|
||||
val imePadding = insets.ime.getBottom(density = LocalDensity.current)
|
||||
var bottomPadding by remember { mutableStateOf(0.dp) }
|
||||
@@ -80,7 +99,11 @@ fun CommentModalContent(onDismiss: () -> Unit = {}) {
|
||||
.padding(horizontal = 16.dp)
|
||||
.weight(1f)
|
||||
) {
|
||||
CommentsSection{}
|
||||
|
||||
CommentsSection(lazyPagingItems = comments) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
@@ -131,7 +154,6 @@ fun CommentModalContent(onDismiss: () -> Unit = {}) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user