Are You Doing THIS Modifier Mistake In Jetpack Compose?

  Рет қаралды 43,385

Philipp Lackner

Philipp Lackner

Күн бұрын

Пікірлер: 46
@moisesvalera3597
@moisesvalera3597 Жыл бұрын
Can we have a video getting deep into SideEffects?, what a nightmare they have been for me
@Internet_Ghost-GA
@Internet_Ghost-GA Жыл бұрын
dude how amazing you are in programming . the way you write codes make me feel the programming is very very easy
@ashaluwalakazeem9063
@ashaluwalakazeem9063 Жыл бұрын
I was able to point out the problem before watching your explanation 😂😅. Thanks, Philip 🙏. I have learned many Android cool tips from you 😊.
@Detonat0r
@Detonat0r Жыл бұрын
I did exactly this mistake yesterday, and I faced the issue you described
@ruskiikoshka
@ruskiikoshka 8 ай бұрын
Learned this the hard way XD Nice tip.
@eelbaz1
@eelbaz1 Жыл бұрын
Great explanation. So, in this case, we should pass the background color as a parameter as well, in order to make the button reusable
@aza749
@aza749 Жыл бұрын
Could make a button class with a few templates of button that can be reused in different contexts
@ubersticks
@ubersticks Жыл бұрын
I know that passing a defaulted Modifier is good practice, but this always seemed to me like a very awkward "backdoor" since it is not clear what the caller is expected to modify. There is no clear expectation as opposed to the other function parameters.
@OrlanDroyd
@OrlanDroyd 3 ай бұрын
Clean 😎
@erickmutura8512
@erickmutura8512 9 ай бұрын
You see that onclick function behind you has been disturbing me for the last 6 hours I didn't know how to implement it since I wanted my cards to be clicked and you have helped me solve it also its midnight so I can sleep easy tonight so thanks and God bless
@AldrinMayor-ne5cd
@AldrinMayor-ne5cd Жыл бұрын
Thanks for this 💯💪
@mohancena8970
@mohancena8970 11 ай бұрын
Thanks philipp ❤
@pumaelgatosiberian5047
@pumaelgatosiberian5047 Жыл бұрын
Do we need wrap onclick in remember? Seems like we create new lambda every recompose
@september669
@september669 Жыл бұрын
It's needed, but there is a bug in the modifier.clickable due to which remember won't help
@manojmaheshwari
@manojmaheshwari 7 ай бұрын
Love jetpack compose
@UsamaThakurr
@UsamaThakurr Жыл бұрын
Can you please do a free KZbin course on Android Development with Jetpack Compose? I am sick and tired of using React Native I hate it
@PhilippLackner
@PhilippLackner Жыл бұрын
Already have a crash course 🤔
@UsamaThakurr
@UsamaThakurr Жыл бұрын
@@PhilippLackner yes I have watched it completely but I still am unclear and can't create simple projects your recent video on Roadmap of Android Development you suggested to create projects but I am really having a hard time since Jetpack Compose is still very new and also do I have to learn XML now that we have Jetpack Compose?
@vibovitold
@vibovitold Жыл бұрын
​@@UsamaThakurrin my opinion yes, because xml is still pretty common. And it's not like it's getting deprecated any time soon.
@nesletchimaew9209
@nesletchimaew9209 Жыл бұрын
I always have a size or height and width parameter in my reusables. I also have a class to calculate size using px, dp, sp or a combination of them
@vibovitold
@vibovitold Жыл бұрын
converting between pixels and Dp etc. is covered by Kotlin's standard libraries. your class is reinventing the wheel.
@nesletchimaew9209
@nesletchimaew9209 Жыл бұрын
@@vibovitold no it's not lol it is all depending on local density
@vibovitold
@vibovitold Жыл бұрын
@@nesletchimaew9209 yes, you obviously have to pass the density to the converter, eg. to the toPx function. that's why it's an extension function of the Density interface. it doesn't change the fact that it's already implemented. all you've got to do is something like with(LocalDensity.current) { someValueInDp.toPx() } and thta's it. if you've rolled out a custom class for such calculations, you're doing it wrong.
@Marcix456
@Marcix456 Жыл бұрын
Also, shouldn't modifier be passed at the end with .then(modifier) extension? Modifier is order sensitive, and passing a modifier at the beginning can break effects created by further extensions.
@vibovitold
@vibovitold Жыл бұрын
Exactly. With the current implementation you can't override the hardcoded background colour, for example. And what's worse, without looking into the actual implementation you will have no idea which attributes can, and which cannot be overridden by a modifier argument. Which makes for poor API.
@John-qt6qk
@John-qt6qk Жыл бұрын
Thanks
@jpdsah
@jpdsah Жыл бұрын
I think we can override the size params from callee
@kskfernando2945
@kskfernando2945 Жыл бұрын
What is that IDE theme? It's beautiful
@AmitJayant
@AmitJayant Жыл бұрын
I have asked this several times in his various videos. Didn't get the answer 😢
@ficc666
@ficc666 6 ай бұрын
​@@AmitJayantHe uses Xcode dark
@goodluck3409
@goodluck3409 Жыл бұрын
@ChrisAthanas
@ChrisAthanas Жыл бұрын
Modifier is supposed to be the first parameter in a composable
@davidesorcelli6873
@davidesorcelli6873 Жыл бұрын
First optional parameter of a composable function
@ChrisAthanas
@ChrisAthanas Жыл бұрын
@@davidesorcelli6873 yes Where else where that be used?
@davidesorcelli6873
@davidesorcelli6873 Жыл бұрын
@@ChrisAthanas I mean Modifier, in your composable function signature, should be the first optional parameter. In your first comment you said that should be the first parameter at all.
@purplehazer417
@purplehazer417 Жыл бұрын
'mistake' in your videos in not a suitable word :)
@PSK005
@PSK005 Жыл бұрын
✌️✌️
@BDCCN-NguyenKiemTan
@BDCCN-NguyenKiemTan 6 ай бұрын
Modifier hoisting
@warTag68
@warTag68 Жыл бұрын
This is not a bug its a design. The first time u will have to reuse this component you will just refactor 😂😂😂😂 Stop making trivial stuff sound very serious. None of us get stuff right the first time.
@Kanha0321
@Kanha0321 Жыл бұрын
What about MaterialTheme.colorScheme.primary
@BlueWhaleYT
@BlueWhaleYT Жыл бұрын
this one you said is material 3
@Internet_Ghost-GA
@Internet_Ghost-GA Жыл бұрын
dude how amazing you are in programming . the way you write codes make me feel the programming is very very easy
@manshalkhatri9289
@manshalkhatri9289 Жыл бұрын
Don't Do THIS Jetpack Compose Mistake
8:12
Philipp Lackner
Рет қаралды 21 М.
23 - NAVIGATION - Android Jetpack Compose
19:25
Mohsen Mashkour
Рет қаралды 14 М.
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 81 МЛН
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
THIS Compose-State Mistake Leads to Problems In Your Code
7:58
Philipp Lackner
Рет қаралды 47 М.
I built a DeepSeek R1 powered VS Code extension…
7:02
Beyond Fireship
Рет қаралды 536 М.
Kotlin Multiplatform vs Flutter: Which should we use?
4:42
Kei Fujikawa
Рет қаралды 29 М.
Jetpack Compose in a Nutshell
2:46
Philipp Lackner
Рет қаралды 44 М.
Nested scrolling | Jetpack Compose Tips
3:52
Android Developers
Рет қаралды 19 М.
Dagger-Hilt vs. Koin vs. Manual Dependency Injection - Pick THIS
21:27
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 81 МЛН