File tree Expand file tree Collapse file tree 5 files changed +20
-3
lines changed Expand file tree Collapse file tree 5 files changed +20
-3
lines changed Original file line number Diff line number Diff line change
1
+ ## [ 2.0.9]
2
+ ### 🛠️ Updated 🛠️
3
+ * Add ` expandDisclosureItems ` flag to ` SidebarItem ` to optionally (default not changed) expand disclosure items initially
4
+
1
5
## [ 2.0.8]
2
6
### 🛠️ Updated 🛠️
3
7
* Fixed ` SidebarItem ` text overflowing.
Original file line number Diff line number Diff line change @@ -221,6 +221,7 @@ class _WidgetGalleryState extends State<WidgetGallery> {
221
221
label: Text ('ResizablePane' ),
222
222
),
223
223
],
224
+ expandDisclosureItems: true ,
224
225
),
225
226
SidebarItem (
226
227
leading: MacosImageIcon (
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ class SidebarItem with Diagnosticable {
19
19
this .focusNode,
20
20
this .semanticLabel,
21
21
this .disclosureItems,
22
+ this .expandDisclosureItems = false ,
22
23
this .trailing,
23
24
});
24
25
@@ -58,6 +59,11 @@ class SidebarItem with Diagnosticable {
58
59
/// If non-null and [leading] is null, a local animated icon is created
59
60
final List <SidebarItem >? disclosureItems;
60
61
62
+ /// If true, the disclosure items will be expanded otherwise collapsed.
63
+ ///
64
+ /// Defaults to false. There is no impact if [disclosureItems] is null.
65
+ final bool expandDisclosureItems;
66
+
61
67
/// An optional trailing widget.
62
68
///
63
69
/// Typically a text indicator of a count of items, like in this
@@ -77,6 +83,8 @@ class SidebarItem with Diagnosticable {
77
83
'disclosure items' ,
78
84
disclosureItems,
79
85
));
86
+ properties.add (
87
+ FlagProperty ('expandDisclosureItems' , value: expandDisclosureItems));
80
88
properties.add (DiagnosticsProperty <Widget ?>('trailing' , trailing));
81
89
}
82
90
}
Original file line number Diff line number Diff line change @@ -378,8 +378,7 @@ class __DisclosureSidebarItemState extends State<_DisclosureSidebarItem>
378
378
late AnimationController _controller;
379
379
late Animation <double > _iconTurns;
380
380
late Animation <double > _heightFactor;
381
-
382
- bool _isExpanded = false ;
381
+ late bool _isExpanded;
383
382
384
383
bool get hasLeading => widget.item.leading != null ;
385
384
@@ -389,6 +388,11 @@ class __DisclosureSidebarItemState extends State<_DisclosureSidebarItem>
389
388
_controller = AnimationController (duration: _kExpand, vsync: this );
390
389
_heightFactor = _controller.drive (_easeInTween);
391
390
_iconTurns = _controller.drive (_halfTween.chain (_easeInTween));
391
+
392
+ _isExpanded = widget.item.expandDisclosureItems;
393
+ if (_isExpanded) {
394
+ _controller.forward ();
395
+ }
392
396
}
393
397
394
398
void _handleTap () {
Original file line number Diff line number Diff line change 1
1
name : macos_ui
2
2
description : Flutter widgets and themes implementing the current macOS design language.
3
- version : 2.0.8
3
+ version : 2.0.9
4
4
homepage : " https://macosui.dev"
5
5
repository : " https://github.com/GroovinChip/macos_ui"
6
6
You can’t perform that action at this time.
0 commit comments