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+
15## [ 2.0.8]
26### 🛠️ Updated 🛠️
37* Fixed ` SidebarItem ` text overflowing.
Original file line number Diff line number Diff line change @@ -221,6 +221,7 @@ class _WidgetGalleryState extends State<WidgetGallery> {
221221 label: Text ('ResizablePane' ),
222222 ),
223223 ],
224+ expandDisclosureItems: true ,
224225 ),
225226 SidebarItem (
226227 leading: MacosImageIcon (
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ class SidebarItem with Diagnosticable {
1919 this .focusNode,
2020 this .semanticLabel,
2121 this .disclosureItems,
22+ this .expandDisclosureItems = false ,
2223 this .trailing,
2324 });
2425
@@ -58,6 +59,11 @@ class SidebarItem with Diagnosticable {
5859 /// If non-null and [leading] is null, a local animated icon is created
5960 final List <SidebarItem >? disclosureItems;
6061
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+
6167 /// An optional trailing widget.
6268 ///
6369 /// Typically a text indicator of a count of items, like in this
@@ -77,6 +83,8 @@ class SidebarItem with Diagnosticable {
7783 'disclosure items' ,
7884 disclosureItems,
7985 ));
86+ properties.add (
87+ FlagProperty ('expandDisclosureItems' , value: expandDisclosureItems));
8088 properties.add (DiagnosticsProperty <Widget ?>('trailing' , trailing));
8189 }
8290}
Original file line number Diff line number Diff line change @@ -378,8 +378,7 @@ class __DisclosureSidebarItemState extends State<_DisclosureSidebarItem>
378378 late AnimationController _controller;
379379 late Animation <double > _iconTurns;
380380 late Animation <double > _heightFactor;
381-
382- bool _isExpanded = false ;
381+ late bool _isExpanded;
383382
384383 bool get hasLeading => widget.item.leading != null ;
385384
@@ -389,6 +388,11 @@ class __DisclosureSidebarItemState extends State<_DisclosureSidebarItem>
389388 _controller = AnimationController (duration: _kExpand, vsync: this );
390389 _heightFactor = _controller.drive (_easeInTween);
391390 _iconTurns = _controller.drive (_halfTween.chain (_easeInTween));
391+
392+ _isExpanded = widget.item.expandDisclosureItems;
393+ if (_isExpanded) {
394+ _controller.forward ();
395+ }
392396 }
393397
394398 void _handleTap () {
Original file line number Diff line number Diff line change 11name : macos_ui
22description : Flutter widgets and themes implementing the current macOS design language.
3- version : 2.0.8
3+ version : 2.0.9
44homepage : " https://macosui.dev"
55repository : " https://github.com/GroovinChip/macos_ui"
66
You can’t perform that action at this time.
0 commit comments