Jaime Blasco

fix: analyzer issues

@@ -143,20 +143,27 @@ class BouncingSheetPhysics extends ScrollPhysics with SheetPhysics { @@ -143,20 +143,27 @@ class BouncingSheetPhysics extends ScrollPhysics with SheetPhysics {
143 return true; 143 return true;
144 }()); 144 }());
145 if (!overflowViewport) { 145 if (!overflowViewport) {
  146 + // overscroll
146 if (position.viewportDimension <= position.pixels && 147 if (position.viewportDimension <= position.pixels &&
147 - position.pixels < value) // overscroll 148 + position.pixels < value) {
148 return value - position.pixels; 149 return value - position.pixels;
  150 + }
  151 + // hit top edge
149 if (value < position.viewportDimension && 152 if (value < position.viewportDimension &&
150 - position.viewportDimension < position.pixels) // hit top edge 153 + position.viewportDimension < position.pixels) {
151 return value - position.viewportDimension; 154 return value - position.viewportDimension;
  155 + }
152 } 156 }
  157 + // underscroll
153 if (value < position.pixels && 158 if (value < position.pixels &&
154 - position.pixels <= position.minScrollExtent) // underscroll 159 + position.pixels <= position.minScrollExtent) {
155 return value - position.pixels; 160 return value - position.pixels;
156 - 161 + }
  162 + // hit bottom edge
157 if (position.pixels < position.maxScrollExtent && 163 if (position.pixels < position.maxScrollExtent &&
158 - position.maxScrollExtent < value) // hit bottom edge 164 + position.maxScrollExtent < value) {
159 return value - position.maxScrollExtent; 165 return value - position.maxScrollExtent;
  166 + }
