feat(uikit): 引入明缘主题色板与通用组件
This commit is contained in:
23
uikit/src/main/ets/components/Avatar.ets
Normal file
23
uikit/src/main/ets/components/Avatar.ets
Normal file
@@ -0,0 +1,23 @@
|
||||
import { AppColor } from '../theme/Theme';
|
||||
|
||||
/**
|
||||
* 首字母圆形头像:金色底白字。
|
||||
*/
|
||||
@ComponentV2
|
||||
export struct Avatar {
|
||||
@Param name: string = '';
|
||||
@Param diameter: number = 40;
|
||||
|
||||
build() {
|
||||
Stack({ alignContent: Alignment.Center }) {
|
||||
Text(this.name.length > 0 ? this.name.charAt(0) : '明')
|
||||
.fontSize(this.diameter * 0.42)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.fontColor(AppColor.white)
|
||||
}
|
||||
.width(this.diameter)
|
||||
.height(this.diameter)
|
||||
.borderRadius(this.diameter / 2)
|
||||
.backgroundColor(AppColor.gold)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user