@@ -16,7 +16,7 @@ typedef InnerDrawerCallback = void Function(bool isOpened);
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
1818typedef InnerDragUpdateCallback = void Function (
19- double value, InnerDrawerDirection direction);
19+ double value, InnerDrawerDirection ? direction);
2020
2121/// The possible position of a [InnerDrawer] .
2222enum InnerDrawerDirection {
@@ -39,10 +39,10 @@ const Duration _kBaseSettleDuration = Duration(milliseconds: 246);
3939
4040class InnerDrawer extends StatefulWidget {
4141 const InnerDrawer (
42- {GlobalKey key,
42+ {GlobalKey ? key,
4343 this .leftChild,
4444 this .rightChild,
45- @ required this .scaffold,
45+ required this .scaffold,
4646 this .offset = const IDOffset .horizontal (0.4 ),
4747 this .scale = const IDOffset .horizontal (1 ),
4848 this .proportionalChildArea = true ,
@@ -66,10 +66,10 @@ class InnerDrawer extends StatefulWidget {
6666 super (key: key);
6767
6868 /// Left child
69- final Widget leftChild;
69+ final Widget ? leftChild;
7070
7171 /// Right child
72- final Widget rightChild;
72+ final Widget ? rightChild;
7373
7474 /// A Scaffold is generally used but you are free to use other widgets
7575 final Widget scaffold;
@@ -101,19 +101,19 @@ class InnerDrawer extends StatefulWidget {
101101 final bool swipeChild;
102102
103103 /// duration animation controller
104- final Duration duration;
104+ final Duration ? duration;
105105
106106 /// possibility to set the opening and closing velocity
107107 final double velocity;
108108
109109 /// BoxShadow of scaffold open
110- final List <BoxShadow > boxShadow;
110+ final List <BoxShadow >? boxShadow;
111111
112112 ///Color of gradient background
113- final Color colorTransitionChild;
113+ final Color ? colorTransitionChild;
114114
115115 ///Color of gradient background
116- final Color colorTransitionScaffold;
116+ final Color ? colorTransitionScaffold;
117117
118118 /// Static or Linear or Quadratic
119119 final InnerDrawerAnimation leftAnimationType;
@@ -122,13 +122,13 @@ class InnerDrawer extends StatefulWidget {
122122 final InnerDrawerAnimation rightAnimationType;
123123
124124 /// Color of the main background
125- final Decoration backgroundDecoration;
125+ final Decoration ? backgroundDecoration;
126126
127127 /// Optional callback that is called when a [InnerDrawer] is open or closed.
128- final InnerDrawerCallback innerDrawerCallback;
128+ final InnerDrawerCallback ? innerDrawerCallback;
129129
130130 /// when a pointer that is in contact with the screen and moves to the right or left
131- final InnerDragUpdateCallback onDragUpdate;
131+ final InnerDragUpdateCallback ? onDragUpdate;
132132
133133 @override
134134 InnerDrawerState createState () => InnerDrawerState ();
@@ -143,7 +143,7 @@ class InnerDrawerState extends State<InnerDrawer>
143143
144144 double _initWidth = _kWidth;
145145 Orientation _orientation = Orientation .portrait;
146- InnerDrawerDirection _position;
146+ InnerDrawerDirection ? _position;
147147
148148 @override
149149 void initState () {
@@ -174,28 +174,28 @@ class InnerDrawerState extends State<InnerDrawer>
174174 });
175175 if (widget.colorTransitionChild != null )
176176 _colorTransitionChild = ColorTween (
177- begin: widget.colorTransitionChild.withOpacity (0.0 ),
177+ begin: widget.colorTransitionChild! .withOpacity (0.0 ),
178178 end: widget.colorTransitionChild);
179179
180180 if (widget.colorTransitionScaffold != null )
181181 _colorTransitionScaffold = ColorTween (
182182 begin: widget.colorTransitionScaffold,
183- end: widget.colorTransitionScaffold.withOpacity (0.0 ));
183+ end: widget.colorTransitionScaffold! .withOpacity (0.0 ));
184184
185185 if (widget.onDragUpdate != null && _controller.value < 1 ) {
186- widget.onDragUpdate ((1 - _controller.value), _position);
186+ widget.onDragUpdate ! ((1 - _controller.value), _position);
187187 }
188188 }
189189
190- LocalHistoryEntry _historyEntry;
190+ LocalHistoryEntry ? _historyEntry;
191191 final FocusScopeNode _focusScopeNode = FocusScopeNode ();
192192
193193 void _ensureHistoryEntry () {
194194 if (_historyEntry == null ) {
195- final ModalRoute <dynamic > route = ModalRoute .of (context);
195+ final ModalRoute <dynamic >? route = ModalRoute .of (context);
196196 if (route != null ) {
197197 _historyEntry = LocalHistoryEntry (onRemove: _handleHistoryEntryRemoved);
198- route.addLocalHistoryEntry (_historyEntry);
198+ route.addLocalHistoryEntry (_historyEntry! );
199199 FocusScope .of (context).setFirstFocus (_focusScopeNode);
200200 }
201201 }
@@ -213,15 +213,15 @@ class InnerDrawerState extends State<InnerDrawer>
213213 if (_previouslyOpened != opened) {
214214 _previouslyOpened = opened;
215215 if (widget.innerDrawerCallback != null )
216- widget.innerDrawerCallback (opened);
216+ widget.innerDrawerCallback ! (opened);
217217 }
218218 _ensureHistoryEntry ();
219219 break ;
220220 case AnimationStatus .completed:
221221 if (_previouslyOpened != opened) {
222222 _previouslyOpened = opened;
223223 if (widget.innerDrawerCallback != null )
224- widget.innerDrawerCallback (opened);
224+ widget.innerDrawerCallback ! (opened);
225225 }
226226 _historyEntry? .remove ();
227227 _historyEntry = null ;
@@ -233,7 +233,7 @@ class InnerDrawerState extends State<InnerDrawer>
233233 close ();
234234 }
235235
236- AnimationController _controller;
236+ late AnimationController _controller;
237237
238238 void _handleDragDown (DragDownDetails details) {
239239 _controller.stop ();
@@ -252,8 +252,9 @@ class InnerDrawerState extends State<InnerDrawer>
252252
253253 /// get width of screen after initState
254254 void _updateWidth () {
255- WidgetsBinding .instance.addPostFrameCallback ((_) {
256- final RenderBox box = _drawerKey.currentContext.findRenderObject ();
255+ WidgetsBinding .instance! .addPostFrameCallback ((_) {
256+ final RenderBox ? box =
257+ _drawerKey.currentContext! .findRenderObject () as RenderBox ? ;
257258 //final RenderBox box = context.findRenderObject();
258259 if (box != null &&
259260 box.hasSize &&
@@ -268,7 +269,7 @@ class InnerDrawerState extends State<InnerDrawer>
268269 bool _previouslyOpened = false ;
269270
270271 void _move (DragUpdateDetails details) {
271- double delta = details.primaryDelta / _width;
272+ double delta = details.primaryDelta! / _width;
272273
273274 if (delta > 0 && _controller.value == 1 && _leftChild != null )
274275 _position = InnerDrawerDirection .start;
@@ -287,8 +288,8 @@ class InnerDrawerState extends State<InnerDrawer>
287288 else if (offset <= 0.6 ) ee = 1.05 ;
288289
289290 offset = 1 -
290- pow (offset / ee,
291- 1 / 2 ); //(num.parse(pow(offset/2,1/3).toStringAsFixed(1)));
291+ ( pow (offset / ee, 1 / 2 )
292+ as double ); //(num.parse(pow(offset/2,1/3).toStringAsFixed(1)));
292293
293294 switch (_position) {
294295 case InnerDrawerDirection .end:
@@ -308,7 +309,7 @@ class InnerDrawerState extends State<InnerDrawer>
308309
309310 final bool opened = _controller.value < 0.5 ? true : false ;
310311 if (opened != _previouslyOpened && widget.innerDrawerCallback != null )
311- widget.innerDrawerCallback (opened);
312+ widget.innerDrawerCallback ! (opened);
312313 _previouslyOpened = opened;
313314 }
314315
@@ -340,18 +341,18 @@ class InnerDrawerState extends State<InnerDrawer>
340341 }
341342 }
342343
343- void open ({InnerDrawerDirection direction}) {
344+ void open ({InnerDrawerDirection ? direction}) {
344345 if (direction != null ) _position = direction;
345346 _controller.fling (velocity: - _velocity);
346347 }
347348
348- void close ({InnerDrawerDirection direction}) {
349+ void close ({InnerDrawerDirection ? direction}) {
349350 if (direction != null ) _position = direction;
350351 _controller.fling (velocity: _velocity);
351352 }
352353
353354 /// Open or Close InnerDrawer
354- void toggle ({InnerDrawerDirection direction}) {
355+ void toggle ({InnerDrawerDirection ? direction}) {
355356 if (_previouslyOpened)
356357 close (direction: direction);
357358 else
@@ -361,7 +362,7 @@ class InnerDrawerState extends State<InnerDrawer>
361362 final GlobalKey _gestureDetectorKey = GlobalKey ();
362363
363364 /// Outer Alignment
364- AlignmentDirectional get _drawerOuterAlignment {
365+ AlignmentDirectional ? get _drawerOuterAlignment {
365366 switch (_position) {
366367 case InnerDrawerDirection .start:
367368 return AlignmentDirectional .centerEnd;
@@ -372,7 +373,7 @@ class InnerDrawerState extends State<InnerDrawer>
372373 }
373374
374375 /// Inner Alignment
375- AlignmentDirectional get _drawerInnerAlignment {
376+ AlignmentDirectional ? get _drawerInnerAlignment {
376377 switch (_position) {
377378 case InnerDrawerDirection .start:
378379 return AlignmentDirectional .centerStart;
@@ -428,12 +429,12 @@ class InnerDrawerState extends State<InnerDrawer>
428429 Widget _scaffold () {
429430 assert (widget.borderRadius >= 0 );
430431
431- final Widget invC = _invisibleCover ();
432+ final Widget ? invC = _invisibleCover ();
432433
433434 final Widget scaffoldChild = Stack (
434- children: < Widget > [widget.scaffold, invC != null ? invC : null ]
435+ children: < Widget ? > [widget.scaffold, invC != null ? invC : null ]
435436 .where ((a) => a != null )
436- .toList (),
437+ .toList () as List < Widget > ,
437438 );
438439
439440 Widget container = Container (
@@ -477,7 +478,7 @@ class InnerDrawerState extends State<InnerDrawer>
477478 }
478479
479480 ///Disable the scaffolding tap when the drawer is open
480- Widget _invisibleCover () {
481+ Widget ? _invisibleCover () {
481482 final Container container = Container (
482483 color: _colorTransitionScaffold.evaluate (_controller),
483484 );
@@ -496,17 +497,17 @@ class InnerDrawerState extends State<InnerDrawer>
496497 return null ;
497498 }
498499
499- Widget get _leftChild {
500+ Widget ? get _leftChild {
500501 return widget.leftChild;
501502 }
502503
503- Widget get _rightChild {
504+ Widget ? get _rightChild {
504505 return widget.rightChild;
505506 }
506507
507508 /// return widget with specific animation
508509 Widget _animatedChild () {
509- Widget child =
510+ Widget ? child =
510511 _position == InnerDrawerDirection .start ? _leftChild : _rightChild;
511512 if (_swipeChild) {
512513 child = GestureDetector (
@@ -524,13 +525,13 @@ class InnerDrawerState extends State<InnerDrawer>
524525 switch (_animationType) {
525526 case InnerDrawerAnimation .linear:
526527 return Align (
527- alignment: _drawerOuterAlignment,
528+ alignment: _drawerOuterAlignment! ,
528529 widthFactor: 1 - (_controller.value),
529530 child: container,
530531 );
531532 case InnerDrawerAnimation .quadratic:
532533 return Align (
533- alignment: _drawerOuterAlignment,
534+ alignment: _drawerOuterAlignment! ,
534535 widthFactor: 1 - (_controller.value / 2 ),
535536 child: container,
536537 );
@@ -540,7 +541,7 @@ class InnerDrawerState extends State<InnerDrawer>
540541 }
541542
542543 /// Trigger Area
543- Widget _trigger (AlignmentDirectional alignment, Widget child) {
544+ Widget ? _trigger (AlignmentDirectional alignment, Widget ? child) {
544545 assert (alignment != null );
545546 final bool drawerIsStart = _position == InnerDrawerDirection .start;
546547 final EdgeInsets padding = MediaQuery .of (context).padding;
@@ -584,7 +585,7 @@ class InnerDrawerState extends State<InnerDrawer>
584585 color: Theme .of (context).backgroundColor,
585586 ),
586587 child: Stack (
587- alignment: _drawerInnerAlignment,
588+ alignment: _drawerInnerAlignment! ,
588589 children: < Widget > [
589590 FocusScope (node: _focusScopeNode, child: _animatedChild ()),
590591 GestureDetector (
@@ -596,7 +597,7 @@ class InnerDrawerState extends State<InnerDrawer>
596597 excludeFromSemantics: true ,
597598 child: RepaintBoundary (
598599 child: Stack (
599- children: < Widget > [
600+ children: < Widget ? > [
600601 ///Gradient
601602 Container (
602603 width: _controller.value == 0 ||
@@ -606,17 +607,17 @@ class InnerDrawerState extends State<InnerDrawer>
606607 color: _colorTransitionChild.evaluate (_controller),
607608 ),
608609 Align (
609- alignment: _drawerOuterAlignment,
610+ alignment: _drawerOuterAlignment! ,
610611 child: Align (
611- alignment: _drawerInnerAlignment,
612+ alignment: _drawerInnerAlignment! ,
612613 widthFactor: wFactor,
613614 child: RepaintBoundary (child: _scaffold ())),
614615 ),
615616
616617 ///Trigger
617618 _trigger (AlignmentDirectional .centerStart, _leftChild),
618619 _trigger (AlignmentDirectional .centerEnd, _rightChild),
619- ].where ((a) => a != null ).toList (),
620+ ].where ((a) => a != null ).toList () as List < Widget > ,
620621 ),
621622 ),
622623 ),
0 commit comments