Questions tagged [android-jetpack-compose-modifier]
14 questions
                    
                    4
                    
            votes
                
                0 answers
            
        Preview java.lang.NoSuchMethodError: androidx.compose.foundation.layout.SizeKt.fillMaxWidth$default
I started migrate our code to Compose and have problem with @Preview.
For example, when I use modifier.fillMaxWidth() without default param "fraction = 1f" I have render problem
java.lang.NoSuchMethodError: 'androidx.compose.ui.Modifier…
        
        Ihor
        
- 41
 - 5
 
                    2
                    
            votes
                
                1 answer
            
        Android Compose ModalBottomSheetLayout outside click
I want to catch event when user clicks outside of ModalBottomSheetLayout.
I wrapped ModalBottomSheetLayout with Box which is full size of the screen and set click listener. But Click listener only works when I click on the ModalBottomSheetLayout but…
        
        Rainmaker
        
- 10,294
 - 9
 - 54
 - 89
 
                    2
                    
            votes
                
                0 answers
            
        In Jetpack Compose, Does paddingFromBaseline alter the padding of a Text element?
@Composable
fun Sample(){
    val startPadding = 10.dp
    Column {
        Text(
            text = "sample text",
            modifier = Modifier
                .paddingFromBaseline(top = 30.dp)
                .padding(start = startPadding)
    …
        
        Kun.tito
        
- 165
 - 1
 - 7
 
                    2
                    
            votes
                
                0 answers
            
        How to create a lint warning like "Modifier parameter should be the first optional parameter"?
How to create a lint warning like this?
Lint Warning
I am clear on Why this warning is shown and how to fix it.
I am interested in understanding how this lint warning is created and is there a way to make a custom lint warning like this?
        
        Abhimanyu
        
- 11,351
 - 7
 - 51
 - 121
 
                    2
                    
            votes
                
                3 answers
            
        Scroll Two Lazy Scrollers Together
This question has been asked before, but in different forms, regarding some specific use cases, and so far there has been no answer. I finally got it working, so I am sharing this here, but this should not be marked as a duplicate since all the…
        
        Richard Onslow Roper
        
- 5,477
 - 2
 - 11
 - 42
 
                    1
                    
            vote
                
                1 answer
            
        Why is requiredSizeIn not the same as requiredWidthIn + requiredHeightIn with the same parameter values?
I have the below code
    LazyColumn(
        contentPadding = PaddingValues(all = 64.dp),
        verticalArrangement = Arrangement.spacedBy(16.dp),
    ) {
        item {
            Box(
                modifier = Modifier
                   …
        
        Elye
        
- 53,639
 - 54
 - 212
 - 474
 
                    1
                    
            vote
                
                2 answers
            
        How to add compose modifiers based on other surrounding views?
I am unable to get the expected results as shown in the picture below. There are 2 rules to follow
The horizontal line should not continue till the bottom text. Instead, it should just be the height of the right text (multiline).
Bottom text should…
        
        Navjot
        
- 1,202
 - 1
 - 11
 - 24
 
                    1
                    
            vote
                
                1 answer
            
        Jetpack compose merge two Modifier.clickable
I'm trying to design a modifier that can be used in composable where if you click, it'll automatically log something. e.g. Modifier.logClick = then(Modifier.clickable{ //log })
The problem here is that when users apply to composable that come with…
        
        Yao
        
- 709
 - 2
 - 11
 - 22
 
                    0
                    
            votes
                
                1 answer
            
        Jetpack Compose: swipeable anchors depend on the on size of the component
The documentation provides a sample of the swipeable modifier. However, the sample defines anchors with hardcoded values.
@OptIn(ExperimentalMaterialApi::class)
@Composable
private fun SwipeableSample() {
    val width = 96.dp
    val squareSize =…
        
        Hawklike
        
- 952
 - 16
 - 23
 
                    0
                    
            votes
                
                0 answers
            
        Conflict on using ParentDataModifiers together
I have a composable function like this:
    Column(
        modifier = Modifier.fillMaxSize()
    ) {
        Button(
            modifier = Modifier
                .wrapContentWidth()
                .align(Alignment.End),
            onClick =…
        
        Saman Sattari
        
- 3,322
 - 6
 - 30
 - 46
 
                    0
                    
            votes
                
                1 answer
            
        Restrict compose modifier that only accessible from my composable function
I have a composable function:
@Composable
fun GapText(
    modifier: Modifier,
    text: String,
) {
    Row(modifier = modifier) {
        Text(text = text)
        ...
    }
}
Now I want to create a modifier that only GapText can use:
fun…
        
        Saman Sattari
        
- 3,322
 - 6
 - 30
 - 46
 
                    0
                    
            votes
                
                0 answers
            
        detectTransformGestures detecting a second gesture (with zoom = 1f) after every gesture (when refactored to custom modifier)
I'm trying to refactor my code for a pinch/zoom functionality into a custom modifier. However, when I move the code to a custom modifier, the PointerInputScope.detectTransformGestures onGesture lambda (callback) is detecting a second gesture after…
        
        VIN
        
- 6,385
 - 7
 - 38
 - 77
 
                    0
                    
            votes
                
                1 answer
            
        Compose: 2 AppBars with different ScrollBehavior for single page
A "genius" designer wants a screen with 2 app-bars and different scroll behaviors. The top one should appear only when user scrolls till the begin of the screen, the second one should appear even when user scrolls back a little. I have attached a…
        
        Michael Abyzov
        
- 452
 - 1
 - 6
 - 16
 
                    0
                    
            votes
                
                1 answer
            
        Weird behaviour from Interactive Line in Cavnas
I created an interactive line, but that might be irrelevant. Even if there was no interaction, this renders unexpected results:-
@Composable
fun PowerClock() {
    var dynamicAngle by remember { mutableStateOf(90f.toRadians()) }
    val angle by…
        
        Richard Onslow Roper
        
- 5,477
 - 2
 - 11
 - 42