Skip to content

Commit

Permalink
Added single line expression
Browse files Browse the repository at this point in the history
  • Loading branch information
myofficework000 committed Mar 31, 2024
1 parent 0bb1634 commit fa5f967
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.material3.Scaffold
import androidx.compose.material3.Tab
import androidx.compose.material3.TabRow
import androidx.compose.material3.TabRowDefaults
import androidx.compose.material3.TabRowDefaults.SecondaryIndicator
import androidx.compose.material3.TabRowDefaults.tabIndicatorOffset
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
Expand Down Expand Up @@ -77,7 +78,7 @@ fun Tabs(
selectedTabIndex = selectedTabIndex, // Index of the currently selected tab
indicator = { tabPositions ->
// Customizing tab indicator position
TabRowDefaults.Indicator(
SecondaryIndicator(
modifier = Modifier.tabIndicatorOffset(tabPositions[selectedTabIndex]), // Offset based on selected tab position
color = Color.Black // Color of the indicator
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ fun AutoCompleteSearchBar(
OutlinedTextField(
value = text,
onValueChange = onChange,
modifier = Modifier.fillMaxWidth().padding(dp_15),
modifier = Modifier
.fillMaxWidth()
.padding(dp_15),
enabled = enabled,
label = label?.run { { Text(this) } },
trailingIcon = {
Expand All @@ -271,21 +273,15 @@ fun AutoCompleteSearchBar(
}



@Preview
@Composable
private fun SimpleSearchBarPreview() {
SimpleSearchBar(
"Testing testing...",

) {}
}
private fun SimpleSearchBarPreview() = SimpleSearchBar("Testing testing..."){}

@Preview
@Composable
private fun AutocompleteSearchBarPreview() {
AutoCompleteSearchBar(
"Testing testing...",
listOf("1","222222....","3. Hey Bob the mic is not working.")
listOf("1", "222222....", "3. Hey Bob the mic is not working.")
) {}
}

0 comments on commit fa5f967

Please sign in to comment.