SidebarItem with disclosureItems should be selectable.
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
- Open the macos_ui gallery
- 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.
@whiplashoo I've experimented a bit with this but there are some oddities:
- Should the selection of a disclosure item result in the de-selection of the currently selected sidebar item?
- 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.
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.
I also need