账户编辑、评论点赞功能优化和UI调整
**功能优化:**
* **账户编辑:**
* 昵称和个人简介输入时自动去除换行符。
* 修复了进入编辑页面时可能未正确加载或重置用户资料的问题。
* 保存资料时,确保昵称和个人简介中的换行符被移除。
* 清除裁剪的头像图片,避免重复使用。
* **评论点赞/取消点赞:**
* 引入乐观更新策略,提升用户体验,点赞/取消点赞操作会立即反映在UI上,然后进行后台API调用。
* 增加防抖机制,防止用户快速重复点击点赞/取消点赞按钮导致多次API请求。
**UI调整:**
* **账户编辑页面:**
* 页面切换动画调整为iOS风格的底部滑入滑出效果。
This commit is contained in:
@@ -6,10 +6,13 @@ import ModificationListScreen
|
||||
import androidx.compose.animation.ExperimentalSharedTransitionApi
|
||||
import androidx.compose.animation.SharedTransitionLayout
|
||||
import androidx.compose.animation.core.tween
|
||||
import androidx.compose.animation.core.FastOutSlowInEasing
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.animation.slideInHorizontally
|
||||
import androidx.compose.animation.slideOutHorizontally
|
||||
import androidx.compose.animation.slideInVertically
|
||||
import androidx.compose.animation.slideOutVertically
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.navigationBars
|
||||
@@ -364,10 +367,40 @@ fun NavigationController(
|
||||
composable(
|
||||
route = NavigationRoute.AccountEdit.route,
|
||||
enterTransition = {
|
||||
fadeIn(animationSpec = tween(durationMillis = 0))
|
||||
// iOS风格:从底部向上滑入
|
||||
slideInVertically(
|
||||
initialOffsetY = { fullHeight -> fullHeight },
|
||||
animationSpec = tween(durationMillis = 300, easing = FastOutSlowInEasing)
|
||||
) + fadeIn(
|
||||
animationSpec = tween(durationMillis = 300)
|
||||
)
|
||||
},
|
||||
exitTransition = {
|
||||
fadeOut(animationSpec = tween(durationMillis = 0))
|
||||
// iOS风格:向底部滑出
|
||||
slideOutVertically(
|
||||
targetOffsetY = { fullHeight -> fullHeight },
|
||||
animationSpec = tween(durationMillis = 300, easing = FastOutSlowInEasing)
|
||||
) + fadeOut(
|
||||
animationSpec = tween(durationMillis = 300)
|
||||
)
|
||||
},
|
||||
popEnterTransition = {
|
||||
// 返回时从底部滑入
|
||||
slideInVertically(
|
||||
initialOffsetY = { fullHeight -> fullHeight },
|
||||
animationSpec = tween(durationMillis = 300, easing = FastOutSlowInEasing)
|
||||
) + fadeIn(
|
||||
animationSpec = tween(durationMillis = 300)
|
||||
)
|
||||
},
|
||||
popExitTransition = {
|
||||
// 返回时向底部滑出
|
||||
slideOutVertically(
|
||||
targetOffsetY = { fullHeight -> fullHeight },
|
||||
animationSpec = tween(durationMillis = 300, easing = FastOutSlowInEasing)
|
||||
) + fadeOut(
|
||||
animationSpec = tween(durationMillis = 300)
|
||||
)
|
||||
}
|
||||
) {
|
||||
AccountEditScreen2()
|
||||
|
||||
Reference in New Issue
Block a user