Thread
#compose
    u

    Utkarsh Tiwari

    1 year ago
    How can I control the tint of a composable A from within Composable B, provided A is passed into B as a param?
    // Comment.kt 
    
    fun Comment(
    	enabled: Boolean = true,
    	actions: @Composable RowScope.() -> Unit
    )  {
    	actions()
    }
    
    enum class ActionIcon {
        REPORT,
        DELETE;
    }
    
    ActionIcon(
    	painter: Painter,
    	contentDescription: String? = null,
    	onClick: () -> Unit
    ) {
    	Icon(
    		modifier = Modifier.tint() // Want to control tint color here based on value of `enabled` 
    
    
    		)
    }
    
    // Screen.kt
    
    Row {
    	Comment(
    		enabled = true
    	) {
    		ActionIcon(
    			icon: ActionIcon = ActionIcon.DELETE
    			contentDescription = "This is delete button"
    		)
    
    		ActionIcon(
    			icon: ActionIcon = ActionIcon.REPORT
    			contentDescription = "This is report button"
    		)
    
    	}
    }