toast: limit size and enable word wrap
This commit is contained in:
@@ -6,8 +6,8 @@ use taffy::{
|
|||||||
use crate::{
|
use crate::{
|
||||||
drawing,
|
drawing,
|
||||||
parser::{
|
parser::{
|
||||||
AttribPair, is_percent, parse_color_hex, parse_f32, parse_percent, parse_size_unit, parse_val,
|
is_percent, parse_color_hex, parse_f32, parse_percent, parse_size_unit, parse_val, print_invalid_attrib,
|
||||||
print_invalid_attrib, print_invalid_value,
|
print_invalid_value, AttribPair,
|
||||||
},
|
},
|
||||||
renderer_vk::text::{FontWeight, HorizontalAlign, TextStyle},
|
renderer_vk::text::{FontWeight, HorizontalAlign, TextStyle},
|
||||||
widget::util::WLength,
|
widget::util::WLength,
|
||||||
@@ -98,6 +98,13 @@ pub fn parse_text_style(attribs: &[AttribPair]) -> TextStyle {
|
|||||||
print_invalid_attrib(key, value);
|
print_invalid_attrib(key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"wrap" => {
|
||||||
|
if let Ok(y) = value.parse::<i32>() {
|
||||||
|
style.wrap = y == 1;
|
||||||
|
} else {
|
||||||
|
print_invalid_attrib(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
|
|
||||||
<elements>
|
<elements>
|
||||||
<div interactable="0" >
|
<div interactable="0" >
|
||||||
<rectangle padding="4" box_sizing="content_box" flex_wrap="wrap" flex_direction="row" gap="4" color="#000000c0" border_color="~color_accent" border="2" round="8" justify_content="space_between">
|
<rectangle max_width="500" max_height="400" padding="4" box_sizing="content_box" flex_wrap="wrap" flex_direction="row" gap="4" color="#000000c0" border_color="~color_accent" border="2" round="8" justify_content="space_between">
|
||||||
<div width="100%" padding="4">
|
<div width="100%" padding="4">
|
||||||
<label text="toast title" id="toast_title" weight="bold" />
|
<label text="toast title" id="toast_title" weight="bold" />
|
||||||
</div>
|
</div>
|
||||||
<div width="100%" height="100%" padding="4" flex_wrap="wrap">
|
<div width="100%" height="100%" padding="4" flex_wrap="wrap">
|
||||||
<label text="toast body goes here" id="toast_body" />
|
<label text="toast body goes here" id="toast_body" wrap="1" />
|
||||||
</div>
|
</div>
|
||||||
</rectangle>
|
</rectangle>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user