Unverified Commit bd69fa59 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

use predefined constants (#74627)

parent efe8a397
......@@ -982,7 +982,7 @@ class _CupertinoModalPopupRoute<T> extends PopupRoute<T> {
);
_offsetTween = Tween<Offset>(
begin: const Offset(0.0, 1.0),
end: const Offset(0.0, 0.0),
end: Offset.zero,
);
return _animation!;
}
......
......@@ -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>[Color(0x00000000), Color(0xFFFF00FF), Color(0xFFFF00FF), Color(0x00000000)],
const <double>[0.25, 0.25, 0.75, 0.75],
......
......@@ -231,7 +231,7 @@ class _AutocompleteOptions<T extends Object> 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);
......
......@@ -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,
......
......@@ -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;
......
......@@ -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,
......
......@@ -396,7 +396,7 @@ class _HelperErrorState extends State<_HelperError> with SingleTickerProviderSta
child: FractionalTranslation(
translation: Tween<Offset>(
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
......
......@@ -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:
......
......@@ -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) {
......
......@@ -228,7 +228,7 @@ class _TooltipState extends State<Tooltip> 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;
......
......@@ -1884,7 +1884,7 @@ abstract class RenderBox extends RenderObject {
),
]),
));
return const Size(0, 0);
return Size.zero;
}
static bool _dryLayoutCalculationValid = true;
......
......@@ -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),
<Color>[_black, _yellow, _yellow, _black],
<double>[0.25, 0.25, 0.75, 0.75],
......
......@@ -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;
......
......@@ -677,7 +677,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
assert(debugCannotComputeDryLayout(
reason: 'Dry layout cannot be computed for CrossAxisAlignment.baseline, which requires a full layout.'
));
return const Size(0, 0);
return Size.zero;
}
FlutterError? constraintsError;
assert(() {
......@@ -689,7 +689,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
}());
if (constraintsError != null) {
assert(debugCannotComputeDryLayout(error: constraintsError));
return const Size(0, 0);
return Size.zero;
}
final _LayoutSizes sizes = _computeSizes(
......
......@@ -637,7 +637,7 @@ class RenderParagraph extends RenderBox
assert(debugCannotComputeDryLayout(
reason: 'Dry layout not available for alignments that require baseline.',
));
return const Size(0, 0);
return Size.zero;
}
_textPainter.setPlaceholderDimensions(_layoutChildren(constraints, dry: true));
_layoutText(minWidth: constraints.minWidth, maxWidth: constraints.maxWidth);
......
......@@ -1389,7 +1389,7 @@ abstract class _RenderCustomClip<T> extends RenderProxyBox {
assert(() {
_debugPaint ??= Paint()
..shader = ui.Gradient.linear(
const Offset(0.0, 0.0),
Offset.zero,
const Offset(10.0, 10.0),
<Color>[const Color(0x00000000), const Color(0xFFFF00FF), const Color(0xFFFF00FF), const Color(0x00000000)],
<double>[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) {
......
......@@ -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
......
......@@ -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;
}
......
......@@ -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<double> 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<double> widths = _computeColumnWidths(constraints);
......
......@@ -1070,7 +1070,7 @@ RawFloatingCursorPoint _toTextPoint(FloatingCursorDragState state, Map<String, d
assert(encoded['Y'] != null, 'You must provide a value for the vertical location of the floating cursor.');
final Offset offset = state == FloatingCursorDragState.Update
? Offset(encoded['X'] as double, encoded['Y'] as double)
: const Offset(0, 0);
: Offset.zero;
return RawFloatingCursorPoint(offset: offset, state: state);
}
......
......@@ -495,7 +495,7 @@ class AnimatedListState extends State<AnimatedList> with TickerProviderStateMixi
shrinkWrap: widget.shrinkWrap,
slivers: <Widget>[
SliverPadding(
padding: widget.padding ?? const EdgeInsets.all(0),
padding: widget.padding ?? EdgeInsets.zero,
sliver: SliverAnimatedList(
key: _sliverAnimatedListKey,
itemBuilder: widget.itemBuilder,
......
......@@ -351,7 +351,7 @@ class _RenderLayoutBuilder extends RenderBox with RenderObjectWithChildMixin<Ren
'Calculating the dry layout would require running the layout callback '
'speculatively, which might mutate the live render object tree.',
));
return const Size(0, 0);
return Size.zero;
}
@override
......
......@@ -1895,7 +1895,7 @@ class RenderSliverOverlapAbsorber extends RenderSliver with RenderObjectWithChil
'A SliverOverlapAbsorberHandle cannot be passed to multiple RenderSliverOverlapAbsorber objects at the same time.',
);
if (child == null) {
geometry = const SliverGeometry();
geometry = SliverGeometry.zero;
return;
}
child!.layout(constraints, parentUsesSize: true);
......
......@@ -336,7 +336,7 @@ class ReorderableListState extends State<ReorderableList> {
shrinkWrap: widget.shrinkWrap,
slivers: <Widget>[
SliverPadding(
padding: widget.padding ?? const EdgeInsets.all(0),
padding: widget.padding ?? EdgeInsets.zero,
sliver: SliverReorderableList(
key: _sliverReorderableListKey,
itemBuilder: widget.itemBuilder,
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment