@@ -15,8 +15,7 @@ typedef InnerDrawerCallback = void Function(bool isOpened);
1515
1616/// Signature for when a pointer that is in contact with the screen and moves to the right or left
1717/// values between 1 and 0
18- typedef InnerDragUpdateCallback = void Function (
19- double value, InnerDrawerDirection ? direction);
18+ typedef InnerDragUpdateCallback = void Function (double value, InnerDrawerDirection ? direction);
2019
2120/// The possible position of a [InnerDrawer] .
2221enum InnerDrawerDirection {
@@ -134,12 +133,9 @@ class InnerDrawer extends StatefulWidget {
134133 InnerDrawerState createState () => InnerDrawerState ();
135134}
136135
137- class InnerDrawerState extends State <InnerDrawer >
138- with SingleTickerProviderStateMixin {
139- ColorTween _colorTransitionChild =
140- ColorTween (begin: Colors .transparent, end: Colors .black54);
141- ColorTween _colorTransitionScaffold =
142- ColorTween (begin: Colors .black54, end: Colors .transparent);
136+ class InnerDrawerState extends State <InnerDrawer > with SingleTickerProviderStateMixin {
137+ ColorTween _colorTransitionChild = ColorTween (begin: Colors .transparent, end: Colors .black54);
138+ ColorTween _colorTransitionScaffold = ColorTween (begin: Colors .black54, end: Colors .transparent);
143139
144140 double _initWidth = _kWidth;
145141 Orientation _orientation = Orientation .portrait;
@@ -172,15 +168,13 @@ class InnerDrawerState extends State<InnerDrawer>
172168 setState (() {
173169 // The animation controller's state is our build state, and it changed already.
174170 });
175- if (widget.colorTransitionChild != null )
176- _colorTransitionChild = ColorTween (
177- begin: widget.colorTransitionChild! .withOpacity (0.0 ),
178- end: widget.colorTransitionChild);
171+ if (widget.colorTransitionChild != null ) {
172+ _colorTransitionChild = ColorTween (begin: widget.colorTransitionChild! .withOpacity (0.0 ), end: widget.colorTransitionChild);
173+ }
179174
180- if (widget.colorTransitionScaffold != null )
181- _colorTransitionScaffold = ColorTween (
182- begin: widget.colorTransitionScaffold,
183- end: widget.colorTransitionScaffold! .withOpacity (0.0 ));
175+ if (widget.colorTransitionScaffold != null ) {
176+ _colorTransitionScaffold = ColorTween (begin: widget.colorTransitionScaffold, end: widget.colorTransitionScaffold! .withOpacity (0.0 ));
177+ }
184178
185179 if (widget.onDragUpdate != null && _controller.value < 1 ) {
186180 widget.onDragUpdate !((1 - _controller.value), _position);
@@ -212,16 +206,18 @@ class InnerDrawerState extends State<InnerDrawer>
212206 case AnimationStatus .dismissed:
213207 if (_previouslyOpened != opened) {
214208 _previouslyOpened = opened;
215- if (widget.innerDrawerCallback != null )
209+ if (widget.innerDrawerCallback != null ) {
216210 widget.innerDrawerCallback !(opened);
211+ }
217212 }
218213 _ensureHistoryEntry ();
219214 break ;
220215 case AnimationStatus .completed:
221216 if (_previouslyOpened != opened) {
222217 _previouslyOpened = opened;
223- if (widget.innerDrawerCallback != null )
218+ if (widget.innerDrawerCallback != null ) {
224219 widget.innerDrawerCallback !(opened);
220+ }
225221 }
226222 _historyEntry? .remove ();
227223 _historyEntry = null ;
@@ -253,8 +249,7 @@ class InnerDrawerState extends State<InnerDrawer>
253249 /// get width of screen after initState
254250 void _updateWidth () {
255251 WidgetsBinding .instance! .addPostFrameCallback ((_) {
256- final RenderBox ? box =
257- _drawerKey.currentContext! .findRenderObject () as RenderBox ? ;
252+ final RenderBox ? box = _drawerKey.currentContext! .findRenderObject () as RenderBox ? ;
258253 //final RenderBox box = context.findRenderObject();
259254 if (box != null &&
260255 box.hasSize &&
@@ -271,10 +266,11 @@ class InnerDrawerState extends State<InnerDrawer>
271266 void _move (DragUpdateDetails details) {
272267 double delta = details.primaryDelta! / _width;
273268
274- if (delta > 0 && _controller.value == 1 && _leftChild != null )
269+ if (delta > 0 && _controller.value == 1 && _leftChild != null ) {
275270 _position = InnerDrawerDirection .start;
276- else if (delta < 0 && _controller.value == 1 && _rightChild != null )
271+ } else if (delta < 0 && _controller.value == 1 && _rightChild != null ) {
277272 _position = InnerDrawerDirection .end;
273+ }
278274
279275 double offset = _position == InnerDrawerDirection .start
280276 ? widget.offset.left
@@ -431,11 +427,7 @@ class InnerDrawerState extends State<InnerDrawer>
431427
432428 final Widget ? invC = _invisibleCover ();
433429
434- final Widget scaffoldChild = Stack (
435- children: < Widget ? > [widget.scaffold, invC != null ? invC : null ]
436- .where ((a) => a != null )
437- .toList () as List <Widget >,
438- );
430+ final Widget scaffoldChild = Stack (children: [widget.scaffold, invC ?? Container ()].where ((Widget a) => a.runtimeType.toString ().toLowerCase () != 'container' ).toList ());
439431
440432 Widget container = Container (
441433 key: _drawerKey,
@@ -580,10 +572,7 @@ class InnerDrawerState extends State<InnerDrawer>
580572 final double wFactor = (_controller.value * (1 - offset)) + offset;
581573
582574 return Container (
583- decoration: widget.backgroundDecoration ??
584- BoxDecoration (
585- color: Theme .of (context).backgroundColor,
586- ),
575+ decoration: widget.backgroundDecoration ?? BoxDecoration (color: Theme .of (context).backgroundColor),
587576 child: Stack (
588577 alignment: _drawerInnerAlignment! ,
589578 children: < Widget > [
@@ -597,13 +586,10 @@ class InnerDrawerState extends State<InnerDrawer>
597586 excludeFromSemantics: true ,
598587 child: RepaintBoundary (
599588 child: Stack (
600- children: < Widget ? > [
589+ children: [
601590 ///Gradient
602591 Container (
603- width: _controller.value == 0 ||
604- _animationType == InnerDrawerAnimation .linear
605- ? 0
606- : null ,
592+ width: _controller.value == 0 || _animationType == InnerDrawerAnimation .linear ? 0 : null ,
607593 color: _colorTransitionChild.evaluate (_controller),
608594 ),
609595 Align (
@@ -613,11 +599,10 @@ class InnerDrawerState extends State<InnerDrawer>
613599 widthFactor: wFactor,
614600 child: RepaintBoundary (child: _scaffold ())),
615601 ),
616-
617602 ///Trigger
618- _trigger (AlignmentDirectional .centerStart, _leftChild),
619- _trigger (AlignmentDirectional .centerEnd, _rightChild),
620- ].where ((a) => a != null ).toList () as List < Widget > ,
603+ _trigger (AlignmentDirectional .centerStart, _leftChild) ?? Container () ,
604+ _trigger (AlignmentDirectional .centerEnd, _rightChild) ?? Container () ,
605+ ].where ((a) => a.runtimeType. toString (). toLowerCase () != 'container' ).toList (),
621606 ),
622607 ),
623608 ),
@@ -662,4 +647,4 @@ class IDOffset {
662647
663648 /// The offset from the bottom.
664649 final double bottom;
665- }
650+ }
0 commit comments