Fudge
05/15/2019, 11:11 AMdp
, why can't I just put a number, instead of doing <number>.dp
?
What is the deal with the +
operator (in style = +themeTextStyle { subtitle1 }
for example) ? I've read the documentation about it, but I still don't understand the need for it.ribesg
05/15/2019, 11:16 AMdp
?Fudge
05/15/2019, 11:24 AMDP
miha-x64
05/15/2019, 12:07 PMFudge
05/15/2019, 12:37 PMdp
btwmiha-x64
05/15/2019, 12:41 PMnumber.dp
expression?Fudge
05/15/2019, 12:45 PMDP
😁Component APIs specify their
* dimensions such as line thickness in DP with Dp objects.
* IMPORTANT:
* This global operator is TEMPORARY, and should be removed whenever an answer for contextual composers is reached. At that time, the
* unaryPlus operator on the composer itself is the one that should be used.
Hmm, I'm thinking the unary plus syntax won't be a thing in the future then?Leland Richardson [G]
05/15/2019, 4:02 PMInt
as the type, then there is no compiler help to tell you what kind of units it’s expecting, and you have to rely on, say, the parameter name: widthInPx: Int
ragunathjawahar
05/15/2019, 4:13 PM+
operator. Because, most of the time code becomes hard to understand and maintain because we mix logic and effects. The +
operator visibly makes a distinction and helps identify an effect. This has added benefits during code reviews and architecture. Whenever, I see an effect I could use the visual cue to ensure that the effect does just one thing. And also ensure that my effect does not have business logic in it. (i.e.) My state gets updated outside the effect.Fudge
05/15/2019, 4:19 PMpx
? I come from Flutter where that is not even a conceptLeland Richardson [G]
05/15/2019, 4:24 PM+
. It’s strange at first, but having a visual clue to tell you when something different is going on can be a good thingEffect
special are pretty darn similar to what make @Composable
special, and i’m trying to unify them (though we are still thinking that maybe they need to be a little bit different)ragunathjawahar
05/15/2019, 4:28 PMFudge
05/15/2019, 4:28 PMLeland Richardson [G]
05/15/2019, 4:30 PMragunathjawahar
05/15/2019, 4:32 PMText
to a composable function that is an effect? I feel that the lines are getting blurry if the API tends to move towards that direction.Leland Richardson [G]
05/15/2019, 4:37 PMromainguy
05/15/2019, 5:36 PMGeorge Mount
05/16/2019, 2:40 PMFudge
05/16/2019, 3:25 PMromainguy
05/16/2019, 3:26 PMFudge
05/16/2019, 3:29 PMwidth = 10
when meaning dp
, width = 10.px
when meaning px
and width = 10.sp
when meaning sp
.
If 99% of use cases are dp
then that makes .dp
boilerplate in my opinion.romainguy
05/16/2019, 4:04 PMwidth = 10
I think it would be a bad idea to go this waymiha-x64
05/16/2019, 7:26 PMinterface Dimen
inline class Px : Dimen
inline class Dp : Dimen
inline class Sp : Dimen
Leland Richardson [G]
05/16/2019, 7:42 PMromainguy
05/16/2019, 7:45 PMmiha-x64
05/16/2019, 8:58 PMLeland Richardson [G]
05/16/2019, 10:13 PMDimen
interface goes away. any function with width: Dimen
would represent an upcastInt
to represent Dp or Px and classes for the less common ones is a bad idea… it just has trade offs like romain mentioned, and we are trying to navigate those thoughtfully