Skip to content

Commit

Permalink
refactor: use generic theme when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 committed Jan 31, 2024
1 parent f7c6708 commit 9a05eea
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
8 changes: 5 additions & 3 deletions src/keyframes/button.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use self::iced_core::{widget::Id as IcedId, Element, Length, Padding, Renderer as IcedRenderer};
use crate::reexports::{iced_core, iced_widget, Theme};
use crate::reexports::{iced_core, iced_style, iced_widget};

use crate::keyframes::{as_f32, get_length, Repeat};
use crate::timeline::Frame;
Expand Down Expand Up @@ -36,13 +36,14 @@ impl Id {
}

/// Used by [`crate::anim!`] macro
pub fn as_widget<'a, Message, Renderer>(
pub fn as_widget<'a, Message, Theme, Renderer>(
self,
timeline: &crate::Timeline,
content: impl Into<Element<'a, Message, Theme, Renderer>>,
) -> iced_widget::Button<'a, Message, Theme, Renderer>
where
Renderer: IcedRenderer,
Theme: iced_style::button::StyleSheet,
{
Button::as_widget(self, timeline, content)
}
Expand Down Expand Up @@ -144,13 +145,14 @@ impl Button {
}
}

pub fn as_widget<'a, Message, Renderer>(
pub fn as_widget<'a, Message, Theme, Renderer>(
id: Id,
timeline: &crate::Timeline,
content: impl Into<Element<'a, Message, Theme, Renderer>>,
) -> iced_widget::Button<'a, Message, Theme, Renderer>
where
Renderer: IcedRenderer,
Theme: iced_style::button::StyleSheet,
{
let id: IcedId = id.into();

Expand Down
6 changes: 3 additions & 3 deletions src/keyframes/column.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::reexports::iced_core::{
widget::Id as IcedId, Length, Padding, Pixels, Renderer as IcedRenderer,
};
use crate::reexports::{iced_widget, Theme};
use crate::reexports::iced_widget;

use crate::keyframes::{as_f32, get_length, Repeat};
use crate::timeline::Frame;
Expand Down Expand Up @@ -39,7 +39,7 @@ impl Id {

/// Used by [`crate::anim!`] macro
#[must_use]
pub fn as_widget<'a, Message, Renderer>(
pub fn as_widget<'a, Message, Theme, Renderer>(
self,
timeline: &crate::Timeline,
) -> iced_widget::Column<'a, Message, Theme, Renderer>
Expand Down Expand Up @@ -149,7 +149,7 @@ impl Column {
}
}

pub fn as_widget<'a, Message, Renderer>(
pub fn as_widget<'a, Message, Theme, Renderer>(
id: Id,
timeline: &crate::Timeline,
) -> iced_widget::Column<'a, Message, Theme, Renderer>
Expand Down
6 changes: 3 additions & 3 deletions src/keyframes/row.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::reexports::iced_core::{
widget::Id as IcedId, Length, Padding, Pixels, Renderer as IcedRenderer,
};
use crate::reexports::{iced_widget, Theme};
use crate::reexports::iced_widget;

use crate::keyframes::{as_f32, get_length, Repeat};
use crate::timeline::Frame;
Expand Down Expand Up @@ -39,7 +39,7 @@ impl Id {

/// Used by [`crate::anim!`] macro
#[must_use]
pub fn as_iced_widget<'a, Message, Renderer>(
pub fn as_iced_widget<'a, Message, Theme, Renderer>(
self,
timeline: &crate::Timeline,
) -> iced_widget::Row<'a, Message, Theme, Renderer>
Expand Down Expand Up @@ -149,7 +149,7 @@ impl Row {
}
}

pub fn as_iced_widget<'a, Message, Renderer>(
pub fn as_iced_widget<'a, Message, Theme, Renderer>(
id: Id,
timeline: &crate::Timeline,
) -> iced_widget::Row<'a, Message, Theme, Renderer>
Expand Down
3 changes: 1 addition & 2 deletions src/keyframes/style_button.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::keyframes::{as_f32, get_length, Repeat};
use crate::reexports::iced_core::{widget, Element, Length, Padding, Renderer as IcedRenderer};
use crate::reexports::iced_style::button::StyleSheet;
use crate::reexports::Theme;

use crate::keyframes::{as_f32, get_length, Repeat};
use crate::timeline::{Frame, Interped};
use crate::{Ease, Linear, MovementType};

Expand Down
1 change: 0 additions & 1 deletion src/keyframes/toggler.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::reexports::iced_core::{text, widget::Id as IcedId, Renderer as IcedRenderer};
use crate::reexports::iced_widget;

use crate::keyframes::Repeat;
use crate::timeline::Frame;
Expand Down

0 comments on commit 9a05eea

Please sign in to comment.