I want to ask what is the best way to do something...
I want to create a Composable ("view") to do a TimeLine (for example), and this will contains an icon, color and content for each "row"
But, what I'm not sure is... if each row has a title, what's the best way? make a composable function with lambda that returns a String?
What about icon? A lambda that returns an Asset?
Or instead, a composable lambda to allow user to customize the title / icon... so it will allow change the size of the icon etc...
TL;DR: What I'm not sure in compose is... how I allow customization of content with some constrained rules about style / size etc...
If i allow a lambda to build in a lambda the tittle of a row, how can i Make that all titles have the same color? or same alignement...
Not sure if I explained well..
11/09/2020, 11:31 AM
you can refer this video if you want a time line view.
. Don't know if that's what you meant by
11/09/2020, 11:32 AM
well, my question is more about... how allow custom composable with constraining styles / sizes...
11/09/2020, 11:57 AM
So, you mean right way user can customize your Composable custom views which are distributed as a library.
11/09/2020, 12:22 PM
how they can add content in my composable views, weith some "library" styling
i let them add content, but i want to control how that content is styled for example
Generally the most idiomatic and flexible way to accept custom child content is to accept a “slot” (a composable function). Since your composable is in full control of calling those functions, you can place whatever size constraints you wish on it, and wrap it with whatever theming ambients you wish (eg content color or text style).