搜索页:精准搜索从SettingsSheet移至topbar,移除搜索类型列表水平padding

This commit is contained in:
HapeLee
2026-05-27 21:23:58 +08:00
parent a9b14e5b50
commit 6278f26839
@@ -269,7 +269,7 @@ fun SearchScreen(
}, },
actions = { actions = {
TopBarAnimatedActionButton( TopBarAnimatedActionButton(
checked = isSourceGroupedMode || state.matchMode == MatchMode.EXACT || state.selectedSourceTypes.isNotEmpty(), checked = isSourceGroupedMode || state.selectedSourceTypes.isNotEmpty(),
onCheckedChange = { onCheckedChange = {
viewModel.onIntent(SearchIntent.SetSettingsSheetVisible(true)) viewModel.onIntent(SearchIntent.SetSettingsSheetVisible(true))
}, },
@@ -278,6 +278,17 @@ fun SearchScreen(
activeText = stringResource(R.string.setting), activeText = stringResource(R.string.setting),
inactiveText = stringResource(R.string.setting), inactiveText = stringResource(R.string.setting),
) )
TopBarAnimatedActionButton(
checked = state.matchMode == MatchMode.EXACT,
onCheckedChange = {
val newMode = if (state.matchMode == MatchMode.EXACT) MatchMode.DEFAULT else MatchMode.EXACT
viewModel.onIntent(SearchIntent.SetMatchMode(newMode))
},
iconChecked = AppIcons.PrecisionSearch,
iconUnchecked = AppIcons.UnPrecisionSearch,
activeText = stringResource(R.string.precision_search),
inactiveText = stringResource(R.string.precision_search),
)
TopBarAnimatedActionButton( TopBarAnimatedActionButton(
checked = !state.isAllScope, checked = !state.isAllScope,
onCheckedChange = { onCheckedChange = {
@@ -616,26 +627,6 @@ fun SearchScreen(
} }
) )
CompactDropdownSettingItem(
title = stringResource(R.string.precision_search),
selectedValue = state.matchMode.value.toString(),
displayEntries = arrayOf(
stringResource(R.string.precision_search),
stringResource(R.string.search)
),
entryValues = arrayOf(
MatchMode.EXACT.value.toString(),
MatchMode.DEFAULT.value.toString()
),
imageVector = if (state.matchMode == MatchMode.EXACT) AppIcons.PrecisionSearch else AppIcons.UnPrecisionSearch,
onValueChange = { newValue ->
val mode = MatchMode.of(newValue.toInt())
if (mode != state.matchMode) {
viewModel.onIntent(SearchIntent.SetMatchMode(mode))
}
}
)
Row( Row(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
@@ -651,7 +642,6 @@ fun SearchScreen(
} }
Column( Column(
modifier = Modifier.padding(horizontal = 16.dp),
verticalArrangement = Arrangement.spacedBy(4.dp) verticalArrangement = Arrangement.spacedBy(4.dp)
) { ) {
SelectionItemCard( SelectionItemCard(