From ef7985c177c5ec6fe4d26559eca14c9f0b8bc69d Mon Sep 17 00:00:00 2001 From: pml68 Date: Tue, 22 Jul 2025 18:23:24 +0200 Subject: style: organize imports --- src/dialog.rs | 15 +++++---------- src/lib.rs | 5 ++--- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/dialog.rs b/src/dialog.rs index c944e72..840800f 100644 --- a/src/dialog.rs +++ b/src/dialog.rs @@ -1,14 +1,13 @@ //! Dialogs can be used to provide users with //! important information and make them act on it. -use iced_core::{ - self as core, Color, Element, Length, Padding, Pixels, alignment, color, -}; use iced_widget::{ Container, Row, Theme, column, container, mouse_area, opaque, stack, text, text::{Fragment, IntoFragment}, vertical_space, }; +use crate::core::{self, Color, Element, Length, Padding, Pixels, alignment}; + /// A message dialog. /// /// Only the content is required, [`buttons`] and the [`title`] are optional. @@ -513,11 +512,7 @@ impl Catalog for Theme { } fn default_container<'a>() -> ::Class<'a> { - Box::new(|theme| { - container::background( - theme.extended_palette().background.base.color, - ) - }) + Box::new(|theme| container::background(theme.palette().background)) } fn style(&self, class: &::Class<'_>) -> Style { @@ -526,8 +521,8 @@ impl Catalog for Theme { } /// The default style of a [`Dialog`]. -pub fn default(_theme: &Theme) -> Style { +pub fn default(_theme: &Theme) -> Style { Style { - backdrop_color: color!(0x000000, 0.3), + backdrop_color: core::color!(0x000000, 0.3), } } diff --git a/src/lib.rs b/src/lib.rs index ccf7da0..6f105de 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,9 +1,8 @@ #![doc = include_str!("../README.md")] pub mod dialog; pub use dialog::Dialog; -use iced_core as core; -use iced_core::alignment::Horizontal; use iced_widget::Button; +use iced_widget::core; use iced_widget::{container, text}; /// Creates a new [`Dialog`] with the given base and dialog content. @@ -37,7 +36,7 @@ where text(content) .size(14) .line_height(text::LineHeight::Absolute(core::Pixels(20.0))) - .align_x(Horizontal::Center), + .align_x(core::Alignment::Center), ) .on_press(message) .height(32) -- cgit v1.2.3