This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-demo/src/TextDemo.ts

84 lines
3.0 KiB
TypeScript
Raw Normal View History

2020-03-24 16:23:51 +08:00
import { Panel, Group, scroller, vlayout, layoutConfig, LayoutSpec, Input, Gravity, log, input, text, Color, Text } from "doric";
2020-01-14 19:50:32 +08:00
import { title } from "./utils";
@Entry
class TextDemo extends Panel {
build(root: Group) {
scroller(
vlayout(
[
title("Text Demo"),
text({
text: "This is normal text",
}),
text({
text: "This is normal text",
textSize: 20,
}),
text({
text: "This is normal text",
textSize: 30,
}),
text({
text: "This is bold text",
fontStyle: "bold",
}),
text({
text: "This is bold text",
textSize: 30,
fontStyle: "bold"
}),
text({
text: "This is italic text",
fontStyle: "italic"
}),
text({
text: "This is italic text",
textSize: 30,
fontStyle: "italic"
}),
text({
text: "This is bold_italic text",
fontStyle: "bold_italic"
}),
text({
text: "This is bold_italic text",
textSize: 30,
fontStyle: "bold_italic"
}),
2020-03-13 14:22:46 +08:00
text({
text: "This is Icon Font text \ue631",
2020-03-13 15:00:42 +08:00
font: 'iconfont'
2020-03-13 14:22:46 +08:00
}),
text({
text: "This is Icon Font text \ue631",
textSize: 30,
2020-03-13 15:00:42 +08:00
font: 'iconfont'
2020-03-13 14:22:46 +08:00
}),
2020-03-24 11:06:30 +08:00
text({
text: "This is line Spaceing 0,\nSecond line",
maxLines: 0,
}),
text({
text: "This is line Spaceing 40,\nSecond line",
maxLines: 0,
lineSpacing: 40,
textColor: Color.RED,
textAlignment: Gravity.Right,
2020-03-24 16:23:51 +08:00
onClick: function () {
(this as Text).textAlignment = Gravity.Left;
(this as Text).textColor = Color.BLACK;
}
2020-03-24 11:06:30 +08:00
}),
2020-01-14 19:50:32 +08:00
],
{
space: 10,
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT)
}
),
{
layoutConfig: layoutConfig().most()
}
).in(root)
}
}