Anastasia Rozovskaya
09/20/2021, 10:27 AMMichal
09/20/2021, 12:21 PMZoltan Demant
09/20/2021, 2:24 PMBox
that renders an arc with Canvas
and a centered `Text`; why is the Box
sizing wrong if contentAlignment is set to center? 🧵Bradleycorn
09/20/2021, 2:56 PM@Preview
composable, is there any way to get it to render a piece of UI with focus applied? I tried adding a FocusRequester
and using a LaunchedEffect
in the preview to request focus, but that doesn’t seem to work in the preview.Napa Ram
09/20/2021, 2:57 PMSusheel
09/20/2021, 3:56 PMtheapache64
09/20/2021, 4:43 PMMutableTransitionState
(MTS) with updateTransition
is only useful if we want to update the state within the composable. If we simply want to access the MTS#currentState
, MTS#targetState
and MTS#isIdle
, we can use Transition#currentState
, Transition#targetState
and Transition#isRunning
respectively. Please correct me if am wrong.Ernestas
09/20/2021, 5:55 PMPiotr Prus
09/20/2021, 7:26 PMIntrinsicSize
and layout.measure
, but I cannot make it work. I managed to have a square card, but items are not in center. More in thread 👇Bradleycorn
09/20/2021, 7:47 PMTextField
value and State.
Can someone explain why, given the following composable:
var text by remember { mutableStateOf("") }
TextField(
value = text,
onValueChange = { newText ->
Log.d("TEXTFIELD", "NewText: $newText")
val editedText = newText.replace(Regex("\\D"), "")
if (editedText.startsWith("1"))
text = editedText
}
)
If I type the number 5 into the text field four times, the result I see in LogCat is:
D/TEXTFIELD: NewText: 5
D/TEXTFIELD: NewText: 5
D/TEXTFIELD: NewText: 55
D/TEXTFIELD: NewText: 5
I’m stumped?itnoles
09/21/2021, 12:38 AMdambakk
09/21/2021, 8:18 AMTestNavHostController
as NavHostController
parameter (defaults to rememberAnimatedNavController
) but get an exception when the building the navgraph:
androidx.navigation.testing.TestNavigatorProvider$navigator$1 cannot be cast to com.google.accompanist.navigation.animation.AnimatedComposeNavigator
at com.google.accompanist.navigation.animation.NavGraphBuilderKt.composable(NavGraphBuilder.kt:124)
Doesnt the accompanist nav animation lib support testing yet?
(code in 🧵)Akram Bensalem
09/21/2021, 8:39 AMval mapView = rememberMapViewWithLifecycle()
Roman Polach
09/21/2021, 10:11 AMOrhan Tozan
09/21/2021, 10:27 AMsuppressKotlinVersionCompatibilityCheck
but don't say I didn't warn you!).`
while my kotlin version is currently at 1.5.21, with this in my root gradle file: classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21"
Jakub Doležal
09/21/2021, 11:23 AMModalBottomSheetLayout
. Clicking on Scrim
area above the modal doesn't close it.
According to a documentation a click should close it. Can you please confirm this is a bug?Joey
09/21/2021, 11:46 AMScrollableTabRowMinimumTabWidth
? Or do I have to copy the full implementation to make this change?Lilly
09/21/2021, 3:10 PMMichał Diner
09/21/2021, 4:05 PMcontent: @Composable ColumnScope.() -> Unit
in
content: @Composable () -> Unit
and invoking it in
AnimatedVisibility(...) {
content()
}
Cancels the ColumnScope?carbaj0
09/21/2021, 4:28 PMAsh
09/21/2021, 11:51 PMOG
09/22/2021, 5:31 AMjames
09/22/2021, 6:53 AMJoey
09/22/2021, 7:11 AMLuka
09/22/2021, 12:09 PMCicero
09/22/2021, 1:03 PMrajesh
09/22/2021, 2:49 PMorangy
09/22/2021, 3:20 PMdata class ShapeStroke(val width: Dp, val color: Color)
I want to write a function
fun <S> Transition<S>.animateShapeStroke() : State<ShapeStroke>
so that it would just add child animations for width and color and return State<ShapeStroke>
instance. What’s proper way to do this?Alexa_Gal
09/22/2021, 7:10 PMandroidTest
and im having some problems trying to mock the ViewController of my view, maybe im doing something working but i would like to test only the view without the view controller (i already have the Unit test for my view controller)
how would you do it using hilt and compose-navigation (HiltAndroidTest
)Ink
09/22/2021, 9:19 PMdefaultMinSize
to e.g. 40.dp it looks good but I don't want that big
Code in thread:Ink
09/22/2021, 9:19 PMdefaultMinSize
to e.g. 40.dp it looks good but I don't want that big
Code in thread:Chris Johnson
09/22/2021, 9:31 PMColton Idle
09/22/2021, 9:37 PMChris Sinco [G]
09/22/2021, 9:40 PMcontentAlignment = Alignment.Center
on the Box
ComposableInk
09/22/2021, 9:42 PMBox(contentAlignment= Alignment.Center,
modifier = Modifier
.background(Color.Black, shape = CircleShape)
.layout(){ measurable, constraints ->
val placeable = measurable.measure(constraints)
//get the current max dimension to assign width=height
val currentHeight = placeable.height
var heightCircle = currentHeight
if (placeable.width > heightCircle)
heightCircle = placeable.width
//assign the dimension and the center position
layout(heightCircle, heightCircle) {
// Where the composable gets placed
placeable.placeRelative(0, (heightCircle-currentHeight)/2)
}
}) {
Text(
text = questionIndex.toString(),
textAlign = TextAlign.Center,
color = Color.White,
modifier = Modifier.defaultMinSize(20.dp) //Use a min size for short text.
)
}
Text(
text = question.question,
fontFamily = DefaultFont,
fontWeight = FontWeight.Normal,
fontSize = 16.sp,
color = Color(0xFF1E1E1E),
modifier = Modifier.padding(start = 10.dp)
)
}
Canvas(modifier = Modifier.size(100.dp), onDraw = {
drawCircle(color = Color.Red)
})
Chris Sinco [G]
09/22/2021, 9:46 PMInk
09/22/2021, 9:48 PMChris Sinco [G]
09/22/2021, 9:50 PM@Preview
@Composable
fun SlackTest() {
Box(
contentAlignment= Alignment.Center,
modifier = Modifier
.background(Color.Black, shape = CircleShape)
.size(20.dp)
) {
Text(
text = "1",
textAlign = TextAlign.Center,
color = Color.White,
)
}
}
produces thisInk
09/22/2021, 9:56 PMChris Sinco [G]
09/22/2021, 9:56 PMCanvas
to do it, you can use drawText
Jeff
09/23/2021, 12:59 PMChris Sinco [G]
09/23/2021, 6:33 PMTin Tran
09/24/2021, 8:28 AM