diff --git a/packages/flutter/lib/src/cupertino/route.dart b/packages/flutter/lib/src/cupertino/route.dart index 94b97f29b1..f0bc51df0b 100644 --- a/packages/flutter/lib/src/cupertino/route.dart +++ b/packages/flutter/lib/src/cupertino/route.dart @@ -982,7 +982,7 @@ class _CupertinoModalPopupRoute extends PopupRoute { ); _offsetTween = Tween( begin: const Offset(0.0, 1.0), - end: const Offset(0.0, 0.0), + end: Offset.zero, ); return _animation!; } diff --git a/packages/flutter/lib/src/cupertino/text_selection_toolbar.dart b/packages/flutter/lib/src/cupertino/text_selection_toolbar.dart index ae23e6443c..e3380a25fb 100644 --- a/packages/flutter/lib/src/cupertino/text_selection_toolbar.dart +++ b/packages/flutter/lib/src/cupertino/text_selection_toolbar.dart @@ -311,7 +311,7 @@ class _RenderCupertinoTextSelectionToolbarShape extends RenderShiftedBox { _debugPaint ??= Paint() ..shader = ui.Gradient.linear( - const Offset(0.0, 0.0), + Offset.zero, const Offset(10.0, 10.0), const [Color(0x00000000), Color(0xFFFF00FF), Color(0xFFFF00FF), Color(0x00000000)], const [0.25, 0.25, 0.75, 0.75], diff --git a/packages/flutter/lib/src/material/autocomplete.dart b/packages/flutter/lib/src/material/autocomplete.dart index 9b6979a293..786ba4a2ad 100644 --- a/packages/flutter/lib/src/material/autocomplete.dart +++ b/packages/flutter/lib/src/material/autocomplete.dart @@ -231,7 +231,7 @@ class _AutocompleteOptions extends StatelessWidget { child: Container( height: 200.0, child: ListView.builder( - padding: const EdgeInsets.all(0.0), + padding: EdgeInsets.zero, itemCount: options.length, itemBuilder: (BuildContext context, int index) { final T option = options.elementAt(index); diff --git a/packages/flutter/lib/src/material/button.dart b/packages/flutter/lib/src/material/button.dart index 409d827e6a..d358d0f606 100644 --- a/packages/flutter/lib/src/material/button.dart +++ b/packages/flutter/lib/src/material/button.dart @@ -66,7 +66,7 @@ class RawMaterialButton extends StatefulWidget { this.highlightElevation = 8.0, this.disabledElevation = 0.0, this.padding = EdgeInsets.zero, - this.visualDensity = const VisualDensity(), + this.visualDensity = VisualDensity.standard, this.constraints = const BoxConstraints(minWidth: 88.0, minHeight: 36.0), this.shape = const RoundedRectangleBorder(), this.animationDuration = kThemeChangeDuration, diff --git a/packages/flutter/lib/src/material/date_picker.dart b/packages/flutter/lib/src/material/date_picker.dart index 9536acc877..963884c1b8 100644 --- a/packages/flutter/lib/src/material/date_picker.dart +++ b/packages/flutter/lib/src/material/date_picker.dart @@ -1053,9 +1053,9 @@ class _DateRangePickerDialogState extends State<_DateRangePickerDialog> { helpText: widget.helpText ?? localizations.dateRangePickerHelpText, ); size = mediaQuery.size; - insetPadding = const EdgeInsets.all(0.0); + insetPadding = EdgeInsets.zero; shape = const RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.zero) + borderRadius: BorderRadius.zero ); elevation = 0; break; diff --git a/packages/flutter/lib/src/material/dialog.dart b/packages/flutter/lib/src/material/dialog.dart index e91ad809a0..a8ca8f160f 100644 --- a/packages/flutter/lib/src/material/dialog.dart +++ b/packages/flutter/lib/src/material/dialog.dart @@ -128,7 +128,7 @@ class Dialog extends StatelessWidget { @override Widget build(BuildContext context) { final DialogTheme dialogTheme = DialogTheme.of(context); - final EdgeInsets effectivePadding = MediaQuery.of(context).viewInsets + (insetPadding ?? const EdgeInsets.all(0.0)); + final EdgeInsets effectivePadding = MediaQuery.of(context).viewInsets + (insetPadding ?? EdgeInsets.zero); return AnimatedPadding( padding: effectivePadding, duration: insetAnimationDuration, diff --git a/packages/flutter/lib/src/material/input_decorator.dart b/packages/flutter/lib/src/material/input_decorator.dart index 9055b9f38d..159b2cd488 100644 --- a/packages/flutter/lib/src/material/input_decorator.dart +++ b/packages/flutter/lib/src/material/input_decorator.dart @@ -396,7 +396,7 @@ class _HelperErrorState extends State<_HelperError> with SingleTickerProviderSta child: FractionalTranslation( translation: Tween( begin: const Offset(0.0, -0.25), - end: const Offset(0.0, 0.0), + end: Offset.zero, ).evaluate(_controller.view), child: Text( widget.errorText!, @@ -1284,7 +1284,7 @@ class _RenderDecoration extends RenderBox { assert(debugCannotComputeDryLayout( reason: 'Layout requires baseline metrics, which are only available after a full layout.', )); - return const Size(0, 0); + return Size.zero; } @override diff --git a/packages/flutter/lib/src/material/list_tile.dart b/packages/flutter/lib/src/material/list_tile.dart index b3acb8c60e..6ce196ec54 100644 --- a/packages/flutter/lib/src/material/list_tile.dart +++ b/packages/flutter/lib/src/material/list_tile.dart @@ -1691,7 +1691,7 @@ class _RenderListTile extends RenderBox { assert(debugCannotComputeDryLayout( reason: 'Layout requires baseline metrics, which are only available after a full layout.' )); - return const Size(0, 0); + return Size.zero; } // All of the dimensions below were taken from the Material Design spec: diff --git a/packages/flutter/lib/src/material/reorderable_list.dart b/packages/flutter/lib/src/material/reorderable_list.dart index 06f4cf7112..0b8779791c 100644 --- a/packages/flutter/lib/src/material/reorderable_list.dart +++ b/packages/flutter/lib/src/material/reorderable_list.dart @@ -419,7 +419,7 @@ class _ReorderableListContentState extends State<_ReorderableListContent> { // so we wrap the CustomScrollView in the padding for the top, left and right // and only add the padding from the bottom to the sliver list (or the equivalent // for other axis directions). - final EdgeInsets padding = widget.padding ?? const EdgeInsets.all(0); + final EdgeInsets padding = widget.padding ?? EdgeInsets.zero; late EdgeInsets outerPadding; late EdgeInsets listPadding; switch (widget.scrollDirection) { diff --git a/packages/flutter/lib/src/material/tooltip.dart b/packages/flutter/lib/src/material/tooltip.dart index db73084885..a8b3c15b5c 100644 --- a/packages/flutter/lib/src/material/tooltip.dart +++ b/packages/flutter/lib/src/material/tooltip.dart @@ -228,7 +228,7 @@ class _TooltipState extends State with SingleTickerProviderStateMixin { static const Duration _fadeInDuration = Duration(milliseconds: 150); static const Duration _fadeOutDuration = Duration(milliseconds: 75); static const Duration _defaultShowDuration = Duration(milliseconds: 1500); - static const Duration _defaultWaitDuration = Duration(milliseconds: 0); + static const Duration _defaultWaitDuration = Duration.zero; static const bool _defaultExcludeFromSemantics = false; late double height; diff --git a/packages/flutter/lib/src/rendering/box.dart b/packages/flutter/lib/src/rendering/box.dart index 96d7070d33..0238fad62f 100644 --- a/packages/flutter/lib/src/rendering/box.dart +++ b/packages/flutter/lib/src/rendering/box.dart @@ -1884,7 +1884,7 @@ abstract class RenderBox extends RenderObject { ), ]), )); - return const Size(0, 0); + return Size.zero; } static bool _dryLayoutCalculationValid = true; diff --git a/packages/flutter/lib/src/rendering/debug_overflow_indicator.dart b/packages/flutter/lib/src/rendering/debug_overflow_indicator.dart index d768c5875e..eedc3b03cb 100644 --- a/packages/flutter/lib/src/rendering/debug_overflow_indicator.dart +++ b/packages/flutter/lib/src/rendering/debug_overflow_indicator.dart @@ -100,7 +100,7 @@ mixin DebugOverflowIndicatorMixin on RenderObject { ); static final Paint _indicatorPaint = Paint() ..shader = ui.Gradient.linear( - const Offset(0.0, 0.0), + Offset.zero, const Offset(10.0, 10.0), [_black, _yellow, _yellow, _black], [0.25, 0.25, 0.75, 0.75], diff --git a/packages/flutter/lib/src/rendering/editable.dart b/packages/flutter/lib/src/rendering/editable.dart index 6e913e709d..d2427a0d84 100644 --- a/packages/flutter/lib/src/rendering/editable.dart +++ b/packages/flutter/lib/src/rendering/editable.dart @@ -2193,7 +2193,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin { assert(boundedOffset != null); assert(lastTextPosition != null); if (state == FloatingCursorDragState.Start) { - _relativeOrigin = const Offset(0, 0); + _relativeOrigin = Offset.zero; _previousOffset = null; _resetOriginOnBottom = false; _resetOriginOnTop = false; @@ -2242,7 +2242,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin { // The relative origin in relation to the distance the user has theoretically // dragged the floating cursor offscreen. This value is used to account for the // difference in the rendering position and the raw offset value. - Offset _relativeOrigin = const Offset(0, 0); + Offset _relativeOrigin = Offset.zero; Offset? _previousOffset; bool _resetOriginOnLeft = false; bool _resetOriginOnRight = false; @@ -2252,7 +2252,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin { /// Returns the position within the text field closest to the raw cursor offset. Offset calculateBoundedFloatingCursorOffset(Offset rawCursorOffset) { - Offset deltaPosition = const Offset(0, 0); + Offset deltaPosition = Offset.zero; final double topBound = -floatingCursorAddedMargin.top; final double bottomBound = _textPainter.height - preferredLineHeight + floatingCursorAddedMargin.bottom; final double leftBound = -floatingCursorAddedMargin.left; diff --git a/packages/flutter/lib/src/rendering/flex.dart b/packages/flutter/lib/src/rendering/flex.dart index b26421a367..d9e279a81c 100644 --- a/packages/flutter/lib/src/rendering/flex.dart +++ b/packages/flutter/lib/src/rendering/flex.dart @@ -677,7 +677,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin extends RenderProxyBox { assert(() { _debugPaint ??= Paint() ..shader = ui.Gradient.linear( - const Offset(0.0, 0.0), + Offset.zero, const Offset(10.0, 10.0), [const Color(0x00000000), const Color(0xFFFF00FF), const Color(0xFFFF00FF), const Color(0x00000000)], [0.25, 0.25, 0.75, 0.75], @@ -2502,7 +2502,7 @@ class RenderFittedBox extends RenderProxyBox { assert(debugCannotComputeDryLayout( reason: 'Child provided invalid size of $childSize.', )); - return const Size(0, 0); + return Size.zero; } switch (fit) { diff --git a/packages/flutter/lib/src/rendering/proxy_sliver.dart b/packages/flutter/lib/src/rendering/proxy_sliver.dart index 722acbc01a..7dbe3722f5 100644 --- a/packages/flutter/lib/src/rendering/proxy_sliver.dart +++ b/packages/flutter/lib/src/rendering/proxy_sliver.dart @@ -317,11 +317,7 @@ class RenderSliverOffstage extends RenderProxySliver { if (!offstage) geometry = child!.geometry; else - geometry = const SliverGeometry( - scrollExtent: 0.0, - visible: false, - maxPaintExtent: 0.0, - ); + geometry = SliverGeometry.zero; } @override diff --git a/packages/flutter/lib/src/rendering/shifted_box.dart b/packages/flutter/lib/src/rendering/shifted_box.dart index fa349b771c..6b08ab3e12 100644 --- a/packages/flutter/lib/src/rendering/shifted_box.dart +++ b/packages/flutter/lib/src/rendering/shifted_box.dart @@ -1287,7 +1287,7 @@ class RenderBaseline extends RenderShiftedBox { assert(debugCannotComputeDryLayout( reason: 'Baseline metrics are only available after a full layout.', )); - return const Size(0, 0); + return Size.zero; } return constraints.smallest; } diff --git a/packages/flutter/lib/src/rendering/table.dart b/packages/flutter/lib/src/rendering/table.dart index 5c76212418..bd47b89bc1 100644 --- a/packages/flutter/lib/src/rendering/table.dart +++ b/packages/flutter/lib/src/rendering/table.dart @@ -1002,7 +1002,7 @@ class RenderTable extends RenderBox { @override Size computeDryLayout(BoxConstraints constraints) { if (rows * columns == 0) { - return constraints.constrain(const Size(0.0, 0.0)); + return constraints.constrain(Size.zero); } final List widths = _computeColumnWidths(constraints); final double tableWidth = widths.fold(0.0, (double a, double b) => a + b); @@ -1020,7 +1020,7 @@ class RenderTable extends RenderBox { assert(debugCannotComputeDryLayout( reason: 'TableCellVerticalAlignment.baseline requires a full layout for baseline metrics to be available.' )); - return const Size(0 ,0); + return Size.zero; case TableCellVerticalAlignment.top: case TableCellVerticalAlignment.middle: case TableCellVerticalAlignment.bottom: @@ -1046,7 +1046,7 @@ class RenderTable extends RenderBox { if (rows * columns == 0) { // TODO(ianh): if columns is zero, this should be zero width // TODO(ianh): if columns is not zero, this should be based on the column width specifications - size = constraints.constrain(const Size(0.0, 0.0)); + size = constraints.constrain(Size.zero); return; } final List widths = _computeColumnWidths(constraints); diff --git a/packages/flutter/lib/src/services/text_input.dart b/packages/flutter/lib/src/services/text_input.dart index 234a507d5b..7b7fd3e457 100644 --- a/packages/flutter/lib/src/services/text_input.dart +++ b/packages/flutter/lib/src/services/text_input.dart @@ -1070,7 +1070,7 @@ RawFloatingCursorPoint _toTextPoint(FloatingCursorDragState state, Map with TickerProviderStateMixi shrinkWrap: widget.shrinkWrap, slivers: [ SliverPadding( - padding: widget.padding ?? const EdgeInsets.all(0), + padding: widget.padding ?? EdgeInsets.zero, sliver: SliverAnimatedList( key: _sliverAnimatedListKey, itemBuilder: widget.itemBuilder, diff --git a/packages/flutter/lib/src/widgets/layout_builder.dart b/packages/flutter/lib/src/widgets/layout_builder.dart index 29f084c6b2..80ffb080a0 100644 --- a/packages/flutter/lib/src/widgets/layout_builder.dart +++ b/packages/flutter/lib/src/widgets/layout_builder.dart @@ -351,7 +351,7 @@ class _RenderLayoutBuilder extends RenderBox with RenderObjectWithChildMixin { shrinkWrap: widget.shrinkWrap, slivers: [ SliverPadding( - padding: widget.padding ?? const EdgeInsets.all(0), + padding: widget.padding ?? EdgeInsets.zero, sliver: SliverReorderableList( key: _sliverReorderableListKey, itemBuilder: widget.itemBuilder, diff --git a/packages/flutter/lib/src/widgets/widget_inspector.dart b/packages/flutter/lib/src/widgets/widget_inspector.dart index 2cd4c09489..63bfe0fd07 100644 --- a/packages/flutter/lib/src/widgets/widget_inspector.dart +++ b/packages/flutter/lib/src/widgets/widget_inspector.dart @@ -2492,7 +2492,7 @@ class _RenderInspectorOverlay extends RenderBox { @override Size computeDryLayout(BoxConstraints constraints) { - return constraints.constrain(const Size(double.infinity, double.infinity)); + return constraints.constrain(Size.infinite); } @override