KeyMapData 类

KeyMapData 类

【免费下载链接】keyviz Keyviz is a free and open-source tool to visualize your keystrokes ⌨️ and 🖱️ mouse actions in real-time. 【免费下载链接】keyviz 项目地址: https://gitcode.com/gh_mirrors/ke/keyviz

KeyMapData 类用于封装键盘按键的映射数据,定义在 lib/domain/services/key_maps.dart 文件中。

构造函数

const KeyMapData({
  required this.label,
  this.shortLabel,
  this.glyph,
  this.symbol,
  this.icon,
});

参数说明

参数类型描述
labelString按键的完整标签文本,如 "control"
shortLabelString?按键的短标签文本,如 "ctrl"
glyphString?按键的符号表示,如 "⌃"
symbolString?按键的辅助符号,如 "~" 对应 "`" 键
iconString?按键图标的路径

示例

// 定义 Control 键的映射
const KeyMapData(
  label: "control",
  shortLabel: "ctrl",
  glyph: "⌃",
  icon: KeyIcons.control,
)

平台差异

部分按键在不同平台上有不同的表示:

meta: switchPlatform<KeyMapData>(
  windows: const KeyMapData(
    label: "win",
    symbol: "\u{229E}",
    icon: KeyIcons.meta,
  ),
  macos: const KeyMapData(
    label: "command",
    shortLabel: "cmd",
    symbol: "⌘",
    icon: KeyIcons.macMeta,
  ),
  linux: const KeyMapData(
    label: "Meta",
    symbol: "✦",
    icon: KeyIcons.meta,
  ),
)

### 7.3 提交与 PR

```bash
# 提交更改
git add README.md
git commit -m "docs: update KeyMapData API documentation"

# 推送到远程
git push origin feature/update-keymap-docs

【免费下载链接】keyviz Keyviz is a free and open-source tool to visualize your keystrokes ⌨️ and 🖱️ mouse actions in real-time. 【免费下载链接】keyviz 项目地址: https://gitcode.com/gh_mirrors/ke/keyviz

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值