mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-26 07:04:51 +02:00
Minor styling
This commit is contained in:
parent
3ee6dcc5c7
commit
f45b65e68e
@ -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 } => {
|
||||||
|
@ -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(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user