Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 040e3103bc0cfb65b085ec7401e5f4aee7b2f893
Author: Max Alfonso-Ying <maxying@google.com>
Date: Wed Mar 27 17:36:06 2024
Make SearchBar take input field as a slot
- SearchBarInputField moved into SearchBarDefaults and made public
- Deprecated SearchBarColors inputFieldColors param
- renamed "active" to "expanded" in new API to better align with spec language
Bug: b/275074248 , b/278773336
Fixes: b/326627700 , b/326314616
Relnote: "`SearchBar` and `DockedSearchBar` have new overloads that
take a text field parameter. This allows styling the text field
separately from the rest of the search bar as well as passing in
custom text fields. The text field of the current implementation
has been made available as `SearchBarDefaults.InputField`."
Test: tests updated
Change-Id: I50c73509b4a67247df7240207e7ad13d5863a7ff
M compose/material3/benchmark/src/androidTest/java/androidx/compose/material3/benchmark/SearchBarBenchmark.kt
M compose/material3/material3/api/current.txt
M compose/material3/material3/api/restricted_current.txt
M compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SearchBarSamples.kt
M compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/SearchBarScreenshotTest.kt
M compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/SearchBarTest.kt
M compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/SearchBar.android.kt
https://android-review.googlesource.com/3016901
Branch: androidx-main
commit 040e3103bc0cfb65b085ec7401e5f4aee7b2f893
Author: Max Alfonso-Ying <maxying@google.com>
Date: Wed Mar 27 17:36:06 2024
Make SearchBar take input field as a slot
- SearchBarInputField moved into SearchBarDefaults and made public
- Deprecated SearchBarColors inputFieldColors param
- renamed "active" to "expanded" in new API to better align with spec language
Bug:
Fixes:
Relnote: "`SearchBar` and `DockedSearchBar` have new overloads that
take a text field parameter. This allows styling the text field
separately from the rest of the search bar as well as passing in
custom text fields. The text field of the current implementation
has been made available as `SearchBarDefaults.InputField`."
Test: tests updated
Change-Id: I50c73509b4a67247df7240207e7ad13d5863a7ff
M compose/material3/benchmark/src/androidTest/java/androidx/compose/material3/benchmark/SearchBarBenchmark.kt
M compose/material3/material3/api/current.txt
M compose/material3/material3/api/restricted_current.txt
M compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/SearchBarSamples.kt
M compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/SearchBarScreenshotTest.kt
M compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/SearchBarTest.kt
M compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/SearchBar.android.kt
ma...@google.com <ma...@google.com>
na...@google.com <na...@google.com> #3
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.material3:material3:1.3.0-alpha05
androidx.compose.material3:material3-android:1.3.0-alpha05
androidx.compose.material3:material3-desktop:1.3.0-alpha05
lu...@gmail.com <lu...@gmail.com> #4
Hi, it's still not possible to add padding to a search bar without it affecting the expanded view state. The issue has not been fixed.
eg...@gmail.com <eg...@gmail.com> #5
You can use that:
val searchBarPadding by animateDpAsState(
targetValue = if(active) 0.dp else 16.dp,
label = "Search bar padding"
)
and then:
modifier = Modifier.padding(horizontal = searchBarPadding) on SearchBar
val searchBarPadding by animateDpAsState(
targetValue = if(active) 0.dp else 16.dp,
label = "Search bar padding"
)
and then:
modifier = Modifier.padding(horizontal = searchBarPadding) on SearchBar
Description
Jetpack Compose component used: SearchBar
Android Studio Build: Build #AI-221.6008.13.2211.9619390, built on February 16, 2023
Kotlin version: 1.8.10
Steps to Reproduce or Code Sample to Reproduce:
1. Just try copy this copy and paste the example code to SearchBar and try apply a horizontal padding to adjust the search bar
It is not possible to apply horizontal padding to the Search Field Text without all Scaffolds receiving the padding. What would be your solution to this?