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

Error when trying to use a custom Theme with the text_editor widget #2187

Closed
2 tasks done
0x192 opened this issue Jan 8, 2024 · 2 comments
Closed
2 tasks done

Error when trying to use a custom Theme with the text_editor widget #2187

0x192 opened this issue Jan 8, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@0x192
Copy link
Contributor

0x192 commented Jan 8, 2024

Is there an existing issue for this?

  • I have searched the existing issues.

Is this issue related to iced?

  • My hardware is compatible and my graphics drivers are up-to-date.

What happened?

Contrary to other widgets, there is a trait bound error when trying to style the text_editor widget :

the trait `From<theme::TextEditor>` is not implemented for `iced::theme::TextEditor`

SSCCE : the official editor example with a custom Theme : https://github.com/0x192/iced/tree/fix/text_editor_style/examples/editor. All other widgets can be styled without issue.

I dug into widget/src/text_editor.rs and style/src/theme.rs but I didn't find any differences with other widgets that could explain the problem.

What is the expected behavior?

No error when using a custom Theme with the widget

Version

master

Operating System

Linux

Do you have any log output?

No response

@0x192 0x192 added the bug Something isn't working label Jan 8, 2024
@DaraJKong
Copy link

I recently encountered the same issue on the same version of Iced (master). I'm on Linux too.
The conditions are the same: I'm trying to use a TextEditor with a custom Theme.

@0x192
Copy link
Contributor Author

0x192 commented Jan 23, 2024

@DaraJKong

I tested again since #2209 has been merged and I managed to make it work by using my custom theme Type on every Element (since it's generic now)

mod theme;

use theme::Theme;

...
fn view(&self) -> Element<Message, Theme> {
...
}

Exhaustive example :
https://github.com/0x192/iced/tree/fix/text_editor_style/examples/editor/src

@0x192 0x192 closed this as completed Jan 23, 2024
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

No branches or pull requests

2 participants