Modifying the behavior of composable functions
Unlike components in traditional imperative UI frameworks, composable functions do not share a basic set of properties. They also do not automatically (in the sense of inheriting) reuse functionality. This must be done explicitly by calling other composables. Their visual appearance and behavior can be controlled through parameters, modifiers, or both. In a way, modifiers pick up the idea of properties in a component but enhance it—unlike properties of components, modifiers can be used completely at the discretion of the developer.
You have already seen quite a few modifiers in my examples, such as the following:
width()
fillMaxWidth()
fillMaxSize()
These control the width and size of the corresponding UI element.
background()
can set a background color and shape, while clickable {}
allows the user to interact with the composable function by clicking on the UI element. Jetpack Compose provides an extensive...