nank1ro / flutter-shadcn-ui

shadcn-ui ported in Flutter. Awesome UI components for Flutter, fully customizable.
https://mariuti.com/shadcn-ui
MIT License
657 stars 42 forks source link

Button Issues #34

Closed dickermoshe closed 3 months ago

dickermoshe commented 4 months ago

I plan on going through each component and comparing it the materials implementation to see if anything is missing. If you rather me do this elsewhere please let me know, I will modify this issue as I find more things.

nank1ro commented 3 months ago

Thanks for this @dickermoshe 🙏

1: I don't find it neat. Let me explain why IMHO enabled is better.

onPressed: enabled ? func : null,

In the example above you have to use a ternary operator and it doesn't become very readable when the function is large.

enabled: enabled,
onPressed: func,

While in this example, you don't have to change the onPressed, but just change the enabled state. This is the same behaviour you have on HTML fields, and it's way more readable. Another reason is when I have a callback, something like onChanged<T>, when you pass null to disable it, Dart cannot automatically find what is T, which would become Object?, this happens in the select component for example. I just want to be consistent and I think this is the best approach. Let me know what you think

2 and 3: Will implement them