fix(main): 临时修复因添加共享元素转场导致的FAB动画不连贯
This commit is contained in:
parent
4958ca9f88
commit
25e1f29e30
4 changed files with 12 additions and 7 deletions
|
|
@ -7,4 +7,8 @@ object TodoDefaults {
|
|||
* 屏幕左右两边预留边距(防止内容全部贴边显示过丑)
|
||||
*/
|
||||
val screenPadding = 16.dp
|
||||
/**
|
||||
* 待办卡片默认高度
|
||||
*/
|
||||
val toDoCardHeight = 80.dp
|
||||
}
|
||||
|
|
@ -53,11 +53,11 @@ fun MainPage(
|
|||
) {
|
||||
val toDoList = viewModel.sortedTodos.collectAsState(initial = emptyList())
|
||||
val listState = rememberLazyListState()
|
||||
val isExpanded by remember {
|
||||
/*val isExpanded by remember {
|
||||
derivedStateOf {
|
||||
listState.firstVisibleItemIndex == 0
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
val selectedTodoIds = viewModel.selectedTodoIds.collectAsState()
|
||||
var showDeleteConfirmDialog by rememberSaveable { mutableStateOf(false) }
|
||||
|
|
@ -97,9 +97,9 @@ fun MainPage(
|
|||
enter = fadeIn() + expandIn(),
|
||||
exit = shrinkOut() + fadeOut()
|
||||
) {
|
||||
// TODO: 修复在滑动列表时FAB位移导致的动画不连贯
|
||||
// TODO: 修复在滑动列表时FAB位移导致的动画不连贯(临时方案为底部加padding)
|
||||
TodoFAB(
|
||||
expanded = isExpanded,
|
||||
expanded = true,
|
||||
onClick = {
|
||||
viewModel.setEditTodoItem(null) // 每次添加待办前清除上一次已选待办
|
||||
toTodoEditPage()
|
||||
|
|
|
|||
|
|
@ -45,11 +45,11 @@ fun ManagerFragment(
|
|||
thumbUnselectedColor = MaterialTheme.colorScheme.secondary,
|
||||
thumbSelectedColor = MaterialTheme.colorScheme.primary
|
||||
),
|
||||
modifier = modifier,
|
||||
modifier = modifier
|
||||
) {
|
||||
LazyColumn(
|
||||
state = state,
|
||||
contentPadding = PaddingValues(horizontal = TodoDefaults.screenPadding)
|
||||
contentPadding = PaddingValues(start = TodoDefaults.screenPadding, bottom = TodoDefaults.toDoCardHeight / 2, end = TodoDefaults.screenPadding)
|
||||
) {
|
||||
if (list.isEmpty()) {
|
||||
item {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import androidx.compose.ui.unit.dp
|
|||
import cn.super12138.todo.R
|
||||
import cn.super12138.todo.constants.Constants
|
||||
import cn.super12138.todo.logic.model.Priority
|
||||
import cn.super12138.todo.ui.TodoDefaults
|
||||
import cn.super12138.todo.utils.VibrationUtils
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class, ExperimentalSharedTransitionApi::class)
|
||||
|
|
@ -64,7 +65,7 @@ fun TodoCard(
|
|||
ElevatedCard(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.height(80.dp)
|
||||
.height(TodoDefaults.toDoCardHeight)
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
|
|
|
|||
Loading…
Reference in a new issue