macos_ui icon indicating copy to clipboard operation
macos_ui copied to clipboard

SidebarItem with disclosureItems should be selectable.

Open slewallen opened this issue 3 years ago • 3 comments

Description

SidebarItem with disclosureItems should be selectable. In Mac OS, it is possible to select any node in the sidebar, not just child nodes. For example, in Mail a user might have an "All Inboxes" node with two children such as "iCloud" and "Google." Selecting "All Inboxes" in Mail would, for example, show all mail in both the "iCloud" and "Google" inbox children.

Steps To Reproduce

  1. Open the macos_ui gallery
  2. Attempt to select the "Disclosure" node

The result is that regardless of where you click, the node simply toggles open or closed but never is selected.

Expected behavior

Clicking on the disclosure turn-down should toggle a parent node open or closed while clicking anywhere else on the parent node will simply select it.

Screenshots

Below is a screenshot from MacOS Mail with the parent node selected.

SelectableSidebarItem

slewallen avatar Jun 30 '22 22:06 slewallen

@whiplashoo I've experimented a bit with this but there are some oddities:

  1. Should the selection of a disclosure item result in the de-selection of the currently selected sidebar item?
  2. I'm having difficulty with keeping the color of the leading icon correct when selected. I tried to wrap it with a MacosIconTheme but it did nothing.

Can you check this out? Change line 364 of sidebar_items.dart to this:

selected: _isExpanded ? true : false,

And then try to handle the color of the leading widget on line 354.

GroovinChip avatar Jul 01 '22 16:07 GroovinChip

Okay I figured out the color issue! Our example is using an Icon, not a MacosIcon, so the color wasn't being respected.

Questions remain about the behavior of the disclosure item, however:

For example, in the Mail app, clicking on the disclosure icon will expand/collapse an item without selecting it, and clicking anywhere else on the item will select that item and change the main view accordingly. However, if the item is collapsed, selecting it does not expand it, and the same is true in reverse. Double clicking an item does not expand or collapse it, either.

The Finder app behaves the same way when viewing files as a List. The Photos app behaves the same way, too. I was not able to find any other apps to test.

GroovinChip avatar Jul 07 '22 18:07 GroovinChip

I also need

qingweiSun avatar Jan 30 '23 07:01 qingweiSun