Remove Sandbox trait 🎉

This commit is contained in:
Héctor Ramón Jiménez 2024-03-17 13:46:52 +01:00
parent 9152904af1
commit 846d76cd3f
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
13 changed files with 169 additions and 240 deletions

View file

@ -10,7 +10,7 @@ pub fn main() -> iced::Result {
iced::application("Arc - Iced", Arc::update, Arc::view)
.subscription(Arc::subscription)
.theme(|_| Theme::Dark)
.antialiased()
.antialiasing(true)
.run()
}

View file

@ -4,7 +4,7 @@ use iced::{Alignment, Element, Length};
pub fn main() -> iced::Result {
iced::application("Bezier Tool - Iced", Example::update, Example::view)
.antialiased()
.antialiasing(true)
.run()
}

View file

@ -11,7 +11,7 @@ pub fn main() -> iced::Result {
iced::application("Clock - Iced", Clock::update, Clock::view)
.subscription(Clock::subscription)
.theme(Clock::theme)
.antialiased()
.antialiasing(true)
.run()
}

View file

@ -20,7 +20,7 @@ pub fn main() -> iced::Result {
)
.theme(ColorPalette::theme)
.default_font(Font::MONOSPACE)
.antialiased()
.antialiasing(true)
.run()
}

View file

@ -7,7 +7,7 @@ use iced::{Alignment, Command, Element, Length, Subscription};
pub fn main() -> iced::Result {
iced::application("Events - Iced", Events::update, Events::view)
.subscription(Events::subscription)
.ignore_close_request()
.exit_on_close_request(false)
.run()
}

View file

@ -1,22 +1,17 @@
use iced::application;
use iced::gradient;
use iced::widget::{
checkbox, column, container, horizontal_space, row, slider, text,
};
use iced::{gradient, window};
use iced::{
Alignment, Color, Element, Length, Radians, Sandbox, Settings, Theme,
};
use iced::{Alignment, Color, Element, Length, Radians, Theme};
pub fn main() -> iced::Result {
tracing_subscriber::fmt::init();
Gradient::run(Settings {
window: window::Settings {
transparent: true,
..Default::default()
},
..Default::default()
})
iced::application("Gradient - Iced", Gradient::update, Gradient::view)
.style(Gradient::style)
.transparent(true)
.run()
}
#[derive(Debug, Clone, Copy)]
@ -35,9 +30,7 @@ enum Message {
TransparentToggled(bool),
}
impl Sandbox for Gradient {
type Message = Message;
impl Gradient {
fn new() -> Self {
Self {
start: Color::WHITE,
@ -47,10 +40,6 @@ impl Sandbox for Gradient {
}
}
fn title(&self) -> String {
String::from("Gradient")
}
fn update(&mut self, message: Message) {
match message {
Message::StartChanged(color) => self.start = color,
@ -118,6 +107,12 @@ impl Sandbox for Gradient {
}
}
impl Default for Gradient {
fn default() -> Self {
Self::new()
}
}
fn color_picker(label: &str, color: Color) -> Element<'_, Color> {
row![
text(label).width(64),

View file

@ -16,7 +16,7 @@ pub fn main() -> iced::Result {
LoadingSpinners::update,
LoadingSpinners::view,
)
.antialiased()
.antialiasing(true)
.run()
}

View file

@ -14,7 +14,7 @@ pub fn main() -> iced::Result {
tracing_subscriber::fmt::init();
iced::application("Multitouch - Iced", Multitouch::update, Multitouch::view)
.antialiased()
.antialiasing(true)
.centered()
.run()
}

View file

@ -13,7 +13,7 @@ fn main() -> iced::Result {
SierpinskiEmulator::update,
SierpinskiEmulator::view,
)
.antialiased()
.antialiasing(true)
.run()
}

View file

@ -12,7 +12,7 @@ pub fn main() -> iced::Result {
VectorialText::view,
)
.theme(|_| Theme::Dark)
.antialiased()
.antialiasing(true)
.run()
}