Skip to content

Commit

Permalink
#2 - Search bar - Modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
jhg3410 committed Jan 24, 2023
1 parent c038382 commit c0a1cba
Showing 1 changed file with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Search
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.codelab.basiclayouts.ui.theme.MySootheTheme
Expand All @@ -40,7 +46,25 @@ class MainActivity : ComponentActivity() {
fun SearchBar(
modifier: Modifier = Modifier
) {
// Implement composable here
TextField(
value = "",
onValueChange = {},
leadingIcon = {
Icon(
imageVector = Icons.Default.Search,
contentDescription = null
)
},
colors = TextFieldDefaults.textFieldColors(
backgroundColor = MaterialTheme.colors.surface
),
placeholder = {
Text(stringResource(id = R.string.placeholder_search))
},
modifier = modifier
.fillMaxWidth()
.heightIn(min = 56.dp)
)
}

// Step: Align your body - Alignment
Expand Down

0 comments on commit c0a1cba

Please sign in to comment.