Make pin widget Fill parent by default
This commit is contained in:
parent
5be1d545d0
commit
a805177b25
3 changed files with 6 additions and 10 deletions
|
|
@ -319,11 +319,11 @@ fn pinning<'a>() -> Element<'a, Message> {
|
||||||
"The pin widget can be used to position a widget \
|
"The pin widget can be used to position a widget \
|
||||||
at some fixed coordinates inside some other widget.",
|
at some fixed coordinates inside some other widget.",
|
||||||
stack![
|
stack![
|
||||||
container(pin("• (50, 50)").width(Fill).height(Fill).x(50).y(50))
|
container(pin("• (50, 50)").x(50).y(50))
|
||||||
.width(500)
|
.width(500)
|
||||||
.height(500)
|
.height(500)
|
||||||
.style(container::bordered_box),
|
.style(container::bordered_box),
|
||||||
pin("• (300, 300)").width(Fill).height(Fill).x(300).y(300),
|
pin("• (300, 300)").x(300).y(300),
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
.align_x(Center)
|
.align_x(Center)
|
||||||
|
|
|
||||||
|
|
@ -267,8 +267,6 @@ where
|
||||||
///
|
///
|
||||||
/// fn view(state: &State) -> Element<'_, Message> {
|
/// fn view(state: &State) -> Element<'_, Message> {
|
||||||
/// pin("This text is displayed at coordinates (50, 50)!")
|
/// pin("This text is displayed at coordinates (50, 50)!")
|
||||||
/// .width(Fill)
|
|
||||||
/// .height(Fill)
|
|
||||||
/// .x(50)
|
/// .x(50)
|
||||||
/// .y(50)
|
/// .y(50)
|
||||||
/// .into()
|
/// .into()
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,6 @@
|
||||||
//!
|
//!
|
||||||
//! fn view(state: &State) -> Element<'_, Message> {
|
//! fn view(state: &State) -> Element<'_, Message> {
|
||||||
//! pin("This text is displayed at coordinates (50, 50)!")
|
//! pin("This text is displayed at coordinates (50, 50)!")
|
||||||
//! .width(Fill)
|
|
||||||
//! .height(Fill)
|
|
||||||
//! .x(50)
|
//! .x(50)
|
||||||
//! .y(50)
|
//! .y(50)
|
||||||
//! .into()
|
//! .into()
|
||||||
|
|
@ -33,6 +31,8 @@ use crate::core::{
|
||||||
|
|
||||||
/// A widget that positions its contents at some fixed coordinates inside of its boundaries.
|
/// A widget that positions its contents at some fixed coordinates inside of its boundaries.
|
||||||
///
|
///
|
||||||
|
/// By default, a [`Pin`] widget will try to fill its parent.
|
||||||
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// # mod iced { pub mod widget { pub use iced_widget::*; } pub use iced_widget::core::Length::Fill; }
|
/// # mod iced { pub mod widget { pub use iced_widget::*; } pub use iced_widget::core::Length::Fill; }
|
||||||
|
|
@ -47,8 +47,6 @@ use crate::core::{
|
||||||
///
|
///
|
||||||
/// fn view(state: &State) -> Element<'_, Message> {
|
/// fn view(state: &State) -> Element<'_, Message> {
|
||||||
/// pin("This text is displayed at coordinates (50, 50)!")
|
/// pin("This text is displayed at coordinates (50, 50)!")
|
||||||
/// .width(Fill)
|
|
||||||
/// .height(Fill)
|
|
||||||
/// .x(50)
|
/// .x(50)
|
||||||
/// .y(50)
|
/// .y(50)
|
||||||
/// .into()
|
/// .into()
|
||||||
|
|
@ -75,8 +73,8 @@ where
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
content: content.into(),
|
content: content.into(),
|
||||||
width: Length::Shrink,
|
width: Length::Fill,
|
||||||
height: Length::Shrink,
|
height: Length::Fill,
|
||||||
position: Point::ORIGIN,
|
position: Point::ORIGIN,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue