mirror of
https://github.com/flutter/flutter
synced 2024-10-13 19:52:53 +00:00
Final definite assignment (#67682)
This commit is contained in:
parent
1a9d635f64
commit
eefcff900c
|
@ -191,22 +191,15 @@ abstract class Animation<T> extends Listenable implements ValueListenable<T> {
|
|||
/// * "⏮": [AnimationStatus.dismissed] ([value] == 0.0)
|
||||
String toStringDetails() {
|
||||
assert(status != null);
|
||||
String icon;
|
||||
switch (status) {
|
||||
case AnimationStatus.forward:
|
||||
icon = '\u25B6'; // >
|
||||
break;
|
||||
return '\u25B6'; // >
|
||||
case AnimationStatus.reverse:
|
||||
icon = '\u25C0'; // <
|
||||
break;
|
||||
return '\u25C0'; // <
|
||||
case AnimationStatus.completed:
|
||||
icon = '\u23ED'; // >>|
|
||||
break;
|
||||
return '\u23ED'; // >>|
|
||||
case AnimationStatus.dismissed:
|
||||
icon = '\u23EE'; // |<<
|
||||
break;
|
||||
return '\u23EE'; // |<<
|
||||
}
|
||||
assert(icon != null);
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -738,9 +738,9 @@ class CatmullRomSpline extends Curve2D {
|
|||
Offset transformInternal(double t) {
|
||||
_initializeIfNeeded();
|
||||
final double length = _cubicSegments.length.toDouble();
|
||||
double position;
|
||||
double localT;
|
||||
int index;
|
||||
final double position;
|
||||
final double localT;
|
||||
final int index;
|
||||
if (t < 1.0) {
|
||||
position = t * length;
|
||||
localT = position % 1.0;
|
||||
|
|
|
@ -275,7 +275,7 @@ class CupertinoActionSheet extends StatelessWidget {
|
|||
];
|
||||
|
||||
final Orientation orientation = MediaQuery.of(context)!.orientation;
|
||||
double actionSheetWidth;
|
||||
final double actionSheetWidth;
|
||||
if (orientation == Orientation.portrait) {
|
||||
actionSheetWidth = MediaQuery.of(context)!.size.width - (_kEdgeHorizontalPadding * 2);
|
||||
} else {
|
||||
|
|
|
@ -956,7 +956,7 @@ class CupertinoDynamicColor extends Color with Diagnosticable {
|
|||
? CupertinoUserInterfaceLevel.of(context, nullOk: nullOk) ?? CupertinoUserInterfaceLevelData.base
|
||||
: CupertinoUserInterfaceLevelData.base;
|
||||
|
||||
Color resolved;
|
||||
final Color resolved;
|
||||
switch (brightness) {
|
||||
case Brightness.light:
|
||||
switch (level) {
|
||||
|
|
|
@ -726,8 +726,8 @@ class _RenderCupertinoDialog extends RenderBox {
|
|||
final double maxContentHeight = contentSection!.getMaxIntrinsicHeight(_dialogWidth);
|
||||
final double maxActionsHeight = actionsSection!.getMaxIntrinsicHeight(_dialogWidth);
|
||||
|
||||
Size contentSize;
|
||||
Size actionsSize;
|
||||
final Size contentSize;
|
||||
final Size actionsSize;
|
||||
if (maxContentHeight + dividerThickness + maxActionsHeight > constraints.maxHeight) {
|
||||
// There isn't enough room for everything. Following iOS's accessibility dialog
|
||||
// layout policy, first we allow the actions to take up to 50% of the dialog
|
||||
|
@ -1435,7 +1435,7 @@ class _RenderCupertinoDialogActions extends RenderBox
|
|||
|
||||
@override
|
||||
double computeMinIntrinsicHeight(double width) {
|
||||
double minHeight;
|
||||
final double minHeight;
|
||||
if (childCount == 0) {
|
||||
minHeight = 0.0;
|
||||
} else if (childCount == 1) {
|
||||
|
@ -1459,7 +1459,7 @@ class _RenderCupertinoDialogActions extends RenderBox
|
|||
double _computeMinIntrinsicHeightSideBySide(double width) {
|
||||
assert(childCount >= 1 && childCount <= 2);
|
||||
|
||||
double minHeight;
|
||||
final double minHeight;
|
||||
if (childCount == 1) {
|
||||
minHeight = firstChild!.getMinIntrinsicHeight(width);
|
||||
} else {
|
||||
|
@ -1484,7 +1484,7 @@ class _RenderCupertinoDialogActions extends RenderBox
|
|||
|
||||
@override
|
||||
double computeMaxIntrinsicHeight(double width) {
|
||||
double maxHeight;
|
||||
final double maxHeight;
|
||||
if (childCount == 0) {
|
||||
// No buttons. Zero height.
|
||||
maxHeight = 0.0;
|
||||
|
@ -1530,7 +1530,7 @@ class _RenderCupertinoDialogActions extends RenderBox
|
|||
}
|
||||
|
||||
bool _isSingleButtonRow(double width) {
|
||||
bool isSingleButtonRow;
|
||||
final bool isSingleButtonRow;
|
||||
if (childCount == 1) {
|
||||
isSingleButtonRow = true;
|
||||
} else if (childCount == 2) {
|
||||
|
|
|
@ -96,7 +96,7 @@ Widget _wrapWithBackground({
|
|||
if (updateSystemUiOverlay) {
|
||||
final bool isDark = backgroundColor.computeLuminance() < 0.179;
|
||||
final Brightness newBrightness = brightness ?? (isDark ? Brightness.dark : Brightness.light);
|
||||
SystemUiOverlayStyle overlayStyle;
|
||||
final SystemUiOverlayStyle overlayStyle;
|
||||
switch (newBrightness) {
|
||||
case Brightness.dark:
|
||||
overlayStyle = SystemUiOverlayStyle.light;
|
||||
|
|
|
@ -236,7 +236,7 @@ class _CupertinoPickerState extends State<CupertinoPicker> {
|
|||
void _handleSelectedItemChanged(int index) {
|
||||
// Only the haptic engine hardware on iOS devices would produce the
|
||||
// intended effects.
|
||||
bool hasSuitableHapticHardware;
|
||||
final bool hasSuitableHapticHardware;
|
||||
switch (defaultTargetPlatform) {
|
||||
case TargetPlatform.iOS:
|
||||
hasSuitableHapticHardware = true;
|
||||
|
|
|
@ -756,7 +756,7 @@ class _CupertinoBackGestureController<T> {
|
|||
// This curve has been determined through rigorously eyeballing native iOS
|
||||
// animations.
|
||||
const Curve animationCurve = Curves.fastLinearToSlowEaseIn;
|
||||
bool animateForward;
|
||||
final bool animateForward;
|
||||
|
||||
// If the user releases the page before mid screen with sufficient velocity,
|
||||
// or after mid screen, we should animate the page out. Otherwise, the page
|
||||
|
@ -911,7 +911,7 @@ class _CupertinoEdgeShadowPainter extends BoxPainter {
|
|||
// its parent box one box width on the start side of the box.
|
||||
final TextDirection? textDirection = configuration.textDirection;
|
||||
assert(textDirection != null);
|
||||
double deltaX;
|
||||
final double deltaX;
|
||||
switch (textDirection!) {
|
||||
case TextDirection.rtl:
|
||||
deltaX = configuration.size!.width;
|
||||
|
|
|
@ -611,7 +611,7 @@ class _RenderSegmentedControl<T> extends RenderBox
|
|||
final Offset childOffset = Offset(start, 0.0);
|
||||
childParentData.offset = childOffset;
|
||||
final Rect childRect = Rect.fromLTWH(start, 0.0, child.size.width, child.size.height);
|
||||
RRect rChildRect;
|
||||
final RRect rChildRect;
|
||||
if (child == leftChild) {
|
||||
rChildRect = RRect.fromRectAndCorners(childRect, topLeft: const Radius.circular(3.0),
|
||||
bottomLeft: const Radius.circular(3.0));
|
||||
|
|
|
@ -439,7 +439,7 @@ class _RenderCupertinoSlider extends RenderConstrainedBox {
|
|||
double get _trackLeft => _kPadding;
|
||||
double get _trackRight => size.width - _kPadding;
|
||||
double get _thumbCenter {
|
||||
double visualPosition;
|
||||
final double visualPosition;
|
||||
switch (textDirection) {
|
||||
case TextDirection.rtl:
|
||||
visualPosition = 1.0 - _value;
|
||||
|
@ -504,9 +504,9 @@ class _RenderCupertinoSlider extends RenderConstrainedBox {
|
|||
|
||||
@override
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
double visualPosition;
|
||||
Color leftColor;
|
||||
Color rightColor;
|
||||
final double visualPosition;
|
||||
final Color leftColor;
|
||||
final Color rightColor;
|
||||
switch (textDirection) {
|
||||
case TextDirection.rtl:
|
||||
visualPosition = 1.0 - _position.value;
|
||||
|
|
|
@ -483,7 +483,7 @@ class _RenderCupertinoSwitch extends RenderConstrainedBox {
|
|||
final double currentValue = _state.position.value;
|
||||
final double currentReactionValue = _state._reaction.value;
|
||||
|
||||
double visualPosition;
|
||||
final double visualPosition;
|
||||
switch (textDirection) {
|
||||
case TextDirection.rtl:
|
||||
visualPosition = 1.0 - currentValue;
|
||||
|
|
|
@ -629,7 +629,7 @@ class FlutterErrorDetails with Diagnosticable {
|
|||
} else if (exception is num) {
|
||||
properties.add(ErrorDescription('The number $exception was $verb.'));
|
||||
} else {
|
||||
DiagnosticsNode errorName;
|
||||
final DiagnosticsNode errorName;
|
||||
if (exception is AssertionError) {
|
||||
errorName = ErrorDescription('assertion');
|
||||
} else if (exception is String) {
|
||||
|
|
|
@ -323,7 +323,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
|
|||
final OffsetPair delta = _pendingDragOffset;
|
||||
final Duration timestamp = _lastPendingEventTimestamp!;
|
||||
final Matrix4? transform = _lastTransform;
|
||||
Offset localUpdateDelta;
|
||||
final Offset localUpdateDelta;
|
||||
switch (dragStartBehavior) {
|
||||
case DragStartBehavior.start:
|
||||
_initialPosition = _initialPosition + delta;
|
||||
|
@ -442,8 +442,8 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
|
|||
final VelocityTracker tracker = _velocityTrackers[pointer]!;
|
||||
assert(tracker != null);
|
||||
|
||||
DragEndDetails details;
|
||||
String Function() debugReport;
|
||||
final DragEndDetails details;
|
||||
final String Function() debugReport;
|
||||
|
||||
final VelocityEstimate? estimate = tracker.getVelocityEstimate();
|
||||
if (estimate != null && isFlingGesture(estimate, tracker.kind)) {
|
||||
|
|
|
@ -907,7 +907,7 @@ class _PackageLicensePageState extends State<_PackageLicensePage> {
|
|||
),
|
||||
];
|
||||
|
||||
Widget page;
|
||||
final Widget page;
|
||||
if (widget.scrollController == null) {
|
||||
page = Scaffold(
|
||||
appBar: AppBar(
|
||||
|
|
|
@ -381,7 +381,7 @@ class _BottomNavigationTile extends StatelessWidget {
|
|||
// need to divide the changes in flex allotment into smaller pieces to
|
||||
// produce smooth animation. We do this by multiplying the flex value
|
||||
// (which is an integer) by a large number.
|
||||
int size;
|
||||
final int size;
|
||||
|
||||
final BottomNavigationBarThemeData bottomTheme = BottomNavigationBarTheme.of(context);
|
||||
|
||||
|
@ -418,8 +418,8 @@ class _BottomNavigationTile extends StatelessWidget {
|
|||
// | text
|
||||
// | <-- Padding equal to 1/2 text height + 1/2 unselectedIconDiff.
|
||||
// =======
|
||||
double bottomPadding;
|
||||
double topPadding;
|
||||
final double bottomPadding;
|
||||
final double topPadding;
|
||||
if (showSelectedLabels! && !showUnselectedLabels!) {
|
||||
bottomPadding = Tween<double>(
|
||||
begin: selectedIconDiff / 2.0,
|
||||
|
@ -840,7 +840,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
|
|||
widget.unselectedFontSize,
|
||||
);
|
||||
|
||||
Color themeColor;
|
||||
final Color themeColor;
|
||||
switch (themeData.brightness) {
|
||||
case Brightness.light:
|
||||
themeColor = themeData.primaryColor;
|
||||
|
@ -850,7 +850,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
|
|||
break;
|
||||
}
|
||||
|
||||
ColorTween colorTween;
|
||||
final ColorTween colorTween;
|
||||
switch (_effectiveType) {
|
||||
case BottomNavigationBarType.fixed:
|
||||
colorTween = ColorTween(
|
||||
|
@ -1051,7 +1051,7 @@ class _RadialPainter extends CustomPainter {
|
|||
final Paint paint = Paint()..color = circle.color;
|
||||
final Rect rect = Rect.fromLTWH(0.0, 0.0, size.width, size.height);
|
||||
canvas.clipRect(rect);
|
||||
double leftFraction;
|
||||
final double leftFraction;
|
||||
switch (textDirection) {
|
||||
case TextDirection.rtl:
|
||||
leftFraction = 1.0 - circle.horizontalLeadingOffset;
|
||||
|
|
|
@ -451,7 +451,7 @@ class _RawMaterialButtonState extends State<RawMaterialButton> {
|
|||
),
|
||||
),
|
||||
);
|
||||
Size minSize;
|
||||
final Size minSize;
|
||||
switch (widget.materialTapTargetSize) {
|
||||
case MaterialTapTargetSize.padded:
|
||||
minSize = Size(
|
||||
|
|
|
@ -371,7 +371,7 @@ class _ButtonStyleState extends State<ButtonStyleButton> with TickerProviderStat
|
|||
),
|
||||
);
|
||||
|
||||
Size minSize;
|
||||
final Size minSize;
|
||||
switch (resolvedTapTargetSize!) {
|
||||
case MaterialTapTargetSize.padded:
|
||||
minSize = Size(
|
||||
|
|
|
@ -1924,7 +1924,7 @@ class _RawChipState extends State<RawChip> with TickerProviderStateMixin<RawChip
|
|||
),
|
||||
),
|
||||
);
|
||||
BoxConstraints constraints;
|
||||
final BoxConstraints constraints;
|
||||
final Offset densityAdjustment = (widget.visualDensity ?? theme.visualDensity).baseSizeAdjustment;
|
||||
switch (widget.materialTapTargetSize ?? theme.materialTapTargetSize) {
|
||||
case MaterialTapTargetSize.padded:
|
||||
|
@ -2570,16 +2570,12 @@ class _RenderChip extends RenderBox {
|
|||
|
||||
Offset centerLayout(Size boxSize, double x) {
|
||||
assert(contentSize >= boxSize.height);
|
||||
Offset boxOffset;
|
||||
switch (textDirection!) {
|
||||
case TextDirection.rtl:
|
||||
boxOffset = Offset(x - boxSize.width, (contentSize - boxSize.height + densityAdjustment.dy) / 2.0);
|
||||
break;
|
||||
return Offset(x - boxSize.width, (contentSize - boxSize.height + densityAdjustment.dy) / 2.0);
|
||||
case TextDirection.ltr:
|
||||
boxOffset = Offset(x, (contentSize - boxSize.height + densityAdjustment.dy) / 2.0);
|
||||
break;
|
||||
return Offset(x, (contentSize - boxSize.height + densityAdjustment.dy) / 2.0);
|
||||
}
|
||||
return boxOffset;
|
||||
}
|
||||
|
||||
// These are the offsets to the upper left corners of the boxes (including
|
||||
|
@ -2687,7 +2683,7 @@ class _RenderChip extends RenderBox {
|
|||
if (enableAnimation == null || enableAnimation.isCompleted) {
|
||||
return Colors.white;
|
||||
}
|
||||
ColorTween enableTween;
|
||||
final ColorTween enableTween;
|
||||
switch (theme.brightness) {
|
||||
case Brightness.light:
|
||||
enableTween = ColorTween(
|
||||
|
|
|
@ -954,7 +954,7 @@ class DataTable extends StatelessWidget {
|
|||
for (int dataColumnIndex = 0; dataColumnIndex < columns.length; dataColumnIndex += 1) {
|
||||
final DataColumn column = columns[dataColumnIndex];
|
||||
|
||||
double paddingStart;
|
||||
final double paddingStart;
|
||||
if (dataColumnIndex == 0 && displayCheckboxColumn) {
|
||||
paddingStart = effectiveHorizontalMargin / 2.0;
|
||||
} else if (dataColumnIndex == 0 && !displayCheckboxColumn) {
|
||||
|
@ -963,7 +963,7 @@ class DataTable extends StatelessWidget {
|
|||
paddingStart = effectiveColumnSpacing / 2.0;
|
||||
}
|
||||
|
||||
double paddingEnd;
|
||||
final double paddingEnd;
|
||||
if (dataColumnIndex == columns.length - 1) {
|
||||
paddingEnd = effectiveHorizontalMargin;
|
||||
} else {
|
||||
|
|
|
@ -534,7 +534,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
|
|||
return const SizedBox.shrink();
|
||||
}
|
||||
} else {
|
||||
bool platformHasBackButton;
|
||||
final bool platformHasBackButton;
|
||||
switch (Theme.of(context)!.platform) {
|
||||
case TargetPlatform.android:
|
||||
platformHasBackButton = true;
|
||||
|
|
|
@ -126,7 +126,7 @@ class _DropdownMenuItemButton<T> extends StatefulWidget {
|
|||
|
||||
class _DropdownMenuItemButtonState<T> extends State<_DropdownMenuItemButton<T>> {
|
||||
void _handleFocusChange(bool focused) {
|
||||
bool inTraditionalMode;
|
||||
final bool inTraditionalMode;
|
||||
switch (FocusManager.instance.highlightMode) {
|
||||
case FocusHighlightMode.touch:
|
||||
inTraditionalMode = false;
|
||||
|
@ -166,7 +166,7 @@ class _DropdownMenuItemButtonState<T> extends State<_DropdownMenuItemButton<T>>
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
CurvedAnimation opacity;
|
||||
final CurvedAnimation opacity;
|
||||
final double unit = 0.5 / (widget.route.items.length + 1.5);
|
||||
if (widget.itemIndex == widget.route.selectedIndex) {
|
||||
opacity = CurvedAnimation(parent: widget.route.animation!, curve: const Threshold(0.0));
|
||||
|
@ -349,7 +349,7 @@ class _DropdownMenuRouteLayout<T> extends SingleChildLayoutDelegate {
|
|||
return true;
|
||||
}());
|
||||
assert(textDirection != null);
|
||||
double left;
|
||||
final double left;
|
||||
switch (textDirection!) {
|
||||
case TextDirection.rtl:
|
||||
left = buttonRect.right.clamp(0.0, size.width) - childSize.width;
|
||||
|
@ -1337,7 +1337,7 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
|
|||
// If value is null (then _selectedIndex is null) or if disabled then we
|
||||
// display the hint or nothing at all.
|
||||
final int? index = _enabled ? (_selectedIndex ?? hintIndex) : hintIndex;
|
||||
Widget innerItemsWidget;
|
||||
final Widget innerItemsWidget;
|
||||
if (items.isEmpty) {
|
||||
innerItemsWidget = Container();
|
||||
} else {
|
||||
|
|
|
@ -926,7 +926,7 @@ class _InkResponseState extends State<_InkResponseStateWidget>
|
|||
}
|
||||
|
||||
void _updateFocusHighlights() {
|
||||
bool showFocus;
|
||||
final bool showFocus;
|
||||
switch (FocusManager.instance.highlightMode) {
|
||||
case FocusHighlightMode.touch:
|
||||
showFocus = false;
|
||||
|
@ -959,7 +959,7 @@ class _InkResponseState extends State<_InkResponseStateWidget>
|
|||
void _startSplash({TapDownDetails? details, BuildContext? context}) {
|
||||
assert(details != null || context != null);
|
||||
|
||||
Offset globalPosition;
|
||||
final Offset globalPosition;
|
||||
if (context != null) {
|
||||
final RenderBox referenceBox = context.findRenderObject()! as RenderBox;
|
||||
assert(referenceBox.hasSize, 'InkResponse must be done with layout before starting a splash.');
|
||||
|
|
|
@ -1290,7 +1290,7 @@ class _RenderDecoration extends RenderBox {
|
|||
width: overallWidth - _boxSize(icon).width,
|
||||
);
|
||||
container!.layout(containerConstraints, parentUsesSize: true);
|
||||
double x;
|
||||
final double x;
|
||||
switch (textDirection) {
|
||||
case TextDirection.rtl:
|
||||
x = 0.0;
|
||||
|
@ -1321,7 +1321,7 @@ class _RenderDecoration extends RenderBox {
|
|||
baseline = _isOutlineAligned ? layout.outlineBaseline : layout.inputBaseline;
|
||||
|
||||
if (icon != null) {
|
||||
double x;
|
||||
final double x;
|
||||
switch (textDirection) {
|
||||
case TextDirection.rtl:
|
||||
x = overallWidth - icon!.size.width;
|
||||
|
@ -1461,7 +1461,7 @@ class _RenderDecoration extends RenderBox {
|
|||
? isOutlineBorder ? (-labelHeight * _kFinalLabelScale) / 2.0 + borderWeight / 2.0 : contentPadding.top
|
||||
: isOutlineBorder ? -labelHeight * 0.25 : contentPadding.top;
|
||||
final double scale = lerpDouble(1.0, _kFinalLabelScale, t)!;
|
||||
double dx;
|
||||
final double dx;
|
||||
switch (textDirection) {
|
||||
case TextDirection.rtl:
|
||||
dx = labelOffset.dx + label!.size.width * (1.0 - scale); // origin is on the right
|
||||
|
@ -2116,7 +2116,7 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
|
|||
return decoration!.border!;
|
||||
}
|
||||
|
||||
Color borderColor;
|
||||
final Color borderColor;
|
||||
if (decoration!.enabled || isFocused) {
|
||||
borderColor = decoration!.errorText == null
|
||||
? _getDefaultBorderColor(themeData)
|
||||
|
@ -2127,7 +2127,7 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
|
|||
: themeData.disabledColor;
|
||||
}
|
||||
|
||||
double borderWeight;
|
||||
final double borderWeight;
|
||||
if (decoration!.isCollapsed || decoration?.border == InputBorder.none || !decoration!.enabled)
|
||||
borderWeight = 0.0;
|
||||
else
|
||||
|
@ -2310,8 +2310,8 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
|
|||
final TextDirection textDirection = Directionality.of(context)!;
|
||||
final EdgeInsets? decorationContentPadding = decoration!.contentPadding?.resolve(textDirection);
|
||||
|
||||
EdgeInsets contentPadding;
|
||||
double floatingLabelHeight;
|
||||
final EdgeInsets contentPadding;
|
||||
final double floatingLabelHeight;
|
||||
if (decoration!.isCollapsed) {
|
||||
floatingLabelHeight = 0.0;
|
||||
contentPadding = decorationContentPadding ?? EdgeInsets.zero;
|
||||
|
|
|
@ -976,7 +976,7 @@ class ListTile extends StatelessWidget {
|
|||
}
|
||||
|
||||
TextStyle _titleTextStyle(ThemeData theme, ListTileTheme? tileTheme) {
|
||||
TextStyle style;
|
||||
final TextStyle style;
|
||||
if (tileTheme != null) {
|
||||
switch (tileTheme.style) {
|
||||
case ListTileStyle.drawer:
|
||||
|
@ -1646,8 +1646,8 @@ class _RenderListTile extends RenderBox {
|
|||
// - For smaller tiles, trailing should always be centered. Leading can be
|
||||
// centered or closer to the top. It should never be further than 16dp
|
||||
// to the top.
|
||||
double leadingY;
|
||||
double trailingY;
|
||||
final double leadingY;
|
||||
final double trailingY;
|
||||
if (tileHeight > 72.0) {
|
||||
leadingY = 16.0;
|
||||
trailingY = 16.0;
|
||||
|
|
|
@ -562,13 +562,13 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
|
|||
final bool hasTopDivider = _willNeedDivider(i - 1);
|
||||
final bool hasBottomDivider = _willNeedDivider(i + 1);
|
||||
|
||||
Border border;
|
||||
final BorderSide divider = Divider.createBorderSide(
|
||||
context,
|
||||
width: 0.5, // TODO(ianh): This probably looks terrible when the dpr isn't a power of two.
|
||||
color: widget.dividerColor,
|
||||
);
|
||||
|
||||
final Border border;
|
||||
if (i == 0) {
|
||||
border = Border(
|
||||
bottom: hasBottomDivider ? divider : BorderSide.none
|
||||
|
@ -584,8 +584,6 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
|
|||
);
|
||||
}
|
||||
|
||||
assert(border != null);
|
||||
|
||||
child = AnimatedContainer(
|
||||
key: _MergeableMaterialSliceKey(_children[i].key),
|
||||
decoration: BoxDecoration(border: border),
|
||||
|
|
|
@ -622,7 +622,7 @@ class _RailDestination extends StatelessWidget {
|
|||
style: labelTextStyle,
|
||||
child: label,
|
||||
);
|
||||
Widget content;
|
||||
final Widget content;
|
||||
switch (labelType) {
|
||||
case NavigationRailLabelType.none:
|
||||
final Widget iconPart = SizedBox(
|
||||
|
|
|
@ -1155,7 +1155,7 @@ class _YearPickerState extends State<_YearPicker> {
|
|||
const double decorationHeight = 36.0;
|
||||
const double decorationWidth = 72.0;
|
||||
|
||||
Color textColor;
|
||||
final Color textColor;
|
||||
if (isSelected) {
|
||||
textColor = colorScheme.onPrimary;
|
||||
} else if (isDisabled) {
|
||||
|
|
|
@ -393,9 +393,9 @@ class _DatePickerDialogState extends State<_DatePickerDialog> {
|
|||
),
|
||||
);
|
||||
|
||||
Widget picker;
|
||||
IconData entryModeIcon;
|
||||
String entryModeTooltip;
|
||||
final Widget picker;
|
||||
final IconData entryModeIcon;
|
||||
final String entryModeTooltip;
|
||||
switch (_entryMode) {
|
||||
case DatePickerEntryMode.calendar:
|
||||
picker = CalendarDatePicker(
|
||||
|
|
|
@ -340,11 +340,11 @@ class _DateRangePickerDialogState extends State<_DateRangePickerDialog> {
|
|||
final double textScaleFactor = math.min(mediaQuery.textScaleFactor, 1.3);
|
||||
final MaterialLocalizations localizations = MaterialLocalizations.of(context)!;
|
||||
|
||||
Widget contents;
|
||||
Size size;
|
||||
final Widget contents;
|
||||
final Size size;
|
||||
ShapeBorder? shape;
|
||||
double elevation;
|
||||
EdgeInsets insetPadding;
|
||||
final double elevation;
|
||||
final EdgeInsets insetPadding;
|
||||
switch (_entryMode) {
|
||||
case DatePickerEntryMode.calendar:
|
||||
contents = _CalendarRangePickerDialog(
|
||||
|
|
|
@ -167,7 +167,7 @@ class _LinearProgressIndicatorPainter extends CustomPainter {
|
|||
if (width <= 0.0)
|
||||
return;
|
||||
|
||||
double left;
|
||||
final double left;
|
||||
switch (textDirection) {
|
||||
case TextDirection.rtl:
|
||||
left = size.width - width - x;
|
||||
|
|
|
@ -542,8 +542,8 @@ class _RangeSliderState extends State<RangeSlider> with TickerProviderStateMixin
|
|||
// thumb selection is determined by the direction of the dx. The left thumb
|
||||
// is chosen for negative dx, and the right thumb is chosen for positive dx.
|
||||
if (inStartTouchTarget && inEndTouchTarget) {
|
||||
bool towardsStart;
|
||||
bool towardsEnd;
|
||||
final bool towardsStart;
|
||||
final bool towardsEnd;
|
||||
switch (textDirection) {
|
||||
case TextDirection.ltr:
|
||||
towardsStart = dx < 0;
|
||||
|
@ -599,7 +599,7 @@ class _RangeSliderState extends State<RangeSlider> with TickerProviderStateMixin
|
|||
// RectangularSliderValueIndicatorShape is used. In all other cases, the
|
||||
// value indicator is assumed to be the same as the active color.
|
||||
final RangeSliderValueIndicatorShape valueIndicatorShape = sliderTheme.rangeValueIndicatorShape ?? _defaultValueIndicatorShape;
|
||||
Color valueIndicatorColor;
|
||||
final Color valueIndicatorColor;
|
||||
if (valueIndicatorShape is RectangularRangeSliderValueIndicatorShape) {
|
||||
valueIndicatorColor = sliderTheme.valueIndicatorColor ?? Color.alphaBlend(theme.colorScheme.onSurface.withOpacity(0.60), theme.colorScheme.surface.withOpacity(0.90));
|
||||
} else {
|
||||
|
@ -1030,8 +1030,8 @@ class _RenderRangeSlider extends RenderBox with RelayoutWhenSystemFontsChangeMix
|
|||
if (labels == null)
|
||||
return;
|
||||
|
||||
String text;
|
||||
TextPainter labelPainter;
|
||||
final String text;
|
||||
final TextPainter labelPainter;
|
||||
switch (thumb) {
|
||||
case Thumb.start:
|
||||
text = labels!.start;
|
||||
|
@ -1280,8 +1280,8 @@ class _RenderRangeSlider extends RenderBox with RelayoutWhenSystemFontsChangeMix
|
|||
// The visual position is the position of the thumb from 0 to 1 from left
|
||||
// to right. In left to right, this is the same as the value, but it is
|
||||
// reversed for right to left text.
|
||||
double startVisualPosition;
|
||||
double endVisualPosition;
|
||||
final double startVisualPosition;
|
||||
final double endVisualPosition;
|
||||
switch (textDirection) {
|
||||
case TextDirection.rtl:
|
||||
startVisualPosition = 1.0 - startValue;
|
||||
|
|
|
@ -249,7 +249,7 @@ class _ReorderableListContentState extends State<_ReorderableListContent> with T
|
|||
if (_draggingFeedbackSize == null) {
|
||||
return _defaultDropAreaExtent;
|
||||
}
|
||||
double dropAreaWithoutMargin;
|
||||
final double dropAreaWithoutMargin;
|
||||
switch (widget.scrollDirection) {
|
||||
case Axis.horizontal:
|
||||
dropAreaWithoutMargin = _draggingFeedbackSize!.width;
|
||||
|
@ -488,7 +488,7 @@ class _ReorderableListContentState extends State<_ReorderableListContent> with T
|
|||
}
|
||||
|
||||
// Determine the size of the drop area to show under the dragging widget.
|
||||
Widget spacing;
|
||||
final Widget spacing;
|
||||
switch (widget.scrollDirection) {
|
||||
case Axis.horizontal:
|
||||
spacing = SizedBox(width: _dropAreaExtent);
|
||||
|
@ -551,7 +551,7 @@ class _ReorderableListContentState extends State<_ReorderableListContent> with T
|
|||
// We use the layout builder to constrain the cross-axis size of dragging child widgets.
|
||||
return LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) {
|
||||
const Key endWidgetKey = Key('DraggableList - End Widget');
|
||||
Widget finalDropArea;
|
||||
final Widget finalDropArea;
|
||||
switch (widget.scrollDirection) {
|
||||
case Axis.horizontal:
|
||||
finalDropArea = SizedBox(
|
||||
|
|
|
@ -969,7 +969,7 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
|
|||
);
|
||||
}
|
||||
|
||||
double snackBarYOffsetBase;
|
||||
final double snackBarYOffsetBase;
|
||||
if (floatingActionButtonRect.size != Size.zero && isSnackBarFloating) {
|
||||
snackBarYOffsetBase = floatingActionButtonRect.top;
|
||||
} else {
|
||||
|
|
|
@ -499,7 +499,7 @@ class _SearchPageState<T> extends State<_SearchPage<T>> {
|
|||
case null:
|
||||
break;
|
||||
}
|
||||
String routeName;
|
||||
final String routeName;
|
||||
switch (theme.platform) {
|
||||
case TargetPlatform.iOS:
|
||||
case TargetPlatform.macOS:
|
||||
|
|
|
@ -565,12 +565,12 @@ class _SelectableTextState extends State<SelectableText> with AutomaticKeepAlive
|
|||
final TextSelectionThemeData selectionTheme = TextSelectionTheme.of(context);
|
||||
final FocusNode focusNode = _effectiveFocusNode;
|
||||
|
||||
TextSelectionControls textSelectionControls;
|
||||
bool paintCursorAboveText;
|
||||
bool cursorOpacityAnimates;
|
||||
final TextSelectionControls textSelectionControls;
|
||||
final bool paintCursorAboveText;
|
||||
final bool cursorOpacityAnimates;
|
||||
Offset? cursorOffset;
|
||||
Color? cursorColor = widget.cursorColor;
|
||||
Color selectionColor;
|
||||
final Color selectionColor;
|
||||
Radius? cursorRadius = widget.cursorRadius;
|
||||
|
||||
switch (theme.platform) {
|
||||
|
|
|
@ -660,7 +660,7 @@ class _SliderState extends State<Slider> with TickerProviderStateMixin {
|
|||
// RectangularSliderValueIndicatorShape is used. In all other cases, the
|
||||
// value indicator is assumed to be the same as the active color.
|
||||
final SliderComponentShape valueIndicatorShape = sliderTheme.valueIndicatorShape ?? _defaultValueIndicatorShape;
|
||||
Color valueIndicatorColor;
|
||||
final Color valueIndicatorColor;
|
||||
if (valueIndicatorShape is RectangularSliderValueIndicatorShape) {
|
||||
valueIndicatorColor = sliderTheme.valueIndicatorColor ?? Color.alphaBlend(theme.colorScheme.onSurface.withOpacity(0.60), theme.colorScheme.surface.withOpacity(0.90));
|
||||
} else {
|
||||
|
@ -1343,7 +1343,7 @@ class _RenderSlider extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
|||
// The visual position is the position of the thumb from 0 to 1 from left
|
||||
// to right. In left to right, this is the same as the value, but it is
|
||||
// reversed for right to left text.
|
||||
double visualPosition;
|
||||
final double visualPosition;
|
||||
switch (textDirection) {
|
||||
case TextDirection.rtl:
|
||||
visualPosition = 1.0 - value;
|
||||
|
|
|
@ -1537,8 +1537,8 @@ class RectangularSliderTrackShape extends SliderTrackShape with BaseSliderTrackS
|
|||
final ColorTween inactiveTrackColorTween = ColorTween(begin: sliderTheme.disabledInactiveTrackColor, end: sliderTheme.inactiveTrackColor);
|
||||
final Paint activePaint = Paint()..color = activeTrackColorTween.evaluate(enableAnimation)!;
|
||||
final Paint inactivePaint = Paint()..color = inactiveTrackColorTween.evaluate(enableAnimation)!;
|
||||
Paint leftTrackPaint;
|
||||
Paint rightTrackPaint;
|
||||
final Paint leftTrackPaint;
|
||||
final Paint rightTrackPaint;
|
||||
switch (textDirection) {
|
||||
case TextDirection.ltr:
|
||||
leftTrackPaint = activePaint;
|
||||
|
@ -1634,8 +1634,8 @@ class RoundedRectSliderTrackShape extends SliderTrackShape with BaseSliderTrackS
|
|||
final ColorTween inactiveTrackColorTween = ColorTween(begin: sliderTheme.disabledInactiveTrackColor, end: sliderTheme.inactiveTrackColor);
|
||||
final Paint activePaint = Paint()..color = activeTrackColorTween.evaluate(enableAnimation)!;
|
||||
final Paint inactivePaint = Paint()..color = inactiveTrackColorTween.evaluate(enableAnimation)!;
|
||||
Paint leftTrackPaint;
|
||||
Paint rightTrackPaint;
|
||||
final Paint leftTrackPaint;
|
||||
final Paint rightTrackPaint;
|
||||
switch (textDirection) {
|
||||
case TextDirection.ltr:
|
||||
leftTrackPaint = activePaint;
|
||||
|
@ -1777,8 +1777,8 @@ class RectangularRangeSliderTrackShape extends RangeSliderTrackShape {
|
|||
final Paint activePaint = Paint()..color = activeTrackColorTween.evaluate(enableAnimation!)!;
|
||||
final Paint inactivePaint = Paint()..color = inactiveTrackColorTween.evaluate(enableAnimation)!;
|
||||
|
||||
Offset leftThumbOffset;
|
||||
Offset rightThumbOffset;
|
||||
final Offset leftThumbOffset;
|
||||
final Offset rightThumbOffset;
|
||||
switch (textDirection) {
|
||||
case TextDirection.ltr:
|
||||
leftThumbOffset = startThumbCenter;
|
||||
|
@ -1917,8 +1917,8 @@ class RoundedRectRangeSliderTrackShape extends RangeSliderTrackShape {
|
|||
final Paint inactivePaint = Paint()
|
||||
..color = inactiveTrackColorTween.evaluate(enableAnimation)!;
|
||||
|
||||
Offset leftThumbOffset;
|
||||
Offset rightThumbOffset;
|
||||
final Offset leftThumbOffset;
|
||||
final Offset rightThumbOffset;
|
||||
switch (textDirection) {
|
||||
case TextDirection.ltr:
|
||||
leftThumbOffset = startThumbCenter;
|
||||
|
@ -2144,7 +2144,7 @@ class RoundRangeSliderTickMarkShape extends RangeSliderTickMarkShape {
|
|||
assert(isEnabled != null);
|
||||
assert(textDirection != null);
|
||||
|
||||
bool isBetweenThumbs;
|
||||
final bool isBetweenThumbs;
|
||||
switch (textDirection) {
|
||||
case TextDirection.ltr:
|
||||
isBetweenThumbs = startThumbCenter.dx < center.dx && center.dx < endThumbCenter.dx;
|
||||
|
|
|
@ -537,7 +537,7 @@ class _SnackBarState extends State<SnackBar> {
|
|||
),
|
||||
);
|
||||
|
||||
Widget snackBarTransition;
|
||||
final Widget snackBarTransition;
|
||||
if (mediaQueryData.accessibleNavigation) {
|
||||
snackBarTransition = snackBar;
|
||||
} else if (isFloatingSnackBar) {
|
||||
|
|
|
@ -394,8 +394,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
|
|||
if (widget.controlsBuilder != null)
|
||||
return widget.controlsBuilder!(context, onStepContinue: widget.onStepContinue, onStepCancel: widget.onStepCancel);
|
||||
|
||||
Color cancelColor;
|
||||
|
||||
final Color cancelColor;
|
||||
switch (Theme.of(context)!.brightness) {
|
||||
case Brightness.light:
|
||||
cancelColor = Colors.black54;
|
||||
|
@ -405,8 +404,6 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
|
|||
break;
|
||||
}
|
||||
|
||||
assert(cancelColor != null);
|
||||
|
||||
final ThemeData themeData = Theme.of(context)!;
|
||||
final ColorScheme colorScheme = themeData.colorScheme;
|
||||
final MaterialLocalizations localizations = MaterialLocalizations.of(context)!;
|
||||
|
|
|
@ -306,8 +306,8 @@ class _SwitchState extends State<Switch> with TickerProviderStateMixin {
|
|||
final Color hoverColor = widget.hoverColor ?? theme.hoverColor;
|
||||
final Color focusColor = widget.focusColor ?? theme.focusColor;
|
||||
|
||||
Color inactiveThumbColor;
|
||||
Color inactiveTrackColor;
|
||||
final Color inactiveThumbColor;
|
||||
final Color inactiveTrackColor;
|
||||
if (enabled) {
|
||||
const Color black32 = Color(0x52000000); // Black with 32% opacity
|
||||
inactiveThumbColor = widget.inactiveThumbColor ?? (isDark ? Colors.grey.shade400 : Colors.grey.shade50);
|
||||
|
@ -738,7 +738,7 @@ class _RenderSwitch extends RenderToggleable {
|
|||
final bool isEnabled = onChanged != null;
|
||||
final double currentValue = position.value;
|
||||
|
||||
double visualPosition;
|
||||
final double visualPosition;
|
||||
switch (textDirection) {
|
||||
case TextDirection.rtl:
|
||||
visualPosition = 1.0 - currentValue;
|
||||
|
|
|
@ -442,7 +442,7 @@ class SwitchListTile extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget control;
|
||||
final Widget control;
|
||||
switch (_switchListTileType) {
|
||||
case _SwitchListTileType.adaptive:
|
||||
control = Switch.adaptive(
|
||||
|
|
|
@ -101,8 +101,8 @@ class Tab extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
assert(debugCheckHasMaterial(context));
|
||||
|
||||
double height;
|
||||
Widget label;
|
||||
final double height;
|
||||
final Widget label;
|
||||
if (icon == null) {
|
||||
height = _kTabHeight;
|
||||
label = _buildLabelText();
|
||||
|
@ -956,7 +956,7 @@ class _TabBarState extends State<TabBar> {
|
|||
|
||||
final double index = _controller!.index.toDouble();
|
||||
final double value = _controller!.animation!.value;
|
||||
double offset;
|
||||
final double offset;
|
||||
if (value == index - 1.0)
|
||||
offset = leadingPosition ?? middlePosition;
|
||||
else if (value == index + 1.0)
|
||||
|
@ -1462,7 +1462,7 @@ class TabPageSelector extends StatelessWidget {
|
|||
ColorTween selectedColorTween,
|
||||
ColorTween previousColorTween,
|
||||
) {
|
||||
Color background;
|
||||
final Color background;
|
||||
if (tabController.indexIsChanging) {
|
||||
// The selection's animation is animating from previousValue to value.
|
||||
final double t = 1.0 - _indexChangeProgress(tabController);
|
||||
|
|
|
@ -1092,12 +1092,12 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements
|
|||
if (widget.maxLength != null && widget.maxLengthEnforced)
|
||||
formatters.add(LengthLimitingTextInputFormatter(widget.maxLength));
|
||||
|
||||
TextSelectionControls textSelectionControls;
|
||||
bool paintCursorAboveText;
|
||||
bool cursorOpacityAnimates;
|
||||
final TextSelectionControls textSelectionControls;
|
||||
final bool paintCursorAboveText;
|
||||
final bool cursorOpacityAnimates;
|
||||
Offset? cursorOffset;
|
||||
Color? cursorColor = widget.cursorColor;
|
||||
Color selectionColor;
|
||||
final Color selectionColor;
|
||||
Color? autocorrectionTextRectColor;
|
||||
Radius? cursorRadius = widget.cursorRadius;
|
||||
|
||||
|
|
|
@ -148,9 +148,9 @@ class _TimePickerHeader extends StatelessWidget {
|
|||
use24HourDials: use24HourDials,
|
||||
);
|
||||
|
||||
EdgeInsets padding;
|
||||
final EdgeInsets padding;
|
||||
double? width;
|
||||
Widget controls;
|
||||
final Widget controls;
|
||||
|
||||
switch (orientation) {
|
||||
case Orientation.portrait:
|
||||
|
@ -603,7 +603,7 @@ class _DayPeriodControl extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
|
||||
Widget result;
|
||||
final Widget result;
|
||||
switch (orientation) {
|
||||
case Orientation.portrait:
|
||||
const double width = 52.0;
|
||||
|
@ -1090,7 +1090,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
|
|||
|
||||
void _selectHour(int hour) {
|
||||
_announceToAccessibility(context, localizations.formatDecimal(hour));
|
||||
TimeOfDay time;
|
||||
final TimeOfDay time;
|
||||
if (widget.mode == _TimePickerMode.hour && widget.use24HourDials) {
|
||||
time = TimeOfDay(hour: hour, minute: widget.selectedTime.minute);
|
||||
} else {
|
||||
|
@ -1230,7 +1230,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
|
|||
final Color secondaryLabelColor = MaterialStateProperty.resolveAs(pickerTheme.dialTextColor, <MaterialState>{MaterialState.selected}) ?? themeData.colorScheme.onPrimary;
|
||||
List<_TappableLabel> primaryLabels;
|
||||
List<_TappableLabel> secondaryLabels;
|
||||
int selectedDialValue;
|
||||
final int selectedDialValue;
|
||||
switch (widget.mode) {
|
||||
case _TimePickerMode.hour:
|
||||
if (widget.use24HourDials) {
|
||||
|
@ -1910,8 +1910,8 @@ class _TimePickerDialogState extends State<_TimePickerDialog> {
|
|||
// to 1.1 as that provides enough space to reasonably fit all the content.
|
||||
final double textScaleFactor = math.min(MediaQuery.of(context)!.textScaleFactor, 1.1);
|
||||
|
||||
double timePickerWidth;
|
||||
double timePickerHeight;
|
||||
final double timePickerWidth;
|
||||
final double timePickerHeight;
|
||||
switch (_entryMode) {
|
||||
case TimePickerEntryMode.dial:
|
||||
switch (orientation) {
|
||||
|
@ -1984,7 +1984,7 @@ class _TimePickerDialogState extends State<_TimePickerDialog> {
|
|||
],
|
||||
);
|
||||
|
||||
Widget picker;
|
||||
final Widget picker;
|
||||
switch (_entryMode) {
|
||||
case TimePickerEntryMode.dial:
|
||||
final Widget dial = Padding(
|
||||
|
|
|
@ -767,8 +767,8 @@ class _ToggleButton extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
assert(debugCheckHasMaterial(context));
|
||||
Color currentColor;
|
||||
Color currentFillColor;
|
||||
final Color currentColor;
|
||||
final Color currentFillColor;
|
||||
Color? currentFocusColor;
|
||||
Color? currentHoverColor;
|
||||
Color? currentSplashColor;
|
||||
|
@ -1053,8 +1053,8 @@ class _SelectToggleButtonRenderObject extends RenderShiftedBox {
|
|||
}
|
||||
|
||||
final double trailingBorderOffset = isLastButton ? trailingBorderSide.width : 0.0;
|
||||
double leftConstraint;
|
||||
double rightConstraint;
|
||||
final double leftConstraint;
|
||||
final double rightConstraint;
|
||||
|
||||
switch (textDirection) {
|
||||
case TextDirection.ltr:
|
||||
|
|
|
@ -370,8 +370,8 @@ class _TooltipState extends State<Tooltip> with SingleTickerProviderStateMixin {
|
|||
assert(Overlay.of(context, debugRequiredFor: widget) != null);
|
||||
final ThemeData theme = Theme.of(context)!;
|
||||
final TooltipThemeData tooltipTheme = TooltipTheme.of(context);
|
||||
TextStyle defaultTextStyle;
|
||||
BoxDecoration defaultDecoration;
|
||||
final TextStyle defaultTextStyle;
|
||||
final BoxDecoration defaultDecoration;
|
||||
if (theme.brightness == Brightness.dark) {
|
||||
defaultTextStyle = theme.textTheme.bodyText2!.copyWith(
|
||||
color: Colors.black,
|
||||
|
|
|
@ -330,7 +330,7 @@ class _FlutterLogoPainter extends BoxPainter {
|
|||
final Size canvasSize = _config.margin.deflateSize(configuration.size!);
|
||||
if (canvasSize.isEmpty)
|
||||
return;
|
||||
Size logoSize;
|
||||
final Size logoSize;
|
||||
if (_config._position > 0.0) {
|
||||
// horizontal style
|
||||
logoSize = const Size(820.0, 232.0);
|
||||
|
@ -352,7 +352,7 @@ class _FlutterLogoPainter extends BoxPainter {
|
|||
centerSquareHeight,
|
||||
);
|
||||
|
||||
Rect logoTargetSquare;
|
||||
final Rect logoTargetSquare;
|
||||
if (_config._position > 0.0) {
|
||||
// horizontal style
|
||||
logoTargetSquare = Rect.fromLTWH(rect.left, rect.top, rect.height, rect.height);
|
||||
|
|
|
@ -91,7 +91,7 @@ class ShapeDecoration extends Decoration {
|
|||
/// [RoundedRectangleBorder]; the [BoxDecoration] class cannot animate the
|
||||
/// transition from a [BoxShape.circle] to [BoxShape.rectangle]).
|
||||
factory ShapeDecoration.fromBoxDecoration(BoxDecoration source) {
|
||||
ShapeBorder shape;
|
||||
final ShapeBorder shape;
|
||||
assert(source.shape != null);
|
||||
switch (source.shape) {
|
||||
case BoxShape.circle:
|
||||
|
|
|
@ -2021,7 +2021,7 @@ abstract class RenderBox extends RenderObject {
|
|||
assert(constraints != null);
|
||||
assert(() {
|
||||
if (!hasSize) {
|
||||
DiagnosticsNode contract;
|
||||
final DiagnosticsNode contract;
|
||||
if (sizedByParent)
|
||||
contract = ErrorDescription('Because this RenderBox has sizedByParent set to true, it must set its size in performResize().');
|
||||
else
|
||||
|
|
|
@ -120,7 +120,7 @@ mixin DebugOverflowIndicatorMixin on RenderObject {
|
|||
|
||||
String _formatPixels(double value) {
|
||||
assert(value > 0.0);
|
||||
String pixels;
|
||||
final String pixels;
|
||||
if (value > 10.0) {
|
||||
pixels = value.toStringAsFixed(0);
|
||||
} else if (value > 1.0) {
|
||||
|
|
|
@ -746,7 +746,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
|||
totalFlex += flex;
|
||||
lastFlexChild = child;
|
||||
} else {
|
||||
BoxConstraints innerConstraints;
|
||||
final BoxConstraints innerConstraints;
|
||||
if (crossAxisAlignment == CrossAxisAlignment.stretch) {
|
||||
switch (_direction) {
|
||||
case Axis.horizontal:
|
||||
|
@ -798,7 +798,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
|||
break;
|
||||
}
|
||||
assert(minChildExtent != null);
|
||||
BoxConstraints innerConstraints;
|
||||
final BoxConstraints innerConstraints;
|
||||
if (crossAxisAlignment == CrossAxisAlignment.stretch) {
|
||||
switch (_direction) {
|
||||
case Axis.horizontal:
|
||||
|
@ -862,7 +862,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
|||
|
||||
// Align items along the main axis.
|
||||
final double idealSize = canFlex && mainAxisSize == MainAxisSize.max ? maxMainSize : allocatedSize;
|
||||
double actualSize;
|
||||
final double actualSize;
|
||||
switch (_direction) {
|
||||
case Axis.horizontal:
|
||||
size = constraints.constrain(Size(idealSize, crossSize));
|
||||
|
@ -917,7 +917,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
|||
child = firstChild;
|
||||
while (child != null) {
|
||||
final FlexParentData childParentData = child.parentData! as FlexParentData;
|
||||
double childCrossPosition;
|
||||
final double childCrossPosition;
|
||||
switch (_crossAxisAlignment) {
|
||||
case CrossAxisAlignment.start:
|
||||
case CrossAxisAlignment.end:
|
||||
|
@ -933,12 +933,15 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
|||
childCrossPosition = 0.0;
|
||||
break;
|
||||
case CrossAxisAlignment.baseline:
|
||||
childCrossPosition = 0.0;
|
||||
if (_direction == Axis.horizontal) {
|
||||
assert(textBaseline != null);
|
||||
final double? distance = child.getDistanceToBaseline(textBaseline!, onlyReal: true);
|
||||
if (distance != null)
|
||||
childCrossPosition = maxBaselineDistance - distance;
|
||||
else
|
||||
childCrossPosition = 0.0;
|
||||
} else {
|
||||
childCrossPosition = 0.0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1015,7 +1018,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
|||
// Simulate a child rect that overflows by the right amount. This child
|
||||
// rect is never used for drawing, just for determining the overflow
|
||||
// location and amount.
|
||||
Rect overflowChildRect;
|
||||
final Rect overflowChildRect;
|
||||
switch (_direction) {
|
||||
case Axis.horizontal:
|
||||
overflowChildRect = Rect.fromLTWH(0.0, 0.0, size.width + _overflow!, 0.0);
|
||||
|
|
|
@ -274,7 +274,7 @@ class RenderConstrainedBox extends RenderProxyBox {
|
|||
void debugPaintSize(PaintingContext context, Offset offset) {
|
||||
super.debugPaintSize(context, offset);
|
||||
assert(() {
|
||||
Paint paint;
|
||||
final Paint paint;
|
||||
if (child == null || child!.size.isEmpty) {
|
||||
paint = Paint()
|
||||
..color = const Color(0x90909090);
|
||||
|
@ -3032,7 +3032,7 @@ class RenderRepaintBoundary extends RenderProxyBox {
|
|||
properties.add(MessageProperty('usefulness ratio', 'no metrics collected yet (never painted)'));
|
||||
} else {
|
||||
final double fraction = debugAsymmetricPaintCount / (debugSymmetricPaintCount + debugAsymmetricPaintCount);
|
||||
String diagnosis;
|
||||
final String diagnosis;
|
||||
if (debugSymmetricPaintCount + debugAsymmetricPaintCount < 5) {
|
||||
diagnosis = 'insufficient data to draw conclusion (less than five repaints)';
|
||||
} else if (fraction > 0.9) {
|
||||
|
|
|
@ -406,9 +406,9 @@ class RenderPositionedBox extends RenderAligningShiftedBox {
|
|||
void debugPaintSize(PaintingContext context, Offset offset) {
|
||||
super.debugPaintSize(context, offset);
|
||||
assert(() {
|
||||
Paint paint;
|
||||
final Paint paint;
|
||||
if (child != null && !child!.size.isEmpty) {
|
||||
Path path;
|
||||
final Path path;
|
||||
paint = Paint()
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = 1.0
|
||||
|
@ -673,7 +673,7 @@ class RenderUnconstrainedBox extends RenderAligningShiftedBox with DebugOverflow
|
|||
if (child != null) {
|
||||
// Let the child lay itself out at it's "natural" size, but if
|
||||
// constrainedAxis is non-null, keep any constraints on that axis.
|
||||
BoxConstraints childConstraints;
|
||||
final BoxConstraints childConstraints;
|
||||
if (constrainedAxis != null) {
|
||||
switch (constrainedAxis!) {
|
||||
case Axis.horizontal:
|
||||
|
@ -911,7 +911,7 @@ class RenderFractionallySizedOverflowBox extends RenderAligningShiftedBox {
|
|||
|
||||
@override
|
||||
double computeMinIntrinsicWidth(double height) {
|
||||
double result;
|
||||
final double result;
|
||||
if (child == null) {
|
||||
result = super.computeMinIntrinsicWidth(height);
|
||||
} else { // the following line relies on double.infinity absorption
|
||||
|
@ -923,7 +923,7 @@ class RenderFractionallySizedOverflowBox extends RenderAligningShiftedBox {
|
|||
|
||||
@override
|
||||
double computeMaxIntrinsicWidth(double height) {
|
||||
double result;
|
||||
final double result;
|
||||
if (child == null) {
|
||||
result = super.computeMaxIntrinsicWidth(height);
|
||||
} else { // the following line relies on double.infinity absorption
|
||||
|
@ -935,7 +935,7 @@ class RenderFractionallySizedOverflowBox extends RenderAligningShiftedBox {
|
|||
|
||||
@override
|
||||
double computeMinIntrinsicHeight(double width) {
|
||||
double result;
|
||||
final double result;
|
||||
if (child == null) {
|
||||
result = super.computeMinIntrinsicHeight(width);
|
||||
} else { // the following line relies on double.infinity absorption
|
||||
|
@ -947,7 +947,7 @@ class RenderFractionallySizedOverflowBox extends RenderAligningShiftedBox {
|
|||
|
||||
@override
|
||||
double computeMaxIntrinsicHeight(double width) {
|
||||
double result;
|
||||
final double result;
|
||||
if (child == null) {
|
||||
result = super.computeMaxIntrinsicHeight(width);
|
||||
} else { // the following line relies on double.infinity absorption
|
||||
|
|
|
@ -1488,7 +1488,7 @@ abstract class RenderSliver extends RenderObject {
|
|||
return true;
|
||||
assert(p0.dx == p1.dx || p0.dy == p1.dy); // must be axis-aligned
|
||||
final double d = (p1 - p0).distance * 0.2;
|
||||
Offset temp;
|
||||
final Offset temp;
|
||||
double dx1, dx2, dy1, dy2;
|
||||
switch (direction) {
|
||||
case GrowthDirection.forward:
|
||||
|
@ -1810,7 +1810,7 @@ class RenderSliverToBoxAdapter extends RenderSliverSingleBoxAdapter {
|
|||
}
|
||||
final SliverConstraints constraints = this.constraints;
|
||||
child!.layout(constraints.asBoxConstraints(), parentUsesSize: true);
|
||||
double childExtent;
|
||||
final double childExtent;
|
||||
switch (constraints.axis) {
|
||||
case Axis.horizontal:
|
||||
childExtent = child!.size.width;
|
||||
|
|
|
@ -142,7 +142,7 @@ class RenderSliverFillRemaining extends RenderSliverSingleBoxAdapter {
|
|||
double extent = constraints.viewportMainAxisExtent - constraints.precedingScrollExtent;
|
||||
|
||||
if (child != null) {
|
||||
double childExtent;
|
||||
final double childExtent;
|
||||
switch (constraints.axis) {
|
||||
case Axis.horizontal:
|
||||
childExtent = child!.getMaxIntrinsicWidth(constraints.crossAxisExtent);
|
||||
|
@ -218,7 +218,7 @@ class RenderSliverFillRemainingAndOverscroll extends RenderSliverSingleBoxAdapte
|
|||
double maxExtent = constraints.remainingPaintExtent - math.min(constraints.overlap, 0.0);
|
||||
|
||||
if (child != null) {
|
||||
double childExtent;
|
||||
final double childExtent;
|
||||
switch (constraints.axis) {
|
||||
case Axis.horizontal:
|
||||
childExtent = child!.getMaxIntrinsicWidth(constraints.crossAxisExtent);
|
||||
|
|
|
@ -196,7 +196,7 @@ abstract class RenderSliverFixedExtentBoxAdaptor extends RenderSliverMultiBoxAda
|
|||
if (firstChild == null) {
|
||||
if (!addInitialChild(index: firstIndex, layoutOffset: indexToLayoutOffset(itemExtent, firstIndex))) {
|
||||
// There are either no children, or we are past the end of all our children.
|
||||
double max;
|
||||
final double max;
|
||||
if (firstIndex <= 0) {
|
||||
max = 0.0;
|
||||
} else {
|
||||
|
|
|
@ -300,7 +300,7 @@ class RenderSliverList extends RenderSliverMultiBoxAdaptor {
|
|||
collectGarbage(leadingGarbage, trailingGarbage);
|
||||
|
||||
assert(debugAssertChildListIsNonEmptyAndContiguous());
|
||||
double estimatedMaxScrollOffset;
|
||||
final double estimatedMaxScrollOffset;
|
||||
if (reachedEnd) {
|
||||
estimatedMaxScrollOffset = endScrollOffset;
|
||||
} else {
|
||||
|
|
|
@ -595,8 +595,8 @@ abstract class RenderSliverMultiBoxAdaptor extends RenderSliver
|
|||
return;
|
||||
// offset is to the top-left corner, regardless of our axis direction.
|
||||
// originOffset gives us the delta from the real origin to the origin in the axis direction.
|
||||
Offset mainAxisUnit, crossAxisUnit, originOffset;
|
||||
bool addExtent;
|
||||
final Offset mainAxisUnit, crossAxisUnit, originOffset;
|
||||
final bool addExtent;
|
||||
switch (applyGrowthDirectionToAxisDirection(constraints.axisDirection, constraints.growthDirection)) {
|
||||
case AxisDirection.up:
|
||||
mainAxisUnit = const Offset(0.0, -1.0);
|
||||
|
|
|
@ -284,10 +284,9 @@ abstract class RenderSliverEdgeInsetsPadding extends RenderSliver with RenderObj
|
|||
if (debugPaintSizeEnabled) {
|
||||
final Size parentSize = getAbsoluteSize();
|
||||
final Rect outerRect = offset & parentSize;
|
||||
Size childSize;
|
||||
Rect? innerRect;
|
||||
if (child != null) {
|
||||
childSize = child!.getAbsoluteSize();
|
||||
final Size childSize = child!.getAbsoluteSize();
|
||||
final SliverPhysicalParentData childParentData = child!.parentData! as SliverPhysicalParentData;
|
||||
innerRect = (offset + childParentData.paintOffset) & childSize;
|
||||
assert(innerRect.top >= outerRect.top);
|
||||
|
|
|
@ -540,7 +540,7 @@ class RenderStack extends RenderBox
|
|||
double width = constraints.minWidth;
|
||||
double height = constraints.minHeight;
|
||||
|
||||
BoxConstraints nonPositionedConstraints;
|
||||
final BoxConstraints nonPositionedConstraints;
|
||||
assert(fit != null);
|
||||
switch (fit) {
|
||||
case StackFit.loose:
|
||||
|
|
|
@ -870,7 +870,7 @@ class RenderTable extends RenderBox {
|
|||
if (totalFlex > 0.0) {
|
||||
// this can only grow the table, but it _will_ grow the table at
|
||||
// least as big as the target width.
|
||||
double targetWidth;
|
||||
final double targetWidth;
|
||||
if (maxWidthConstraint.isFinite) {
|
||||
targetWidth = maxWidthConstraint;
|
||||
} else {
|
||||
|
@ -1011,7 +1011,7 @@ class RenderTable extends RenderBox {
|
|||
}
|
||||
final List<double> widths = _computeColumnWidths(constraints);
|
||||
final List<double> positions = List<double>.filled(columns, 0.0, growable: false);
|
||||
double tableWidth;
|
||||
final double tableWidth;
|
||||
switch (textDirection) {
|
||||
case TextDirection.rtl:
|
||||
positions[columns - 1] = 0.0;
|
||||
|
|
|
@ -658,7 +658,7 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
|
|||
final Canvas canvas = context.canvas;
|
||||
RenderSliver? child = firstChild;
|
||||
while (child != null) {
|
||||
Size size;
|
||||
final Size size;
|
||||
switch (axis) {
|
||||
case Axis.vertical:
|
||||
size = Size(child.constraints.crossAxisExtent, child.geometry!.layoutExtent);
|
||||
|
@ -756,10 +756,10 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
|
|||
}
|
||||
|
||||
// `rect` in the new intermediate coordinate system.
|
||||
Rect rectLocal;
|
||||
final Rect rectLocal;
|
||||
// Our new reference frame render object's main axis extent.
|
||||
double pivotExtent;
|
||||
GrowthDirection growthDirection;
|
||||
final double pivotExtent;
|
||||
final GrowthDirection growthDirection;
|
||||
|
||||
// `leadingScrollOffset` is currently the scrollOffset of our new reference
|
||||
// frame (`pivot` or `target`), within `child`.
|
||||
|
@ -820,7 +820,7 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
|
|||
assert(child is RenderSliver);
|
||||
final RenderSliver sliver = child as RenderSliver;
|
||||
|
||||
double targetMainAxisExtent;
|
||||
final double targetMainAxisExtent;
|
||||
// The scroll offset of `rect` within `child`.
|
||||
switch (applyGrowthDirectionToAxisDirection(axisDirection, growthDirection)) {
|
||||
case AxisDirection.up:
|
||||
|
@ -882,7 +882,7 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
|
|||
break;
|
||||
}
|
||||
|
||||
double mainAxisExtent;
|
||||
final double mainAxisExtent;
|
||||
switch (axis) {
|
||||
case Axis.horizontal:
|
||||
mainAxisExtent = size.width - extentOfPinnedSlivers;
|
||||
|
@ -1173,7 +1173,7 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
|
|||
// to `trailingEdgeOffset`, the one on the right by setting it to
|
||||
// `leadingEdgeOffset`.
|
||||
|
||||
RevealedOffset targetOffset;
|
||||
final RevealedOffset targetOffset;
|
||||
if (leadingEdgeOffset.offset < trailingEdgeOffset.offset) {
|
||||
// `descendant` is too big to be visible on screen in its entirety. Let's
|
||||
// align it with the edge that requires the least amount of scrolling.
|
||||
|
@ -1453,8 +1453,8 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
|
|||
}
|
||||
assert(center!.parent == this);
|
||||
|
||||
double mainAxisExtent;
|
||||
double crossAxisExtent;
|
||||
final double mainAxisExtent;
|
||||
final double crossAxisExtent;
|
||||
switch (axis) {
|
||||
case Axis.vertical:
|
||||
mainAxisExtent = size.height;
|
||||
|
@ -1845,8 +1845,8 @@ class RenderShrinkWrappingViewport extends RenderViewportBase<SliverLogicalConta
|
|||
return;
|
||||
}
|
||||
|
||||
double mainAxisExtent;
|
||||
double crossAxisExtent;
|
||||
final double mainAxisExtent;
|
||||
final double crossAxisExtent;
|
||||
switch (axis) {
|
||||
case Axis.vertical:
|
||||
assert(constraints.hasBoundedWidth);
|
||||
|
|
|
@ -580,7 +580,7 @@ class RenderWrap extends RenderBox
|
|||
size = constraints.smallest;
|
||||
return;
|
||||
}
|
||||
BoxConstraints childConstraints;
|
||||
final BoxConstraints childConstraints;
|
||||
double mainAxisLimit = 0.0;
|
||||
bool flipMainAxis = false;
|
||||
bool flipCrossAxis = false;
|
||||
|
|
|
@ -2029,8 +2029,8 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin {
|
|||
void _addToUpdate(ui.SemanticsUpdateBuilder builder, Set<int> customSemanticsActionIdsUpdate) {
|
||||
assert(_dirty);
|
||||
final SemanticsData data = getSemanticsData();
|
||||
Int32List childrenInTraversalOrder;
|
||||
Int32List childrenInHitTestOrder;
|
||||
final Int32List childrenInTraversalOrder;
|
||||
final Int32List childrenInHitTestOrder;
|
||||
if (!hasChildren || mergeAllDescendantsIntoThisNode) {
|
||||
childrenInTraversalOrder = _kEmptyChildList;
|
||||
childrenInHitTestOrder = _kEmptyChildList;
|
||||
|
|
|
@ -567,7 +567,7 @@ class _AndroidMotionEventConverter {
|
|||
return null;
|
||||
}
|
||||
|
||||
int action;
|
||||
final int action;
|
||||
if (event is PointerDownEvent) {
|
||||
action = numPointers == 1
|
||||
? AndroidViewController.kActionDown
|
||||
|
|
|
@ -264,7 +264,7 @@ abstract class RawKeyEvent with Diagnosticable {
|
|||
/// Creates a concrete [RawKeyEvent] class from a message in the form received
|
||||
/// on the [SystemChannels.keyEvent] channel.
|
||||
factory RawKeyEvent.fromMessage(Map<String, dynamic> message) {
|
||||
RawKeyEventData data;
|
||||
final RawKeyEventData data;
|
||||
String? character;
|
||||
|
||||
final String keymap = message['keymap'] as String;
|
||||
|
|
|
@ -151,7 +151,7 @@ class RawKeyEventDataMacOs extends RawKeyEventData {
|
|||
@override
|
||||
bool isModifierPressed(ModifierKey key, {KeyboardSide side = KeyboardSide.any}) {
|
||||
final int independentModifier = modifiers & deviceIndependentMask;
|
||||
bool result;
|
||||
final bool result;
|
||||
switch (key) {
|
||||
case ModifierKey.controlModifier:
|
||||
result = _isLeftRightModifierPressed(side, independentModifier & modifierControl, modifierLeftControl, modifierRightControl);
|
||||
|
|
|
@ -122,7 +122,7 @@ class RawKeyEventDataWindows extends RawKeyEventData {
|
|||
|
||||
@override
|
||||
bool isModifierPressed(ModifierKey key, {KeyboardSide side = KeyboardSide.any}) {
|
||||
bool result;
|
||||
final bool result;
|
||||
switch (key) {
|
||||
case ModifierKey.controlModifier:
|
||||
result = _isLeftRightModifierPressed(side, modifierControl, modifierLeftControl, modifierRightControl);
|
||||
|
|
|
@ -316,12 +316,12 @@ class _AnimatedCrossFadeState extends State<AnimatedCrossFade> with TickerProvid
|
|||
const Key kSecondChildKey = ValueKey<CrossFadeState>(CrossFadeState.showSecond);
|
||||
final bool transitioningForwards = _controller!.status == AnimationStatus.completed ||
|
||||
_controller!.status == AnimationStatus.forward;
|
||||
Key topKey;
|
||||
final Key topKey;
|
||||
Widget topChild;
|
||||
Animation<double> topAnimation;
|
||||
Key bottomKey;
|
||||
final Animation<double> topAnimation;
|
||||
final Key bottomKey;
|
||||
Widget bottomChild;
|
||||
Animation<double> bottomAnimation;
|
||||
final Animation<double> bottomAnimation;
|
||||
if (transitioningForwards) {
|
||||
topKey = kSecondChildKey;
|
||||
topChild = widget.secondChild;
|
||||
|
|
|
@ -1586,7 +1586,7 @@ class _WidgetsAppState extends State<WidgetsApp> with WidgetsBindingObserver {
|
|||
return true;
|
||||
}());
|
||||
|
||||
Widget title;
|
||||
final Widget title;
|
||||
if (widget.onGenerateTitle != null) {
|
||||
title = Builder(
|
||||
// This Builder exists to provide a context below the Localizations widget.
|
||||
|
|
|
@ -2171,7 +2171,7 @@ class SizedBox extends SingleChildRenderObjectWidget {
|
|||
|
||||
@override
|
||||
String toStringShort() {
|
||||
String type;
|
||||
final String type;
|
||||
if (width == double.infinity && height == double.infinity) {
|
||||
type = '${objectRuntimeType(this, 'SizedBox')}.expand';
|
||||
} else if (width == 0.0 && height == 0.0) {
|
||||
|
@ -2185,7 +2185,7 @@ class SizedBox extends SingleChildRenderObjectWidget {
|
|||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
super.debugFillProperties(properties);
|
||||
DiagnosticLevel level;
|
||||
final DiagnosticLevel level;
|
||||
if ((width == double.infinity && height == double.infinity) ||
|
||||
(width == 0.0 && height == 0.0)) {
|
||||
level = DiagnosticLevel.hidden;
|
||||
|
|
|
@ -95,7 +95,7 @@ class DecoratedBox extends SingleChildRenderObjectWidget {
|
|||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
super.debugFillProperties(properties);
|
||||
String label;
|
||||
final String label;
|
||||
switch (position) {
|
||||
case DecorationPosition.background:
|
||||
label = 'bg';
|
||||
|
|
|
@ -385,7 +385,7 @@ class _DraggableState<T extends Object> extends State<Draggable<T>> {
|
|||
_DragAvatar<T>? _startDrag(Offset position) {
|
||||
if (widget.maxSimultaneousDrags != null && _activeCount >= widget.maxSimultaneousDrags!)
|
||||
return null;
|
||||
Offset dragStartPoint;
|
||||
final Offset dragStartPoint;
|
||||
switch (widget.dragAnchor) {
|
||||
case DragAnchor.child:
|
||||
final RenderBox renderObject = context.findRenderObject()! as RenderBox;
|
||||
|
|
|
@ -1910,8 +1910,8 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
|
|||
return RevealedOffset(offset: _scrollController!.offset, rect: rect);
|
||||
|
||||
final Size editableSize = renderEditable.size;
|
||||
double additionalOffset;
|
||||
Offset unitOffset;
|
||||
final double additionalOffset;
|
||||
final Offset unitOffset;
|
||||
|
||||
if (!_isMultiline) {
|
||||
additionalOffset = rect.width >= editableSize.width
|
||||
|
|
|
@ -1503,7 +1503,7 @@ class FocusManager with DiagnosticableTreeMixin, ChangeNotifier {
|
|||
// Update function to be called whenever the state relating to highlightMode
|
||||
// changes.
|
||||
void _updateHighlightMode() {
|
||||
FocusHighlightMode newMode;
|
||||
final FocusHighlightMode newMode;
|
||||
switch (highlightStrategy) {
|
||||
case FocusHighlightStrategy.automatic:
|
||||
if (_lastInteractionWasTouch == null) {
|
||||
|
@ -1587,7 +1587,7 @@ class FocusManager with DiagnosticableTreeMixin, ChangeNotifier {
|
|||
final FocusScopeNode rootScope = FocusScopeNode(debugLabel: 'Root Focus Scope');
|
||||
|
||||
void _handlePointerEvent(PointerEvent event) {
|
||||
FocusHighlightMode expectedMode;
|
||||
final FocusHighlightMode expectedMode;
|
||||
switch (event.kind) {
|
||||
case PointerDeviceKind.touch:
|
||||
case PointerDeviceKind.stylus:
|
||||
|
|
|
@ -595,7 +595,7 @@ mixin DirectionalFocusTraversalPolicyMixin on FocusTraversalPolicy {
|
|||
invalidateScopeData(nearestScope);
|
||||
return false;
|
||||
}
|
||||
ScrollPositionAlignmentPolicy alignmentPolicy;
|
||||
final ScrollPositionAlignmentPolicy alignmentPolicy;
|
||||
switch (direction) {
|
||||
case TraversalDirection.up:
|
||||
case TraversalDirection.left:
|
||||
|
|
|
@ -226,7 +226,7 @@ abstract class GlobalKey<T extends State<StatefulWidget>> extends Key {
|
|||
// We have duplication reservations for the same global key.
|
||||
final Element older = keyToParent[key]!;
|
||||
final Element newer = parent;
|
||||
FlutterError error;
|
||||
final FlutterError error;
|
||||
if (older.toString() != newer.toString()) {
|
||||
error = FlutterError.fromParts(<DiagnosticsNode>[
|
||||
ErrorSummary('Multiple widgets used the same GlobalKey.'),
|
||||
|
@ -3333,7 +3333,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
|||
deactivateChild(child);
|
||||
return null;
|
||||
}
|
||||
Element newChild;
|
||||
final Element newChild;
|
||||
if (child != null) {
|
||||
bool hasSameSuperclass = true;
|
||||
// When the type of a widget is changed between Stateful and Stateless via
|
||||
|
|
|
@ -77,7 +77,7 @@ class ModalBarrier extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
assert(!dismissible || semanticsLabel == null || debugCheckHasDirectionality(context));
|
||||
bool platformSupportsDismissingBarrier;
|
||||
final bool platformSupportsDismissingBarrier;
|
||||
switch (defaultTargetPlatform) {
|
||||
case TargetPlatform.android:
|
||||
case TargetPlatform.fuchsia:
|
||||
|
|
|
@ -115,7 +115,7 @@ class _ToolbarLayout extends MultiChildLayoutDelegate {
|
|||
maxHeight: size.height,
|
||||
);
|
||||
leadingWidth = layoutChild(_ToolbarSlot.leading, constraints).width;
|
||||
double leadingX;
|
||||
final double leadingX;
|
||||
switch (textDirection) {
|
||||
case TextDirection.rtl:
|
||||
leadingX = size.width - leadingWidth;
|
||||
|
@ -130,7 +130,7 @@ class _ToolbarLayout extends MultiChildLayoutDelegate {
|
|||
if (hasChild(_ToolbarSlot.trailing)) {
|
||||
final BoxConstraints constraints = BoxConstraints.loose(size);
|
||||
final Size trailingSize = layoutChild(_ToolbarSlot.trailing, constraints);
|
||||
double trailingX;
|
||||
final double trailingX;
|
||||
switch (textDirection) {
|
||||
case TextDirection.rtl:
|
||||
trailingX = 0.0;
|
||||
|
@ -162,7 +162,7 @@ class _ToolbarLayout extends MultiChildLayoutDelegate {
|
|||
middleStart = middleStartMargin;
|
||||
}
|
||||
|
||||
double middleX;
|
||||
final double middleX;
|
||||
switch (textDirection) {
|
||||
case TextDirection.rtl:
|
||||
middleX = size.width - middleSize.width - middleStart;
|
||||
|
|
|
@ -4358,7 +4358,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin, Res
|
|||
if (route != null) {
|
||||
routeJsonable = <String, dynamic>{};
|
||||
|
||||
String description;
|
||||
final String description;
|
||||
if (route is TransitionRoute<dynamic>) {
|
||||
final TransitionRoute<dynamic> transitionRoute = route;
|
||||
description = transitionRoute.debugLabel;
|
||||
|
|
|
@ -200,7 +200,7 @@ class GlowingOverscrollIndicator extends StatefulWidget {
|
|||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
super.debugFillProperties(properties);
|
||||
properties.add(EnumProperty<AxisDirection>('axisDirection', axisDirection));
|
||||
String showDescription;
|
||||
final String showDescription;
|
||||
if (showLeading && showTrailing) {
|
||||
showDescription = 'both sides';
|
||||
} else if (showLeading) {
|
||||
|
|
|
@ -610,8 +610,8 @@ abstract class ScrollPosition extends ViewportOffset with ScrollMetrics {
|
|||
/// scroll view dimensions both change) and therefore shouldn't do anything
|
||||
/// expensive.
|
||||
void _updateSemanticActions() {
|
||||
SemanticsAction forward;
|
||||
SemanticsAction backward;
|
||||
final SemanticsAction forward;
|
||||
final SemanticsAction backward;
|
||||
switch (axisDirection) {
|
||||
case AxisDirection.up:
|
||||
forward = SemanticsAction.scrollDown;
|
||||
|
|
|
@ -103,7 +103,7 @@ class BouncingScrollSimulation extends Simulation {
|
|||
}
|
||||
|
||||
Simulation _simulation(double time) {
|
||||
Simulation simulation;
|
||||
final Simulation simulation;
|
||||
if (time > _springTime) {
|
||||
_timeOffset = _springTime.isFinite ? _springTime : 0.0;
|
||||
simulation = _springSimulation;
|
||||
|
|
|
@ -1247,7 +1247,7 @@ class ListView extends BoxScrollView {
|
|||
childrenDelegate = SliverChildBuilderDelegate(
|
||||
(BuildContext context, int index) {
|
||||
final int itemIndex = index ~/ 2;
|
||||
Widget widget;
|
||||
final Widget widget;
|
||||
if (index.isEven) {
|
||||
widget = itemBuilder(context, itemIndex);
|
||||
} else {
|
||||
|
|
|
@ -198,8 +198,8 @@ class ScrollbarPainter extends ChangeNotifier implements CustomPainter {
|
|||
}
|
||||
|
||||
void _paintThumbCrossAxis(Canvas canvas, Size size, double thumbOffset, double thumbExtent, AxisDirection direction) {
|
||||
double x, y;
|
||||
Size thumbSize;
|
||||
final double x, y;
|
||||
final Size thumbSize;
|
||||
|
||||
switch (direction) {
|
||||
case AxisDirection.down:
|
||||
|
|
|
@ -281,11 +281,11 @@ class _SemanticsDebuggerPainter extends CustomPainter {
|
|||
annotations.add('adjustable');
|
||||
|
||||
assert(data.label != null);
|
||||
String message;
|
||||
final String message;
|
||||
if (data.label.isEmpty) {
|
||||
message = annotations.join('; ');
|
||||
} else {
|
||||
String label;
|
||||
final String label;
|
||||
if (data.textDirection == null) {
|
||||
label = '${Unicode.FSI}${data.label}${Unicode.PDI}';
|
||||
annotations.insert(0, 'MISSING TEXT DIRECTION');
|
||||
|
|
|
@ -633,9 +633,9 @@ class _RenderSingleChildViewport extends RenderBox with RenderObjectWithChildMix
|
|||
final Rect bounds = MatrixUtils.transformRect(transform, rect);
|
||||
final Size contentSize = child!.size;
|
||||
|
||||
double leadingScrollOffset;
|
||||
double targetMainAxisExtent;
|
||||
double mainAxisExtent;
|
||||
final double leadingScrollOffset;
|
||||
final double targetMainAxisExtent;
|
||||
final double mainAxisExtent;
|
||||
|
||||
assert(axisDirection != null);
|
||||
switch (axisDirection) {
|
||||
|
|
|
@ -433,7 +433,7 @@ class SliverChildBuilderDelegate extends SliverChildDelegate {
|
|||
if (findChildIndexCallback == null)
|
||||
return null;
|
||||
assert(key != null);
|
||||
Key childKey;
|
||||
final Key childKey;
|
||||
if (key is _SaltedValueKey) {
|
||||
final _SaltedValueKey saltedValueKey = key;
|
||||
childKey = saltedValueKey.value;
|
||||
|
@ -665,7 +665,7 @@ class SliverChildListDelegate extends SliverChildDelegate {
|
|||
@override
|
||||
int? findIndexByKey(Key key) {
|
||||
assert(key != null);
|
||||
Key childKey;
|
||||
final Key childKey;
|
||||
if (key is _SaltedValueKey) {
|
||||
final _SaltedValueKey saltedValueKey = key;
|
||||
childKey = saltedValueKey.value;
|
||||
|
@ -1366,7 +1366,7 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
|
|||
void debugVisitOnstageChildren(ElementVisitor visitor) {
|
||||
_childElements.values.cast<Element>().where((Element child) {
|
||||
final SliverMultiBoxAdaptorParentData parentData = child.renderObject!.parentData! as SliverMultiBoxAdaptorParentData;
|
||||
double itemExtent;
|
||||
final double itemExtent;
|
||||
switch (renderObject.constraints.axis) {
|
||||
case Axis.horizontal:
|
||||
itemExtent = child.renderObject!.paintBounds.width;
|
||||
|
|
|
@ -587,7 +587,7 @@ class TextSelectionOverlay {
|
|||
}
|
||||
|
||||
void _handleSelectionHandleChanged(TextSelection newSelection, _TextSelectionHandlePosition position) {
|
||||
TextPosition textPosition;
|
||||
final TextPosition textPosition;
|
||||
switch (position) {
|
||||
case _TextSelectionHandlePosition.start:
|
||||
textPosition = newSelection.base;
|
||||
|
@ -695,7 +695,7 @@ class _TextSelectionHandleOverlayState
|
|||
return;
|
||||
}
|
||||
|
||||
TextSelection newSelection;
|
||||
final TextSelection newSelection;
|
||||
switch (widget.position) {
|
||||
case _TextSelectionHandlePosition.start:
|
||||
newSelection = TextSelection(
|
||||
|
@ -724,8 +724,8 @@ class _TextSelectionHandleOverlayState
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
LayerLink layerLink;
|
||||
TextSelectionHandleType type;
|
||||
final LayerLink layerLink;
|
||||
final TextSelectionHandleType type;
|
||||
|
||||
switch (widget.position) {
|
||||
case _TextSelectionHandlePosition.start:
|
||||
|
|
|
@ -632,7 +632,7 @@ class SizeTransition extends AnimatedWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
AlignmentDirectional alignment;
|
||||
final AlignmentDirectional alignment;
|
||||
if (axis == Axis.vertical)
|
||||
alignment = AlignmentDirectional(-1.0, axisAlignment);
|
||||
else
|
||||
|
|
|
@ -3222,8 +3222,8 @@ void main() {
|
|||
EditableText.debugDeterministicCursor = true;
|
||||
tester.binding.window.physicalSizeTestValue = const Size(400, 400);
|
||||
tester.binding.window.devicePixelRatioTestValue = 1;
|
||||
TextEditingController controller;
|
||||
EditableTextState state;
|
||||
final TextEditingController controller;
|
||||
final EditableTextState state;
|
||||
|
||||
// Normal multiword collapsed selection. The toolbar arrow should point down, and
|
||||
// it should point exactly to the caret.
|
||||
|
@ -3293,8 +3293,8 @@ void main() {
|
|||
EditableText.debugDeterministicCursor = true;
|
||||
tester.binding.window.physicalSizeTestValue = const Size(400, 400);
|
||||
tester.binding.window.devicePixelRatioTestValue = 1;
|
||||
TextEditingController controller;
|
||||
EditableTextState state;
|
||||
final TextEditingController controller;
|
||||
final EditableTextState state;
|
||||
|
||||
// Normal multiline collapsed selection. The toolbar arrow should point down, and
|
||||
// it should point exactly to the horizontal center of the text field.
|
||||
|
|
|
@ -219,7 +219,7 @@ void main() {
|
|||
|
||||
test('Malformed FlutterError objects', () {
|
||||
{
|
||||
AssertionError error;
|
||||
final AssertionError error;
|
||||
try {
|
||||
throw FlutterError.fromParts(<DiagnosticsNode>[]);
|
||||
} on AssertionError catch (e) {
|
||||
|
@ -235,7 +235,7 @@ void main() {
|
|||
}
|
||||
|
||||
{
|
||||
AssertionError error;
|
||||
final AssertionError error;
|
||||
try {
|
||||
throw FlutterError.fromParts(<DiagnosticsNode>[
|
||||
(ErrorDescription('Error description without a summary'))]);
|
||||
|
@ -261,7 +261,7 @@ void main() {
|
|||
}
|
||||
|
||||
{
|
||||
AssertionError error;
|
||||
final AssertionError error;
|
||||
try {
|
||||
throw FlutterError.fromParts(<DiagnosticsNode>[
|
||||
ErrorSummary('Error Summary A'),
|
||||
|
@ -298,7 +298,7 @@ void main() {
|
|||
}
|
||||
|
||||
{
|
||||
AssertionError error;
|
||||
final AssertionError error;
|
||||
try {
|
||||
throw FlutterError.fromParts(<DiagnosticsNode>[
|
||||
ErrorDescription('Some description'),
|
||||
|
@ -329,7 +329,7 @@ void main() {
|
|||
|
||||
test('User-thrown exceptions have ErrorSummary properties', () {
|
||||
{
|
||||
DiagnosticsNode node;
|
||||
final DiagnosticsNode node;
|
||||
try {
|
||||
throw 'User thrown string';
|
||||
} catch (e) {
|
||||
|
@ -340,7 +340,7 @@ void main() {
|
|||
}
|
||||
|
||||
{
|
||||
DiagnosticsNode node;
|
||||
final DiagnosticsNode node;
|
||||
try {
|
||||
throw ArgumentError.notNull('myArgument');
|
||||
} catch (e) {
|
||||
|
|
Loading…
Reference in a new issue