Peter Enyedi
09/23/2022, 10:15 AMiroyo
09/23/2022, 10:21 AM@HiltViewModel
class SearchVM @Inject constructor(
savedStateHandle: SavedStateHandle
) : ViewModel() {
var query by mutableStateOf(savedStateHandle["query"] ?: "")
private set
}
the wrapper of BaseTextField is very simple it only has:
if (autofocus) {
LaunchedEffect(Unit) {
focusRequester.requestFocus()
}
}
Asad Mukhtar
09/23/2022, 11:36 AModay
09/23/2022, 11:51 AMonView(
allOf(
withText("Amsterdam"),
withId(R.id.name),
hasSibling(allOf(withText("The Netherlands"), withId(R.id.country)))
)
).check(matches(isDisplayed()))
I am trying:
composeTestRule.onAllNodes(
withText("Amsterdam"),
withId(R.id.name),
hasSibling()
).assertAll(isDisplayed())
but yea it needs a SemanticMatcher, not a MatcherAaron Waller
09/23/2022, 12:38 PMsystemUiController.setSystemBarsColor(
color = Color.Transparent
)
How can I put a gradient?K Merle
09/23/2022, 3:31 PMZach
09/23/2022, 7:18 PMste
09/24/2022, 7:37 AMkey
(so it does get recreated when the key changes), but it actually gets recreated everytime, even if the key is the same.
@Composable
fun OnlineSearchTab(
textFieldValue: TextFieldValue,
viewModel: OnlineSearchTabViewModel = viewModel(key = textFieldValue.text)
)
What am I missing?Sunil Kumar
09/24/2022, 2:49 PMBharath Kandula
09/24/2022, 4:51 PMColumn(
modifier = Modifier
.fillMaxWidth()
.fillMaxHeight()
.background(BackgroundPrimary)
) {
CustomAppBar() {
navController.popBackStack()
}
Divider(thickness = 1.dp, color = BorderPrimary)
Spacer(modifier = Modifier.height(Spacing20))
Column(
modifier = Modifier.wrapContentHeight().fillMaxWidth()
) {
Row(
modifier = Modifier
.padding(horizontal = 40.dp, vertical = 20.sp)
.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
) {
Spacer(modifier = Modifier.width(30.dp))
Column {
Text(
text = viewModel.getSelectedContact().name ?: "",
modifier = Modifier.padding(vertical = 2.dp),
color = ContentPrimary
)
Text(
text = "${viewModel.getSelectedOperator().name} ${viewModel.getSelectedCircle().name}",
color = ContentSecondary
)
Text(
text = viewModel.getSelectedContact().mobileNumber ?: "",
color = ContentSecondary
)
}
Spacer(modifier = Modifier.weight(1f))
Text(
text = "Change",
color = ContentBrand,
modifier = Modifier.clickable(onClick = {
navController.navigate(BillPayNavigationScreens.ConfirmCircleOperator.route)
})
)
Spacer(modifier = Modifier.width(30.dp))
}
PreSearchViewForPlanScreen()
val pagerState = rememberPagerState()
Tabs(tabs = tabs, pagerState = pagerState)
PlansContentScreen(tabs = tabs, pagerState = pagerState, viewModel,navController)
}
}
@Composable
fun PlansContentScreen(plans: List<PlanInfoData>, navController: NavHostController) {
LazyColumn(modifier = Modifier.padding(vertical = 10.dp, horizontal = 40.dp).fillMaxHeight()) {
items(items = plans) { plan ->
UI(plan, navController)
Spacer(modifier = Modifier.height(30.dp))
}
}
}
Can anyone suggest the scrolling approach? The search is sticky and lazy column scroll.
Thanks, advance.Bharath Kandula
09/24/2022, 4:51 PMAsad Mukhtar
09/24/2022, 9:14 PMStarr
09/24/2022, 9:17 PMcommonMain
for all platforms (desktop, web, android)?Slackbot
09/25/2022, 2:52 AMAlexander
09/25/2022, 11:24 AMJi Sungbin
09/25/2022, 4:46 PMModifier.size
to the same size, but the assertion fails. Am I using the aasertion api wrong?
@Test
fun size_is_500_x_500() {
val size = 500.dp
testRule.setContent {
Box(
modifier = Modifier.size(
size = size,
),
)
}
testRule
.onRoot()
.assertWidthIsEqualTo(
expectedWidth = size,
)
.assertHeightIsEqualTo(
expectedHeight = size,
)
}
java.lang.AssertionError: Actual width is 392.72726.dp, expected 500.0.dp (tolerance: 0.5.dp)
Napa Ram
09/26/2022, 8:09 AMHasan Nagizade
09/26/2022, 8:15 AMKotlinLeaner
09/26/2022, 12:35 PMrememberLauncherForActivityResult
in jetpack compose? I am trying for so long but unable to understand through accompanist
library..Lilly
09/26/2022, 6:13 PMbanner
component was never popular in compose. In material design 3 it isn't listed anymore. What would be a replacement for banners, e.g. to notify about bluetooth or wifi being disabled?MR3Y
09/26/2022, 8:55 PMmattinger
09/26/2022, 11:49 PMZoltan Demant
09/27/2022, 4:37 AMAnimatedContent
skips the transition sometimes, despite targetState having changed. Why could that be? Potential bug? Code in 🧵AmrJyniat
09/27/2022, 9:58 AMmutableStateListOf
without creating a new list then assign it to the original mutableStateListOf
?KotlinLeaner
09/27/2022, 11:58 AMYoung Rock
09/27/2022, 12:11 PMelye
09/27/2022, 1:24 PMViewRootForInspector
, and how one can use it?farmerbb
09/27/2022, 8:44 PMspring()
animation? Specifically, one that uses Spring.StiffnessMedium
?Travis Griggs
09/27/2022, 8:53 PMChris Fillmore
09/27/2022, 9:41 PMgraphicsLayer
or otherwise) and also have it scale down the amount of space it occupies?Chris Fillmore
09/27/2022, 9:41 PMgraphicsLayer
or otherwise) and also have it scale down the amount of space it occupies?Stylianos Gakis
09/27/2022, 11:21 PMChris Fillmore
09/27/2022, 11:35 PMval width = ...
val height = ...
val scale = ...
Box(
Modifier
.size(width = width * scale, height = height * scale)
.wrapContentSize(unbounded = true)
) {
Surface(
Modifier
.size(width, height)
.scale(scale)
) { ... }
}
Stylianos Gakis
09/28/2022, 12:03 AMChris Fillmore
09/28/2022, 12:05 AM0.5f
is applied, there’s nothing thereStylianos Gakis
09/28/2022, 7:35 AMChris Fillmore
09/28/2022, 2:31 PM@Composable
fun ScaledLayout(
scale: Float,
width: Dp,
height: Dp,
content: @Composable () -> Unit,
) {
Box(
modifier = Modifier
.size(width = width * scale, height = height * scale)
.wrapContentSize(unbounded = true),
contentAlignment = Alignment.Center,
) {
content()
}
}
The content
still needs to apply the same size and scale on its own, to achieve the right effect. The “ScaledLayout” just provides it a layout container that will fit the provided scale
.