Implement padding support for Container
This commit is contained in:
parent
6e9ab1cd6f
commit
749a9588d7
7 changed files with 46 additions and 21 deletions
|
|
@ -66,6 +66,7 @@ impl Application for Clock {
|
|||
Container::new(canvas)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill)
|
||||
.padding(20)
|
||||
.center_x()
|
||||
.center_y()
|
||||
.into()
|
||||
|
|
|
|||
|
|
@ -106,11 +106,10 @@ impl Sandbox for Example {
|
|||
.on_resize(Message::Resized)
|
||||
.on_key_press(handle_hotkey);
|
||||
|
||||
Column::new()
|
||||
Container::new(pane_grid)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill)
|
||||
.padding(10)
|
||||
.push(pane_grid)
|
||||
.into()
|
||||
}
|
||||
}
|
||||
|
|
@ -213,9 +212,10 @@ impl Content {
|
|||
.push(Text::new(format!("Pane {}", id)).size(30))
|
||||
.push(controls);
|
||||
|
||||
Container::new(Column::new().padding(5).push(content))
|
||||
Container::new(content)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill)
|
||||
.padding(5)
|
||||
.center_y()
|
||||
.style(style::Pane {
|
||||
is_focused: focus.is_some(),
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ enum Error {
|
|||
|
||||
impl From<reqwest::Error> for Error {
|
||||
fn from(error: reqwest::Error) -> Error {
|
||||
dbg!(&error);
|
||||
dbg!(error);
|
||||
|
||||
Error::APIError
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use iced::{Column, Container, Element, Length, Sandbox, Settings, Svg};
|
||||
use iced::{Container, Element, Length, Sandbox, Settings, Svg};
|
||||
|
||||
pub fn main() {
|
||||
env_logger::init();
|
||||
|
|
@ -23,18 +23,17 @@ impl Sandbox for Tiger {
|
|||
fn update(&mut self, _message: ()) {}
|
||||
|
||||
fn view(&mut self) -> Element<()> {
|
||||
let content = Column::new().padding(20).push(
|
||||
Svg::new(format!(
|
||||
"{}/resources/tiger.svg",
|
||||
env!("CARGO_MANIFEST_DIR")
|
||||
))
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill),
|
||||
);
|
||||
let svg = Svg::new(format!(
|
||||
"{}/resources/tiger.svg",
|
||||
env!("CARGO_MANIFEST_DIR")
|
||||
))
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill);
|
||||
|
||||
Container::new(content)
|
||||
Container::new(svg)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill)
|
||||
.padding(20)
|
||||
.center_x()
|
||||
.center_y()
|
||||
.into()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue