Minor styling

This commit is contained in:
ClementTsang 2021-12-31 00:39:39 -05:00
parent 3ee6dcc5c7
commit f45b65e68e
2 changed files with 7 additions and 7 deletions

View File

@ -224,9 +224,7 @@ impl WidgetLayoutNode {
children children
.iter() .iter()
.map(|child| { .map(|child| {
FlexElement::with_no_flex(Self::make_element( FlexElement::new(Self::make_element(ctx, app_state, data, child, false))
ctx, app_state, data, child, false,
))
}) })
.collect(), .collect(),
)) ))
@ -254,7 +252,9 @@ impl WidgetLayoutNode {
} }
} }
fn wrap_element<Message>(element: Element<Message>, rule: &WidgetLayoutRule) -> FlexElement<Message> { fn wrap_element<Message>(
element: Element<Message>, rule: &WidgetLayoutRule,
) -> FlexElement<Message> {
match rule { match rule {
WidgetLayoutRule::Expand { ratio } => FlexElement::with_flex(element, *ratio), WidgetLayoutRule::Expand { ratio } => FlexElement::with_flex(element, *ratio),
WidgetLayoutRule::Length { width, height } => { WidgetLayoutRule::Length { width, height } => {

View File

@ -14,21 +14,21 @@ pub struct FlexElement<Message> {
impl<Message> FlexElement<Message> { impl<Message> FlexElement<Message> {
/// Creates a new [`FlexElement`] with a flex of 1. /// Creates a new [`FlexElement`] with a flex of 1.
pub fn new<I: Into<Element<Message>>>(element: I) -> Self { pub fn new<E: Into<Element<Message>>>(element: E) -> Self {
Self { Self {
flex: 1, flex: 1,
element: element.into(), element: element.into(),
} }
} }
pub fn with_flex<I: Into<Element<Message>>>(element: I, flex: u16) -> Self { pub fn with_flex<E: Into<Element<Message>>>(element: E, flex: u16) -> Self {
Self { Self {
flex, flex,
element: element.into(), element: element.into(),
} }
} }
pub fn with_no_flex<I: Into<Element<Message>>>(element: I) -> Self { pub fn with_no_flex<E: Into<Element<Message>>>(element: E) -> Self {
Self { Self {
flex: 0, flex: 0,
element: element.into(), element: element.into(),