add trailing comma when argList is splitted (#79650)
This commit is contained in:
parent
c82675187c
commit
f82046b150
@ -287,9 +287,11 @@ class RenderSectorRing extends RenderSectorWithChildren {
|
||||
remainingDeltaTheta -= paddingTheta;
|
||||
}
|
||||
}
|
||||
return SectorDimensions.withConstraints(constraints,
|
||||
deltaRadius: outerDeltaRadius,
|
||||
deltaTheta: innerTheta);
|
||||
return SectorDimensions.withConstraints(
|
||||
constraints,
|
||||
deltaRadius: outerDeltaRadius,
|
||||
deltaTheta: innerTheta,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -399,9 +401,11 @@ class RenderSectorSlice extends RenderSectorWithChildren {
|
||||
childRadius += padding;
|
||||
remainingDeltaRadius -= padding;
|
||||
}
|
||||
return SectorDimensions.withConstraints(constraints,
|
||||
deltaRadius: childRadius - parentData!.radius,
|
||||
deltaTheta: outerDeltaTheta);
|
||||
return SectorDimensions.withConstraints(
|
||||
constraints,
|
||||
deltaRadius: childRadius - parentData!.radius,
|
||||
deltaTheta: outerDeltaTheta,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -931,17 +931,21 @@ class CatmullRomCurve extends Curve {
|
||||
i < controlPoints.length - 2 &&
|
||||
(controlPoints[i].dx <= 0.0 || controlPoints[i].dx >= 1.0)) {
|
||||
assert(() {
|
||||
reasons?.add('Control points must have X values between 0.0 and 1.0, exclusive. '
|
||||
'Point $i has an x value (${controlPoints![i].dx}) which is outside the range.');
|
||||
reasons?.add(
|
||||
'Control points must have X values between 0.0 and 1.0, exclusive. '
|
||||
'Point $i has an x value (${controlPoints![i].dx}) which is outside the range.',
|
||||
);
|
||||
return true;
|
||||
}());
|
||||
return false;
|
||||
}
|
||||
if (controlPoints[i].dx <= lastX) {
|
||||
assert(() {
|
||||
reasons?.add('Each X coordinate must be greater than the preceding X coordinate '
|
||||
'(i.e. must be monotonically increasing in X). Point $i has an x value of '
|
||||
'${controlPoints![i].dx}, which is not greater than $lastX');
|
||||
reasons?.add(
|
||||
'Each X coordinate must be greater than the preceding X coordinate '
|
||||
'(i.e. must be monotonically increasing in X). Point $i has an x value of '
|
||||
'${controlPoints![i].dx}, which is not greater than $lastX',
|
||||
);
|
||||
return true;
|
||||
}());
|
||||
return false;
|
||||
@ -964,9 +968,11 @@ class CatmullRomCurve extends Curve {
|
||||
bool bail = true;
|
||||
success = false;
|
||||
assert(() {
|
||||
reasons?.add('The curve has more than one Y value at X = ${samplePoints.first.value.dx}. '
|
||||
'Try moving some control points further away from this value of X, or increasing '
|
||||
'the tension.');
|
||||
reasons?.add(
|
||||
'The curve has more than one Y value at X = ${samplePoints.first.value.dx}. '
|
||||
'Try moving some control points further away from this value of X, or increasing '
|
||||
'the tension.',
|
||||
);
|
||||
// No need to keep going if we're not giving reasons.
|
||||
bail = reasons == null;
|
||||
return true;
|
||||
@ -985,8 +991,10 @@ class CatmullRomCurve extends Curve {
|
||||
bool bail = true;
|
||||
success = false;
|
||||
assert(() {
|
||||
reasons?.add('The resulting curve has an X value ($x) which is outside '
|
||||
'the range [0.0, 1.0], inclusive.');
|
||||
reasons?.add(
|
||||
'The resulting curve has an X value ($x) which is outside '
|
||||
'the range [0.0, 1.0], inclusive.',
|
||||
);
|
||||
// No need to keep going if we're not giving reasons.
|
||||
bail = reasons == null;
|
||||
return true;
|
||||
@ -1001,8 +1009,10 @@ class CatmullRomCurve extends Curve {
|
||||
bool bail = true;
|
||||
success = false;
|
||||
assert(() {
|
||||
reasons?.add('The curve has more than one Y value at x = $x. Try moving '
|
||||
'some control points further apart in X, or increasing the tension.');
|
||||
reasons?.add(
|
||||
'The curve has more than one Y value at x = $x. Try moving '
|
||||
'some control points further apart in X, or increasing the tension.',
|
||||
);
|
||||
// No need to keep going if we're not giving reasons.
|
||||
bail = reasons == null;
|
||||
return true;
|
||||
|
@ -169,9 +169,11 @@ class CupertinoActionSheet extends StatelessWidget {
|
||||
this.messageScrollController,
|
||||
this.actionScrollController,
|
||||
this.cancelButton,
|
||||
}) : assert(actions != null || title != null || message != null || cancelButton != null,
|
||||
'An action sheet must have a non-null value for at least one of the following arguments: '
|
||||
'actions, title, message, or cancelButton'),
|
||||
}) : assert(
|
||||
actions != null || title != null || message != null || cancelButton != null,
|
||||
'An action sheet must have a non-null value for at least one of the following arguments: '
|
||||
'actions, title, message, or cancelButton',
|
||||
),
|
||||
super(key: key);
|
||||
|
||||
/// An optional title of the action sheet. When the [message] is non-null,
|
||||
@ -491,10 +493,8 @@ class _CupertinoAlertRenderElement extends RenderObjectElement {
|
||||
@override
|
||||
void mount(Element? parent, Object? newSlot) {
|
||||
super.mount(parent, newSlot);
|
||||
_contentElement = updateChild(_contentElement,
|
||||
widget.contentSection, _AlertSections.contentSection);
|
||||
_actionsElement = updateChild(_actionsElement,
|
||||
widget.actionsSection, _AlertSections.actionsSection);
|
||||
_contentElement = updateChild(_contentElement, widget.contentSection, _AlertSections.contentSection);
|
||||
_actionsElement = updateChild(_actionsElement, widget.actionsSection, _AlertSections.actionsSection);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -510,10 +510,8 @@ class _CupertinoAlertRenderElement extends RenderObjectElement {
|
||||
@override
|
||||
void update(RenderObjectWidget newWidget) {
|
||||
super.update(newWidget);
|
||||
_contentElement = updateChild(_contentElement,
|
||||
widget.contentSection, _AlertSections.contentSection);
|
||||
_actionsElement = updateChild(_actionsElement,
|
||||
widget.actionsSection, _AlertSections.actionsSection);
|
||||
_contentElement = updateChild(_contentElement, widget.contentSection, _AlertSections.contentSection);
|
||||
_actionsElement = updateChild(_actionsElement, widget.actionsSection, _AlertSections.actionsSection);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -612,11 +612,17 @@ class _RenderSegmentedControl<T> extends RenderBox
|
||||
final Rect childRect = Rect.fromLTWH(start, 0.0, child.size.width, child.size.height);
|
||||
final RRect rChildRect;
|
||||
if (child == leftChild) {
|
||||
rChildRect = RRect.fromRectAndCorners(childRect, topLeft: const Radius.circular(3.0),
|
||||
bottomLeft: const Radius.circular(3.0));
|
||||
rChildRect = RRect.fromRectAndCorners(
|
||||
childRect,
|
||||
topLeft: const Radius.circular(3.0),
|
||||
bottomLeft: const Radius.circular(3.0),
|
||||
);
|
||||
} else if (child == rightChild) {
|
||||
rChildRect = RRect.fromRectAndCorners(childRect, topRight: const Radius.circular(3.0),
|
||||
bottomRight: const Radius.circular(3.0));
|
||||
rChildRect = RRect.fromRectAndCorners(
|
||||
childRect,
|
||||
topRight: const Radius.circular(3.0),
|
||||
bottomRight: const Radius.circular(3.0),
|
||||
);
|
||||
} else {
|
||||
rChildRect = RRect.fromRectAndCorners(childRect);
|
||||
}
|
||||
|
@ -328,10 +328,12 @@ class CupertinoTextField extends StatefulWidget {
|
||||
assert(prefixMode != null),
|
||||
assert(suffixMode != null),
|
||||
// Assert the following instead of setting it directly to avoid surprising the user by silently changing the value they set.
|
||||
assert(!identical(textInputAction, TextInputAction.newline) ||
|
||||
assert(
|
||||
!identical(textInputAction, TextInputAction.newline) ||
|
||||
maxLines == 1 ||
|
||||
!identical(keyboardType, TextInputType.text),
|
||||
'Use keyboardType TextInputType.multiline when using TextInputAction.newline on a multiline TextField.'),
|
||||
'Use keyboardType TextInputType.multiline when using TextInputAction.newline on a multiline TextField.',
|
||||
),
|
||||
keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline),
|
||||
toolbarOptions = toolbarOptions ?? (obscureText ?
|
||||
const ToolbarOptions(
|
||||
@ -479,10 +481,12 @@ class CupertinoTextField extends StatefulWidget {
|
||||
assert(prefixMode != null),
|
||||
assert(suffixMode != null),
|
||||
// Assert the following instead of setting it directly to avoid surprising the user by silently changing the value they set.
|
||||
assert(!identical(textInputAction, TextInputAction.newline) ||
|
||||
assert(
|
||||
!identical(textInputAction, TextInputAction.newline) ||
|
||||
maxLines == 1 ||
|
||||
!identical(keyboardType, TextInputType.text),
|
||||
'Use keyboardType TextInputType.multiline when using TextInputAction.newline on a multiline TextField.'),
|
||||
'Use keyboardType TextInputType.multiline when using TextInputAction.newline on a multiline TextField.',
|
||||
),
|
||||
keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline),
|
||||
toolbarOptions = toolbarOptions ?? (obscureText ?
|
||||
const ToolbarOptions(
|
||||
|
@ -203,8 +203,7 @@ class CupertinoTextFormFieldRow extends FormField<String> {
|
||||
!expands || (maxLines == null && minLines == null),
|
||||
'minLines and maxLines must be null when expands is true.',
|
||||
),
|
||||
assert(!obscureText || maxLines == 1,
|
||||
'Obscured fields cannot be multiline.'),
|
||||
assert(!obscureText || maxLines == 1, 'Obscured fields cannot be multiline.'),
|
||||
assert(maxLength == null || maxLength > 0),
|
||||
assert(enableInteractiveSelection != null),
|
||||
super(
|
||||
|
@ -140,9 +140,11 @@ class DragUpdateDetails {
|
||||
required this.globalPosition,
|
||||
Offset? localPosition,
|
||||
}) : assert(delta != null),
|
||||
assert(primaryDelta == null
|
||||
assert(
|
||||
primaryDelta == null
|
||||
|| (primaryDelta == delta.dx && delta.dy == 0.0)
|
||||
|| (primaryDelta == delta.dy && delta.dx == 0.0)),
|
||||
|| (primaryDelta == delta.dy && delta.dx == 0.0),
|
||||
),
|
||||
localPosition = localPosition ?? globalPosition;
|
||||
|
||||
/// Recorded timestamp of the source pointer event that triggered the drag
|
||||
@ -217,9 +219,11 @@ class DragEndDetails {
|
||||
this.velocity = Velocity.zero,
|
||||
this.primaryVelocity,
|
||||
}) : assert(velocity != null),
|
||||
assert(primaryVelocity == null
|
||||
assert(
|
||||
primaryVelocity == null
|
||||
|| primaryVelocity == velocity.pixelsPerSecond.dx
|
||||
|| primaryVelocity == velocity.pixelsPerSecond.dy);
|
||||
|| primaryVelocity == velocity.pixelsPerSecond.dy,
|
||||
);
|
||||
|
||||
/// The velocity the pointer was moving when it stopped contacting the screen.
|
||||
///
|
||||
|
@ -462,20 +462,17 @@ class LongPressGestureRecognizer extends PrimaryPointerGestureRecognizer {
|
||||
switch (_initialButtons) {
|
||||
case kPrimaryButton:
|
||||
if (onLongPressMoveUpdate != null) {
|
||||
invokeCallback<void>('onLongPressMoveUpdate',
|
||||
() => onLongPressMoveUpdate!(details));
|
||||
invokeCallback<void>('onLongPressMoveUpdate', () => onLongPressMoveUpdate!(details));
|
||||
}
|
||||
break;
|
||||
case kSecondaryButton:
|
||||
if (onSecondaryLongPressMoveUpdate != null) {
|
||||
invokeCallback<void>('onSecondaryLongPressMoveUpdate',
|
||||
() => onSecondaryLongPressMoveUpdate!(details));
|
||||
invokeCallback<void>('onSecondaryLongPressMoveUpdate', () => onSecondaryLongPressMoveUpdate!(details));
|
||||
}
|
||||
break;
|
||||
case kTertiaryButton:
|
||||
if (onTertiaryLongPressMoveUpdate != null) {
|
||||
invokeCallback<void>('onTertiaryLongPressMoveUpdate',
|
||||
() => onTertiaryLongPressMoveUpdate!(details));
|
||||
invokeCallback<void>('onTertiaryLongPressMoveUpdate', () => onTertiaryLongPressMoveUpdate!(details));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -1064,8 +1064,10 @@ class _DayPickerGridDelegate extends SliverGridDelegate {
|
||||
SliverGridLayout getLayout(SliverConstraints constraints) {
|
||||
const int columnCount = DateTime.daysPerWeek;
|
||||
final double tileWidth = constraints.crossAxisExtent / columnCount;
|
||||
final double tileHeight = math.min(_dayPickerRowHeight,
|
||||
constraints.viewportMainAxisExtent / (_maxDayPickerRowCount + 1));
|
||||
final double tileHeight = math.min(
|
||||
_dayPickerRowHeight,
|
||||
constraints.viewportMainAxisExtent / (_maxDayPickerRowCount + 1),
|
||||
);
|
||||
return SliverGridRegularTileLayout(
|
||||
childCrossAxisExtent: tileWidth,
|
||||
childMainAxisExtent: tileHeight,
|
||||
|
@ -229,10 +229,8 @@ class ChipThemeData with Diagnosticable {
|
||||
required Color secondaryColor,
|
||||
required TextStyle labelStyle,
|
||||
}) {
|
||||
assert(primaryColor != null || brightness != null,
|
||||
'One of primaryColor or brightness must be specified');
|
||||
assert(primaryColor == null || brightness == null,
|
||||
'Only one of primaryColor or brightness may be specified');
|
||||
assert(primaryColor != null || brightness != null, 'One of primaryColor or brightness must be specified');
|
||||
assert(primaryColor == null || brightness == null, 'Only one of primaryColor or brightness may be specified');
|
||||
assert(secondaryColor != null);
|
||||
assert(labelStyle != null);
|
||||
|
||||
|
@ -977,26 +977,32 @@ class _RenderDecoration extends RenderBox {
|
||||
boxToBaseline[prefixIcon] = _layoutLineBox(prefixIcon, boxConstraints);
|
||||
boxToBaseline[suffixIcon] = _layoutLineBox(suffixIcon, boxConstraints);
|
||||
|
||||
final double inputWidth = math.max(0.0, constraints.maxWidth - (
|
||||
_boxSize(icon).width
|
||||
+ contentPadding.left
|
||||
+ _boxSize(prefixIcon).width
|
||||
+ _boxSize(prefix).width
|
||||
+ _boxSize(suffix).width
|
||||
+ _boxSize(suffixIcon).width
|
||||
+ contentPadding.right));
|
||||
final double inputWidth = math.max(
|
||||
0.0,
|
||||
constraints.maxWidth - (
|
||||
_boxSize(icon).width
|
||||
+ contentPadding.left
|
||||
+ _boxSize(prefixIcon).width
|
||||
+ _boxSize(prefix).width
|
||||
+ _boxSize(suffix).width
|
||||
+ _boxSize(suffixIcon).width
|
||||
+ contentPadding.right),
|
||||
);
|
||||
// Increase the available width for the label when it is scaled down.
|
||||
final double invertedLabelScale = lerpDouble(1.00, 1 / _kFinalLabelScale, decoration.floatingLabelProgress)!;
|
||||
double suffixIconWidth = _boxSize(suffixIcon).width;
|
||||
if (decoration.border!.isOutline) {
|
||||
suffixIconWidth = lerpDouble(suffixIconWidth, 0.0, decoration.floatingLabelProgress)!;
|
||||
}
|
||||
final double labelWidth = math.max(0.0, constraints.maxWidth - (
|
||||
_boxSize(icon).width
|
||||
+ contentPadding.left
|
||||
+ _boxSize(prefixIcon).width
|
||||
+ suffixIconWidth
|
||||
+ contentPadding.right));
|
||||
final double labelWidth = math.max(
|
||||
0.0,
|
||||
constraints.maxWidth - (
|
||||
_boxSize(icon).width
|
||||
+ contentPadding.left
|
||||
+ _boxSize(prefixIcon).width
|
||||
+ suffixIconWidth
|
||||
+ contentPadding.right),
|
||||
);
|
||||
boxToBaseline[label] = _layoutLineBox(
|
||||
label,
|
||||
boxConstraints.copyWith(maxWidth: labelWidth * invertedLabelScale),
|
||||
@ -1496,8 +1502,13 @@ class _RenderDecoration extends RenderBox {
|
||||
_labelTransform = Matrix4.identity()
|
||||
..translate(dx, labelOffset.dy + dy)
|
||||
..scale(scale);
|
||||
_transformLayer = context.pushTransform(needsCompositing, offset, _labelTransform!, _paintLabel,
|
||||
oldLayer: _transformLayer);
|
||||
_transformLayer = context.pushTransform(
|
||||
needsCompositing,
|
||||
offset,
|
||||
_labelTransform!,
|
||||
_paintLabel,
|
||||
oldLayer: _transformLayer,
|
||||
);
|
||||
} else {
|
||||
_transformLayer = null;
|
||||
}
|
||||
@ -2578,8 +2589,10 @@ class InputDecoration {
|
||||
this.border = InputBorder.none,
|
||||
this.enabled = true,
|
||||
}) : assert(enabled != null),
|
||||
assert(!(!hasFloatingPlaceholder && identical(floatingLabelBehavior, FloatingLabelBehavior.always)),
|
||||
'hasFloatingPlaceholder=false conflicts with FloatingLabelBehavior.always'),
|
||||
assert(
|
||||
!(!hasFloatingPlaceholder && identical(floatingLabelBehavior, FloatingLabelBehavior.always)),
|
||||
'hasFloatingPlaceholder=false conflicts with FloatingLabelBehavior.always',
|
||||
),
|
||||
icon = null,
|
||||
labelText = null,
|
||||
labelStyle = null,
|
||||
@ -3642,8 +3655,10 @@ class InputDecorationTheme with Diagnosticable {
|
||||
assert(isCollapsed != null),
|
||||
assert(filled != null),
|
||||
assert(alignLabelWithHint != null),
|
||||
assert(!(!hasFloatingPlaceholder && identical(floatingLabelBehavior, FloatingLabelBehavior.always)),
|
||||
'hasFloatingPlaceholder=false conflicts with FloatingLabelBehavior.always');
|
||||
assert(
|
||||
!(!hasFloatingPlaceholder && identical(floatingLabelBehavior, FloatingLabelBehavior.always)),
|
||||
'hasFloatingPlaceholder=false conflicts with FloatingLabelBehavior.always',
|
||||
);
|
||||
|
||||
/// The style to use for [InputDecoration.labelText] when the label is
|
||||
/// above (i.e., vertically adjacent to) the input field.
|
||||
|
@ -988,8 +988,10 @@ class PopupMenuButton<T> extends StatefulWidget {
|
||||
}) : assert(itemBuilder != null),
|
||||
assert(offset != null),
|
||||
assert(enabled != null),
|
||||
assert(!(child != null && icon != null),
|
||||
'You can only pass [child] or [icon], not both.'),
|
||||
assert(
|
||||
!(child != null && icon != null),
|
||||
'You can only pass [child] or [icon], not both.',
|
||||
),
|
||||
super(key: key);
|
||||
|
||||
/// Called when the button is pressed to create the items to show in the menu.
|
||||
|
@ -457,8 +457,10 @@ class ScaffoldMessengerState extends State<ScaffoldMessenger> with TickerProvide
|
||||
if (_snackBarController!.isCompleted && _snackBarTimer == null) {
|
||||
final SnackBar snackBar = _snackBars.first._widget;
|
||||
_snackBarTimer = Timer(snackBar.duration, () {
|
||||
assert(_snackBarController!.status == AnimationStatus.forward ||
|
||||
_snackBarController!.status == AnimationStatus.completed);
|
||||
assert(
|
||||
_snackBarController!.status == AnimationStatus.forward ||
|
||||
_snackBarController!.status == AnimationStatus.completed,
|
||||
);
|
||||
// Look up MediaQuery again in case the setting changed.
|
||||
final MediaQueryData mediaQuery = MediaQuery.of(context);
|
||||
if (mediaQuery.accessibleNavigation && snackBar.action != null)
|
||||
@ -2984,8 +2986,10 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
|
||||
if (_snackBarController!.isCompleted && _snackBarTimer == null) {
|
||||
final SnackBar snackBar = _snackBars.first._widget;
|
||||
_snackBarTimer = Timer(snackBar.duration, () {
|
||||
assert(_snackBarController!.status == AnimationStatus.forward ||
|
||||
_snackBarController!.status == AnimationStatus.completed);
|
||||
assert(
|
||||
_snackBarController!.status == AnimationStatus.forward ||
|
||||
_snackBarController!.status == AnimationStatus.completed,
|
||||
);
|
||||
// Look up MediaQuery again in case the setting changed.
|
||||
final MediaQueryData mediaQuery = MediaQuery.of(context);
|
||||
if (mediaQuery.accessibleNavigation && snackBar.action != null)
|
||||
@ -3374,8 +3378,10 @@ class _StandardBottomSheetState extends State<_StandardBottomSheet> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
assert(widget.animationController != null);
|
||||
assert(widget.animationController.status == AnimationStatus.forward
|
||||
|| widget.animationController.status == AnimationStatus.completed);
|
||||
assert(
|
||||
widget.animationController.status == AnimationStatus.forward
|
||||
|| widget.animationController.status == AnimationStatus.completed,
|
||||
);
|
||||
widget.animationController.addStatusListener(_handleStatusChange);
|
||||
}
|
||||
|
||||
|
@ -423,10 +423,12 @@ class TextField extends StatefulWidget {
|
||||
assert(!obscureText || maxLines == 1, 'Obscured fields cannot be multiline.'),
|
||||
assert(maxLength == null || maxLength == TextField.noMaxLength || maxLength > 0),
|
||||
// Assert the following instead of setting it directly to avoid surprising the user by silently changing the value they set.
|
||||
assert(!identical(textInputAction, TextInputAction.newline) ||
|
||||
assert(
|
||||
!identical(textInputAction, TextInputAction.newline) ||
|
||||
maxLines == 1 ||
|
||||
!identical(keyboardType, TextInputType.text),
|
||||
'Use keyboardType TextInputType.multiline when using TextInputAction.newline on a multiline TextField.'),
|
||||
'Use keyboardType TextInputType.multiline when using TextInputAction.newline on a multiline TextField.',
|
||||
),
|
||||
keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline),
|
||||
toolbarOptions = toolbarOptions ?? (obscureText ?
|
||||
const ToolbarOptions(
|
||||
|
@ -128,8 +128,7 @@ class BoxDecoration extends Decoration {
|
||||
|
||||
@override
|
||||
bool debugAssertIsValid() {
|
||||
assert(shape != BoxShape.circle ||
|
||||
borderRadius == null); // Can't have a border radius if you're a circle.
|
||||
assert(shape != BoxShape.circle || borderRadius == null); // Can't have a border radius if you're a circle.
|
||||
return super.debugAssertIsValid();
|
||||
}
|
||||
|
||||
|
@ -173,8 +173,7 @@ FittedSizes applyBoxFit(BoxFit fit, Size inputSize, Size outputSize) {
|
||||
destinationSize = Size(sourceSize.width * outputSize.height / sourceSize.height, outputSize.height);
|
||||
break;
|
||||
case BoxFit.none:
|
||||
sourceSize = Size(math.min(inputSize.width, outputSize.width),
|
||||
math.min(inputSize.height, outputSize.height));
|
||||
sourceSize = Size(math.min(inputSize.width, outputSize.width), math.min(inputSize.height, outputSize.height));
|
||||
destinationSize = sourceSize;
|
||||
break;
|
||||
case BoxFit.scaleDown:
|
||||
|
@ -79,14 +79,16 @@ class FlutterLogoDecoration extends Decoration {
|
||||
|
||||
@override
|
||||
bool debugAssertIsValid() {
|
||||
assert(textColor != null
|
||||
assert(
|
||||
textColor != null
|
||||
&& style != null
|
||||
&& margin != null
|
||||
&& _position != null
|
||||
&& _position.isFinite
|
||||
&& _opacity != null
|
||||
&& _opacity >= 0.0
|
||||
&& _opacity <= 1.0);
|
||||
&& _opacity <= 1.0,
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -261,9 +261,9 @@ class AssetImage extends AssetBundleImageProvider {
|
||||
// TODO(ianh): JSON decoding really shouldn't be on the main thread.
|
||||
final Map<String, dynamic> parsedJson = json.decode(jsonData) as Map<String, dynamic>;
|
||||
final Iterable<String> keys = parsedJson.keys;
|
||||
final Map<String, List<String>> parsedManifest =
|
||||
Map<String, List<String>>.fromIterables(keys,
|
||||
keys.map<List<String>>((String key) => List<String>.from(parsedJson[key] as List<dynamic>)));
|
||||
final Map<String, List<String>> parsedManifest = <String, List<String>> {
|
||||
for (final String key in keys) key: List<String>.from(parsedJson[key] as List<dynamic>),
|
||||
};
|
||||
// TODO(ianh): convert that data structure to the right types.
|
||||
return SynchronousFuture<Map<String, List<String>>?>(parsedManifest);
|
||||
}
|
||||
|
@ -250,8 +250,8 @@ class _UnderdampedSolution implements _SpringSolution {
|
||||
double distance,
|
||||
double velocity,
|
||||
) {
|
||||
final double w = math.sqrt(4.0 * spring.mass * spring.stiffness -
|
||||
spring.damping * spring.damping) / (2.0 * spring.mass);
|
||||
final double w = math.sqrt(4.0 * spring.mass * spring.stiffness - spring.damping * spring.damping) /
|
||||
(2.0 * spring.mass);
|
||||
final double r = -(spring.damping / 2.0 * spring.mass);
|
||||
final double c1 = distance;
|
||||
final double c2 = (velocity - r * distance) / w;
|
||||
|
@ -327,8 +327,14 @@ class RenderAnimatedSize extends RenderAligningShiftedBox {
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
if (child != null && _hasVisualOverflow && clipBehavior != Clip.none) {
|
||||
final Rect rect = Offset.zero & size;
|
||||
_clipRectLayer = context.pushClipRect(needsCompositing, offset, rect, super.paint,
|
||||
clipBehavior: clipBehavior, oldLayer: _clipRectLayer);
|
||||
_clipRectLayer = context.pushClipRect(
|
||||
needsCompositing,
|
||||
offset,
|
||||
rect,
|
||||
super.paint,
|
||||
clipBehavior: clipBehavior,
|
||||
oldLayer: _clipRectLayer,
|
||||
);
|
||||
} else {
|
||||
_clipRectLayer = null;
|
||||
super.paint(context, offset);
|
||||
|
@ -282,8 +282,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
|
||||
event is PointerAddedEvent ||
|
||||
event is PointerRemovedEvent) {
|
||||
assert(event.position != null);
|
||||
_mouseTracker!.updateWithEvent(event,
|
||||
() => hitTestResult ?? renderView.hitTestMouseTrackers(event.position));
|
||||
_mouseTracker!.updateWithEvent(event, () => hitTestResult ?? renderView.hitTestMouseTrackers(event.position));
|
||||
}
|
||||
super.dispatchEvent(event, hitTestResult);
|
||||
}
|
||||
|
@ -865,10 +865,12 @@ class BoxHitTestResult extends HitTestResult {
|
||||
required BoxHitTestWithOutOfBandPosition hitTest,
|
||||
}) {
|
||||
assert(hitTest != null);
|
||||
assert((paintOffset == null && paintTransform == null && rawTransform != null) ||
|
||||
(paintOffset == null && paintTransform != null && rawTransform == null) ||
|
||||
(paintOffset != null && paintTransform == null && rawTransform == null),
|
||||
'Exactly one transform or offset argument must be provided.');
|
||||
assert(
|
||||
(paintOffset == null && paintTransform == null && rawTransform != null) ||
|
||||
(paintOffset == null && paintTransform != null && rawTransform == null) ||
|
||||
(paintOffset != null && paintTransform == null && rawTransform == null),
|
||||
'Exactly one transform or offset argument must be provided.',
|
||||
);
|
||||
if (paintOffset != null) {
|
||||
pushOffset(-paintOffset);
|
||||
} else if (rawTransform != null) {
|
||||
|
@ -224,8 +224,7 @@ mixin DebugOverflowIndicatorMixin on RenderObject {
|
||||
if (overflow.right > 0.0) '${_formatPixels(overflow.right)} pixels on the right',
|
||||
];
|
||||
String overflowText = '';
|
||||
assert(overflows.isNotEmpty,
|
||||
"Somehow $runtimeType didn't actually overflow like it thought it did.");
|
||||
assert(overflows.isNotEmpty, "Somehow $runtimeType didn't actually overflow like it thought it did.");
|
||||
switch (overflows.length) {
|
||||
case 1:
|
||||
overflowText = overflows.first;
|
||||
|
@ -1399,9 +1399,11 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
||||
return _extendSelectionToStart(cause);
|
||||
}
|
||||
|
||||
assert(_textLayoutLastMaxWidth == constraints.maxWidth &&
|
||||
_textLayoutLastMinWidth == constraints.minWidth,
|
||||
'Last width ($_textLayoutLastMinWidth, $_textLayoutLastMaxWidth) not the same as max width constraint (${constraints.minWidth}, ${constraints.maxWidth}).');
|
||||
assert(
|
||||
_textLayoutLastMaxWidth == constraints.maxWidth &&
|
||||
_textLayoutLastMinWidth == constraints.minWidth,
|
||||
'Last width ($_textLayoutLastMinWidth, $_textLayoutLastMaxWidth) not the same as max width constraint (${constraints.minWidth}, ${constraints.maxWidth}).',
|
||||
);
|
||||
final TextSelection nextSelection = _extendGivenSelectionLeftByWord(
|
||||
_textPainter,
|
||||
selection!,
|
||||
@ -1437,9 +1439,11 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
||||
return _extendSelectionToEnd(cause);
|
||||
}
|
||||
|
||||
assert(_textLayoutLastMaxWidth == constraints.maxWidth &&
|
||||
_textLayoutLastMinWidth == constraints.minWidth,
|
||||
'Last width ($_textLayoutLastMinWidth, $_textLayoutLastMaxWidth) not the same as max width constraint (${constraints.minWidth}, ${constraints.maxWidth}).');
|
||||
assert(
|
||||
_textLayoutLastMaxWidth == constraints.maxWidth &&
|
||||
_textLayoutLastMinWidth == constraints.minWidth,
|
||||
'Last width ($_textLayoutLastMinWidth, $_textLayoutLastMaxWidth) not the same as max width constraint (${constraints.minWidth}, ${constraints.maxWidth}).',
|
||||
);
|
||||
final TextSelection nextSelection = _extendGivenSelectionRightByWord(
|
||||
_textPainter,
|
||||
selection!,
|
||||
@ -1597,9 +1601,11 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
||||
return moveSelectionToStart(cause);
|
||||
}
|
||||
|
||||
assert(_textLayoutLastMaxWidth == constraints.maxWidth &&
|
||||
_textLayoutLastMinWidth == constraints.minWidth,
|
||||
'Last width ($_textLayoutLastMinWidth, $_textLayoutLastMaxWidth) not the same as max width constraint (${constraints.minWidth}, ${constraints.maxWidth}).');
|
||||
assert(
|
||||
_textLayoutLastMaxWidth == constraints.maxWidth &&
|
||||
_textLayoutLastMinWidth == constraints.minWidth,
|
||||
'Last width ($_textLayoutLastMinWidth, $_textLayoutLastMaxWidth) not the same as max width constraint (${constraints.minWidth}, ${constraints.maxWidth}).',
|
||||
);
|
||||
final TextSelection nextSelection = _moveGivenSelectionLeftByWord(
|
||||
_textPainter,
|
||||
selection!,
|
||||
@ -1683,9 +1689,11 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
||||
return moveSelectionToEnd(cause);
|
||||
}
|
||||
|
||||
assert(_textLayoutLastMaxWidth == constraints.maxWidth &&
|
||||
_textLayoutLastMinWidth == constraints.minWidth,
|
||||
'Last width ($_textLayoutLastMinWidth, $_textLayoutLastMaxWidth) not the same as max width constraint (${constraints.minWidth}, ${constraints.maxWidth}).');
|
||||
assert(
|
||||
_textLayoutLastMaxWidth == constraints.maxWidth &&
|
||||
_textLayoutLastMinWidth == constraints.minWidth,
|
||||
'Last width ($_textLayoutLastMinWidth, $_textLayoutLastMaxWidth) not the same as max width constraint (${constraints.minWidth}, ${constraints.maxWidth}).',
|
||||
);
|
||||
final TextSelection nextSelection = _moveGivenSelectionRightByWord(
|
||||
_textPainter,
|
||||
selection!,
|
||||
@ -3032,9 +3040,11 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
||||
}
|
||||
|
||||
TextSelection _getWordAtOffset(TextPosition position) {
|
||||
assert(_textLayoutLastMaxWidth == constraints.maxWidth &&
|
||||
_textLayoutLastMinWidth == constraints.minWidth,
|
||||
'Last width ($_textLayoutLastMinWidth, $_textLayoutLastMaxWidth) not the same as max width constraint (${constraints.minWidth}, ${constraints.maxWidth}).');
|
||||
assert(
|
||||
_textLayoutLastMaxWidth == constraints.maxWidth &&
|
||||
_textLayoutLastMinWidth == constraints.minWidth,
|
||||
'Last width ($_textLayoutLastMinWidth, $_textLayoutLastMaxWidth) not the same as max width constraint (${constraints.minWidth}, ${constraints.maxWidth}).',
|
||||
);
|
||||
final TextRange word = _textPainter.getWordBoundary(position);
|
||||
// When long-pressing past the end of the text, we want a collapsed cursor.
|
||||
if (position.offset >= word.end)
|
||||
@ -3095,9 +3105,11 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
||||
}
|
||||
|
||||
TextSelection _getLineAtOffset(TextPosition position) {
|
||||
assert(_textLayoutLastMaxWidth == constraints.maxWidth &&
|
||||
_textLayoutLastMinWidth == constraints.minWidth,
|
||||
'Last width ($_textLayoutLastMinWidth, $_textLayoutLastMaxWidth) not the same as max width constraint (${constraints.minWidth}, ${constraints.maxWidth}).');
|
||||
assert(
|
||||
_textLayoutLastMaxWidth == constraints.maxWidth &&
|
||||
_textLayoutLastMinWidth == constraints.minWidth,
|
||||
'Last width ($_textLayoutLastMinWidth, $_textLayoutLastMaxWidth) not the same as max width constraint (${constraints.minWidth}, ${constraints.maxWidth}).',
|
||||
);
|
||||
final TextRange line = _textPainter.getLineBoundary(position);
|
||||
if (position.offset >= line.end)
|
||||
return TextSelection.fromPosition(position);
|
||||
@ -3294,9 +3306,11 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
||||
}
|
||||
|
||||
void _paintContents(PaintingContext context, Offset offset) {
|
||||
assert(_textLayoutLastMaxWidth == constraints.maxWidth &&
|
||||
_textLayoutLastMinWidth == constraints.minWidth,
|
||||
'Last width ($_textLayoutLastMinWidth, $_textLayoutLastMaxWidth) not the same as max width constraint (${constraints.minWidth}, ${constraints.maxWidth}).');
|
||||
assert(
|
||||
_textLayoutLastMaxWidth == constraints.maxWidth &&
|
||||
_textLayoutLastMinWidth == constraints.minWidth,
|
||||
'Last width ($_textLayoutLastMinWidth, $_textLayoutLastMaxWidth) not the same as max width constraint (${constraints.minWidth}, ${constraints.maxWidth}).',
|
||||
);
|
||||
final Offset effectiveOffset = offset + _paintOffset;
|
||||
|
||||
if (selection != null && !_floatingCursorOn) {
|
||||
@ -3346,8 +3360,14 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
_layoutText(minWidth: constraints.minWidth, maxWidth: constraints.maxWidth);
|
||||
if (_hasVisualOverflow && clipBehavior != Clip.none) {
|
||||
_clipRectLayer = context.pushClipRect(needsCompositing, offset, Offset.zero & size, _paintContents,
|
||||
clipBehavior: clipBehavior, oldLayer: _clipRectLayer);
|
||||
_clipRectLayer = context.pushClipRect(
|
||||
needsCompositing,
|
||||
offset,
|
||||
Offset.zero & size,
|
||||
_paintContents,
|
||||
clipBehavior: clipBehavior,
|
||||
oldLayer: _clipRectLayer,
|
||||
);
|
||||
} else {
|
||||
_clipRectLayer = null;
|
||||
_paintContents(context, offset);
|
||||
|
@ -583,8 +583,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
||||
|
||||
// Determine the spacePerFlex by allocating the remaining available space.
|
||||
// When you're overconstrained spacePerFlex can be negative.
|
||||
final double spacePerFlex = math.max(0.0,
|
||||
(availableMainSpace - inflexibleSpace) / totalFlex);
|
||||
final double spacePerFlex = math.max(0.0, (availableMainSpace - inflexibleSpace) / totalFlex);
|
||||
|
||||
// Size remaining (flexible) items, find the maximum cross size.
|
||||
child = firstChild;
|
||||
@ -1089,8 +1088,14 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
||||
defaultPaint(context, offset);
|
||||
} else {
|
||||
// We have overflow and the clipBehavior isn't none. Clip it.
|
||||
_clipRectLayer = context.pushClipRect(needsCompositing, offset, Offset.zero & size, defaultPaint,
|
||||
clipBehavior: clipBehavior, oldLayer: _clipRectLayer);
|
||||
_clipRectLayer = context.pushClipRect(
|
||||
needsCompositing,
|
||||
offset,
|
||||
Offset.zero & size,
|
||||
defaultPaint,
|
||||
clipBehavior: clipBehavior,
|
||||
oldLayer: _clipRectLayer,
|
||||
);
|
||||
}
|
||||
|
||||
assert(() {
|
||||
|
@ -392,8 +392,14 @@ class RenderFlow extends RenderBox
|
||||
_clipRectLayer = null;
|
||||
_paintWithDelegate(context, offset);
|
||||
} else {
|
||||
_clipRectLayer = context.pushClipRect(needsCompositing, offset, Offset.zero & size, _paintWithDelegate,
|
||||
clipBehavior: clipBehavior, oldLayer: _clipRectLayer);
|
||||
_clipRectLayer = context.pushClipRect(
|
||||
needsCompositing,
|
||||
offset,
|
||||
Offset.zero & size,
|
||||
_paintWithDelegate,
|
||||
clipBehavior: clipBehavior,
|
||||
oldLayer: _clipRectLayer,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -790,9 +790,11 @@ class ContainerLayer extends Layer {
|
||||
|
||||
List<PictureLayer> _processConflictingPhysicalLayers(PhysicalModelLayer predecessor, PhysicalModelLayer child) {
|
||||
FlutterError.reportError(FlutterErrorDetails(
|
||||
exception: FlutterError('Painting order is out of order with respect to elevation.\n'
|
||||
'See https://api.flutter.dev/flutter/rendering/debugCheckElevationsEnabled.html '
|
||||
'for more details.'),
|
||||
exception: FlutterError(
|
||||
'Painting order is out of order with respect to elevation.\n'
|
||||
'See https://api.flutter.dev/flutter/rendering/debugCheckElevationsEnabled.html '
|
||||
'for more details.',
|
||||
),
|
||||
library: 'rendering library',
|
||||
context: ErrorDescription('during compositing'),
|
||||
informationCollector: () {
|
||||
|
@ -989,11 +989,15 @@ class RenderListWheelViewport
|
||||
Matrix4 _centerOriginTransform(Matrix4 originalMatrix) {
|
||||
final Matrix4 result = Matrix4.identity();
|
||||
final Offset centerOriginTranslation = Alignment.center.alongSize(size);
|
||||
result.translate(centerOriginTranslation.dx * (-_offAxisFraction * 2 + 1),
|
||||
centerOriginTranslation.dy);
|
||||
result.translate(
|
||||
centerOriginTranslation.dx * (-_offAxisFraction * 2 + 1),
|
||||
centerOriginTranslation.dy,
|
||||
);
|
||||
result.multiply(originalMatrix);
|
||||
result.translate(-centerOriginTranslation.dx * (-_offAxisFraction * 2 + 1),
|
||||
-centerOriginTranslation.dy);
|
||||
result.translate(
|
||||
-centerOriginTranslation.dx * (-_offAxisFraction * 2 + 1),
|
||||
-centerOriginTranslation.dy,
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -373,9 +373,11 @@ class RenderParagraph extends RenderBox
|
||||
case ui.PlaceholderAlignment.baseline:
|
||||
case ui.PlaceholderAlignment.aboveBaseline:
|
||||
case ui.PlaceholderAlignment.belowBaseline: {
|
||||
assert(RenderObject.debugCheckingIntrinsics,
|
||||
assert(
|
||||
RenderObject.debugCheckingIntrinsics,
|
||||
'Intrinsics are not available for PlaceholderAlignment.baseline, '
|
||||
'PlaceholderAlignment.aboveBaseline, or PlaceholderAlignment.belowBaseline.');
|
||||
'PlaceholderAlignment.aboveBaseline, or PlaceholderAlignment.belowBaseline.',
|
||||
);
|
||||
return false;
|
||||
}
|
||||
case ui.PlaceholderAlignment.top:
|
||||
|
@ -209,8 +209,14 @@ class RenderAndroidView extends RenderBox with _PlatformViewGestureMixin {
|
||||
// Clip the texture if it's going to paint out of the bounds of the renter box
|
||||
// (see comment in _paintTexture for an explanation of when this happens).
|
||||
if ((size.width < _currentAndroidViewSize.width || size.height < _currentAndroidViewSize.height) && clipBehavior != Clip.none) {
|
||||
_clipRectLayer = context.pushClipRect(true, offset, offset & size, _paintTexture, clipBehavior: clipBehavior,
|
||||
oldLayer: _clipRectLayer);
|
||||
_clipRectLayer = context.pushClipRect(
|
||||
true,
|
||||
offset,
|
||||
offset & size,
|
||||
_paintTexture,
|
||||
clipBehavior: clipBehavior,
|
||||
oldLayer: _clipRectLayer,
|
||||
);
|
||||
return;
|
||||
}
|
||||
_clipRectLayer = null;
|
||||
|
@ -1600,8 +1600,10 @@ class RenderClipOval extends _RenderCustomClip<Rect> {
|
||||
assert(_clip != null);
|
||||
final Offset center = _clip!.center;
|
||||
// convert the position to an offset from the center of the unit circle
|
||||
final Offset offset = Offset((position.dx - center.dx) / _clip!.width,
|
||||
(position.dy - center.dy) / _clip!.height);
|
||||
final Offset offset = Offset(
|
||||
(position.dx - center.dx) / _clip!.width,
|
||||
(position.dy - center.dy) / _clip!.height,
|
||||
);
|
||||
// check if the point is outside the unit circle
|
||||
if (offset.distanceSquared > 0.25) // x^2 + y^2 > r^2
|
||||
return false;
|
||||
@ -2582,8 +2584,13 @@ class RenderFittedBox extends RenderProxyBox {
|
||||
TransformLayer? _paintChildWithTransform(PaintingContext context, Offset offset) {
|
||||
final Offset? childOffset = MatrixUtils.getAsTranslation(_transform!);
|
||||
if (childOffset == null)
|
||||
return context.pushTransform(needsCompositing, offset, _transform!, super.paint,
|
||||
oldLayer: layer is TransformLayer ? layer! as TransformLayer : null);
|
||||
return context.pushTransform(
|
||||
needsCompositing,
|
||||
offset,
|
||||
_transform!,
|
||||
super.paint,
|
||||
oldLayer: layer is TransformLayer ? layer! as TransformLayer : null,
|
||||
);
|
||||
else
|
||||
super.paint(context, offset + childOffset);
|
||||
return null;
|
||||
@ -2596,8 +2603,14 @@ class RenderFittedBox extends RenderProxyBox {
|
||||
_updatePaintData();
|
||||
if (child != null) {
|
||||
if (_hasVisualOverflow! && clipBehavior != Clip.none)
|
||||
layer = context.pushClipRect(needsCompositing, offset, Offset.zero & size, _paintChildWithTransform,
|
||||
oldLayer: layer is ClipRectLayer ? layer! as ClipRectLayer : null, clipBehavior: clipBehavior);
|
||||
layer = context.pushClipRect(
|
||||
needsCompositing,
|
||||
offset,
|
||||
Offset.zero & size,
|
||||
_paintChildWithTransform,
|
||||
oldLayer: layer is ClipRectLayer ? layer! as ClipRectLayer : null,
|
||||
clipBehavior: clipBehavior,
|
||||
);
|
||||
else
|
||||
layer = _paintChildWithTransform(context, offset);
|
||||
}
|
||||
@ -4655,10 +4668,14 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
|
||||
super.describeSemanticsConfiguration(config);
|
||||
config.isSemanticBoundary = container;
|
||||
config.explicitChildNodes = explicitChildNodes;
|
||||
assert((scopesRoute == true && explicitChildNodes == true) || scopesRoute != true,
|
||||
'explicitChildNodes must be set to true if scopes route is true');
|
||||
assert(!(toggled == true && checked == true),
|
||||
'A semantics node cannot be toggled and checked at the same time');
|
||||
assert(
|
||||
(scopesRoute == true && explicitChildNodes == true) || scopesRoute != true,
|
||||
'explicitChildNodes must be set to true if scopes route is true',
|
||||
);
|
||||
assert(
|
||||
!(toggled == true && checked == true),
|
||||
'A semantics node cannot be toggled and checked at the same time',
|
||||
);
|
||||
|
||||
if (enabled != null)
|
||||
config.isEnabled = enabled;
|
||||
|
@ -117,8 +117,13 @@ class RenderRotatedBox extends RenderBox with RenderObjectWithChildMixin<RenderB
|
||||
@override
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
if (child != null) {
|
||||
_transformLayer = context.pushTransform(needsCompositing, offset, _paintTransform!, _paintChild,
|
||||
oldLayer: _transformLayer);
|
||||
_transformLayer = context.pushTransform(
|
||||
needsCompositing,
|
||||
offset,
|
||||
_paintTransform!,
|
||||
_paintChild,
|
||||
oldLayer: _transformLayer,
|
||||
);
|
||||
} else {
|
||||
_transformLayer = null;
|
||||
}
|
||||
|
@ -435,12 +435,16 @@ class RenderPositionedBox extends RenderAligningShiftedBox {
|
||||
|
||||
if (child != null) {
|
||||
child!.layout(constraints.loosen(), parentUsesSize: true);
|
||||
size = constraints.constrain(Size(shrinkWrapWidth ? child!.size.width * (_widthFactor ?? 1.0) : double.infinity,
|
||||
shrinkWrapHeight ? child!.size.height * (_heightFactor ?? 1.0) : double.infinity));
|
||||
size = constraints.constrain(Size(
|
||||
shrinkWrapWidth ? child!.size.width * (_widthFactor ?? 1.0) : double.infinity,
|
||||
shrinkWrapHeight ? child!.size.height * (_heightFactor ?? 1.0) : double.infinity,
|
||||
));
|
||||
alignChild();
|
||||
} else {
|
||||
size = constraints.constrain(Size(shrinkWrapWidth ? 0.0 : double.infinity,
|
||||
shrinkWrapHeight ? 0.0 : double.infinity));
|
||||
size = constraints.constrain(Size(
|
||||
shrinkWrapWidth ? 0.0 : double.infinity,
|
||||
shrinkWrapHeight ? 0.0 : double.infinity,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@ -801,8 +805,14 @@ class RenderConstraintsTransformBox extends RenderAligningShiftedBox with DebugO
|
||||
super.paint(context, offset);
|
||||
} else {
|
||||
// We have overflow and the clipBehavior isn't none. Clip it.
|
||||
_clipRectLayer = context.pushClipRect(needsCompositing, offset, Offset.zero & size, super.paint,
|
||||
clipBehavior: clipBehavior, oldLayer:_clipRectLayer);
|
||||
_clipRectLayer = context.pushClipRect(
|
||||
needsCompositing,
|
||||
offset,
|
||||
Offset.zero & size,
|
||||
super.paint,
|
||||
clipBehavior: clipBehavior,
|
||||
oldLayer:_clipRectLayer,
|
||||
);
|
||||
}
|
||||
|
||||
// Display the overflow indicator.
|
||||
|
@ -380,8 +380,10 @@ class SliverGridDelegateWithFixedCrossAxisCount extends SliverGridDelegate {
|
||||
@override
|
||||
SliverGridLayout getLayout(SliverConstraints constraints) {
|
||||
assert(_debugAssertIsValid());
|
||||
final double usableCrossAxisExtent = math.max(0.0,
|
||||
constraints.crossAxisExtent - crossAxisSpacing * (crossAxisCount - 1));
|
||||
final double usableCrossAxisExtent = math.max(
|
||||
0.0,
|
||||
constraints.crossAxisExtent - crossAxisSpacing * (crossAxisCount - 1),
|
||||
);
|
||||
final double childCrossAxisExtent = usableCrossAxisExtent / crossAxisCount;
|
||||
final double childMainAxisExtent = mainAxisExtent ?? childCrossAxisExtent / childAspectRatio;
|
||||
return SliverGridRegularTileLayout(
|
||||
@ -489,8 +491,10 @@ class SliverGridDelegateWithMaxCrossAxisExtent extends SliverGridDelegate {
|
||||
SliverGridLayout getLayout(SliverConstraints constraints) {
|
||||
assert(_debugAssertIsValid(constraints.crossAxisExtent));
|
||||
final int crossAxisCount = (constraints.crossAxisExtent / (maxCrossAxisExtent + crossAxisSpacing)).ceil();
|
||||
final double usableCrossAxisExtent = math.max(0.0,
|
||||
constraints.crossAxisExtent - crossAxisSpacing * (crossAxisCount - 1));
|
||||
final double usableCrossAxisExtent = math.max(
|
||||
0.0,
|
||||
constraints.crossAxisExtent - crossAxisSpacing * (crossAxisCount - 1),
|
||||
);
|
||||
final double childCrossAxisExtent = usableCrossAxisExtent / crossAxisCount;
|
||||
final double childMainAxisExtent = mainAxisExtent ?? childCrossAxisExtent / childAspectRatio;
|
||||
return SliverGridRegularTileLayout(
|
||||
|
@ -632,8 +632,14 @@ class RenderStack extends RenderBox
|
||||
@override
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
if (clipBehavior != Clip.none && _hasVisualOverflow) {
|
||||
_clipRectLayer = context.pushClipRect(needsCompositing, offset, Offset.zero & size, paintStack,
|
||||
clipBehavior: clipBehavior, oldLayer: _clipRectLayer);
|
||||
_clipRectLayer = context.pushClipRect(
|
||||
needsCompositing,
|
||||
offset,
|
||||
Offset.zero & size,
|
||||
paintStack,
|
||||
clipBehavior: clipBehavior,
|
||||
oldLayer: _clipRectLayer,
|
||||
);
|
||||
} else {
|
||||
_clipRectLayer = null;
|
||||
paintStack(context, offset);
|
||||
|
@ -632,8 +632,14 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
|
||||
if (firstChild == null)
|
||||
return;
|
||||
if (hasVisualOverflow && clipBehavior != Clip.none) {
|
||||
_clipRectLayer = context.pushClipRect(needsCompositing, offset, Offset.zero & size, _paintContents,
|
||||
clipBehavior: clipBehavior, oldLayer: _clipRectLayer);
|
||||
_clipRectLayer = context.pushClipRect(
|
||||
needsCompositing,
|
||||
offset,
|
||||
Offset.zero & size,
|
||||
_paintContents,
|
||||
clipBehavior: clipBehavior,
|
||||
oldLayer: _clipRectLayer,
|
||||
);
|
||||
} else {
|
||||
_clipRectLayer = null;
|
||||
_paintContents(context, offset);
|
||||
|
@ -761,8 +761,14 @@ class RenderWrap extends RenderBox
|
||||
// TODO(ianh): move the debug flex overflow paint logic somewhere common so
|
||||
// it can be reused here
|
||||
if (_hasVisualOverflow && clipBehavior != Clip.none) {
|
||||
_clipRectLayer = context.pushClipRect(needsCompositing, offset, Offset.zero & size, defaultPaint,
|
||||
clipBehavior: clipBehavior, oldLayer: _clipRectLayer);
|
||||
_clipRectLayer = context.pushClipRect(
|
||||
needsCompositing,
|
||||
offset,
|
||||
Offset.zero & size,
|
||||
defaultPaint,
|
||||
clipBehavior: clipBehavior,
|
||||
oldLayer: _clipRectLayer,
|
||||
);
|
||||
} else {
|
||||
_clipRectLayer = null;
|
||||
defaultPaint(context, offset);
|
||||
|
@ -818,8 +818,10 @@ abstract class AndroidViewController extends PlatformViewController {
|
||||
|
||||
/// Sets the layout direction for the Android view.
|
||||
Future<void> setLayoutDirection(TextDirection layoutDirection) async {
|
||||
assert(_state != _AndroidViewState.disposed,
|
||||
'trying to set a layout direction for a disposed UIView. View id: $viewId');
|
||||
assert(
|
||||
_state != _AndroidViewState.disposed,
|
||||
'trying to set a layout direction for a disposed UIView. View id: $viewId',
|
||||
);
|
||||
|
||||
if (layoutDirection == _layoutDirection)
|
||||
return;
|
||||
@ -994,8 +996,7 @@ class TextureAndroidViewController extends AndroidViewController {
|
||||
|
||||
@override
|
||||
Future<void> setSize(Size size) async {
|
||||
assert(_state != _AndroidViewState.disposed,
|
||||
'trying to size a disposed Android View. View id: $viewId');
|
||||
assert(_state != _AndroidViewState.disposed, 'trying to size a disposed Android View. View id: $viewId');
|
||||
|
||||
assert(size != null);
|
||||
assert(!size.isEmpty);
|
||||
|
@ -172,10 +172,12 @@ abstract class RawKeyEventData {
|
||||
}
|
||||
assert((){
|
||||
if (side == null) {
|
||||
debugPrint('Raw key data is returning inconsistent information for '
|
||||
'pressed modifiers. isModifierPressed returns true for $key '
|
||||
'being pressed, but when getModifierSide is called, it says '
|
||||
'that no modifiers are pressed.');
|
||||
debugPrint(
|
||||
'Raw key data is returning inconsistent information for '
|
||||
'pressed modifiers. isModifierPressed returns true for $key '
|
||||
'being pressed, but when getModifierSide is called, it says '
|
||||
'that no modifiers are pressed.',
|
||||
);
|
||||
if (this is RawKeyEventDataAndroid) {
|
||||
debugPrint('Android raw key metaState: ${(this as RawKeyEventDataAndroid).metaState}');
|
||||
}
|
||||
@ -660,11 +662,13 @@ class RawKeyboard {
|
||||
// Make sure that the modifiers reflect reality, in case a modifier key was
|
||||
// pressed/released while the app didn't have focus.
|
||||
_synchronizeModifiers(event);
|
||||
assert(event is! RawKeyDownEvent || _keysPressed.isNotEmpty,
|
||||
'Attempted to send a key down event when no keys are in keysPressed. '
|
||||
"This state can occur if the key event being sent doesn't properly "
|
||||
'set its modifier flags. This was the event: $event and its data: '
|
||||
'${event.data}');
|
||||
assert(
|
||||
event is! RawKeyDownEvent || _keysPressed.isNotEmpty,
|
||||
'Attempted to send a key down event when no keys are in keysPressed. '
|
||||
"This state can occur if the key event being sent doesn't properly "
|
||||
'set its modifier flags. This was the event: $event and its data: '
|
||||
'${event.data}',
|
||||
);
|
||||
// Send the event to passive listeners.
|
||||
for (final ValueChanged<RawKeyEvent> listener in List<ValueChanged<RawKeyEvent>>.from(_listeners)) {
|
||||
if (_listeners.contains(listener)) {
|
||||
@ -742,9 +746,11 @@ class RawKeyboard {
|
||||
final Set<PhysicalKeyboardKey>? mappedKeys = _modifierKeyMap[_ModifierSidePair(key, modifiersPressed[key])];
|
||||
assert((){
|
||||
if (mappedKeys == null) {
|
||||
debugPrint('Platform key support for ${Platform.operatingSystem} is '
|
||||
'producing unsupported modifier combinations for '
|
||||
'modifier $key on side ${modifiersPressed[key]}.');
|
||||
debugPrint(
|
||||
'Platform key support for ${Platform.operatingSystem} is '
|
||||
'producing unsupported modifier combinations for '
|
||||
'modifier $key on side ${modifiersPressed[key]}.',
|
||||
);
|
||||
if (event.data is RawKeyEventDataAndroid) {
|
||||
debugPrint('Android raw key metaState: ${(event.data as RawKeyEventDataAndroid).metaState}');
|
||||
}
|
||||
|
@ -814,14 +814,16 @@ class Actions extends StatefulWidget {
|
||||
assert(() {
|
||||
if (action == null) {
|
||||
final Type type = intent?.runtimeType ?? T;
|
||||
throw FlutterError('Unable to find an action for a $type in an $Actions widget '
|
||||
'in the given context.\n'
|
||||
"$Actions.find() was called on a context that doesn't contain an "
|
||||
'$Actions widget with a mapping for the given intent type.\n'
|
||||
'The context used was:\n'
|
||||
' $context\n'
|
||||
'The intent type requested was:\n'
|
||||
' $type');
|
||||
throw FlutterError(
|
||||
'Unable to find an action for a $type in an $Actions widget '
|
||||
'in the given context.\n'
|
||||
"$Actions.find() was called on a context that doesn't contain an "
|
||||
'$Actions widget with a mapping for the given intent type.\n'
|
||||
'The context used was:\n'
|
||||
' $context\n'
|
||||
'The intent type requested was:\n'
|
||||
' $type',
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}());
|
||||
@ -925,16 +927,18 @@ class Actions extends StatefulWidget {
|
||||
|
||||
assert(() {
|
||||
if (actionElement == null) {
|
||||
throw FlutterError('Unable to find an action for an Intent with type '
|
||||
'${intent.runtimeType} in an $Actions widget in the given context.\n'
|
||||
'$Actions.invoke() was unable to find an $Actions widget that '
|
||||
"contained a mapping for the given intent, or the intent type isn't the "
|
||||
'same as the type argument to invoke (which is $T - try supplying a '
|
||||
'type argument to invoke if one was not given)\n'
|
||||
'The context used was:\n'
|
||||
' $context\n'
|
||||
'The intent type requested was:\n'
|
||||
' ${intent.runtimeType}');
|
||||
throw FlutterError(
|
||||
'Unable to find an action for an Intent with type '
|
||||
'${intent.runtimeType} in an $Actions widget in the given context.\n'
|
||||
'$Actions.invoke() was unable to find an $Actions widget that '
|
||||
"contained a mapping for the given intent, or the intent type isn't the "
|
||||
'same as the type argument to invoke (which is $T - try supplying a '
|
||||
'type argument to invoke if one was not given)\n'
|
||||
'The context used was:\n'
|
||||
' $context\n'
|
||||
'The intent type requested was:\n'
|
||||
' ${intent.runtimeType}',
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}());
|
||||
|
@ -1205,15 +1205,16 @@ class _WidgetsAppState extends State<WidgetsApp> with WidgetsBindingObserver {
|
||||
: widget.routes![name];
|
||||
|
||||
if (pageContentBuilder != null) {
|
||||
assert(widget.pageRouteBuilder != null,
|
||||
assert(
|
||||
widget.pageRouteBuilder != null,
|
||||
'The default onGenerateRoute handler for WidgetsApp must have a '
|
||||
'pageRouteBuilder set if the home or routes properties are set.');
|
||||
'pageRouteBuilder set if the home or routes properties are set.',
|
||||
);
|
||||
final Route<dynamic> route = widget.pageRouteBuilder!<dynamic>(
|
||||
settings,
|
||||
pageContentBuilder,
|
||||
);
|
||||
assert(route != null,
|
||||
'The pageRouteBuilder for WidgetsApp must return a valid non-null Route.');
|
||||
assert(route != null, 'The pageRouteBuilder for WidgetsApp must return a valid non-null Route.');
|
||||
return route;
|
||||
}
|
||||
if (widget.onGenerateRoute != null)
|
||||
|
@ -1676,8 +1676,10 @@ class FocusManager with DiagnosticableTreeMixin, ChangeNotifier {
|
||||
if (node.onKey != null) {
|
||||
// TODO(gspencergoog): Convert this from dynamic to KeyEventResult once migration is complete.
|
||||
final dynamic result = node.onKey!(node, event);
|
||||
assert(result is bool || result is KeyEventResult,
|
||||
'Value returned from onKey handler must be a non-null bool or KeyEventResult, not ${result.runtimeType}');
|
||||
assert(
|
||||
result is bool || result is KeyEventResult,
|
||||
'Value returned from onKey handler must be a non-null bool or KeyEventResult, not ${result.runtimeType}',
|
||||
);
|
||||
if (result is KeyEventResult) {
|
||||
switch (result) {
|
||||
case KeyEventResult.handled:
|
||||
|
@ -3435,12 +3435,14 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
||||
void update(covariant Widget newWidget) {
|
||||
// This code is hot when hot reloading, so we try to
|
||||
// only call _AssertionError._evaluateAssertion once.
|
||||
assert(_lifecycleState == _ElementLifecycle.active
|
||||
assert(
|
||||
_lifecycleState == _ElementLifecycle.active
|
||||
&& widget != null
|
||||
&& newWidget != null
|
||||
&& newWidget != widget
|
||||
&& depth != null
|
||||
&& Widget.canUpdate(widget, newWidget));
|
||||
&& Widget.canUpdate(widget, newWidget),
|
||||
);
|
||||
// This Element was told to update and we can now release all the global key
|
||||
// reservations of forgotten children. We cannot do this earlier because the
|
||||
// forgotten children still represent global key duplications if the element
|
||||
@ -5694,17 +5696,21 @@ abstract class RenderObjectElement extends Element {
|
||||
@override
|
||||
void deactivate() {
|
||||
super.deactivate();
|
||||
assert(!renderObject.attached,
|
||||
assert(
|
||||
!renderObject.attached,
|
||||
'A RenderObject was still attached when attempting to deactivate its '
|
||||
'RenderObjectElement: $renderObject');
|
||||
'RenderObjectElement: $renderObject',
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void unmount() {
|
||||
super.unmount();
|
||||
assert(!renderObject.attached,
|
||||
assert(
|
||||
!renderObject.attached,
|
||||
'A RenderObject was still attached when attempting to unmount its '
|
||||
'RenderObjectElement: $renderObject');
|
||||
'RenderObjectElement: $renderObject',
|
||||
);
|
||||
widget.didUnmountRenderObject(renderObject);
|
||||
}
|
||||
|
||||
@ -5798,15 +5804,19 @@ abstract class RenderObjectElement extends Element {
|
||||
name: 'insertChildRenderObject() was called on this Element',
|
||||
style: DiagnosticsTreeStyle.shallow,
|
||||
),
|
||||
ErrorDescription('insertChildRenderObject() has been deprecated in favor of '
|
||||
ErrorDescription(
|
||||
'insertChildRenderObject() has been deprecated in favor of '
|
||||
'insertRenderObjectChild(). See https://github.com/flutter/flutter/issues/63269 '
|
||||
'for details.'),
|
||||
ErrorHint('Rather than overriding insertChildRenderObject() in your '
|
||||
'for details.',
|
||||
),
|
||||
ErrorHint(
|
||||
'Rather than overriding insertChildRenderObject() in your '
|
||||
'RenderObjectElement subclass, override insertRenderObjectChild() instead, '
|
||||
"and DON'T call super.insertRenderObjectChild(). If you're implementing a "
|
||||
'new RenderObjectElement, you should override/implement '
|
||||
'insertRenderObjectChild(), moveRenderObjectChild(), and '
|
||||
'removeRenderObjectChild().'),
|
||||
'removeRenderObjectChild().',
|
||||
),
|
||||
]);
|
||||
}());
|
||||
}
|
||||
@ -5871,15 +5881,19 @@ abstract class RenderObjectElement extends Element {
|
||||
name: 'super.moveChildRenderObject() was called on this Element',
|
||||
style: DiagnosticsTreeStyle.shallow,
|
||||
),
|
||||
ErrorDescription('moveChildRenderObject() has been deprecated in favor of '
|
||||
'moveRenderObjectChild(). See https://github.com/flutter/flutter/issues/63269 '
|
||||
'for details.'),
|
||||
ErrorHint('Rather than overriding moveChildRenderObject() in your '
|
||||
'RenderObjectElement subclass, override moveRenderObjectChild() instead, '
|
||||
"and DON'T call super.moveRenderObjectChild(). If you're implementing a "
|
||||
'new RenderObjectElement, you should override/implement '
|
||||
'insertRenderObjectChild(), moveRenderObjectChild(), and '
|
||||
'removeRenderObjectChild().'),
|
||||
ErrorDescription(
|
||||
'moveChildRenderObject() has been deprecated in favor of '
|
||||
'moveRenderObjectChild(). See https://github.com/flutter/flutter/issues/63269 '
|
||||
'for details.',
|
||||
),
|
||||
ErrorHint(
|
||||
'Rather than overriding moveChildRenderObject() in your '
|
||||
'RenderObjectElement subclass, override moveRenderObjectChild() instead, '
|
||||
"and DON'T call super.moveRenderObjectChild(). If you're implementing a "
|
||||
'new RenderObjectElement, you should override/implement '
|
||||
'insertRenderObjectChild(), moveRenderObjectChild(), and '
|
||||
'removeRenderObjectChild().',
|
||||
),
|
||||
]);
|
||||
}());
|
||||
}
|
||||
@ -5938,15 +5952,19 @@ abstract class RenderObjectElement extends Element {
|
||||
name: 'super.removeChildRenderObject() was called on this Element',
|
||||
style: DiagnosticsTreeStyle.shallow,
|
||||
),
|
||||
ErrorDescription('removeChildRenderObject() has been deprecated in favor of '
|
||||
'removeRenderObjectChild(). See https://github.com/flutter/flutter/issues/63269 '
|
||||
'for details.'),
|
||||
ErrorHint('Rather than overriding removeChildRenderObject() in your '
|
||||
'RenderObjectElement subclass, override removeRenderObjectChild() instead, '
|
||||
"and DON'T call super.removeRenderObjectChild(). If you're implementing a "
|
||||
'new RenderObjectElement, you should override/implement '
|
||||
'insertRenderObjectChild(), moveRenderObjectChild(), and '
|
||||
'removeRenderObjectChild().'),
|
||||
ErrorDescription(
|
||||
'removeChildRenderObject() has been deprecated in favor of '
|
||||
'removeRenderObjectChild(). See https://github.com/flutter/flutter/issues/63269 '
|
||||
'for details.',
|
||||
),
|
||||
ErrorHint(
|
||||
'Rather than overriding removeChildRenderObject() in your '
|
||||
'RenderObjectElement subclass, override removeRenderObjectChild() instead, '
|
||||
"and DON'T call super.removeRenderObjectChild(). If you're implementing a "
|
||||
'new RenderObjectElement, you should override/implement '
|
||||
'insertRenderObjectChild(), moveRenderObjectChild(), and '
|
||||
'removeRenderObjectChild().',
|
||||
),
|
||||
]);
|
||||
}());
|
||||
}
|
||||
|
@ -99,10 +99,12 @@ class InteractiveViewer extends StatefulWidget {
|
||||
assert(scaleEnabled != null),
|
||||
// boundaryMargin must be either fully infinite or fully finite, but not
|
||||
// a mix of both.
|
||||
assert((boundaryMargin.horizontal.isInfinite
|
||||
assert(
|
||||
(boundaryMargin.horizontal.isInfinite
|
||||
&& boundaryMargin.vertical.isInfinite) || (boundaryMargin.top.isFinite
|
||||
&& boundaryMargin.right.isFinite && boundaryMargin.bottom.isFinite
|
||||
&& boundaryMargin.left.isFinite)),
|
||||
&& boundaryMargin.left.isFinite),
|
||||
),
|
||||
super(key: key);
|
||||
|
||||
/// If set to [Clip.none], the child may extend beyond the size of the InteractiveViewer,
|
||||
@ -582,11 +584,14 @@ class _InteractiveViewerState extends State<InteractiveViewer> with TickerProvid
|
||||
final Rect boundaryRect = widget.boundaryMargin.inflateRect(Offset.zero & childSize);
|
||||
// Boundaries that are partially infinite are not allowed because Matrix4's
|
||||
// rotation and translation methods don't handle infinites well.
|
||||
assert(boundaryRect.isFinite ||
|
||||
assert(
|
||||
boundaryRect.isFinite ||
|
||||
(boundaryRect.left.isInfinite
|
||||
&& boundaryRect.top.isInfinite
|
||||
&& boundaryRect.right.isInfinite
|
||||
&& boundaryRect.bottom.isInfinite), 'boundaryRect must either be infinite in all directions or finite in all directions.');
|
||||
&& boundaryRect.bottom.isInfinite),
|
||||
'boundaryRect must either be infinite in all directions or finite in all directions.',
|
||||
);
|
||||
return boundaryRect;
|
||||
}
|
||||
|
||||
|
@ -785,8 +785,14 @@ class _RenderTheatre extends RenderBox with ContainerRenderObjectMixin<RenderBox
|
||||
@override
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
if (_hasVisualOverflow && clipBehavior != Clip.none) {
|
||||
_clipRectLayer = context.pushClipRect(needsCompositing, offset, Offset.zero & size, paintStack,
|
||||
clipBehavior: clipBehavior, oldLayer: _clipRectLayer);
|
||||
_clipRectLayer = context.pushClipRect(
|
||||
needsCompositing,
|
||||
offset,
|
||||
Offset.zero & size,
|
||||
paintStack,
|
||||
clipBehavior: clipBehavior,
|
||||
oldLayer: _clipRectLayer,
|
||||
);
|
||||
} else {
|
||||
_clipRectLayer = null;
|
||||
paintStack(context, offset);
|
||||
|
@ -903,9 +903,11 @@ class _PageViewState extends State<PageView> {
|
||||
final AxisDirection axisDirection = _getDirection(context);
|
||||
final ScrollPhysics physics = _ForceImplicitScrollPhysics(
|
||||
allowImplicitScrolling: widget.allowImplicitScrolling,
|
||||
).applyTo(widget.pageSnapping
|
||||
).applyTo(
|
||||
widget.pageSnapping
|
||||
? _kPagePhysics.applyTo(widget.physics ?? widget.scrollBehavior?.getScrollPhysics(context))
|
||||
: widget.physics ?? widget.scrollBehavior?.getScrollPhysics(context));
|
||||
: widget.physics ?? widget.scrollBehavior?.getScrollPhysics(context),
|
||||
);
|
||||
|
||||
return NotificationListener<ScrollNotification>(
|
||||
onNotification: (ScrollNotification notification) {
|
||||
|
@ -829,8 +829,10 @@ class SliverReorderableListState extends State<SliverReorderableList> with Ticke
|
||||
// When dragging, the dragged item is still in the list but has been replaced
|
||||
// by a zero height SizedBox, so that the gap can move around. To make the
|
||||
// list extent stable we add a dummy entry to the end.
|
||||
delegate: SliverChildBuilderDelegate(_itemBuilder,
|
||||
childCount: widget.itemCount + (_dragInfo != null ? 1 : 0)),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
_itemBuilder,
|
||||
childCount: widget.itemCount + (_dragInfo != null ? 1 : 0),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -321,9 +321,11 @@ class TrackingScrollController extends ScrollController {
|
||||
double initialScrollOffset = 0.0,
|
||||
bool keepScrollOffset = true,
|
||||
String? debugLabel,
|
||||
}) : super(initialScrollOffset: initialScrollOffset,
|
||||
keepScrollOffset: keepScrollOffset,
|
||||
debugLabel: debugLabel);
|
||||
}) : super(
|
||||
initialScrollOffset: initialScrollOffset,
|
||||
keepScrollOffset: keepScrollOffset,
|
||||
debugLabel: debugLabel,
|
||||
);
|
||||
|
||||
final Map<ScrollPosition, VoidCallback> _positionToListener = <ScrollPosition, VoidCallback>{};
|
||||
ScrollPosition? _lastUpdated;
|
||||
|
@ -183,9 +183,7 @@ class ClampingScrollSimulation extends Simulation {
|
||||
|
||||
// See getSplineDeceleration().
|
||||
double _splineDeceleration(double velocity) {
|
||||
return math.log(_inflexion *
|
||||
velocity.abs() /
|
||||
(friction * _decelerationForFriction(0.84)));
|
||||
return math.log(_inflexion * velocity.abs() / (friction * _decelerationForFriction(0.84)));
|
||||
}
|
||||
|
||||
// See getSplineFlingDuration().
|
||||
|
@ -676,8 +676,10 @@ class ScrollableState extends State<Scrollable> with TickerProviderStateMixin, R
|
||||
// Returns the offset that should result from applying [event] to the current
|
||||
// position, taking min/max scroll extent into account.
|
||||
double _targetScrollOffsetForPointerScroll(double delta) {
|
||||
return math.min(math.max(position.pixels + delta, position.minScrollExtent),
|
||||
position.maxScrollExtent);
|
||||
return math.min(
|
||||
math.max(position.pixels + delta, position.minScrollExtent),
|
||||
position.maxScrollExtent,
|
||||
);
|
||||
}
|
||||
|
||||
// Returns the delta that should result from applying [event] with axis and
|
||||
|
@ -347,11 +347,13 @@ class ShortcutManager extends ChangeNotifier with Diagnosticable {
|
||||
return KeyEventResult.ignored;
|
||||
}
|
||||
assert(context != null);
|
||||
assert(keysPressed != null || RawKeyboard.instance.keysPressed.isNotEmpty,
|
||||
assert(
|
||||
keysPressed != null || RawKeyboard.instance.keysPressed.isNotEmpty,
|
||||
'Received a key down event when no keys are in keysPressed. '
|
||||
"This state can occur if the key event being sent doesn't properly "
|
||||
'set its modifier flags. This was the event: $event and its data: '
|
||||
'${event.data}');
|
||||
'${event.data}',
|
||||
);
|
||||
final Intent? matchedIntent = _find(keysPressed: keysPressed);
|
||||
if (matchedIntent != null) {
|
||||
final BuildContext primaryContext = primaryFocus!.context!;
|
||||
@ -622,13 +624,15 @@ class Shortcuts extends StatefulWidget {
|
||||
final _ShortcutsMarker? inherited = context.dependOnInheritedWidgetOfExactType<_ShortcutsMarker>();
|
||||
assert(() {
|
||||
if (inherited == null) {
|
||||
throw FlutterError('Unable to find a $Shortcuts widget in the context.\n'
|
||||
'$Shortcuts.of() was called with a context that does not contain a '
|
||||
'$Shortcuts widget.\n'
|
||||
'No $Shortcuts ancestor could be found starting from the context that was '
|
||||
'passed to $Shortcuts.of().\n'
|
||||
'The context used was:\n'
|
||||
' $context');
|
||||
throw FlutterError(
|
||||
'Unable to find a $Shortcuts widget in the context.\n'
|
||||
'$Shortcuts.of() was called with a context that does not contain a '
|
||||
'$Shortcuts widget.\n'
|
||||
'No $Shortcuts ancestor could be found starting from the context that was '
|
||||
'passed to $Shortcuts.of().\n'
|
||||
'The context used was:\n'
|
||||
' $context',
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}());
|
||||
|
@ -620,8 +620,14 @@ class _RenderSingleChildViewport extends RenderBox with RenderObjectWithChildMix
|
||||
}
|
||||
|
||||
if (_shouldClipAtPaintOffset(paintOffset) && clipBehavior != Clip.none) {
|
||||
_clipRectLayer = context.pushClipRect(needsCompositing, offset, Offset.zero & size, paintContents,
|
||||
clipBehavior: clipBehavior, oldLayer: _clipRectLayer);
|
||||
_clipRectLayer = context.pushClipRect(
|
||||
needsCompositing,
|
||||
offset,
|
||||
Offset.zero & size,
|
||||
paintContents,
|
||||
clipBehavior: clipBehavior,
|
||||
oldLayer: _clipRectLayer,
|
||||
);
|
||||
} else {
|
||||
_clipRectLayer = null;
|
||||
paintContents(context, offset);
|
||||
|
@ -340,10 +340,12 @@ class TextSelectionOverlay {
|
||||
_handlesVisible = handlesVisible,
|
||||
_value = value {
|
||||
final OverlayState? overlay = Overlay.of(context, rootOverlay: true);
|
||||
assert(overlay != null,
|
||||
assert(
|
||||
overlay != null,
|
||||
'No Overlay widget exists above $context.\n'
|
||||
'Usually the Navigator created by WidgetsApp provides the overlay. Perhaps your '
|
||||
'app content was created above the Navigator with the WidgetsApp builder parameter.');
|
||||
'app content was created above the Navigator with the WidgetsApp builder parameter.',
|
||||
);
|
||||
_toolbarController = AnimationController(duration: fadeDuration, vsync: overlay!);
|
||||
}
|
||||
|
||||
|
@ -1544,8 +1544,9 @@ mixin WidgetInspectorService {
|
||||
|
||||
List<DiagnosticsNode> _truncateNodes(Iterable<DiagnosticsNode> nodes, int maxDescendentsTruncatableNode) {
|
||||
if (nodes.every((DiagnosticsNode node) => node.value is Element) && isWidgetCreationTracked()) {
|
||||
final List<DiagnosticsNode> localNodes = nodes.where((DiagnosticsNode node) =>
|
||||
_isValueCreatedByLocalProject(node.value)).toList();
|
||||
final List<DiagnosticsNode> localNodes = nodes
|
||||
.where((DiagnosticsNode node) => _isValueCreatedByLocalProject(node.value))
|
||||
.toList();
|
||||
if (localNodes.isNotEmpty) {
|
||||
return localNodes;
|
||||
}
|
||||
|
@ -75,11 +75,13 @@ class WidgetSpan extends PlaceholderSpan {
|
||||
TextBaseline? baseline,
|
||||
TextStyle? style,
|
||||
}) : assert(child != null),
|
||||
assert(baseline != null || !(
|
||||
identical(alignment, ui.PlaceholderAlignment.aboveBaseline) ||
|
||||
identical(alignment, ui.PlaceholderAlignment.belowBaseline) ||
|
||||
identical(alignment, ui.PlaceholderAlignment.baseline)
|
||||
)),
|
||||
assert(
|
||||
baseline != null || !(
|
||||
identical(alignment, ui.PlaceholderAlignment.aboveBaseline) ||
|
||||
identical(alignment, ui.PlaceholderAlignment.belowBaseline) ||
|
||||
identical(alignment, ui.PlaceholderAlignment.baseline)
|
||||
),
|
||||
),
|
||||
super(
|
||||
alignment: alignment,
|
||||
baseline: baseline,
|
||||
|
Loading…
x
Reference in New Issue
Block a user