text new fn
This commit is contained in:
1 parent
55bee4b25e
commit
4b1ee21e94
1 file changed
+10
-7
+10
-7
@@ -26,6 +26,14 @@ impl Text {
|
|||||||
self.attrs.line_height = height;
|
self.attrs.line_height = height;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
pub fn new(content: impl Into<String>) -> Self {
|
||||||
|
let attrs = TextAttrs::default();
|
||||||
|
Self {
|
||||||
|
content: content.into(),
|
||||||
|
buf: TextBuffer::new_empty(Metrics::new(attrs.font_size, attrs.line_height)),
|
||||||
|
attrs,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Widget for Text {
|
impl Widget for Text {
|
||||||
@@ -49,11 +57,6 @@ impl Widget for Text {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn text(text: impl Into<String>) -> Text {
|
pub fn text(content: impl Into<String>) -> Text {
|
||||||
let attrs = TextAttrs::default();
|
Text::new(content)
|
||||||
Text {
|
|
||||||
content: text.into(),
|
|
||||||
buf: TextBuffer::new_empty(Metrics::new(attrs.font_size, attrs.line_height)),
|
|
||||||
attrs,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user