@@ -4,7 +4,7 @@ import 'package:getwidget/getwidget.dart';
44class GFAccordion extends StatefulWidget {
55 /// An accordion is used to show (and hide) content. Use [showAccordion] to hide & show the accordion content.
66 const GFAccordion (
7- {Key key,
7+ {Key ? key,
88 this .title,
99 this .content,
1010 this .titleChild,
@@ -30,13 +30,13 @@ class GFAccordion extends StatefulWidget {
3030 final bool showAccordion;
3131
3232 /// child of type [Widget] is alternative to title key. title will get priority over titleChild
33- final Widget titleChild;
33+ final Widget ? titleChild;
3434
3535 /// content of type[String] which shows the messages after the [GFAccordion] is expanded
36- final String content;
36+ final String ? content;
3737
3838 /// contentChild of type [Widget] is alternative to content key. content will get priority over contentChild
39- final Widget contentChild;
39+ final Widget ? contentChild;
4040
4141 /// type of [Color] or [GFColors] which is used to change the background color of the [GFAccordion] title when it is collapsed
4242 final Color collapsedTitleBackgroundColor;
@@ -51,7 +51,7 @@ class GFAccordion extends StatefulWidget {
5151 final Widget expandedIcon;
5252
5353 /// text of type [String] is alternative to child. text will get priority over titleChild
54- final String title;
54+ final String ? title;
5555
5656 /// textStyle of type [textStyle] will be applicable to text only and not for the child
5757 final TextStyle textStyle;
@@ -63,10 +63,10 @@ class GFAccordion extends StatefulWidget {
6363 final EdgeInsets contentPadding;
6464
6565 /// type of [Color] or [GFColors] which is used to change the background color of the [GFAccordion] description
66- final Color contentBackgroundColor;
66+ final Color ? contentBackgroundColor;
6767
6868 /// margin of type [EdgeInsets] which is used to set the margin of the [GFAccordion]
69- final EdgeInsets margin;
69+ final EdgeInsets ? margin;
7070
7171 /// titleBorderColor of type [Color] or [GFColors] which is used to change the border color of title
7272 final Border titleBorder;
@@ -81,18 +81,18 @@ class GFAccordion extends StatefulWidget {
8181 final BorderRadius contentBorderRadius;
8282
8383 /// function called when the content body collapsed
84- final Function (bool ) onToggleCollapsed;
84+ final Function (bool )? onToggleCollapsed;
8585
8686 @override
8787 _GFAccordionState createState () => _GFAccordionState ();
8888}
8989
9090class _GFAccordionState extends State <GFAccordion >
9191 with TickerProviderStateMixin {
92- AnimationController animationController;
93- AnimationController controller;
94- Animation <Offset > offset;
95- bool showAccordion;
92+ late AnimationController animationController;
93+ late AnimationController controller;
94+ late Animation <Offset > offset;
95+ late bool showAccordion;
9696
9797 @override
9898 void initState () {
@@ -142,7 +142,7 @@ class _GFAccordionState extends State<GFAccordion>
142142 children: < Widget > [
143143 Expanded (
144144 child: widget.title != null
145- ? Text (widget.title, style: widget.textStyle)
145+ ? Text (widget.title! , style: widget.textStyle)
146146 : (widget.titleChild ?? Container ()),
147147 ),
148148 showAccordion ? widget.expandedIcon : widget.collapsedIcon
@@ -162,7 +162,7 @@ class _GFAccordionState extends State<GFAccordion>
162162 child: SlideTransition (
163163 position: offset,
164164 child: widget.content != null
165- ? Text (widget.content)
165+ ? Text (widget.content! )
166166 : (widget.contentChild ?? Container ()),
167167 ))
168168 : Container ()
@@ -183,7 +183,7 @@ class _GFAccordionState extends State<GFAccordion>
183183 }
184184 showAccordion = ! showAccordion;
185185 if (widget.onToggleCollapsed != null ) {
186- widget.onToggleCollapsed (showAccordion);
186+ widget.onToggleCollapsed ! (showAccordion);
187187 }
188188 });
189189 }
0 commit comments