【问题标题】:Flutter Desktop: How to disable "disabled" mouse-cursor on button-hover?Flutter Desktop:如何在按钮悬停时禁用“禁用”鼠标光标?
【发布时间】:2021-05-02 21:16:51
【问题描述】:

默认情况下,在桌面上,flutter 中的 btns 在禁用时会更改鼠标光标:

我们想禁用此行为,或用不同的光标替换。

【问题讨论】:

    标签: flutter flutter-desktop


    【解决方案1】:

    要覆盖ElevatedButtonTextButtonOutlinedButton 的默认disabledMouseCursor,可以这样写:

            ElevatedButton(
              style: ElevatedButton.styleFrom(
                disabledMouseCursor: SystemMouseCursors.basic,
              ),
              // ...
            )
    

    更多信息请参见ButtonStyle class

    【讨论】:

    • 这是一个非常方便的构造函数,当然还有 ButtonStyle.mouseCursor 在引擎盖下。干杯!
    猜你喜欢
    • 1970-01-01
    • 2018-07-20
    • 2017-09-15
    • 1970-01-01
    • 2023-02-24
    • 2017-06-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多