Skip to content

SidebarItems section header#543

Merged
Adrian-Samoticha merged 14 commits intomacosui:devfrom
whirlun:section_header
Jan 14, 2025
Merged

SidebarItems section header#543
Adrian-Samoticha merged 14 commits intomacosui:devfrom
whirlun:section_header

Conversation

@whirlun
Copy link
Contributor

@whirlun whirlun commented Jan 7, 2025

Add an additional section parameter to SidebarItem to convert it into an unclickable widget so it can be used as a section header. It may be better to design a dedicated Section widget for this task but this workaround works well for me now.
Capture d’écran, le 2025-01-07 à 3 32 48 p m

Pre-launch Checklist

  • I have incremented the package version as appropriate and updated CHANGELOG.md with my changes
  • I have added/updated relevant documentation
  • I have run "optimize/organize imports" on all changed files
  • I have addressed all analyzer warnings as best I could

@Adrian-Samoticha
Copy link
Member

Thanks. Does this support headers that allow the user to fold the content like native headers do:

Screen.Recording.2025-01-08.at.14.44.51.mov

And if not, do you think it can be added to your solution easily?

@whirlun
Copy link
Contributor Author

whirlun commented Jan 8, 2025

Thanks. Does this support headers that allow the user to fold the content like native headers do:

Screen.Recording.2025-01-08.at.14.44.51.mov

Sure, I've added this functionality by reusing disclosureItems. Now if section is true and disclosureItems is not null it will have the ability to expand.

Enregistrement.d.ecran.le.2025-01-08.a.1.02.26.p.m.mov

@Adrian-Samoticha
Copy link
Member

Wow, that’s great! I’ll review this PR soon.

@Adrian-Samoticha Adrian-Samoticha merged commit e174dd7 into macosui:dev Jan 14, 2025
This was referenced Jan 14, 2025
).withValues(alpha: 0.6);
);

barrierColor = Color.fromRGBO((barrierColor.r * 255).floor(),
Copy link

Choose a reason for hiding this comment

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

@Adrian-Samoticha Can you please explain why this code would be different from the withValues(alpha:) before?

I can't see how this would not result in the same color, but maybe I am missing something.

Gave this a quick spin in DartPad to verify, but I always end up with the same color in either approach 🤔

CleanShot 2025-01-16 at 08 55 47@2x

Copy link
Member

Choose a reason for hiding this comment

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

@tp I don’t remember the details, but if I recall correctly, barrierColor wasn’t a standard Color object in this case, but some object that inherited from Color and whose actual color value was resolved at runtime. It was actually correctly resolved (as in, it was resolved to some object that had a property that held the correct value), but was still rendered incorrectly (it was white even in dark mode).

I just forced it to be a standard Color object that is easier to reason about to make sure that it produces the correct color regardless of the app’s current light/dark-mode setting. There may have been a better way to go about this, but this was I believe the simplest approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants