当孩子是 Chip Widget 时,Flutter MouseRegion 不起作用

Pro*_*_14 3 dart flutter flutter-web

当子组件是 Chip 小部件时,我的 flutter web 程序中的鼠标光标在悬停时不会更改为单击光标。我将芯片更改为文本和容器小部件,并且鼠标光标发生变化,没有任何问题。

以下是 MouseRegion 的代码。

return MouseRegion(
  cursor: SystemMouseCursors.click,
  child: Container(
    width: 200,
    alignment: Alignment.centerRight,
    child: GestureDetector(
      onTap: () {},
      child: Chip(
        backgroundColor: kLightPrimary,
        avatar: const Icon(
           Feather.phone_call,
           size: 18.0,
           color: kPrimaryColor,
        ),
        label: Text(
          "Test num",
          style: GoogleFonts.poppins(
              fontWeight: FontWeight.w500, color: kPrimaryColor),
          textAlign: TextAlign.end,
        ),
        padding: const EdgeInsets.all(kDefaultPadding),
      ),
    ),
  ),
),
Run Code Online (Sandbox Code Playgroud)

Rik*_*137 8

您想使用而不是a 上的MouseRegionand 。GestureDetectorChipActionChip

    ActionChip(
        onPressed() {/* use onPressed even if it would be empty */}
        backgroundColor: kLightPrimary,
        avatar: const Icon(
           Feather.phone_call,
           size: 18.0,
           color: kPrimaryColor,
        ),
        label: Text(
          "Test num",
          style: GoogleFonts.poppins(
              fontWeight: FontWeight.w500, color: kPrimaryColor),
          textAlign: TextAlign.end,
        ),
        padding: const EdgeInsets.all(kDefaultPadding),
      )
Run Code Online (Sandbox Code Playgroud)