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

ShadBorder sides isn't merged #184

Closed
dickermoshe opened this issue Oct 31, 2024 · 4 comments · Fixed by #185
Closed

ShadBorder sides isn't merged #184

dickermoshe opened this issue Oct 31, 2024 · 4 comments · Fixed by #185
Labels
bug Something isn't working

Comments

@dickermoshe
Copy link
Contributor

dickermoshe commented Oct 31, 2024

Steps to reproduce

  1. Merge a ShadBorder with another ShadBorder

Expected results

  1. Get a mix of the 2

Actual results

It's completely replaced!

image

ShadBorder sides has a default of BorderSide.none instead of null, so a copyWith will result in these values getting replaced!

shadcn_ui version

0.14.1

Platform

MacOS, Windows, Linux, Android, iOS, Web

Code sample

Code sample
ShadInput(
placeholder: const Text('Search'),
decoration: ShadDecoration(
    focusedBorder: ShadBorder(
        radius: BorderRadius.circular(16)),
    border: ShadBorder(
        radius: BorderRadius.circular(16))),
)

Screenshots or Video

Screenshots / Video demonstration

Why is the border gone

Recording.2024-10-31.144225.mp4

Logs

Logs
N/A```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.24.3, on Microsoft Windows [Version 10.0.22631.4317], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.11.5)
[√] Android Studio (version 2023.1)
[√] VS Code, 64-bit edition (version 1.93.1)
[!] Proxy Configuration
    ! NO_PROXY does not contain ::1
[√] Connected device (3 available)
[√] Network resources

! Doctor found issues in 1 category.
@dickermoshe dickermoshe added the bug Something isn't working label Oct 31, 2024
@dickermoshe dickermoshe changed the title ShadBorder isn't merges ShadBorder isn't merged Oct 31, 2024
@dickermoshe dickermoshe changed the title ShadBorder isn't merged ShadBorder sides isn't merged Oct 31, 2024
@nank1ro
Copy link
Owner

nank1ro commented Oct 31, 2024

I was sure that I already addressed this issue. With ShadBorder.all do you have the same issue?

This is the default border of the input theme

border: ShadBorder.all(
  width: 2,
  color: colorScheme.border,
  radius: radius,
),

And if in the Input field I use border: ShadBorder.all(radius: BorderRadius.circular(50)) the radius is merged correctly.

@dickermoshe
Copy link
Contributor Author

This is a broader issue. merge() should only override explicitly set properties. So there can't be defaults on themes anywhere.
I'm gonna work on a PR which will resolve all of this. The package is littered with many instances of themes with defaults.

@dickermoshe
Copy link
Contributor Author

For this specifically, the merge is much more complex:
See the flutter code for BorderSide.merge.

https://github.com/flutter/flutter/blob/2da2332ad1be7ed6efc049155e1f47d1fde2276b/packages/flutter/lib/src/painting/borders.dart#L85-L106

@dickermoshe
Copy link
Contributor Author

dickermoshe commented Nov 1, 2024

#185

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 a pull request may close this issue.

2 participants