Use horizontal_space instead of empty text widget in gradient example

This commit is contained in:
Héctor Ramón Jiménez 2023-09-07 07:55:09 +02:00
parent 6ff2e48feb
commit d6be3ab682
No known key found for this signature in database
GPG key ID: 140CC052C94F138E

View file

@ -1,5 +1,5 @@
use iced::gradient; use iced::gradient;
use iced::widget::{column, container, row, slider, text}; use iced::widget::{column, container, horizontal_space, row, slider, text};
use iced::{ use iced::{
Alignment, Background, Color, Element, Length, Radians, Sandbox, Settings, Alignment, Background, Color, Element, Length, Radians, Sandbox, Settings,
}; };
@ -48,7 +48,7 @@ impl Sandbox for Gradient {
fn view(&self) -> Element<Message> { fn view(&self) -> Element<Message> {
let Self { start, end, angle } = *self; let Self { start, end, angle } = *self;
let gradient_box = container(text("")) let gradient_box = container(horizontal_space(Length::Fill))
.width(Length::Fill) .width(Length::Fill)
.height(Length::Fill) .height(Length::Fill)
.center_x() .center_x()