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

Ability to have theme overrides for a widget/container #4313

Merged
merged 53 commits into from
Feb 1, 2024

Conversation

andydotxyz
Copy link
Member

@andydotxyz andydotxyz commented Oct 13, 2023

As discussed at contributor meeting, API updated to simpler and less exposed info.
Does not include all widgets, that will be a follow-on PR.
Additional optimisations could follow to reduce time spent in setting/walking the list of overridden widget themes.

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.

Where applicable:

  • Public APIs match existing style and have Since: line.

@coveralls
Copy link

coveralls commented Oct 13, 2023

Coverage Status

coverage: 64.491% (-0.1%) from 64.619%
when pulling 4e2e24c on andydotxyz:feature/themewidgets
into 85644c2 on fyne-io:develop.

@andydotxyz andydotxyz marked this pull request as ready for review December 7, 2023 12:16
@andydotxyz
Copy link
Member Author

This isn't the whole codebase but it's the APIs and techniques required.
Done: Button, Label, Hyperlink.

Rather than drag on a large PR for much longer and get them all I'd like to land this one as soon as the API/code structure etc is approved and track remaining widgets in another issue with multiple PRs.

@andydotxyz
Copy link
Member Author

Edit, the ID update is easier - using the scope of different caches to simply prefix the IDs works quite well. Just working on how the import loop issue for ThemedResource may work for the ColorName to ensure the cache updates correctly if that value changes.

@Jacalz
Copy link
Member

Jacalz commented Jan 11, 2024

You might be able to change ColorName to be an alias to string and just use strings for any internal calls. Avoids some type of casting and should be a backwards compatible change.

@andydotxyz
Copy link
Member Author

The colour name type is already top level, it's being able to look up the new value that's a challenge.

I've realised there are two solutions:

  1. a top level interface "ThemedResource" that adds a lookup function the theme package can implement.

  2. the theme package can offer the entry point to allowing theme override for resources and they could extract a pointer to the colour name field for the cache to use.

I think 1 wins - 2 feels a little hacky for a reason I can't quite put my finger on.

@andydotxyz
Copy link
Member Author

Is this looking good now @dweymouth, @Jacalz ?

internal/cache/theme.go Outdated Show resolved Hide resolved
Jacalz
Jacalz previously approved these changes Jan 21, 2024
@andydotxyz
Copy link
Member Author

Thanks @Jacalz - very exciting :)

I think that @dweymouth has a bit of an outage but I'll wait a little longer in case they are back and have time to confirm the fix.

@dweymouth
Copy link
Contributor

Thanks @Jacalz - very exciting :)

I think that @dweymouth has a bit of an outage but I'll wait a little longer in case they are back and have time to confirm the fix.

Yep, still have intermittent internet access. Hopefully should be fully back online by end of tomorrow, but no guarantees. I will try to take a look at this later in the coming week

internal/cache/theme.go Show resolved Hide resolved
test/markup_renderer.go Outdated Show resolved Hide resolved
widget/button.go Outdated Show resolved Hide resolved
Jacalz
Jacalz previously approved these changes Feb 1, 2024
Copy link
Member

@Jacalz Jacalz left a comment

Choose a reason for hiding this comment

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

Approved with the requirement that an issue is opened as a blocker against v2.5.0 to make sure that the last remaining improvements are resolved before then.

@andydotxyz
Copy link
Member Author

Thanks @Jacalz I added #4596

@andydotxyz andydotxyz merged commit 3a34b21 into fyne-io:develop Feb 1, 2024
12 checks passed
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.

None yet

5 participants