Iced: Decouple built-in widgets from their style

Created on 5 Sep 2019  路  5Comments  路  Source: hecrj/iced

Some of the built-in widgets have part of their style hard-coded, like height.

We should be able to move this logic into the Renderer trait of each widget. Now, there are different ways of doing this:

  • constants, like Renderer::HEIGHT
  • simple methods, like Renderer::height
  • a single complex method to decorate a provided style, like Renderer::style

We should think about the pros and cons of each before proceeding. Also, feel free to suggest new ideas!

feature help wanted

All 5 comments

"Constants" and "simple methods" both assume the fields that a renderer is allowed to decorate. It's possible that a back-end has some sort of weird requirement, on colors or size for example.

In my opinion, the most flexible solution is to provide a decorator for a provided style on each renderer.

Do you want me to have a go at implementing this ?

At first, the built-in widgets were meant to be more of a guideline to build your own custom toolkit. However, I am currently in the middle of some redesign that will affect this (widgets won't contain a direct Style), and I think providing reusable and flexible built-in widgets will be very valuable, as you say.

Do you want me to have a go at implementing this ?

I am already working on this, but I really appreciate the will to help! I will open a PR soon, I'd be glad to receive your feedback there.

As soon as the PR is opened, be sure to reference it here so I get the notification by mail. I will gladly review it :)

@AlisCode Sorry for the delay! The last couple of weeks have been pretty intense for me :)

I have opened a PR that should tackle this issue: #17. There are a lot of changes there, as I have been redesigning the crate a bit. Let me know if you have any questions!

I have been busy too but I now have time ; I will read the PR and give you some comments :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jiminycrick picture jiminycrick  路  3Comments

Plecra picture Plecra  路  4Comments

aentity picture aentity  路  3Comments

aentity picture aentity  路  4Comments

Charles-Schleich picture Charles-Schleich  路  3Comments