Тёмный
No video :(

Are You Doing THIS Modifier Mistake In Jetpack Compose? 

Philipp Lackner
Подписаться 180 тыс.
Просмотров 34 тыс.
50% 1

Follow for more Android & Kotlin tips 🙌

Опубликовано:

 

6 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 44   
@moisesvalera3597
@moisesvalera3597 Год назад
Can we have a video getting deep into SideEffects?, what a nightmare they have been for me
@tracker_x1
@tracker_x1 Год назад
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 😊.
@erickmutura8512
@erickmutura8512 4 месяца назад
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
@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 8 месяцев назад
Could make a button class with a few templates of button that can be reused in different contexts
@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 10 месяцев назад
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.
@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.
@Detonat0r
@Detonat0r Год назад
I did exactly this mistake yesterday, and I faced the issue you described
@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
@ruskiikoshka
@ruskiikoshka 3 месяца назад
Learned this the hard way XD Nice tip.
@AldrinMayor-ne5cd
@AldrinMayor-ne5cd Год назад
Thanks for this 💯💪
@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.
@manojmaheshwari
@manojmaheshwari 3 месяца назад
Love jetpack compose
@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 9 месяцев назад
converting between pixels and Dp etc. is covered by Kotlin's standard libraries. your class is reinventing the wheel.
@nesletchimaew9209
@nesletchimaew9209 9 месяцев назад
@@vibovitold no it's not lol it is all depending on local density
@vibovitold
@vibovitold 9 месяцев назад
@@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.
@mohancena8970
@mohancena8970 6 месяцев назад
Thanks philipp ❤
@John-qt6qk
@John-qt6qk 11 месяцев назад
Thanks
@jpdsah
@jpdsah Год назад
I think we can override the size params from callee
@goodluck3409
@goodluck3409 Год назад
@purplehazer417
@purplehazer417 Год назад
'mistake' in your videos in not a suitable word :)
@UsamaThakurr
@UsamaThakurr Год назад
Can you please do a free RU-vid 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 10 месяцев назад
​@@UsamaThakurrin my opinion yes, because xml is still pretty common. And it's not like it's getting deprecated any time soon.
@BDCCN-NguyenKiemTan
@BDCCN-NguyenKiemTan 2 месяца назад
Modifier hoisting
@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 Месяц назад
​@@AmitJayantHe uses Xcode dark
@PSK005
@PSK005 Год назад
✌️✌️
@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 9 месяцев назад
this one you said is material 3
@tracker_x1
@tracker_x1 Год назад
dude how amazing you are in programming . the way you write codes make me feel the programming is very very easy
@manshalkhatri9289
@manshalkhatri9289 Год назад
Далее
ВОТ ЧТО МЫ КУПИЛИ НА ALIEXPRESS
11:28
Просмотров 604 тыс.
Full Guide to Jetpack Compose Effect Handlers
24:56
Просмотров 92 тыс.
Nothing is really cool in Kotlin
7:43
Просмотров 4 тыс.
Gestures in Jetpack Compose
31:33
Просмотров 23 тыс.
Bottom Navigation with Jetpack Compose
15:29
Просмотров 52 тыс.
Most overpowered way to build mobile apps?
8:33
Просмотров 785 тыс.
Navigation In Jetpack Compose - Android
21:45
Просмотров 10 тыс.