Lawrence
08/18/2022, 6:38 PM// React
<Stepper activeStep={1}>
{steps.map((label) => (
<Step key={label}>
<StepLabel>{label}</StepLabel>
</Step>
))}
</Stepper>
// Compose
Stepper(Modifier.fillMaxSize(), step) {
steps.forEach { Step(Modifier.padding(15.dp, it) }
}
Implementation in threadTolriq
08/18/2022, 8:13 PMLandry Norris
08/18/2022, 9:00 PMLilly
08/18/2022, 9:22 PMSterling Albury
08/19/2022, 1:57 AMAlex Vanyo
08/19/2022, 4:04 AMStylianos Gakis
08/19/2022, 8:13 AMmovableContentOf()
, got an issue where the state does not persist when (I think) I’m using the content normally on one end, and inside a SubComposeLayout on the other call site. More details in Thread 🧵Michael Flathe
08/19/2022, 11:27 AMLazyVerticalGrid
is really bad. Our Composables are pretty simple. We assign a key to every item and have only one contentType
yet it's still lagging noticeably. For the scrolling we are using LazyGridState#animateScrollToItem
(no real difference when using LazyGridState#animateScrollBy
or a release build with R8 enabled).
Any idea how the scroll performance can be improved or is this just like it is with compose these days? Following a video showing a "full page" scroll. (1.2.1 of compose-ui is used)dazza5000
08/19/2022, 3:39 PMViewCompat.setAccessibilityDelegate(login_text_view_as_button_with_role,
object : AccessibilityDelegateCompat() {
override fun onInitializeAccessibilityNodeInfo(v: View, info: AccessibilityNodeInfoCompat) {
super.onInitializeAccessibilityNodeInfo(v, info)
info.roleDescription = "Button"
}
})
AmrJyniat
08/19/2022, 4:41 PMsealed class LoginUiState
data class LoginEmailUiState(val email: String = ""): LoginUiState()
data class ResetPasswordUiState(val email: String = ""): LoginUiState()
.....
Each class represent a page, then I hide\ show the proper page based on MutableStateFlow in VM like so:
val properUiState = MutableStateFlow<LoginUiState>(LoginEmailUiState())
fun setUiState(newUiState: LoginUiState){
uiStateSealed.value = newUiState
}
Then produce the UiState with its updated value like so:
val uiState = properUiState.map {
when(it){
is LoginEmailUiState -> combine(
email, password, rememberLogin
) { em, pass, rememberLog ->
LoginEmailUiState(em, pass, rememberLog)
}
is ResetPasswordUiState -> email.map {
ResetPasswordUiState(it)
}
....
}
}.flatMapLatest { it }.stateIn(viewModelScope, LoginUiState())
Last thing I collect the uiState
from compose and represent the proper ui based on its value like so:
@Composable
fun Container(loginUiState: LoginUiState){
Card{
when (loginUiState) {
is LoginEmailUiState -> {
LoginEmailContainer(loginUiState)
}
is ResetPasswordUiState -> {
ResetPasswordContainer(loginUiState)
}
...
}
}
}
Colton Idle
08/19/2022, 5:03 PMLandry Norris
08/19/2022, 6:02 PMExposedDropDownMenu
, AndroidMenu
, ExposedDropDownMenuPopup
, and Menu
and explicitly handle the case where the popup background should have alpha. Is this a bug in Compose, where I should contribute the ‘fix’, or is this expected behavior? For reference, if you set Modifier.background to a color with alpha on ExposedDropDownMenu, you can see there is always an opaque white background applied behind.Alex Styl
08/20/2022, 6:24 PMdan.the.man
08/20/2022, 9:19 PM@Composable
fun showList(actions:MutableSharedFlow<Action>){
val scope = rememberCoroutineScope()
Box(contentAlignment = Alignment.Center) {
Column(Modifier.clickable {
scope.launch { actions.emit(NewEvent())}
This works, but if I navigate back to the page, and repeat the action, the event fires 2x, and then 3x if I navigate back etc. What am I missing here? Changing it to a method that's passed in instead of creating a lambda results in what I'd expect
@Composable
fun showList(actions:(Action) -> Unit){
val scope = rememberCoroutineScope()
Box(contentAlignment = Alignment.Center) {
Column(Modifier.clickable {
actions(NewEvent())
^ that works, I guess it has to do with stable?adjpd
08/21/2022, 3:17 AMOleksandr Balan
08/21/2022, 9:03 AModay
08/21/2022, 12:48 PModay
08/21/2022, 1:58 PMMarko Novakovic
08/21/2022, 3:39 PMPager
to represent calendar view. Every month is separate page. Problem I have is with selecting date. Am exposing selected date from state object. When I select new date every page of Pager
recomposes, HorizontalPager
content
lambda is called again for every page, and that creates really bad UI junk. How can I avoid that?Jasmin Fajkic
08/21/2022, 4:52 PMCompositionLocalProvider
that provides navcontroller so that i do not need to pass navcontroller from parent down to child composable?adjpd
08/21/2022, 10:48 PMTextField
at the bottom of the screen in a LazyColumn
the keyboard popups up momentarily, and then quickly disappears: you can't then enter input. Is this a known issue? Code in 🧵.Zoltan Demant
08/22/2022, 3:53 AMModifier.blur
seems like the way to go, but Im also trying to support this effect all the way down to API 21. Has anyone had any success with alternative approaches?nuhkoca
08/22/2022, 8:06 AMstartDestination
dynamically based on a flag. However, btAppGraph
doesn’t recompose it after the initial value. How do I do it?
val isManager by viewModel.isManager.collectAsStateWithLifecycle()
private fun NavGraphBuilder.btAppGraph(
appState: BTAppState,
isManager: Boolean
) {
...
navigation(
route = Screen.Home.route,
startDestination = if (isManager) HomeSections.TaskApproval.route else HomeSections.Tasks.route
) {
addHomeGraph(appState)
}
}
Stylianos Gakis
08/22/2022, 8:15 AMefemoney
08/22/2022, 8:23 AMColumn
? Like my entire column content was divided into sections and I want to draw a bg behind some of those childrenCan Korkmaz
08/22/2022, 9:59 AMjasu
08/22/2022, 10:09 AMabbic
08/22/2022, 12:25 PMviewmodel.events.observe { when (event) etc etc }
now my instinct is to have the events be a val on the uiState like
UiState(val event)
and then in the composition
SomeScreen(uiState) {
LaunchedEffect(uiState.event) {
when (event) etc etc
}
}
but this causes a problem where in livedata you could post the same event in a row multiple times and the observer would trigger each time.
i have to assume that if you copy the uiState and set the same event now the LaunchedEffect wont trigger. I can clear the event manually in the state each time, but the slight overhead makes me wonder if there's a better way to do it?Erfannj En
08/22/2022, 1:05 PMK Merle
08/22/2022, 1:40 PMText
composable, if word does not fit in the line, it goes to the next line. Is it possible to still leave the word in the same line and have that hard break of the word? Example:
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lore
m Ipsum has been the industry's standar
d dummy text ever since the 1500s.
K Merle
08/22/2022, 1:40 PMText
composable, if word does not fit in the line, it goes to the next line. Is it possible to still leave the word in the same line and have that hard break of the word? Example:
Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lore
m Ipsum has been the industry's standar
d dummy text ever since the 1500s.
Zach Klippenstein (he/him) [MOD]
08/22/2022, 1:48 PMK Merle
08/22/2022, 3:32 PMRick Regan
08/22/2022, 7:11 PMAlex Vanyo
08/22/2022, 11:51 PMval sourceText = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s."
val modifiedText = sourceText.toList().joinToString("\u200B")
Text(modifiedText)
Rick Regan
08/22/2022, 11:59 PM" \u200B"
instead of "\uFEFF"
in my code I don’t get the non-breaking behavior.Alex Vanyo
08/23/2022, 12:04 AM\uFEFF
also works for me, although the Wikipedia article says that one is deprecated?\u2060
also works. I’m just trying all of these out for fun, not sure how supported this is or if this is a reasonable approach. There’s also TransformedText
and VisualTransformation
, which might be the correct thing to do for something like thisRick Regan
08/23/2022, 1:01 AM\uFEFF
was deprecated! (Thanks.) Maybe I will switch to \u2060
, which appears to works as well.Text
uses, and at the time I experimented with all of them (a left or right parenthesis, for example, never caused a problem — and still don’t). Space, period, and forward slash were the three that I needed to insert the non-breaking space after. Now it appears only space requires it.
(I don’t know that I would remove the code in my app that inserts them, just to be safe — unless I got a definitive reason why the behavior changed.)TransformedText
as the better way to do this.K Merle
08/23/2022, 5:10 AMSiyamed
08/23/2022, 5:13 AMK Merle
08/23/2022, 5:17 AMRick Regan
08/23/2022, 12:49 PMText
. The use of the non-breaking space for the few problematic symbols was how I dealt with it. Having fewer symbols to account for is better in some sense, but still I’d like to know if it’s a bug or a feature.
I’ll see if I can figure out when it changed (I’m on the latest Compose and Material 3 currently, and API 33 for that matter).Siyamed
08/23/2022, 2:25 PMRick Regan
08/23/2022, 2:28 PMText
width) and not line breaking behavior of forward slash and period. Sorry for the false alarm.