Kshitij Patil
10/24/2020, 7:21 AMKyant
10/24/2020, 7:28 AMWebComponent(
url = url.value,
webContext = webContext,
modifier = Modifier.keyInputFilter {
if (it.key == Key.Back) {
if (webContext.canGoBack()) {
webContext.goBack()
true
} else false
} else false
},
)
But I got exceptions
Exception dispatching finished signal.
Exception in MessageQueue callback: handleReceiveCallback
java.lang.IllegalStateException: KeyEvent can't be processed because this key input node is not active.
Afzal Najam
10/24/2020, 2:38 PMGrigorii Yurkov
10/24/2020, 5:02 PMView.INVISIBLE
analog exist?Mouaad
10/24/2020, 5:19 PMHitanshu Dhawan
10/25/2020, 2:03 AMvar
).
If I remove an item, then there is recomposition happening. How to handle such cases in compose?
ViewModel
class MenuViewModel : ViewModel() {
private val data = MenuRepository.getMenuData()
private val _menuItems = MutableLiveData(data.menuItems)
val menuItems: LiveData<List<MenuItem>> = _menuItems
fun incrementMenuItem(menuItem: MenuItem) {
_menuItems.value = _menuItems.value!!.apply { find { it == menuItem }!!.quantity++ }
}
}
In Composable function
val menuItems by viewModel.menuItems.observeAsState()
LazyColumnFor(
items = menuItems!!
) { menuItem ->
MenuItem(
menuItem = menuItem,
onIncrement = { viewModel.incrementMenuItem(menuItem) },
onDecrement = { viewModel.decrementMenuItem(menuItem) },
modifier = Modifier.padding(16.dp)
)
}
zoha131
10/25/2020, 11:33 AMModifier.fillParentMaxWidth()
for LazyItemScope
. I want my item to take 80% of the available width. It would be great to have similar API like fillMaxWidth(fraction: Float)
manueldidonna
10/25/2020, 3:05 PMModalBottomSheet
doesn't support nested scroll. I can't swipe on the list to slide up the sheetIssa
10/25/2020, 4:31 PMIssa
10/25/2020, 4:39 PMBox(modifier = Modifier.height(100.dp).width(100.dp).drawBehind {
HorizontalGradient(
0.0f to Color.Red,
0.5f to Color.Green,
1.0f to Color.Blue,
startX = 0.0f,
endX = 100.0f
)
})
Vsevolod Ganin
10/25/2020, 6:08 PMTextField
?Grigorii Yurkov
10/25/2020, 7:35 PM@Preview
workable with Composable functions with arguments? As I understand almost all arguments are data classes. Compiler can instantiate them using primary constructor. For example:
data class Post(
val title: String,
val description: String
)
Default instance for this class can be Post("Title", "Description")
. Same with Lists of data classes, but compiler can add index for each instance Post("Title №0", "Description №0")
, Post("Title №1", "Description №1")
, etc. So in most cases you don't need to create special preview composable functions or mess around with @PreviewParameter
. What do you think?AG
10/25/2020, 10:13 PMAfzal Najam
10/26/2020, 1:42 AMdrawShadow
modifier supposed to change the opacity of the whole Box?
Changing the 0.3f
opacity changes the opacity of the whole box and its contents. Simplified example:
@Composable
private fun StrangeButton() {
Box(
modifier = Modifier.then(
Modifier.drawShadow(
elevation = 4.dp,
opacity = 0.3f
)
).then(
Modifier.background(
color = Color.Green
)
)
) {
Image(
asset = Icons.Default.Person,
colorFilter = ColorFilter.tint(Color.White)
)
}
}
Irving
10/26/2020, 1:48 AMAfzal Najam
10/26/2020, 2:52 AMPrashant Priyadarshi
10/26/2020, 6:26 AMalorma
10/26/2020, 6:46 AMIrving
10/26/2020, 9:46 AMDavid Wadge
10/26/2020, 1:01 PMalorma
10/26/2020, 6:33 PMtry
inside a @Composable block?
@Composable
override fun build() {
try {
}
}
alorma
10/26/2020, 6:58 PMGabriel
10/26/2020, 7:45 PMe: androidx.compose.compiler.plugins.kotlin.IncompatibleComposeRuntimeVersionException: You are using an outdated version of Compose Runtime that is not compatible with the version of the Compose Compiler plugin you have installed. The compose compiler plugin you are using (version 1.0.0-alpha07) expects a minimum runtime version of 1.0.0-alpha07. The version of the runtime on the classpath currently is 0.1.0-dev16.
my versions are all the same
const val COMPOSE_VERSION = "1.0.0-SNAPSHOT"
implementation("com.github.skydoves:landscapist-glide:1.0.7")
implementation("androidx.navigation:navigation-compose:$COMPOSE_VERSION")
implementation("androidx.compose.runtime:runtime-livedata:$COMPOSE_VERSION")
implementation("androidx.compose.material:material:$COMPOSE_VERSION")
implementation("androidx.compose.ui:ui:$COMPOSE_VERSION")
implementation("androidx.ui:ui-tooling:$COMPOSE_VERSION")
and it's from a snapshot
maven("<https://androidx.dev/snapshots/builds/6924113/artifacts/repository>")
Afzal Najam
10/26/2020, 9:18 PMJeremy
10/26/2020, 10:14 PMjean pokou
10/26/2020, 10:21 PMCash Hsiao
10/27/2020, 4:53 AMBottomSheetScaffold
to implement bottom sheet behavior. In old BottomSheetBehavior
we have some middle states like STATE_DRAGGING
or STATE_HALF_EXPANDED
, however now the BottomSheetValue
have only Collapsed
and Expanded
. Is there any plan to implement additional states or other ways to deal with the middle states?Chethan
10/27/2020, 5:29 AM@Preview
@Composable
fun ConfirmationScreen() {
ConstraintLayout(
modifier = Modifier.fillMaxHeight().fillMaxWidth().background(Color.White)
) {
val (topBar, confirmationText, continueButton) = createRefs()
TopAppBarFlat(
topBarTitle = "Screen Title",
topBarColor = Color.White,
topBarLeftIcon = R.drawable.ic_back,
navigation = {
},
modifier = Modifier.constrainAs(topBar) {
top.linkTo(<http://parent.top|parent.top>)
}
)
Column(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
modifier = Modifier.fillMaxWidth().wrapContentHeight().constrainAs(confirmationText) {
bottom.linkTo(<http://continueButton.top|continueButton.top>)
centerVerticallyTo(parent)
}
) {
Image(
asset = imageResource(id = R.drawable.test),
modifier = Modifier.fillMaxWidth(0.5F)
)
Text(
text = "Screen Title.",
style = TextStyle(
color = Color.Black,
fontSize = 16.sp,
fontWeight = FontWeight.Bold,
textAlign = TextAlign.Center
),
fontSize = 14.sp,
color = Color.Black,
modifier = Modifier.padding(10.dp)
)
Text(
text = "Description....",
style = TextStyle(
color = Color.Black,
fontSize = 14.sp,
fontWeight = FontWeight.Normal,
textAlign = TextAlign.Center
),
fontSize = 14.sp,
color = Color.Black,
modifier = Modifier.padding(start = 50.dp, end = 50.dp)
)
}
Button(
onClick = {
},
modifier = Modifier.fillMaxWidth().padding(10.dp).preferredHeight(40.dp)
.constrainAs(continueButton) {
bottom.linkTo(parent.bottom)
},
backgroundColor = Color.Black
) {
Text(
text = "OK",
style = TextStyle(
color = Color.White,
fontSize = 16.sp,
fontWeight = FontWeight.Bold,
textAlign = TextAlign.Center
)
)
}
}
}
@Composable
fun TopAppBarFlat(
topBarTitle: String,
topBarColor: Color = Color.Black,
topBarLeftIcon: Int = R.drawable.ic_back,
navigation: () -> Unit,
modifier: Modifier = Modifier.fillMaxWidth()
) {
TopAppBar(
elevation = 0.dp,
title = { Text(text = topBarTitle) },
navigationIcon = {
IconButton(onClick = { navigation() }) {
Icon(vectorResource(topBarLeftIcon))
}
},
backgroundColor = topBarColor,
modifier = modifier
)
}
Kshitij Patil
10/27/2020, 6:39 AMColumn(Modifier.fillMaxSize()) {
Text("Dashboard will be here", Modifier.wrapContentSize(Alignment.Center))
}
is not workingPrashant Priyadarshi
10/27/2020, 7:06 AMProvideEmphasis(emphasis = EmphasisAmbient.current.medium)
it is giving compiler error EmphasisAmbient is not resolved
How to fix it