Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use a rounded corner decoration by default for ShadTabs to match the official shadcn implementation #203

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

helightdev
Copy link
Contributor

Comparing https://ui.shadcn.com/docs/components/tabs with https://flutter-shadcn-ui.mariuti.com/components/tabs/ shows the difference and I think it would be beneficial to adopt the original design because the sharp corners stand out quite a bit.

@helightdev
Copy link
Contributor Author

Just noticed that I should probably also change ShadDefaultThemeNoSecondaryBorderVariant

@helightdev helightdev marked this pull request as draft November 28, 2024 06:58
@nank1ro
Copy link
Owner

nank1ro commented Nov 28, 2024

Please enable the dart formatter otherwise I can't figure out what lines you changed.
For example in VScode you can setup it to run on file save.

Yes the no-secondary-border-variant must be adapted too, you can test it from the example providing disableSecondaryBorder to ShadThemeData

@nank1ro nank1ro added the bug Something isn't working label Nov 28, 2024
@helightdev
Copy link
Contributor Author

I did format it, but seemingly my ide formatter somehow did it differently than the command line formatter, I'll do that after changing the other file in the final commit.

@helightdev helightdev marked this pull request as ready for review November 28, 2024 15:42
@helightdev
Copy link
Contributor Author

Alright should be done now.

@@ -756,6 +756,9 @@ class ShadDefaultThemeNoSecondaryBorderVariant extends ShadThemeVariant {
tabForegroundColor: colorScheme.foreground,
tabSelectedForegroundColor: colorScheme.foreground,
tabSelectedShadows: ShadShadows.sm,
tabDecoration: ShadDecoration(
border: ShadBorder.all(radius: radius, width: 0),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the radius to 4
Screenshot 2024-12-02 at 10 41 38

As you can see in the image above, the default radius used by ui.shadcn.com is 4px.
0.5 rem = 8 px
8px - 4px = 4px

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checked the source code and it uses rounded-sm which is 2px.
https://github.com/shadcn-ui/ui/blob/805ed4120a6a8ae6f6e9714cbd776e18eeba92c7/apps/www/registry/default/ui/tabs.tsx#L32C66-L32C76

So the source code and what is rendered on the docs is different.
No idea of what is supposed to be the right value.
Probably 4px is more elegant than just 2px

@@ -728,6 +728,9 @@ class ShadDefaultThemeVariant extends ShadThemeVariant {
tabForegroundColor: colorScheme.foreground,
tabSelectedForegroundColor: colorScheme.foreground,
tabSelectedShadows: ShadShadows.sm,
tabDecoration: ShadDecoration(
border: ShadBorder.all(radius: radius, width: 0),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the radius to 4 as mentioned above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants