Merge branch 'master' into improvement/docs

This commit is contained in:
Héctor Ramón Jiménez 2019-11-21 13:53:02 +01:00
commit 428509c84a
13 changed files with 76 additions and 8 deletions

View File

@ -255,6 +255,14 @@ where
A: Clone,
Renderer: crate::Renderer,
{
fn width(&self) -> Length {
self.widget.width()
}
fn height(&self) -> Length {
self.widget.height()
}
fn layout(
&self,
renderer: &Renderer,
@ -320,6 +328,14 @@ impl<'a, Message, Renderer> Widget<Message, Renderer>
where
Renderer: crate::Renderer + renderer::Debugger,
{
fn width(&self) -> Length {
self.element.widget.width()
}
fn height(&self) -> Length {
self.element.widget.height()
}
fn layout(
&self,
renderer: &Renderer,

View File

@ -69,6 +69,10 @@ pub trait Widget<Message, Renderer>
where
Renderer: crate::Renderer,
{
fn width(&self) -> Length;
fn height(&self) -> Length;
/// Returns the [`Node`] of the [`Widget`].
///
/// This [`Node`] is used by the runtime to compute the [`Layout`] of the
@ -83,14 +87,6 @@ where
limits: &layout::Limits,
) -> layout::Node;
fn width(&self) -> Length {
Length::Shrink
}
fn height(&self) -> Length {
Length::Shrink
}
/// Draws the [`Widget`] using the associated `Renderer`.
///
/// [`Widget`]: trait.Widget.html

View File

@ -119,6 +119,14 @@ where
Renderer: self::Renderer,
Message: Clone,
{
fn width(&self) -> Length {
self.width
}
fn height(&self) -> Length {
Length::Shrink
}
fn layout(
&self,
renderer: &Renderer,

View File

@ -72,6 +72,10 @@ where
Length::Fill
}
fn height(&self) -> Length {
Length::Shrink
}
fn layout(
&self,
renderer: &Renderer,

View File

@ -118,6 +118,10 @@ where
self.width
}
fn height(&self) -> Length {
self.height
}
fn layout(
&self,
renderer: &Renderer,

View File

@ -99,6 +99,10 @@ where
self.width
}
fn height(&self) -> Length {
self.height
}
fn layout(
&self,
renderer: &Renderer,

View File

@ -58,6 +58,14 @@ impl<Message, Renderer> Widget<Message, Renderer> for Image
where
Renderer: self::Renderer,
{
fn width(&self) -> Length {
self.width
}
fn height(&self) -> Length {
self.height
}
fn layout(
&self,
renderer: &Renderer,

View File

@ -82,6 +82,10 @@ where
Length::Fill
}
fn height(&self) -> Length {
Length::Shrink
}
fn layout(
&self,
renderer: &Renderer,

View File

@ -120,6 +120,10 @@ where
self.width
}
fn height(&self) -> Length {
self.height
}
fn layout(
&self,
renderer: &Renderer,

View File

@ -105,6 +105,14 @@ impl<'a, Message, Renderer> Widget<Message, Renderer>
where
Renderer: self::Renderer + column::Renderer,
{
fn width(&self) -> Length {
Length::Fill
}
fn height(&self) -> Length {
self.height
}
fn layout(
&self,
renderer: &Renderer,

View File

@ -86,6 +86,10 @@ where
self.width
}
fn height(&self) -> Length {
Length::Shrink
}
fn layout(
&self,
renderer: &Renderer,

View File

@ -117,6 +117,10 @@ where
self.width
}
fn height(&self) -> Length {
self.height
}
fn layout(
&self,
renderer: &Renderer,

View File

@ -100,6 +100,10 @@ where
self.width
}
fn height(&self) -> Length {
Length::Shrink
}
fn layout(
&self,
renderer: &Renderer,