Closed deepakjacob closed 1 month ago
Any help or suggestions would be greatly appreciated. Thank you!
The problem here is that you are building your component with a generic theme but then you are using a style function with the builtin iced::Theme
. You could probably make your style function assume the theme to be generic as well and then make sure that the generic theme as text_input::Catalog's Class implements From text_input::StyleFn. But that is really hard and probably completely unnecessary (also there would be no way to use the palette function then).
So the simpler way to fix this is to just use the builtin theme everywhere.
Change this line:
impl<Message, Theme> Component<Message, Theme> for UrlInput<Message>
where
Theme: text_input::Catalog + 'static,
Renderer: iced::advanced::Renderer,
to
impl<Message> Component<Message, iced::Theme> for UrlInput<Message>
where
Renderer: iced::advanced::Renderer,
Change this:
fn view(&self, _state: &Self::State) -> Element<'_, Self::Event, Theme, Renderer> {
to
fn view(&self, _state: &Self::State) -> Element<'_, Self::Event, iced::Theme, Renderer> {
And lastly change this:
impl<'a, Message, Theme> From<UrlInput<Message>> for Element<'a, Message, Theme>
where
Theme: text_input::Catalog + 'static,
Message: 'a,
{
to
impl<'a, Message> From<UrlInput<Message>> for Element<'a, Message, iced::Theme>
where
Message: 'a,
{
This should fix it.
That worked perfectly. Thank you @alex-ds13 for taking the time to provide the solution.
Is there an existing issue for this?
Is this issue related to iced?
What happened?
I have a component like the following. Note the from in the end, i.e., I am using the newest Iced API available in the master branch. I am not able to use the style(..) method for the text_input as the view method won't allow it. This is an "iced" component. The code is as follows:
The custom style function is as follows:
The url_input is used in the Application as follows:
What is the expected behavior?
Should be able to call
style(..)
without any issue whencomponent
api is used.Version
master
Operating System
Linux
Do you have any log output?