配置参数
preeditHeight
Section titled “preeditHeight”类型:Float | String
必选项:是
用于定义预编辑区的高度。
- 当为
Float类型时,表示高度值为确切的 point 值。
如:preeditHeight: 50 表示预编辑区高度为当前屏幕 50 point。
- 当为
String类型时,表示高度值为当前设备物理高度的百分比,必须使用vh结尾。
如:preeditHeight: '10vh' 表示预编辑区高度为当前屏幕物理高度的 10%。
toolbarHeight
Section titled “toolbarHeight”类型:Float | String
必选项:是
用于定义工具栏的高度。
与 preeditHeight 参数的设置方式相同。
keyboardHeight
Section titled “keyboardHeight”类型:Float | String
必选项:是
用于定义按键区的高度。
与 preeditHeight 参数的设置方式相同。
类型:{width: Float | String | {percentage: Float}, height: Float | String | {percentage: Float}}
必选项:是
用于定义区域的尺寸。常用来设置按键,VStack,HStack 等尺寸。
类型:Float | String | {percentage: Float}
必选项:否。
用于定义 size 的宽度。
- 当值为
Float时,表示宽度值为确切的 point 值。
如:width: 100 表示宽度为当前屏幕 100 point。
- 当值为
String时,表示宽度值为百分比,必须使用/表示,它是{percentage: Float}的简化表达形式。
如:width: '1/2' 表示宽度为当前屏幕宽度的 50%。
- 当值为
{percentage: Float}时,表示宽度值为百分比。
如:width: {percentage: 0.5} 表示宽度为当前屏幕宽度的 50%。
- 当不设置 width 时,表示宽度为自动适应,系统会根据当前剩余宽度及其他未设置 width 的元素进行计算。
计算公式:width = 剩余宽度 / 未设置 width 的元素数量。
height
Section titled “height”类型:Float | String | {percentage: Float}
必选项:否。
用于定义 size 的高度。 其设置属性与 width 相同。
bounds
Section titled “bounds”必选项:否
用于定义按键的可视区域尺寸。即在按键 size 定义的范围内,进一步缩小按键上显示的图片、文本等内容的显示区域。
alignment: 用于定义显示内容在按键区域内的对齐方式,默认值为center。width: 用于定义显示区域的宽度,默认值为按键的宽度。height: 用于定义显示区域的高度,默认值为按键的高度。
alignment
Section titled “alignment”类型:'center' | 'centerTop' | 'centerBottom' | 'left' | 'right' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom'
必选项:否,默认值为 center
用于定义显示内容在按键区域内的对齐方式。
配置示例: alignment: 'left'
类型:Float | String | {percentage: Float}
必选项:否,默认值为按键的宽度
用于定义显示区域的宽度。其设置属性与 size.width 相同。
height
Section titled “height”类型:Float | String | {percentage: Float}
必选项:否,默认值为按键的高度
用于定义显示区域的高度。其设置属性与 size.height 相同。
center
Section titled “center”类型:{x: Float, y: Float}
必选项:否
用于调整按键显示内容的中心点位置。常用来调整按键上图片、文本等内容的位置。
x: 用于定义按键显示内容的水平位置偏移。可以为空,表示使用默认中心点 x 的位置。y: 用于定义按键显示内容的垂直位置偏移。可以为空,表示使用默认中心点 y 的位置。
计算公式:
- 中心点位置.x = 当前按键可视区域宽度 × x + 当前按键可视区域.minX
- 中心点位置.y = 当前按键可视区域高度 × y + 当前按键可视区域.minY
举个例子:
center: x: 0.7 y: 0.8表示将按键显示内容调整到按键可视区域的 70% 宽度和 80% 高度位置处。
buttonStyleType
Section titled “buttonStyleType”类型:'geometry' | 'systemImage' | 'assetImage' | 'fileImage' | 'text'
必选项:是
用于标识样式的类型,不同类型的样式,所支持解析的配置参数不同。
geometry:表示使用 iOS 原生属性绘制样式systemImage:使用 SF Symbols 图标assetImage:使用 App 内部的图片资源fileImage:使用皮肤中的图片文件作为样式text:使用文本作为样式
backgroundStyle
Section titled “backgroundStyle”类型:String | Array<ConditionStyle> | undefined
用来引用按键的背景样式。
foregroundStyle
Section titled “foregroundStyle”类型:String | Array<String> | Array<ConditionStyle> | undefined
用来引用按键的前景样式。
notification
Section titled “notification”类型:String | Array<String>
为按键绑定通知。此属性只能在按键样式中使用。
notificationType
Section titled “notificationType”类型:'rime' | 'keyboardAction' | 'returnKeyType'
必选项:是
用于标识监听的通知的类型,不同类型的通知,所支持解析的配置参数不同。
rime:表示 RIME 输入法的通知keyboardAction:表示键盘按键动作的通知returnKeyType:表示回车键类型的通知
rimeNotificationType
Section titled “rimeNotificationType”类型:'optionChanged' | 'schemaChanged'
必选项:是
用于标识 RIME 输入法的通知类型,不同类型的通知,所支持解析的配置参数不同。
optionChanged:表示 option 配置选项变更schemaChanged:表示输入方案变更
rimeOptionName
Section titled “rimeOptionName”类型:String
必选项:否,当 rimeNotificationType 设置为 'optionChanged' 时,此项为必选。
用于标识 RIME 输入法的配置选项名称。
rimeOptionValue
Section titled “rimeOptionValue”类型:Bool
必选项:否,当 rimeNotificationType 设置为 'optionChanged' 时,此项为必选。
用于标识 RIME 输入法的配置选项值。
notificationKeyboardAction
Section titled “notificationKeyboardAction”类型: KeyboardAction
必选项:否,当 notificationType 设置为 'keyboardAction' 时,此项为必选。
用于标识监听键盘触发的 KeyboardAction 的类型。
当键盘通知的 action 与当前设置的 notificationKeyboardAction 类型匹配时,会触发样式变更。当 action 值不匹配时,样式恢复为默认状态。
returnKeyType
Section titled “returnKeyType”类型:Int | [Int]
必选项:否,当 notificationType 设置为 'returnKeyType' 时,此项为必选。
用于标识回车键的类型。
当系统回车键类型与当前设置的 returnKeyType 类型匹配时,会触发样式变更。当回车键类型值不匹配时,样式恢复为默认状态。
animationType
Section titled “animationType”类型:'scale' | 'cartoon' | 'physics'
必选项:是
用于标识动画的类型,不同类型的动画,所支持解析的配置参数不同。
scale:表示缩放动画cartoon:表示卡通动画,用来替代之前版本的 APNG 图片physics:表示物理动画,可以用来描述移动、旋转、透明度变化等
ConditionStyle 条件样式
Section titled “ConditionStyle 条件样式”部分按键的样式需要根据条件判断来决定,例如:符号键盘锁定按键的样式,它初始显示时需要根据当前锁定状态来决定显示样式。
类型:{ conditionKey: String, conditionValue: Bool | Array<Int>, styleName: String | Array<String> }
注意:styleName: Array<String> 需要 1.5.2 版本及以上才能使用。
配置示例:
foregroundStyle: - { styleName: unlockButtonForegroundStyle, # 或者 styleName: [ unlockButtonForegroundStyle1, unlockButtonForegroundStyle2, ], conditionKey: $symbolicKeyboardLockState, conditionValue: false, } - { styleName: lockButtonForegroundStyle, conditionKey: $symbolicKeyboardLockState, conditionValue: true, }conditionKey
Section titled “conditionKey”类型:'$symbolicKeyboardLockState' | 'rime${optionName}'
$symbolicKeyboardLockState:表示符号键盘的锁定状态rime${optionName}:表示 RIME option 状态,比如rime$ascii_mode表示ascii_mode选项的状态
浮动键盘相关参数
Section titled “浮动键盘相关参数”floatKeyboardLockedState
Section titled “floatKeyboardLockedState”类型:Bool
浮动键盘的锁定状态。默认为 true,即:点击浮动键盘上的按键后,自动隐藏浮动键盘;当设置为 false 时,点击浮动键盘上的按键后,不会自动隐藏浮动键盘。
floatKeyboardAlpha
Section titled “floatKeyboardAlpha”类型:Float
浮动键盘背景透明度。取值范围为 0.1 到 1.0 之间,默认为 0.95。
注意:请勿使用
0.0作为透明度值,否则会导致浮动键盘点击空白区域后,不会关闭当前浮动键盘。