Skip to content

Commit 9147ce1

Browse files
committed
feat(harmonyos): improve ArkUiLayoutType and ArkUi documentation
- Improve the layout and styling of `ArkUiLayoutType` components - Add missing width and height properties to several components - Update documentation in `src/main/resources/genius/harmonyos/arkui-design.vm` This commit improves the `ArkUiLayoutType` components by adding `width` and `height` properties to ensure proper layout and styling. Additionally, the documentation in `src/main/resources/genius/harmonyos/arkui-design.vm` has been updated to provide clearer instructions on the usage of certain features, such as the `marginRight` and `paddingRight` properties.
1 parent e670925 commit 9147ce1

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

exts/ext-harmonyos/src/main/kotlin/cc/unitmesh/harmonyos/actions/auto/ArkUiLayoutType.kt

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ enum class ArkUiLayoutType(val description: String, val example: String) {
5555
" }.width('100%').height('50')\n" +
5656
" }.backgroundColor(item)\n" +
5757
" })\n" +
58-
"} "
58+
"}.width('80%').margin({ left: 10, top: 5, bottom: 5 }).height(200)"
5959
),
6060
List(
6161
"列表是一种复杂的容器,当列表项达到一定数量,内容超过屏幕大小时,可以自动提供滚动功能。",
62-
" List() {\n" +
62+
"List() {\n" +
6363
" ListItem() {\n" +
6464
" Text('北京').fontSize(24)\n" +
6565
" }\n" +
@@ -70,8 +70,7 @@ enum class ArkUiLayoutType(val description: String, val example: String) {
7070
" Text('上海').fontSize(24)\n" +
7171
" }\n" +
7272
"}\n" +
73-
".backgroundColor('#FFF1F3F5')\n" +
74-
".alignListItem(ListItemAlign.Center)"
73+
".width('100%').height('100%').backgroundColor('#FFF1F3F5').alignListItem(ListItemAlign.Center)"
7574
),
7675
StackLayout(
7776
"层叠布局(StackLayout)用于在屏幕上预留一块区域来显示组件中的元素,提供元素可以重叠的布局。",
@@ -88,18 +87,8 @@ enum class ArkUiLayoutType(val description: String, val example: String) {
8887
" .backgroundColor(0xFFFFFF)\n" +
8988
" }, item => item)\n" +
9089
" }.width('100%').height('100%')\n" +
91-
" Flex({ justifyContent: FlexAlign.SpaceAround, alignItems: ItemAlign.Center }) {\n" +
92-
" Text('联系人').fontSize(16)\n" +
93-
" Text('设置').fontSize(16)\n" +
94-
" Text('短信').fontSize(16)\n" +
95-
" }\n" +
96-
" .width('50%')\n" +
97-
" .height(50)\n" +
98-
" .backgroundColor('#16302e2e')\n" +
99-
" .margin({ bottom: 15 })\n" +
100-
" .borderRadius(15)\n" +
10190
" }.width('100%').height('100%').backgroundColor('#CFD0CF')\n" +
102-
"}"
91+
"}.width('100%').height(150).margin({ top: 5 })"
10392
);
10493

10594
companion object {

exts/ext-harmonyos/src/main/resources/genius/harmonyos/arkui-design.vm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ According to the user's code/requirements, and Layout/Components info, write Cod
44

55
ArkUi has some special features:
66

7-
- marginRight should be margin({ right: 10 }), or margin(10)
8-
- paddingRight should be padding({left: 5, top: 20, right: 5, bottom: 20})// 设置不同的边距值
7+
- marginRight should be `margin({ right: 10 })`, or `margin(10)`
8+
- paddingRight should be `padding({left: 5, top: 20, right: 5, bottom: 20})` // 设置不同的边距值
9+
- list can use `ForEach`
10+
- layout should used `width` and `height` properties, like `.width('80%').height(200)`
911

1012
ArkUI layout and components fnfos:
1113

0 commit comments

Comments
 (0)