簡體   English   中英

Flutter:是否可以將鼠標 cursor 更改為“可拖動”小部件的“反饋”小部件?

[英]Flutter: Is it possible to change the mouse cursor for `feedback` widget of `Draggable` widget?

在拖動小部件拖動時,我想將 cursor 更改為更合適的SystemMouseCursor.grabbing但不幸的是,通過簡單的 Flutter 工具無法做到這一點。 也許有人已經有過這樣的經歷?

經過一番頭腦風暴后,我找到了足夠簡單的解決方案。 所有需要做的就是用MouseRegion包裝childWhenDragging小部件:

Draggable(
  feedback: <dragging widget>,
  childWhenDragging: Container(
    color: Theme.of(context).colorScheme.secondary.withOpacity(0.1),
    child: MouseRegion(
      cursor: SystemMouseCursors.grabbing,
      child: <draggable child>,
    ), 
  ),
)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM