Skip to content

Commit e2ec86c

Browse files
committed
makes it possible to control showAccordion from outside
1 parent 3960653 commit e2ec86c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/components/accordian/gf_accordian.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ class GFAccordion extends StatefulWidget {
1818
this.contentChild,
1919
this.titleborder = const Border(),
2020
this.contentBorder = const Border(),
21-
this.margin})
21+
this.margin,
22+
this.showAccordion})
2223
: super(key: key);
2324

25+
/// controls if the accordion should be collapsed or not making it possible to be controlled from outside
26+
final bool showAccordion;
27+
2428
/// child of type [Widget]is alternative to title key. title will get priority over titleChild
2529
final Widget titleChild;
2630

@@ -75,10 +79,11 @@ class _GFAccordionState extends State<GFAccordion>
7579
AnimationController animationController;
7680
AnimationController controller;
7781
Animation<Offset> offset;
78-
bool showAccordion = false;
82+
bool showAccordion;
7983

8084
@override
8185
void initState() {
86+
showAccordion = widget.showAccordion;
8287
animationController = AnimationController(
8388
duration: const Duration(seconds: 2),
8489
vsync: this,

0 commit comments

Comments
 (0)