Simplify theming for Button widget
This commit is contained in:
parent
db92e1c942
commit
f4a4845ddb
16 changed files with 306 additions and 412 deletions
|
|
@ -1,7 +1,6 @@
|
|||
use iced::alignment::{self, Alignment};
|
||||
use iced::theme;
|
||||
use iced::widget::{
|
||||
checkbox, column, container, horizontal_space, image, radio, row,
|
||||
button, checkbox, column, container, horizontal_space, image, radio, row,
|
||||
scrollable, slider, text, text_input, toggler, vertical_space,
|
||||
};
|
||||
use iced::widget::{Button, Column, Container, Slider};
|
||||
|
|
@ -56,18 +55,17 @@ impl Sandbox for Tour {
|
|||
fn view(&self) -> Element<Message> {
|
||||
let Tour { steps, .. } = self;
|
||||
|
||||
let controls = row![]
|
||||
.push_maybe(steps.has_previous().then(|| {
|
||||
button("Back")
|
||||
.on_press(Message::BackPressed)
|
||||
.style(theme::Button::Secondary)
|
||||
}))
|
||||
.push(horizontal_space())
|
||||
.push_maybe(
|
||||
steps
|
||||
.can_continue()
|
||||
.then(|| button("Next").on_press(Message::NextPressed)),
|
||||
);
|
||||
let controls =
|
||||
row![]
|
||||
.push_maybe(steps.has_previous().then(|| {
|
||||
padded_button("Back")
|
||||
.on_press(Message::BackPressed)
|
||||
.style(button::secondary)
|
||||
}))
|
||||
.push(horizontal_space())
|
||||
.push_maybe(steps.can_continue().then(|| {
|
||||
padded_button("Next").on_press(Message::NextPressed)
|
||||
}));
|
||||
|
||||
let content: Element<_> = column![
|
||||
steps.view(self.debug).map(Message::StepMessage),
|
||||
|
|
@ -676,8 +674,8 @@ fn ferris<'a>(
|
|||
.center_x()
|
||||
}
|
||||
|
||||
fn button<'a, Message: Clone>(label: &str) -> Button<'a, Message> {
|
||||
iced::widget::button(text(label)).padding([12, 24])
|
||||
fn padded_button<'a, Message: Clone>(label: &str) -> Button<'a, Message> {
|
||||
button(text(label)).padding([12, 24])
|
||||
}
|
||||
|
||||
fn color_slider<'a>(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue