添加更新数据
This commit is contained in:
@@ -37,18 +37,22 @@ fun AccountProfile(id:String) {
|
||||
// val model = MyProfileViewModel
|
||||
val userService: UserService = TestUserServiceImpl()
|
||||
var userProfile by remember { mutableStateOf<AccountProfile?>(null) }
|
||||
var momentListPagingSource = MomentPagingSource(
|
||||
MomentRemoteDataSource(TestMomentServiceImpl())
|
||||
)
|
||||
val momentsFlow: Flow<PagingData<MomentItem>> = Pager(
|
||||
config = PagingConfig(pageSize = 5, enablePlaceholders = false),
|
||||
pagingSourceFactory = { momentListPagingSource }
|
||||
).flow
|
||||
val momentService = TestMomentServiceImpl()
|
||||
var momentsFlow by remember { mutableStateOf<Flow<PagingData<MomentItem>>?>(null) }
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
userProfile = userService.getUserProfile(id)
|
||||
momentsFlow = Pager(
|
||||
config = PagingConfig(pageSize = 5, enablePlaceholders = false),
|
||||
pagingSourceFactory = {
|
||||
MomentPagingSource(
|
||||
MomentRemoteDataSource(momentService),
|
||||
author = id.toInt()
|
||||
)
|
||||
}
|
||||
).flow
|
||||
}
|
||||
val items = momentsFlow.collectAsLazyPagingItems()
|
||||
val items = momentsFlow?.collectAsLazyPagingItems()
|
||||
val systemUiController = rememberSystemUiController()
|
||||
LaunchedEffect(Unit) {
|
||||
systemUiController.setNavigationBarColor(
|
||||
@@ -70,13 +74,14 @@ fun AccountProfile(id:String) {
|
||||
CarGroup()
|
||||
userProfile?.let {
|
||||
UserInformation(isSelf = false, accountProfile = it)
|
||||
|
||||
}
|
||||
RidingStyle()
|
||||
}
|
||||
items(items.itemCount) { idx ->
|
||||
val momentItem = items[idx] ?: return@items
|
||||
MomentPostUnit(momentItem)
|
||||
if (items != null) {
|
||||
items(items.itemCount) { idx ->
|
||||
val momentItem = items[idx] ?: return@items
|
||||
MomentPostUnit(momentItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user