fix: #183 Noting 2a 手机下页面边距显示错误

This commit is contained in:
Super12138 2025-08-05 17:45:20 +08:00
parent 14e1ff0738
commit ae64b19125
2 changed files with 16 additions and 6 deletions

View file

@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeContent
import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.selection.SelectionContainer import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.foundation.verticalScroll import androidx.compose.foundation.verticalScroll
@ -85,7 +84,7 @@ fun CrashPage(
expanded = isExpanded expanded = isExpanded
) )
}, },
contentWindowInsets = WindowInsets.safeContent contentWindowInsets = WindowInsets(0, 0, 0, 0)
) { innerPadding -> ) { innerPadding ->
val context = LocalContext.current val context = LocalContext.current
val packageName = context.packageName val packageName = context.packageName

View file

@ -63,7 +63,8 @@ fun MainPage(
val toDoList by remember { derivedStateOf { toDos.value } } val toDoList by remember { derivedStateOf { toDos.value } }
val totalTasks by remember { derivedStateOf { toDoList.size } } val totalTasks by remember { derivedStateOf { toDoList.size } }
val completedTasks by remember { derivedStateOf { toDoList.count { it.isCompleted } } } val completedTasks by remember { derivedStateOf { toDoList.count { it.isCompleted } } }
val filteredTodoList = if (showCompleted) toDoList else toDoList.filter { item -> !item.isCompleted } val filteredTodoList =
if (showCompleted) toDoList else toDoList.filter { item -> !item.isCompleted }
// 当按下返回键(或进行返回操作)时清空选择,仅在非选择模式下生效 // 当按下返回键(或进行返回操作)时清空选择,仅在非选择模式下生效
BackHandler(inSelectedMode) { viewModel.clearAllTodoSelection() } BackHandler(inSelectedMode) { viewModel.clearAllTodoSelection() }
@ -103,11 +104,16 @@ fun MainPage(
} }
} }
}, },
contentWindowInsets = WindowInsets(0,0,0,0), contentWindowInsets = WindowInsets(0, 0, 0, 0),
modifier = modifier modifier = modifier
) { innerPadding -> ) { innerPadding ->
if (windowSizeClass.windowWidthSizeClass == WindowWidthSizeClass.COMPACT) { if (windowSizeClass.windowWidthSizeClass == WindowWidthSizeClass.COMPACT) {
Column(modifier = Modifier.padding(innerPadding)) { Column(
modifier = Modifier.padding(
top = innerPadding.calculateTopPadding(),
bottom = innerPadding.calculateBottomPadding()
)
) {
ProgressFragment( ProgressFragment(
totalTasks = totalTasks, totalTasks = totalTasks,
completedTasks = completedTasks, completedTasks = completedTasks,
@ -151,7 +157,12 @@ fun MainPage(
) )
} }
} else { } else {
Row(modifier = Modifier.padding(innerPadding)) { Row(
modifier = Modifier.padding(
top = innerPadding.calculateTopPadding(),
bottom = innerPadding.calculateBottomPadding()
)
) {
ProgressFragment( ProgressFragment(
totalTasks = totalTasks, totalTasks = totalTasks,
completedTasks = completedTasks, completedTasks = completedTasks,