我目前正在开发一个带有 flutter 的 Windows 应用程序。我经历过,当将鼠标悬停在可单击的按钮上时,默认鼠标光标会发生变化,或者如果按钮被停用,则默认鼠标光标会显示“禁止”标志。这对我来说感觉不太好,我认为在大多数 Windows 程序中只有标准光标。
我知道 MouseRegion
类,我可以在其中设置一个按钮的光标。有没有办法全局更改整个应用程序的光标?
I'm currently developing a windows app with flutter. I experienced that the default mouse cursor changes when hovering over a button that is clickable or shows an "forbidden" sign if a button is deactivated. This does not feel right for me and I think in most Windows programs there is just the standard cursor.
I know about the MouseRegion
class where I can set the cursor for one button. Is there a way to change the cursor globally for the entire application?
发布评论
评论(1)
我认为,总体来说,Flutter 的光标主题仍在进行中。我们开发桌面应用程序已经快两年了,我可以肯定地说,取得了进展,但仍然是一个问题。
我们大多数时间所做的就是创建自己的按钮并将它们全部排列在一起。
但是,回答您的问题:) 假设您在最新的 Flutter 版本上使用新的材质按钮,在新的材质按钮 在此处共享。您可以看到,
ButtonStyle
类有一个名为final MaterialStateProperty 的字段。 mouseCursor;
这是您可以用于自己的按钮的mouseCursor
。In my opinion, overall, the cursor topic is still in progress for Flutter. We have been developing a Desktop application for almost two years now and I can definitely tell that, there is a progress but still it is a problem.
What we do most of the time is to create our own buttons and arrange all of them together.
However, to answer your question :) Assuming that you are using new material buttons on the latest Flutter version, in the new Material Buttons shared here. You can see that,
ButtonStyle
class has a field calledfinal MaterialStateProperty<MouseCursor> mouseCursor;
which is themouseCursor
that you can use for your own buttons.