Lucien Guimaraes
07/16/2021, 4:12 PMraenardev
07/16/2021, 5:25 PM@Composable
fun TextVerticalCenter() {
Row(verticalAlignment = CenterVertically, modifier = Modifier.background(Color.Black)) {
Box(
Modifier
.size(8.dp)
.background(Color.White)
)
Text(text = "Hello", color = Color.White, fontSize = 24.sp)
}
}
If you look at screenshots, you can see that the box is slightly off center to the top (Even when all letters are same height).
It is even more evident when looking at numbers.
Sorry if i missed it while searching slack, but so far it seems that we have to wait for some way to turn off font padding for that:
https://stackoverflow.com/questions/66126551/jetpack-compose-centering-text-without-font-paddingDominaezzz
07/16/2021, 9:41 PMdetectDragGestures
? Given that onDragStart
's position
parameter is not the one from the user's mouse down and instead the one after the "slop" movement. This makes is such that in any draggable region with multiple elements (LazyColumn
) you cannot determine which element the user intended to drag from.Colton Idle
07/16/2021, 11:07 PMms
07/17/2021, 2:55 AMBottomSheetScaffold
it closes right away
BottomSheetScaffold(
scaffoldState = bottomSheetScaffoldState,
sheetContent = {
LazyColumn {
items(count = 10) {
Text(
text = "Item $it",
modifier = Modifier.padding(vertical = 8.dp)
)
}
}
},
) {
Box(
modifier = Modifier.fillMaxSize().padding(it),
contentAlignment = Alignment.Center
) {
Button(
onClick = {
coroutineScope.launch {
bottomSheetScaffoldState.bottomSheetState.expand()
}
},
) {
Text(text = "Open sheet")
}
}
}
Jason Inbody
07/17/2021, 3:11 AMimport androidx.compose.runtime.savedinstancestate.savedInstanceState
and I didn't see any name changes from the update logs. Did this name change? The android studio also cant find it...Mjahangiry75
07/17/2021, 7:16 AMviewmodel
between two `composable`s ? and inject them using dagger-hilt
Abhishek Dewan
07/17/2021, 7:45 AMPeter Mandeljc
07/17/2021, 1:47 PMAlexander Suraphel
07/17/2021, 3:12 PMbody { font-family: .AppleSystemUIFont; font-size: 13;} ul li {list-style-type:circle;}androidx.compose.ui.tooling.preview.PreviewActivity is not an Activity subclass or alias
Jason Inbody
07/17/2021, 5:01 PMstruct SignInView : View {
@State var createAccount = false
@State var forgotPassword = false
var body: some View {
ZStack{
VStack(alignment: .center, spacing: 15) {
if(!createAccount && !forgotPassword){
Text("Sign In").font(.title).bold().foregroundColor(.white)
TextField("Email Address", text: self.$email)
}
if(createAccount){
Text("Create Account").font(.title).bold().foregroundColor(.white)
TextField("Email Address", text: self.$email)
SecureField("Password", text: self.$password)
SecureField("Confirm Password", text: self.$confirm)
Button(action: {self.createUserAccount()}) {
Text("Create Account")
}
} else if (forgotPassword) {
Text("Forgot Password").font(.title).bold().foregroundColor(.white)
TextField("Email Address", text: self.$email)
Button(action: {self.sendResetCode()}) {
Text("Email Reset Code")
}
TextField("Reset Code", text: self.$code)
Button(action: {self.resetPassword()}) {
Text("Reset Password")
}
}
}
}
}
Jason Inbody
07/17/2021, 5:03 PMJason Inbody
07/17/2021, 5:46 PMvar signInState by rememberSaveable { mutableStateOf("login") }
if(signInState == "login") {
Login(state = signInState)
}
I want to switch states by clicking the button like below
@Composable
fun Login(state: String) {
TextButton(
onClick = { state = "signup" },
colors = ButtonDefaults.textButtonColors(
backgroundColor = Color(0x00FFFFFF),
contentColor = Color.White,
disabledContentColor = Color(0x00FFFFFF),
),
) {
Text("Create Account")
}
}
and then I get an error on
onClick = { state = "signup" },
that says Val cannot be reassigned
James Black
07/17/2021, 5:58 PMStylianos Gakis
07/17/2021, 10:21 PMDominaezzz
07/18/2021, 12:04 AMval someBoolean = true // this is calculated
val translationSize = 100f // this is calculated
val animatedDelta by animateFloatAsState(if (someBoolean) 0.0f else 1.0f)
val value = if (someBoolean) {
animatedDelta * -translationSize
} else {
(1 - animatedDelta) * translationSize
}
Colton Idle
07/18/2021, 2:18 AMJason Inbody
07/18/2021, 3:00 AMJason Inbody
07/18/2021, 3:03 AMJeff
07/18/2021, 5:11 AMonClick
gets called every time without a click on the button 🤷🏾
var userEmail by remember { mutableStateOf("") }
var userPassword by remember { mutableStateOf("") }
Button(
text = "Log in",
onClick = {
viewModel.login(userEmail, userPassword)
}
)
Abhishek Dewan
07/18/2021, 6:56 AMAG
07/18/2021, 7:48 AMGagandeep
07/18/2021, 12:08 PMbuildFeatures {
compose = true
buildConfig = true
viewBinding = true
}
compileOptions {
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = Versions.java
targetCompatibility = Versions.java
}
kotlinOptions {
jvmTarget = Versions.java.name
}
composeOptions {
kotlinCompilerExtensionVersion = Versions.kotlinCompilerExtension
kotlinCompilerVersion = Kotlin.version
}
kotlin version 1.5.20
compose version 1.0.0-rc02Peter Mandeljc
07/18/2021, 4:25 PMCompositionLocal
for? Would it be a bad idea, to make a provider for ViewModel
?Alexander Suraphel
07/18/2021, 4:46 PMLazyColumn(modifier = modifier) {
for (name in names) {
Greeting(name = name)
Divider(color = Color.Black)
}
}
Peter Mandeljc
07/18/2021, 4:56 PM@HiltViewModel
class WorldViewModel @Inject constructor(): ViewModel() {
fun hello() {
}
}
@Composable
fun World(vm: WorldViewModel = hiltViewModel()) {
Continent(onClick = vm::hello)
}
@Composable
fun Continent(onClick: () -> Unit) {
Country(onClick)
}
@Composable
fun Country(onClick: () -> Unit) {
State(onClick)
}
@Composable
fun State(onClick: () -> Unit) {
Button(onClick = onClick) { }
}
ms
07/18/2021, 5:32 PMViewModel
?
2. Are there any plans for a library which suits better for Compose?
3. What is the recommended approach in your opinion?Alexander Suraphel
07/18/2021, 5:33 PMby
used instead of assignment at
var isSelected by remember { mutableStateOf(false) }
I’m following Google’s codelabAlexander Suraphel
07/18/2021, 5:39 PM.value
getter …rsktash
07/18/2021, 8:06 PMtransition.AnimatedContent
feature support child element animation/transition?rsktash
07/18/2021, 8:06 PMtransition.AnimatedContent
feature support child element animation/transition?Doris Liu
07/20/2021, 6:44 PM