160 return 0.0; 167 return 0.0;
161 } 168 }
162 169
@@ -227,26 +234,34 @@ class NoMomentumSheetPhysics extends ScrollPhysics with SheetPhysics { @@ -227,26 +234,34 @@ class NoMomentumSheetPhysics extends ScrollPhysics with SheetPhysics {
227 234
228 @override 235 @override
229 double applyBoundaryConditions(ScrollMetrics position, double value) { 236 double applyBoundaryConditions(ScrollMetrics position, double value) {
  237 + // underscroll
230 if (value < position.pixels && 238 if (value < position.pixels &&
231 - position.pixels <= position.minScrollExtent) // underscroll 239 + position.pixels <= position.minScrollExtent) {
232 return value - position.pixels; 240 return value - position.pixels;
  241 + }
233 if (position.maxScrollExtent <= position.pixels && 242 if (position.maxScrollExtent <= position.pixels &&
234 - position.pixels < value) // overscroll 243 + position.pixels < value) {
  244 + // overscroll
235 return value - position.pixels; 245 return value - position.pixels;
  246 + }
236 if (value < position.minScrollExtent && 247 if (value < position.minScrollExtent &&
237 - position.minScrollExtent < position.pixels) // hit top edge 248 + position.minScrollExtent < position.pixels) {
  249 + // hit top edge
238 return value - position.minScrollExtent; 250 return value - position.minScrollExtent;
  251 + }
239 if (position.pixels < position.maxScrollExtent && 252 if (position.pixels < position.maxScrollExtent &&
240 - position.maxScrollExtent < value) // hit bottom edge 253 + position.maxScrollExtent < value) {
  254 + // hit bottom edge
241 return value - position.maxScrollExtent; 255 return value - position.maxScrollExtent;
  256 + }
242 return 0.0; 257 return 0.0;
243 258
244 - if (position.viewportDimension <= position.pixels &&  
245 - position.pixels < value) // hit top edge  
246 - return value - position.pixels;  
247 - if (position.pixels < 0 && position.pixels > value) // hit bottom edge  
248 - return value - position.pixels;  
249 - return 0.0; 259 + // if (position.viewportDimension <= position.pixels &&
  260 + // position.pixels < value) // hit top edge
  261 + // return value - position.pixels;
  262 + // if (position.pixels < 0 && position.pixels > value) // hit bottom edge
  263 + // return value - position.pixels;
  264 + // return 0.0;
250 } 265 }
251 266
252 @override 267 @override
@@ -255,10 +270,11 @@ class NoMomentumSheetPhysics extends ScrollPhysics with SheetPhysics { @@ -255,10 +270,11 @@ class NoMomentumSheetPhysics extends ScrollPhysics with SheetPhysics {
255 final Tolerance tolerance = this.tolerance; 270 final Tolerance tolerance = this.tolerance;
256 if (position.outOfRange) { 271 if (position.outOfRange) {
257 double? end; 272 double? end;
258 - if (position.pixels > position.maxScrollExtent) 273 + if (position.pixels > position.maxScrollExtent) {
259 end = position.maxScrollExtent; 274 end = position.maxScrollExtent;
260 - if (position.pixels < position.minScrollExtent) 275 + } else if (position.pixels < position.minScrollExtent) {
261 end = position.minScrollExtent; 276 end = position.minScrollExtent;
  277 + }
262 assert(end != null); 278 assert(end != null);
263 return ScrollSpringSimulation( 279 return ScrollSpringSimulation(
264 spring, 280 spring,
@@ -306,11 +322,15 @@ class ClampingSheetPhysics extends ScrollPhysics with SheetPhysics { @@ -306,11 +322,15 @@ class ClampingSheetPhysics extends ScrollPhysics with SheetPhysics {
306 } 322 }
307 return true; 323 return true;
308 }()); 324 }());
  325 + // hit top edge
309 if (position.viewportDimension <= position.pixels && 326 if (position.viewportDimension <= position.pixels &&
310 - position.pixels < value) // hit top edge 327 + position.pixels < value) {
311 return value - position.pixels; 328 return value - position.pixels;
312 - if (position.pixels < 0 && position.pixels > value) // hit bottom edge 329 + }
  330 + // hit bottom edge
  331 + if (position.pixels < 0 && position.pixels > value) {
313 return value - position.pixels; 332 return value - position.pixels;
  333 + }
314 return 0.0; 334 return 0.0;
315 } 335 }
316 336
@@ -320,10 +340,12 @@ class ClampingSheetPhysics extends ScrollPhysics with SheetPhysics { @@ -320,10 +340,12 @@ class ClampingSheetPhysics extends ScrollPhysics with SheetPhysics {
320 final Tolerance tolerance = this.tolerance; 340 final Tolerance tolerance = this.tolerance;
321 if (position.outOfRange) { 341 if (position.outOfRange) {
322 double? end; 342 double? end;
323 - if (position.pixels > position.maxScrollExtent) 343 + if (position.pixels > position.maxScrollExtent) {
324 end = position.maxScrollExtent; 344 end = position.maxScrollExtent;
325 - if (position.pixels < position.minScrollExtent) 345 + }
  346 + if (position.pixels < position.minScrollExtent) {
326 end = position.minScrollExtent; 347 end = position.minScrollExtent;
  348 + }
327 assert(end != null); 349 assert(end != null);
328 return ScrollSpringSimulation( 350 return ScrollSpringSimulation(
329 spring, 351 spring,
@@ -336,10 +358,12 @@ class ClampingSheetPhysics extends ScrollPhysics with SheetPhysics { @@ -336,10 +358,12 @@ class ClampingSheetPhysics extends ScrollPhysics with SheetPhysics {
336 if (velocity.abs() < tolerance.velocity) { 358 if (velocity.abs() < tolerance.velocity) {
337 return null; 359 return null;
338 } 360 }
339 - if (velocity > 0.0 && position.pixels >= position.maxScrollExtent) 361 + if (velocity > 0.0 && position.pixels >= position.maxScrollExtent) {
340 return null; 362 return null;
341 - if (velocity < 0.0 && position.pixels <= position.minScrollExtent) 363 + }
  364 + if (velocity < 0.0 && position.pixels <= position.minScrollExtent) {
342 return null; 365 return null;
  366 + }
343 return ClampingScrollSimulation( 367 return ClampingScrollSimulation(
344 position: position.pixels, 368 position: position.pixels,
345 velocity: velocity, 369 velocity: velocity,
@@ -477,9 +501,7 @@ class SnapSheetPhysics extends ScrollPhysics with SheetPhysics { @@ -477,9 +501,7 @@ class SnapSheetPhysics extends ScrollPhysics with SheetPhysics {
477 501
478 int? _getPage(ScrollMetrics position) { 502 int? _getPage(ScrollMetrics position) {
479 assert( 503 assert(
480 - !position.hasPixels ||  
481 - (position.minScrollExtent != null &&  
482 - position.maxScrollExtent != null), 504 + !position.hasPixels || position.hasContentDimensions,
483 'Page value is only available after content dimensions are established.', 505 'Page value is only available after content dimensions are established.',
484 ); 506 );
485 return !position.hasPixels 507 return !position.hasPixels
@@ -134,13 +134,13 @@ class CupertinoSheetRoute<T> extends SheetRoute<T> { @@ -134,13 +134,13 @@ class CupertinoSheetRoute<T> extends SheetRoute<T> {
134 134
135 @override 135 @override
136 Widget buildSheet(BuildContext context, Widget child) { 136 Widget buildSheet(BuildContext context, Widget child) {
137 - SheetPhysics? _physics = BouncingSheetPhysics( 137 + SheetPhysics? effectivePhysics = BouncingSheetPhysics(
138 parent: SnapSheetPhysics( 138 parent: SnapSheetPhysics(
139 stops: stops ?? <double>[0, 1], 139 stops: stops ?? <double>[0, 1],
140 parent: physics, 140 parent: physics,
141 )); 141 ));
142 if (!draggable) { 142 if (!draggable) {
143 - _physics = const NeverDraggableSheetPhysics(); 143 + effectivePhysics = const NeverDraggableSheetPhysics();
144 } 144 }
145 final MediaQueryData mediaQuery = MediaQuery.of(context); 145 final MediaQueryData mediaQuery = MediaQuery.of(context);
146 final double topMargin = 146 final double topMargin =
@@ -151,7 +151,7 @@ class CupertinoSheetRoute<T> extends SheetRoute<T> { @@ -151,7 +151,7 @@ class CupertinoSheetRoute<T> extends SheetRoute<T> {
151 decorationBuilder: decorationBuilder, 151 decorationBuilder: decorationBuilder,
152 fit: fit, 152 fit: fit,
153 maxExtent: mediaQuery.size.height - topMargin, 153 maxExtent: mediaQuery.size.height - topMargin,
154 - physics: _physics, 154 + physics: effectivePhysics,
155 controller: sheetController, 155 controller: sheetController,
156 child: child, 156 child: child,
157 ); 157 );
@@ -185,18 +185,18 @@ class SheetRoute<T> extends PageRoute<T> with DelegatedTransitionsRoute<T> { @@ -185,18 +185,18 @@ class SheetRoute<T> extends PageRoute<T> with DelegatedTransitionsRoute<T> {
185 } 185 }
186 186
187 Widget buildSheet(BuildContext context, Widget child) { 187 Widget buildSheet(BuildContext context, Widget child) {
188 - SheetPhysics? _physics = SnapSheetPhysics( 188 + SheetPhysics? effectivePhysics = SnapSheetPhysics(
189 stops: stops ?? <double>[0, 1], 189 stops: stops ?? <double>[0, 1],
190 parent: physics, 190 parent: physics,
191 ); 191 );
192 if (!draggable) { 192 if (!draggable) {
193 - _physics = const NeverDraggableSheetPhysics(); 193 + effectivePhysics = const NeverDraggableSheetPhysics();
194 } 194 }
195 return Sheet.raw( 195 return Sheet.raw(
196 initialExtent: initialExtent, 196 initialExtent: initialExtent,
197 decorationBuilder: decorationBuilder, 197 decorationBuilder: decorationBuilder,
198 fit: fit, 198 fit: fit,
199 - physics: _physics, 199 + physics: effectivePhysics,
200 controller: sheetController, 200 controller: sheetController,
201 child: child, 201 child: child,
202 ); 202 );
@@ -56,11 +56,7 @@ class SheetScrollable extends StatefulWidget { @@ -56,11 +56,7 @@ class SheetScrollable extends StatefulWidget {
56 this.scrollBehavior, 56 this.scrollBehavior,
57 this.initialExtent, 57 this.initialExtent,
58 this.minInteractionExtent = 0, 58 this.minInteractionExtent = 0,
59 - }) : assert(axisDirection != null),  
60 - assert(dragStartBehavior != null),  
61 - assert(viewportBuilder != null),  
62 - assert(excludeFromSemantics != null),  
63 - assert(semanticChildCount == null || semanticChildCount >= 0), 59 + }) : assert(semanticChildCount == null || semanticChildCount >= 0),
64 super(key: key); 60 super(key: key);
65 61
66 /// The direction in which this widget scrolls. 62 /// The direction in which this widget scrolls.
@@ -278,8 +274,9 @@ class SheetScrollable extends StatefulWidget { @@ -278,8 +274,9 @@ class SheetScrollable extends StatefulWidget {
278 scrollable = SheetScrollable.of(context); 274 scrollable = SheetScrollable.of(context);
279 } 275 }
280 276
281 - if (futures.isEmpty || duration == Duration.zero) 277 + if (futures.isEmpty || duration == Duration.zero) {
282 return Future<void>.value(); 278 return Future<void>.value();
  279 + }
283 if (futures.length == 1) return futures.single; 280 if (futures.length == 1) return futures.single;
284 return Future.wait<void>(futures).then<void>((List<void> _) => null); 281 return Future.wait<void>(futures).then<void>((List<void> _) => null);
285 } 282 }
@@ -293,9 +290,7 @@ class _ScrollableScope extends InheritedWidget { @@ -293,9 +290,7 @@ class _ScrollableScope extends InheritedWidget {
293 required this.scrollable, 290 required this.scrollable,
294 required this.position, 291 required this.position,
295 required Widget child, 292 required Widget child,
296 - }) : assert(scrollable != null),  
297 - assert(child != null),  
298 - super(key: key, child: child); 293 + }) : super(key: key, child: child);
299 294
300 final SheetState scrollable; 295 final SheetState scrollable;
301 final ScrollPosition position; 296 final ScrollPosition position;
@@ -390,8 +385,9 @@ class SheetState extends State<SheetScrollable> @@ -390,8 +385,9 @@ class SheetState extends State<SheetScrollable>
390 385
391 @override 386 @override
392 void initState() { 387 void initState() {
393 - if (widget.controller == null) 388 + if (widget.controller == null) {
394 _fallbackScrollController = SheetController(); 389 _fallbackScrollController = SheetController();
  390 + }
395 super.initState(); 391 super.initState();
396 } 392 }
397 393
@@ -403,8 +399,9 @@ class SheetState extends State<SheetScrollable> @@ -403,8 +399,9 @@ class SheetState extends State<SheetScrollable>
403 399
404 bool _shouldSheetPhysicsUpdate( 400 bool _shouldSheetPhysicsUpdate(
405 ScrollPhysics? newPhysics, ScrollPhysics? oldPhysics) { 401 ScrollPhysics? newPhysics, ScrollPhysics? oldPhysics) {
406 - if (newPhysics is! SheetPhysics || oldPhysics is! SheetPhysics) 402 + if (newPhysics is! SheetPhysics || oldPhysics is! SheetPhysics) {
407 return false; 403 return false;
  404 + }
408 return newPhysics.shouldReload(oldPhysics); 405 return newPhysics.shouldReload(oldPhysics);
409 } 406 }
410 407
@@ -473,8 +470,9 @@ class SheetState extends State<SheetScrollable> @@ -473,8 +470,9 @@ class SheetState extends State<SheetScrollable>
473 @override 470 @override
474 @protected 471 @protected
475 void setSemanticsActions(Set<SemanticsAction> actions) { 472 void setSemanticsActions(Set<SemanticsAction> actions) {
476 - if (_gestureDetectorKey.currentState != null) 473 + if (_gestureDetectorKey.currentState != null) {
477 _gestureDetectorKey.currentState!.replaceSemanticsActions(actions); 474 _gestureDetectorKey.currentState!.replaceSemanticsActions(actions);
  475 + }
478 } 476 }
479 477
480 // GESTURE RECOGNITION AND POINTER IGNORING 478 // GESTURE RECOGNITION AND POINTER IGNORING
@@ -553,9 +551,10 @@ class SheetState extends State<SheetScrollable> @@ -553,9 +551,10 @@ class SheetState extends State<SheetScrollable>
553 } 551 }
554 _lastCanDrag = canDrag; 552 _lastCanDrag = canDrag;
555 _lastAxisDirection = widget.axis; 553 _lastAxisDirection = widget.axis;
556 - if (_gestureDetectorKey.currentState != null) 554 + if (_gestureDetectorKey.currentState != null) {
557 _gestureDetectorKey.currentState! 555 _gestureDetectorKey.currentState!
558 .replaceGestureRecognizers(_gestureRecognizers); 556 .replaceGestureRecognizers(_gestureRecognizers);
  557 + }
559 } 558 }
560 559
561 @override 560 @override
@@ -773,8 +772,7 @@ class _ScrollSemantics extends SingleChildRenderObjectWidget { @@ -773,8 +772,7 @@ class _ScrollSemantics extends SingleChildRenderObjectWidget {
773 required this.allowImplicitScrolling, 772 required this.allowImplicitScrolling,
774 required this.semanticChildCount, 773 required this.semanticChildCount,
775 Widget? child, 774 Widget? child,
776 - }) : assert(position != null),  
777 - assert(semanticChildCount == null || semanticChildCount >= 0), 775 + }) : assert(semanticChildCount == null || semanticChildCount >= 0),
778 super(key: key, child: child); 776 super(key: key, child: child);
779 777
780 final ScrollPosition position; 778 final ScrollPosition position;
@@ -809,7 +807,6 @@ class _RenderScrollSemantics extends RenderProxyBox { @@ -809,7 +807,6 @@ class _RenderScrollSemantics extends RenderProxyBox {
809 }) : _position = position, 807 }) : _position = position,
810 _allowImplicitScrolling = allowImplicitScrolling, 808 _allowImplicitScrolling = allowImplicitScrolling,
811 _semanticChildCount = semanticChildCount, 809 _semanticChildCount = semanticChildCount,
812 - assert(position != null),  
813 super(child) { 810 super(child) {
814 position.addListener(markNeedsSemanticsUpdate); 811 position.addListener(markNeedsSemanticsUpdate);
815 } 812 }
@@ -818,7 +815,6 @@ class _RenderScrollSemantics extends RenderProxyBox { @@ -818,7 +815,6 @@ class _RenderScrollSemantics extends RenderProxyBox {
818 ScrollPosition get position => _position; 815 ScrollPosition get position => _position;
819 ScrollPosition _position; 816 ScrollPosition _position;
820 set position(ScrollPosition value) { 817 set position(ScrollPosition value) {
821 - assert(value != null);  
822 if (value == _position) return; 818 if (value == _position) return;
823 _position.removeListener(markNeedsSemanticsUpdate); 819 _position.removeListener(markNeedsSemanticsUpdate);
824 _position = value; 820 _position = value;
@@ -881,8 +877,9 @@ class _RenderScrollSemantics extends RenderProxyBox { @@ -881,8 +877,9 @@ class _RenderScrollSemantics extends RenderProxyBox {
881 if (child.isTagged(RenderViewport.excludeFromScrolling)) { 877 if (child.isTagged(RenderViewport.excludeFromScrolling)) {
882 excluded.add(child); 878 excluded.add(child);
883 } else { 879 } else {
884 - if (!child.hasFlag(SemanticsFlag.isHidden)) 880 + if (!child.hasFlag(SemanticsFlag.isHidden)) {
885 firstVisibleIndex ??= child.indexInParent; 881 firstVisibleIndex ??= child.indexInParent;
  882 + }
886 included.add(child); 883 included.add(child);
887 } 884 }
888 } 885 }
@@ -952,8 +949,7 @@ class ScrollIncrementDetails { @@ -952,8 +949,7 @@ class ScrollIncrementDetails {
952 const ScrollIncrementDetails({ 949 const ScrollIncrementDetails({
953 required this.type, 950 required this.type,
954 required this.metrics, 951 required this.metrics,
955 - }) : assert(type != null),  
956 - assert(metrics != null); 952 + });
957 953
958 /// The type of scroll this is (e.g. line, page, etc.). 954 /// The type of scroll this is (e.g. line, page, etc.).
959 /// 955 ///
@@ -976,8 +972,7 @@ class ScrollIntent extends Intent { @@ -976,8 +972,7 @@ class ScrollIntent extends Intent {
976 const ScrollIntent({ 972 const ScrollIntent({
977 required this.direction, 973 required this.direction,
978 this.type = ScrollIncrementType.line, 974 this.type = ScrollIncrementType.line,
979 - }) : assert(direction != null),  
980 - assert(type != null); 975 + });
981 976
982 /// The direction in which to scroll the scrollable containing the focused 977 /// The direction in which to scroll the scrollable containing the focused
983 /// widget. 978 /// widget.
@@ -430,8 +430,9 @@ class SheetController extends ScrollController { @@ -430,8 +430,9 @@ class SheetController extends ScrollController {
430 void relativeJumpTo(double offset) { 430 void relativeJumpTo(double offset) {
431 assert(positions.isNotEmpty, 431 assert(positions.isNotEmpty,
432 'ScrollController not attached to any scroll views.'); 432 'ScrollController not attached to any scroll views.');
433 - for (final ScrollPosition position in positions) 433 + for (final ScrollPosition position in positions) {
434 (position as SheetPosition).relativeJumpTo(offset); 434 (position as SheetPosition).relativeJumpTo(offset);
  435 + }
435 } 436 }
436 } 437 }
437 438
@@ -603,9 +604,7 @@ class SheetViewport extends SingleChildRenderObjectWidget { @@ -603,9 +604,7 @@ class SheetViewport extends SingleChildRenderObjectWidget {
603 Widget? child, 604 Widget? child,
604 required this.fit, 605 required this.fit,
605 required this.clipBehavior, 606 required this.clipBehavior,
606 - }) : assert(axisDirection != null),  
607 - assert(clipBehavior != null),  
608 - super(key: key, child: child); 607 + }) : super(key: key, child: child);
609 608
610 final AxisDirection axisDirection; 609 final AxisDirection axisDirection;
611 final ViewportOffset offset; 610 final ViewportOffset offset;
@@ -615,8 +614,8 @@ class SheetViewport extends SingleChildRenderObjectWidget { @@ -615,8 +614,8 @@ class SheetViewport extends SingleChildRenderObjectWidget {
615 final SheetFit fit; 614 final SheetFit fit;
616 615
617 @override 616 @override
618 - _RenderSheetViewport createRenderObject(BuildContext context) {  
619 - return _RenderSheetViewport( 617 + RenderSheetViewport createRenderObject(BuildContext context) {
  618 + return RenderSheetViewport(
620 axisDirection: axisDirection, 619 axisDirection: axisDirection,
621 offset: offset, 620 offset: offset,
622 clipBehavior: clipBehavior, 621 clipBehavior: clipBehavior,
@@ -628,7 +627,7 @@ class SheetViewport extends SingleChildRenderObjectWidget { @@ -628,7 +627,7 @@ class SheetViewport extends SingleChildRenderObjectWidget {
628 627
629 @override 628 @override
630 void updateRenderObject( 629 void updateRenderObject(
631 - BuildContext context, _RenderSheetViewport renderObject) { 630 + BuildContext context, RenderSheetViewport renderObject) {
632 // Order dependency: The offset setter reads the axis direction. 631 // Order dependency: The offset setter reads the axis direction.
633 renderObject 632 renderObject
634 ..axisDirection = axisDirection 633 ..axisDirection = axisDirection
@@ -640,10 +639,10 @@ class SheetViewport extends SingleChildRenderObjectWidget { @@ -640,10 +639,10 @@ class SheetViewport extends SingleChildRenderObjectWidget {
640 } 639 }
641 } 640 }
642 641
643 -class _RenderSheetViewport extends RenderBox 642 +class RenderSheetViewport extends RenderBox
644 with RenderObjectWithChildMixin<RenderBox> 643 with RenderObjectWithChildMixin<RenderBox>
645 implements RenderAbstractViewport { 644 implements RenderAbstractViewport {
646 - _RenderSheetViewport({ 645 + RenderSheetViewport({
647 AxisDirection axisDirection = AxisDirection.down, 646 AxisDirection axisDirection = AxisDirection.down,
648 required ViewportOffset offset, 647 required ViewportOffset offset,
649 double cacheExtent = RenderAbstractViewport.defaultCacheExtent, 648 double cacheExtent = RenderAbstractViewport.defaultCacheExtent,
@@ -652,11 +651,7 @@ class _RenderSheetViewport extends RenderBox @@ -652,11 +651,7 @@ class _RenderSheetViewport extends RenderBox
652 SheetFit fit = SheetFit.expand, 651 SheetFit fit = SheetFit.expand,
653 double? minExtent, 652 double? minExtent,
654 double? maxExtent, 653 double? maxExtent,
655 - }) : assert(axisDirection != null),  
656 - assert(offset != null),  
657 - assert(cacheExtent != null),  
658 - assert(clipBehavior != null),  
659 - _axisDirection = axisDirection, 654 + }) : _axisDirection = axisDirection,
660 _offset = offset, 655 _offset = offset,
661 _fit = fit, 656 _fit = fit,
662 _minExtent = minExtent, 657 _minExtent = minExtent,
@@ -669,7 +664,6 @@ class _RenderSheetViewport extends RenderBox @@ -669,7 +664,6 @@ class _RenderSheetViewport extends RenderBox
669 AxisDirection get axisDirection => _axisDirection; 664 AxisDirection get axisDirection => _axisDirection;
670 AxisDirection _axisDirection; 665 AxisDirection _axisDirection;
671 set axisDirection(AxisDirection value) { 666 set axisDirection(AxisDirection value) {
672 - assert(value != null);  
673 if (value == _axisDirection) return; 667 if (value == _axisDirection) return;
674 _axisDirection = value; 668 _axisDirection = value;
675 markNeedsLayout(); 669 markNeedsLayout();
@@ -680,7 +674,6 @@ class _RenderSheetViewport extends RenderBox @@ -680,7 +674,6 @@ class _RenderSheetViewport extends RenderBox
680 ViewportOffset get offset => _offset; 674 ViewportOffset get offset => _offset;
681 ViewportOffset _offset; 675 ViewportOffset _offset;
682 set offset(ViewportOffset value) { 676 set offset(ViewportOffset value) {
683 - assert(value != null);  
684 if (value == _offset) return; 677 if (value == _offset) return;
685 if (attached) _offset.removeListener(_hasDragged); 678 if (attached) _offset.removeListener(_hasDragged);
686 _offset = value; 679 _offset = value;
@@ -692,7 +685,6 @@ class _RenderSheetViewport extends RenderBox @@ -692,7 +685,6 @@ class _RenderSheetViewport extends RenderBox
692 double get cacheExtent => _cacheExtent; 685 double get cacheExtent => _cacheExtent;
693 double _cacheExtent; 686 double _cacheExtent;
694 set cacheExtent(double value) { 687 set cacheExtent(double value) {
695 - assert(value != null);  
696 if (value == _cacheExtent) return; 688 if (value == _cacheExtent) return;
697 _cacheExtent = value; 689 _cacheExtent = value;
698 markNeedsLayout(); 690 markNeedsLayout();
@@ -702,7 +694,6 @@ class _RenderSheetViewport extends RenderBox @@ -702,7 +694,6 @@ class _RenderSheetViewport extends RenderBox
702 SheetFit get fit => _fit; 694 SheetFit get fit => _fit;
703 SheetFit _fit; 695 SheetFit _fit;
704 set fit(SheetFit value) { 696 set fit(SheetFit value) {
705 - assert(value != null);  
706 if (value == _fit) return; 697 if (value == _fit) return;
707 _fit = value; 698 _fit = value;
708 markNeedsLayout(); 699 markNeedsLayout();
@@ -714,7 +705,6 @@ class _RenderSheetViewport extends RenderBox @@ -714,7 +705,6 @@ class _RenderSheetViewport extends RenderBox
714 Clip get clipBehavior => _clipBehavior; 705 Clip get clipBehavior => _clipBehavior;
715 Clip _clipBehavior = Clip.none; 706 Clip _clipBehavior = Clip.none;
716 set clipBehavior(Clip value) { 707 set clipBehavior(Clip value) {
717 - assert(value != null);  
718 if (value != _clipBehavior) { 708 if (value != _clipBehavior) {
719 _clipBehavior = value; 709 _clipBehavior = value;
720 markNeedsPaint(); 710 markNeedsPaint();
@@ -884,7 +874,6 @@ class _RenderSheetViewport extends RenderBox @@ -884,7 +874,6 @@ class _RenderSheetViewport extends RenderBox
884 Offset get _paintOffset => _paintOffsetForPosition(offset.pixels); 874 Offset get _paintOffset => _paintOffsetForPosition(offset.pixels);
885 875
886 Offset _paintOffsetForPosition(double position) { 876 Offset _paintOffsetForPosition(double position) {
887 - assert(axisDirection != null);  
888 switch (axisDirection) { 877 switch (axisDirection) {
889 case AxisDirection.up: 878 case AxisDirection.up:
890 return Offset(0.0, position - child!.size.height + size.height); 879 return Offset(0.0, position - child!.size.height + size.height);
@@ -947,8 +936,9 @@ class _RenderSheetViewport extends RenderBox @@ -947,8 +936,9 @@ class _RenderSheetViewport extends RenderBox
947 936
948 @override 937 @override
949 Rect? describeApproximatePaintClip(RenderObject? child) { 938 Rect? describeApproximatePaintClip(RenderObject? child) {
950 - if (child != null && _shouldClipAtPaintOffset(_paintOffset)) 939 + if (child != null && _shouldClipAtPaintOffset(_paintOffset)) {
951 return Offset.zero & size; 940 return Offset.zero & size;
  941 + }
952 return null; 942 return null;
953 } 943 }
954 944
@@ -971,8 +961,9 @@ class _RenderSheetViewport extends RenderBox @@ -971,8 +961,9 @@ class _RenderSheetViewport extends RenderBox
971 RevealedOffset getOffsetToReveal(RenderObject target, double alignment, 961 RevealedOffset getOffsetToReveal(RenderObject target, double alignment,
972 {Rect? rect}) { 962 {Rect? rect}) {
973 rect ??= target.paintBounds; 963 rect ??= target.paintBounds;
974 - if (target is! RenderBox) 964 + if (target is! RenderBox) {
975 return RevealedOffset(offset: offset.pixels, rect: rect); 965 return RevealedOffset(offset: offset.pixels, rect: rect);
  966 + }
976 967
977 final RenderBox targetBox = target; 968 final RenderBox targetBox = target;
978 final Matrix4 transform = targetBox.getTransformTo(child); 969 final Matrix4 transform = targetBox.getTransformTo(child);
@@ -983,7 +974,6 @@ class _RenderSheetViewport extends RenderBox @@ -983,7 +974,6 @@ class _RenderSheetViewport extends RenderBox
983 final double targetMainAxisExtent; 974 final double targetMainAxisExtent;
984 final double mainAxisExtent; 975 final double mainAxisExtent;
985 976
986 - assert(axisDirection != null);  
987 switch (axisDirection) { 977 switch (axisDirection) {
988 case AxisDirection.up: 978 case AxisDirection.up:
989 mainAxisExtent = size.height; 979 mainAxisExtent = size.height;
@@ -1021,33 +1011,34 @@ class _RenderSheetViewport extends RenderBox @@ -1021,33 +1011,34 @@ class _RenderSheetViewport extends RenderBox
1021 Curve curve = Curves.ease, 1011 Curve curve = Curves.ease,
1022 }) { 1012 }) {
1023 return; 1013 return;
1024 - if (!offset.allowImplicitScrolling) {  
1025 - return super.showOnScreen(  
1026 - descendant: descendant,  
1027 - rect: rect,  
1028 - duration: duration,  
1029 - curve: curve,  
1030 - );  
1031 - }  
1032 -  
1033 - final Rect? newRect = RenderViewportBase.showInViewport(  
1034 - descendant: descendant,  
1035 - viewport: this,  
1036 - offset: offset,  
1037 - rect: rect,  
1038 - duration: duration,  
1039 - curve: curve,  
1040 - );  
1041 - super.showOnScreen(  
1042 - rect: newRect,  
1043 - duration: duration,  
1044 - curve: curve,  
1045 - ); 1014 + // TODO(jaime): check showOnScreen method beheves when keyboard appears on
  1015 + // the screen
  1016 + // if (!offset.allowImplicitScrolling) {
  1017 + // return super.showOnScreen(
  1018 + // descendant: descendant,
  1019 + // rect: rect,
  1020 + // duration: duration,
  1021 + // curve: curve,
  1022 + // );
  1023 + // }
  1024 + //
  1025 + // final Rect? newRect = RenderViewportBase.showInViewport(
  1026 + // descendant: descendant,
  1027 + // viewport: this,
  1028 + // offset: offset,
  1029 + // rect: rect,
  1030 + // duration: duration,
  1031 + // curve: curve,
  1032 + // );
  1033 + // super.showOnScreen(
  1034 + // rect: newRect,
  1035 + // duration: duration,
  1036 + // curve: curve,
  1037 + // );
1046 } 1038 }
1047 1039
1048 @override 1040 @override
1049 Rect describeSemanticsClip(RenderObject child) { 1041 Rect describeSemanticsClip(RenderObject child) {
1050 - assert(axis != null);  
1051 switch (axis) { 1042 switch (axis) {
1052 case Axis.vertical: 1043 case Axis.vertical:
1053 return Rect.fromLTRB( 1044 return Rect.fromLTRB(
@@ -13,10 +13,10 @@ class ScrollToTopStatusBarHandler extends StatefulWidget { @@ -13,10 +13,10 @@ class ScrollToTopStatusBarHandler extends StatefulWidget {
13 final Widget child; 13 final Widget child;
14 14
15 @override 15 @override
16 - _ScrollToTopStatusBarState createState() => _ScrollToTopStatusBarState(); 16 + ScrollToTopStatusBarState createState() => ScrollToTopStatusBarState();
17 } 17 }
18 18
19 -class _ScrollToTopStatusBarState extends State<ScrollToTopStatusBarHandler> { 19 +class ScrollToTopStatusBarState extends State<ScrollToTopStatusBarHandler> {
20 @override 20 @override
21 void initState() { 21 void initState() {
22 super.initState(); 22 super.initState();