bdlukaa / fluent_ui

Implements Microsoft's WinUI3 in Flutter.
https://bdlukaa.github.io/fluent_ui/
BSD 3-Clause "New" or "Revised" License
2.94k stars 460 forks source link

Add more gestures for TreeViewItem #851

Closed LinHaoLove closed 1 year ago

LinHaoLove commented 1 year ago

Is your feature request related to a problem? Please describe.

i need show menu for every treeViewItem on windows and macos,by "onSecondaryTap". i need show menu for every treeViewItem on android and ios,by "onLongPress" or "other gestures"

Describe the solution you'd like

return TreeView( selectionMode: TreeViewSelectionMode.single, items: [...], onSecondaryTap: (TreeViewItem item, TapDownDetails details,){ print('onSecondaryTap'); }, onLongPress: (TreeViewItem item){ print('onLongPress'); }, onOtherGestures: (TreeViewItem item){ print('Other Gestures'); }, );

LinHaoLove commented 1 year ago

i put a DropDownButton to content of TreeViewItem,and put text widget with gestures to buttonBuilder of DropDownButton. that is ok!

WinXaito commented 1 year ago

I keep this one open, I'm also interested to have a secondary tap on TreeViewIteams.

bdlukaa commented 1 year ago

I have designed a concept for this. Each TreeViewItem will have a gestures parameter that will take a <Type, GestureRecognizerFactory> map. In the implementation (_TreeViewItem), a the parameter will be passed into a RawGesturesDetector

To use, it'd be something like:

items: [
  TreeViewItem(
    ...,
    gestures: {
      TapGestureRecognizer: GestureRecognizerFactoryWithHandlers<TapGestureRecognizer>(
        () => TapGestureRecognizer(),
        (TapGestureRecognizer instance) {
          instance
            ..onTapDown = (details) {}
            ..onSecondaryTap = () {};
        },
      ),
    },
  ),
],

The records:

robkri commented 1 year ago

This would be a nice feature!

From the point of view of a user, when I see some tree-like element in a desktop app GUI, I would try out these gestures:

In a mobile application I would try out:

Long story short: I think onTap, onDoubleTap, onSecondaryTap and onLongPress should be available by default to cover the most common interactions of a user with a tree view.