Add several missing style attributes in iced_web.
This commit is contained in:
parent
0f2e20f5e5
commit
95988e8e25
@ -130,6 +130,7 @@ where
|
|||||||
) -> dodrio::Node<'b> {
|
) -> dodrio::Node<'b> {
|
||||||
use dodrio::builder::*;
|
use dodrio::builder::*;
|
||||||
|
|
||||||
|
let width = style::length(self.width);
|
||||||
let padding_class =
|
let padding_class =
|
||||||
style_sheet.insert(bump, Style::Padding(self.padding));
|
style_sheet.insert(bump, Style::Padding(self.padding));
|
||||||
|
|
||||||
@ -149,9 +150,10 @@ where
|
|||||||
"style",
|
"style",
|
||||||
bumpalo::format!(
|
bumpalo::format!(
|
||||||
in bump,
|
in bump,
|
||||||
"background: {}; border-radius: {}px; min-width: {}px",
|
"background: {}; border-radius: {}px; width:{}; min-width: {}px",
|
||||||
background,
|
background,
|
||||||
self.border_radius,
|
self.border_radius,
|
||||||
|
width,
|
||||||
self.min_width
|
self.min_width
|
||||||
)
|
)
|
||||||
.into_bump_str(),
|
.into_bump_str(),
|
||||||
|
@ -133,6 +133,8 @@ impl<'a, Message> Widget<Message> for Column<'a, Message> {
|
|||||||
let width = style::length(self.width);
|
let width = style::length(self.width);
|
||||||
let height = style::length(self.height);
|
let height = style::length(self.height);
|
||||||
|
|
||||||
|
let align_items = style::align(self.align_items);
|
||||||
|
|
||||||
// TODO: Complete styling
|
// TODO: Complete styling
|
||||||
div(bump)
|
div(bump)
|
||||||
.attr(
|
.attr(
|
||||||
@ -142,10 +144,12 @@ impl<'a, Message> Widget<Message> for Column<'a, Message> {
|
|||||||
)
|
)
|
||||||
.attr("style", bumpalo::format!(
|
.attr("style", bumpalo::format!(
|
||||||
in bump,
|
in bump,
|
||||||
"width: {}; height: {}; max-width: {}px",
|
"width: {}; height: {}; max-width: {}px; max-height: {}px; align-items: {}",
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
self.max_width
|
self.max_width,
|
||||||
|
self.max_height,
|
||||||
|
align_items
|
||||||
).into_bump_str()
|
).into_bump_str()
|
||||||
)
|
)
|
||||||
.children(children)
|
.children(children)
|
||||||
|
@ -134,6 +134,8 @@ impl<'a, Message> Widget<Message> for Row<'a, Message> {
|
|||||||
let width = style::length(self.width);
|
let width = style::length(self.width);
|
||||||
let height = style::length(self.height);
|
let height = style::length(self.height);
|
||||||
|
|
||||||
|
let justify_content = style::align(self.align_items);
|
||||||
|
|
||||||
// TODO: Complete styling
|
// TODO: Complete styling
|
||||||
div(bump)
|
div(bump)
|
||||||
.attr(
|
.attr(
|
||||||
@ -143,10 +145,12 @@ impl<'a, Message> Widget<Message> for Row<'a, Message> {
|
|||||||
)
|
)
|
||||||
.attr("style", bumpalo::format!(
|
.attr("style", bumpalo::format!(
|
||||||
in bump,
|
in bump,
|
||||||
"width: {}; height: {}; max-width: {}px",
|
"width: {}; height: {}; max-width: {}px; max-height: {}px; justify-content: {}",
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
self.max_width
|
self.max_width,
|
||||||
|
self.max_height,
|
||||||
|
justify_content
|
||||||
).into_bump_str()
|
).into_bump_str()
|
||||||
)
|
)
|
||||||
.children(children)
|
.children(children)
|
||||||
|
@ -119,6 +119,9 @@ impl<'a, Message> Widget<Message> for Text {
|
|||||||
let content = bumpalo::format!(in bump, "{}", self.content);
|
let content = bumpalo::format!(in bump, "{}", self.content);
|
||||||
let color = style::color(self.color.unwrap_or(Color::BLACK));
|
let color = style::color(self.color.unwrap_or(Color::BLACK));
|
||||||
|
|
||||||
|
let width = style::length(self.width);
|
||||||
|
let height = style::length(self.height);
|
||||||
|
|
||||||
let text_align = match self.horizontal_alignment {
|
let text_align = match self.horizontal_alignment {
|
||||||
HorizontalAlignment::Left => "left",
|
HorizontalAlignment::Left => "left",
|
||||||
HorizontalAlignment::Center => "center",
|
HorizontalAlignment::Center => "center",
|
||||||
@ -127,7 +130,9 @@ impl<'a, Message> Widget<Message> for Text {
|
|||||||
|
|
||||||
let style = bumpalo::format!(
|
let style = bumpalo::format!(
|
||||||
in bump,
|
in bump,
|
||||||
"font-size: {}px; color: {}; text-align: {}",
|
"width: {}; height: {}; font-size: {}px; color: {}; text-align: {}",
|
||||||
|
width,
|
||||||
|
height,
|
||||||
self.size.unwrap_or(20),
|
self.size.unwrap_or(20),
|
||||||
color,
|
color,
|
||||||
text_align
|
text_align
|
||||||
|
@ -128,6 +128,8 @@ where
|
|||||||
use dodrio::builder::*;
|
use dodrio::builder::*;
|
||||||
use wasm_bindgen::JsCast;
|
use wasm_bindgen::JsCast;
|
||||||
|
|
||||||
|
let width = style::length(self.width);
|
||||||
|
let max_width = style::length(self.max_width);
|
||||||
let padding_class =
|
let padding_class =
|
||||||
style_sheet.insert(bump, Style::Padding(self.padding));
|
style_sheet.insert(bump, Style::Padding(self.padding));
|
||||||
|
|
||||||
@ -143,7 +145,9 @@ where
|
|||||||
"style",
|
"style",
|
||||||
bumpalo::format!(
|
bumpalo::format!(
|
||||||
in bump,
|
in bump,
|
||||||
"font-size: {}px",
|
"width: {}; max-width: {}; font-size: {}px",
|
||||||
|
width,
|
||||||
|
max_width,
|
||||||
self.size.unwrap_or(20)
|
self.size.unwrap_or(20)
|
||||||
)
|
)
|
||||||
.into_bump_str(),
|
.into_bump_str(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user