Render SearchBarRow inside the main Column container below the top app bar
This commit is contained in:
1 parent
3734cb361f
commit
80578b93d6
1 file changed
+45
-28
@@ -188,35 +188,23 @@ fun ChatScreen(
|
|||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
pinTopBar = true,
|
pinTopBar = true,
|
||||||
title = {
|
title = {
|
||||||
if (state.isSearchActive) {
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
SearchBarRow(
|
Text(
|
||||||
searchQuery = state.searchQuery,
|
text = "Hermes",
|
||||||
onQueryChange = { viewModel.setSearchQuery(it) },
|
style =
|
||||||
searchMatchCount = state.searchMatchIndices.size,
|
MaterialTheme.typography.titleLarge.copy(
|
||||||
currentMatchIndex = state.currentSearchMatchIndex,
|
fontWeight = FontWeight.Bold,
|
||||||
onNavigateUp = { viewModel.navigateSearchMatch(-1) },
|
),
|
||||||
onNavigateDown = { viewModel.navigateSearchMatch(1) },
|
)
|
||||||
onClose = { viewModel.clearSearch() },
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
|
// Connection status dot
|
||||||
|
Box(
|
||||||
|
modifier =
|
||||||
|
Modifier
|
||||||
|
.size(10.dp)
|
||||||
|
.clip(CircleShape)
|
||||||
|
.background(if (state.isConnected) StatusGreen else StatusRed),
|
||||||
)
|
)
|
||||||
} else {
|
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
|
||||||
Text(
|
|
||||||
text = "Hermes",
|
|
||||||
style =
|
|
||||||
MaterialTheme.typography.titleLarge.copy(
|
|
||||||
fontWeight = FontWeight.Bold,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
Spacer(modifier = Modifier.width(8.dp))
|
|
||||||
// Connection status dot
|
|
||||||
Box(
|
|
||||||
modifier =
|
|
||||||
Modifier
|
|
||||||
.size(10.dp)
|
|
||||||
.clip(CircleShape)
|
|
||||||
.background(if (state.isConnected) StatusGreen else StatusRed),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onOpenDrawer = onOpenDrawer,
|
onOpenDrawer = onOpenDrawer,
|
||||||
@@ -333,6 +321,35 @@ fun ChatScreen(
|
|||||||
.background(backgroundGradient)
|
.background(backgroundGradient)
|
||||||
.imePadding(),
|
.imePadding(),
|
||||||
) {
|
) {
|
||||||
|
androidx.compose.animation.AnimatedVisibility(
|
||||||
|
visible = state.isSearchActive,
|
||||||
|
enter = androidx.compose.animation.expandVertically() + androidx.compose.animation.fadeIn(),
|
||||||
|
exit = androidx.compose.animation.shrinkVertically() + androidx.compose.animation.fadeOut(),
|
||||||
|
) {
|
||||||
|
androidx.compose.material3.Surface(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
color = MaterialTheme.colorScheme.surfaceContainerLow,
|
||||||
|
tonalElevation = 2.dp,
|
||||||
|
border =
|
||||||
|
BorderStroke(
|
||||||
|
width = 1.dp,
|
||||||
|
color = MaterialTheme.colorScheme.outline.copy(alpha = 0.12f),
|
||||||
|
),
|
||||||
|
) {
|
||||||
|
Box(modifier = Modifier.padding(horizontal = 12.dp, vertical = 8.dp)) {
|
||||||
|
SearchBarRow(
|
||||||
|
searchQuery = state.searchQuery,
|
||||||
|
onQueryChange = { viewModel.setSearchQuery(it) },
|
||||||
|
searchMatchCount = state.searchMatchIndices.size,
|
||||||
|
currentMatchIndex = state.currentSearchMatchIndex,
|
||||||
|
onNavigateUp = { viewModel.navigateSearchMatch(-1) },
|
||||||
|
onNavigateDown = { viewModel.navigateSearchMatch(1) },
|
||||||
|
onClose = { viewModel.clearSearch() },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Box(
|
Box(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
|
|||||||
Reference in new issue
Block a user