dokar3 / chiptextfield Goto Github PK
View Code? Open in Web Editor NEWEditable chip layout for Compose Multiplatform
License: Apache License 2.0
Editable chip layout for Compose Multiplatform
License: Apache License 2.0
i am using this libarary and to get chips in outlined textfields . (OutlinedChipTextFiled)
while using this with other compose outlined TextFields it get the focus when navigation to that form screen.
Trying to stop that from happening. as my top field are getting scrolled to bottom and get focused on OutlinedChipTextField().
Any Help/support/feedback on this -
FATAL EXCEPTION: main
Process: com.example.bluemail, PID: 23770
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/compose/ui/platform/LocalSoftwareKeyboardController;
It looks like the library only has Material 2 components. Any plans for Material 3?
Hello, I have a non-empty ChipTextField that I would like to auto focus when presented. I'm using code similar to this:
val state = rememberChipTextFieldState(initialSelectedLabels.map {
LabelChipView(it)
})
val focusRequester = remember { FocusRequester() }
ChipTextField(
state = state,
modifier = Modifier .focusRequester(focusRequester)
)
LaunchedEffect(Unit) {
focusRequester.requestFocus()
}
When I run this the text is focused in the first chip in the text field. Is there a way to pass the focus to the very end of the text field?
Hi, It would be nice if you could update the project to support KMP, probably it doesn't require much work since m3 is already supported there. From what I saw the only Android specific thing would be awaitFrame
Trying to use your ChipTextField
M3 composable with the latest alpha version of Compose Material3 (1.3.0-alpha04
) in my application results in the following runtime exception:
FATAL EXCEPTION: main
Process: com.edricchan.studybuddy.debug, PID: 15038
java.lang.NoSuchMethodError: No virtual method containerColor$material3_release(ZZLandroidx/compose/foundation/interaction/InteractionSource;Landroidx/compose/runtime/Composer;I)Landroidx/compose/runtime/State; in class Landroidx/compose/material3/TextFieldColors; or its super classes (declaration of 'androidx.compose.material3.TextFieldColors' appears in /data/app/~~vbA7OQNACTyE_6u8mGXFWA==/com.edricchan.studybuddy.debug-Bon-hhim6VYMu3d0aAH8JA==/base.apk)
at com.dokar.chiptextfield.m3.TextFieldColorsConverterKt$toChipTextFieldColors$1.backgroundColor(TextFieldColorsConverter.kt:38)
at com.dokar.chiptextfield.m3.OutlinedChipTextFieldKt.OutlinedChipTextField-oTzSxmA(OutlinedChipTextField.kt:273)
at com.dokar.chiptextfield.m3.OutlinedChipTextFieldKt.OutlinedChipTextField-oTzSxmA(OutlinedChipTextField.kt:186)
...
Looking at the source code, I believe this is because the containerColor
method that's used in the TextFieldColorsConverter.kt
file has since been made to return a Color
rather than a State<Color>
:
(I presume this change most likely landed in 1.3.0-alpha02, but there's no user-facing release note so I can't confirm that)
Not ready yet, but as always, it's open to contribute!
AGP 8.2.0 and the latest version of your library crashes at runtime while minify is enabled and debuggable disabled.
But seriously, why is reflection used in this library?
Non-fatal Exception: java.lang.NoSuchFieldException: No field focusedTextColor in class Landroidx/compose/material3/cd; (declaration of 'androidx.compose.material3.cd' appears in /data/app/~~T11x0NL06y8UFu6aZRE_2A==/eu.lepicekmichal.fooswars-uWw35dXM74BkibnmcsOXAQ==/base.apk)
at java.lang.Class.getDeclaredField(Class.java)
at com.dokar.chiptextfield.m3.TextFieldColorsConverterKt$textFieldColorsFields$2.invoke$field(TextFieldColorsConverter.kt:120)
at com.dokar.chiptextfield.m3.TextFieldColorsConverterKt$textFieldColorsFields$2.invoke(TextFieldColorsConverter.kt:122)
at com.dokar.chiptextfield.m3.TextFieldColorsConverterKt$textFieldColorsFields$2.invoke(TextFieldColorsConverter.kt:118)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at com.dokar.chiptextfield.m3.TextFieldColorsConverterKt.getTextFieldColorsFields(TextFieldColorsConverter.kt:118)
at com.dokar.chiptextfield.m3.TextFieldColorsConverterKt.readColors(TextFieldColorsConverter.kt:82)
at com.dokar.chiptextfield.m3.TextFieldColorsConverterKt.toChipTextFieldColors(TextFieldColorsConverter.kt:16)
at com.dokar.chiptextfield.m3.ChipTextFieldKt.ChipTextField-ssrxHw0(ChipTextField.kt:290)
at com.dokar.chiptextfield.m3.ChipTextFieldKt.ChipTextField-ssrxHw0(ChipTextField.kt:200)
(whoops, pressed Enter accidentally ๐ )
I'm currently making an app for a school project and using ChipTextField as it looks awesome!
The basic app is almost like the Inventory App Example from the Compose Tutorial.
Please keep in mind, I'm quite new to Kotlin / Jetpack Compose / Android development.
My code (Screen):
val chipState = rememberChipTextFieldState<Chip>()
var syncTags by remember { mutableStateOf(false) }
OutlinedChipTextField(
state = chipState,
onSubmit = {
syncTags = true
Chip(it)
},
enabled = enabled,
label = { Text(stringResource(R.string.form_field_tags_header)) },
)
DisposableEffect(chipState.chips, syncTags) {
if (syncTags) {
appointmentDetails.tags = chipState.chips.map { it.text }
syncTags = false
}
onDispose {
appointmentDetails.tags = chipState.chips.map { it.text }
}
}
My code (ViewModel):
data class AppointmentDetails(
val id: Int = 0,
val title: String = "",
val description: String = "",
val date: LocalDate = LocalDate.now(),
val time: LocalTime = LocalTime.now().noSeconds(),
var tags: List<String> = listOf()
)
My issue is, I want to have my tags all saved in the appointmentDetails.tags list. But as I didn't found out how to make that with the ChipTextFieldState, I had to ask ChatGPT, which came up with DisposableEffect. This works... kinda.
When entering stuff, it works! But when editing something (loading from the appointmentDetails.tags), it doesn't show anything.
So, my question: Is there a way to somehow keep the ChipTextFieldState in sync with the tags List?
Hello,
How can I control the maxLines
parameter, present in the TexField?
Thank you in advance.
The exception:
java.lang.NoSuchMethodError: No virtual method unbox-impl()Ljava/lang/Object; in class Landroidx/compose/ui/input/key/KeyEvent; or its super classes
at com.dokar.chiptextfield.BasicChipTextFieldKt$Input$4$1.invoke(BasicChipTextField.kt:612)
at androidx.compose.ui.input.key.KeyInputNode.onPreKeyEvent-ZmokQxo(KeyInputModifier.kt:81)
Caused by the wrong publish configuration.
Can't use this library on material 3 currently
In my app I am using material 3 only. I don't want to mix both material 3 and 2.
Currently, chips are handled by ChipTextFieldState internally.
Chips should come from outside like ViewModel.
Also there should be Events or Listeners while removing chips that is currently handled internally.
For example, LIKE TextField's value and onValueChanged design (unidirectional)
Bug occurs with implementation 'androidx.compose.ui:ui:1.5.1' and implementation 'io.github.dokar3:chiptextfield:0.6.0' downgrading to 0.5.0 vesions and 0.4.9 give no result.
FATAL EXCEPTION: main
Process: com.easemble, PID: 10236
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/compose/ui/platform/LocalSoftwareKeyboardController;
at com.dokar.chiptextfield.BasicChipTextFieldKt.BasicChipTextField-6hQAwQA(BasicChipTextField.kt:302)
at com.dokar.chiptextfield.OutlinedChipTextFieldKt.OutlinedChipTextField-oTzSxmA(OutlinedChipTextField.kt:274)
at com.dokar.chiptextfield.OutlinedChipTextFieldKt.OutlinedChipTextField-QSzSp5g(OutlinedChipTextField.kt:81)
at
com.easemble.screens.setYourProfileScreen.SetYourProfileScreenKt$SetYourProfileScreen$3$2$7.invoke(SetYourProfileScreen.kt:467)
at
com.easemble.screens.setYourProfileScreen.SetYourProfileScreenKt$SetYourProfileScreen$3$2$7.invoke(SetYourProfileScreen.kt:461)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:117)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.material.ExposedDropdownMenuKt.ExposedDropdownMenuBox(ExposedDropdownMenu.kt:135)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.