Center items in counter example

This commit is contained in:
Héctor Ramón Jiménez 2020-01-22 11:21:16 +01:00
parent b0515c1dd5
commit 3124450aff

View File

@ -1,4 +1,4 @@
use iced::{button, Button, Column, Element, Sandbox, Settings, Text}; use iced::{button, Align, Button, Column, Element, Sandbox, Settings, Text};
pub fn main() { pub fn main() {
Counter::run(Settings::default()) Counter::run(Settings::default())
@ -42,6 +42,7 @@ impl Sandbox for Counter {
fn view(&mut self) -> Element<Message> { fn view(&mut self) -> Element<Message> {
Column::new() Column::new()
.padding(20) .padding(20)
.align_items(Align::Center)
.push( .push(
Button::new(&mut self.increment_button, Text::new("Increment")) Button::new(&mut self.increment_button, Text::new("Increment"))
.on_press(Message::IncrementPressed), .on_press(Message::IncrementPressed),