mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
fix some bad indentations (#41172)
This commit is contained in:
parent
1ea760096a
commit
b873162194
@ -1063,8 +1063,9 @@ class _RenderCupertinoAlertActions extends RenderBox
|
|||||||
..color = pressedColor,
|
..color = pressedColor,
|
||||||
_dividerPaint = Paint()
|
_dividerPaint = Paint()
|
||||||
..color = dividerColor
|
..color = dividerColor
|
||||||
..style = PaintingStyle.fill
|
..style = PaintingStyle.fill {
|
||||||
{ addAll(children); }
|
addAll(children);
|
||||||
|
}
|
||||||
|
|
||||||
// The thickness of the divider between buttons.
|
// The thickness of the divider between buttons.
|
||||||
double get dividerThickness => _dividerThickness;
|
double get dividerThickness => _dividerThickness;
|
||||||
|
@ -1339,7 +1339,7 @@ class _RenderCupertinoDialogActions extends RenderBox
|
|||||||
final Paint _pressedButtonBackgroundPaint;
|
final Paint _pressedButtonBackgroundPaint;
|
||||||
set dialogPressedColor(Color value) {
|
set dialogPressedColor(Color value) {
|
||||||
if (value == _pressedButtonBackgroundPaint.color)
|
if (value == _pressedButtonBackgroundPaint.color)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_pressedButtonBackgroundPaint.color = value;
|
_pressedButtonBackgroundPaint.color = value;
|
||||||
markNeedsPaint();
|
markNeedsPaint();
|
||||||
@ -1348,7 +1348,7 @@ class _RenderCupertinoDialogActions extends RenderBox
|
|||||||
final Paint _dividerPaint;
|
final Paint _dividerPaint;
|
||||||
set dividerColor(Color value) {
|
set dividerColor(Color value) {
|
||||||
if (value == _dividerPaint.color)
|
if (value == _dividerPaint.color)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_dividerPaint.color = value;
|
_dividerPaint.color = value;
|
||||||
markNeedsPaint();
|
markNeedsPaint();
|
||||||
|
@ -225,9 +225,9 @@ class _ToolbarRenderBox extends RenderShiftedBox {
|
|||||||
@override
|
@override
|
||||||
void debugPaintSize(PaintingContext context, Offset offset) {
|
void debugPaintSize(PaintingContext context, Offset offset) {
|
||||||
assert(() {
|
assert(() {
|
||||||
if (child == null) {
|
if (child == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_debugPaint ??= Paint()
|
_debugPaint ??= Paint()
|
||||||
..shader = ui.Gradient.linear(
|
..shader = ui.Gradient.linear(
|
||||||
|
@ -98,7 +98,10 @@ abstract class BindingBase {
|
|||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
void initInstances() {
|
void initInstances() {
|
||||||
assert(!_debugInitialized);
|
assert(!_debugInitialized);
|
||||||
assert(() { _debugInitialized = true; return true; }());
|
assert(() {
|
||||||
|
_debugInitialized = true;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called when the binding is initialized, to register service
|
/// Called when the binding is initialized, to register service
|
||||||
@ -182,7 +185,10 @@ abstract class BindingBase {
|
|||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}());
|
}());
|
||||||
assert(() { _debugServiceExtensionsRegistered = true; return true; }());
|
assert(() {
|
||||||
|
_debugServiceExtensionsRegistered = true;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Whether [lockEvents] is currently locking events.
|
/// Whether [lockEvents] is currently locking events.
|
||||||
|
@ -52,7 +52,10 @@ bool debugInstrumentationEnabled = false;
|
|||||||
/// implicitly add any timeline events.
|
/// implicitly add any timeline events.
|
||||||
Future<T> debugInstrumentAction<T>(String description, Future<T> action()) {
|
Future<T> debugInstrumentAction<T>(String description, Future<T> action()) {
|
||||||
bool instrument = false;
|
bool instrument = false;
|
||||||
assert(() { instrument = debugInstrumentationEnabled; return true; }());
|
assert(() {
|
||||||
|
instrument = debugInstrumentationEnabled;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
if (instrument) {
|
if (instrument) {
|
||||||
final Stopwatch stopwatch = Stopwatch()..start();
|
final Stopwatch stopwatch = Stopwatch()..start();
|
||||||
return action().whenComplete(() {
|
return action().whenComplete(() {
|
||||||
|
@ -163,7 +163,10 @@ abstract class MultiDragPointerState {
|
|||||||
void dispose() {
|
void dispose() {
|
||||||
_arenaEntry?.resolve(GestureDisposition.rejected);
|
_arenaEntry?.resolve(GestureDisposition.rejected);
|
||||||
_arenaEntry = null;
|
_arenaEntry = null;
|
||||||
assert(() { _pendingDelta = null; return true; }());
|
assert(() {
|
||||||
|
_pendingDelta = null;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class PointerSignalResolver {
|
|||||||
}
|
}
|
||||||
assert((_currentEvent.original ?? _currentEvent) == event);
|
assert((_currentEvent.original ?? _currentEvent) == event);
|
||||||
try {
|
try {
|
||||||
_firstRegisteredCallback(_currentEvent);
|
_firstRegisteredCallback(_currentEvent);
|
||||||
} catch (exception, stack) {
|
} catch (exception, stack) {
|
||||||
FlutterError.reportError(FlutterErrorDetails(
|
FlutterError.reportError(FlutterErrorDetails(
|
||||||
exception: exception,
|
exception: exception,
|
||||||
|
@ -480,8 +480,8 @@ class _AppBarState extends State<AppBar> {
|
|||||||
switch (theme.platform) {
|
switch (theme.platform) {
|
||||||
case TargetPlatform.android:
|
case TargetPlatform.android:
|
||||||
case TargetPlatform.fuchsia:
|
case TargetPlatform.fuchsia:
|
||||||
namesRoute = true;
|
namesRoute = true;
|
||||||
break;
|
break;
|
||||||
case TargetPlatform.iOS:
|
case TargetPlatform.iOS:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -620,7 +620,7 @@ class ButtonThemeData extends Diagnosticable {
|
|||||||
case ButtonTextTheme.accent:
|
case ButtonTextTheme.accent:
|
||||||
return colorScheme.secondary;
|
return colorScheme.secondary;
|
||||||
|
|
||||||
case ButtonTextTheme.primary: {
|
case ButtonTextTheme.primary:
|
||||||
final Color fillColor = getFillColor(button);
|
final Color fillColor = getFillColor(button);
|
||||||
final bool fillIsDark = fillColor != null
|
final bool fillIsDark = fillColor != null
|
||||||
? ThemeData.estimateBrightnessForColor(fillColor) == Brightness.dark
|
? ThemeData.estimateBrightnessForColor(fillColor) == Brightness.dark
|
||||||
@ -630,7 +630,6 @@ class ButtonThemeData extends Diagnosticable {
|
|||||||
if (button is FlatButton || button is OutlineButton)
|
if (button is FlatButton || button is OutlineButton)
|
||||||
return colorScheme.primary;
|
return colorScheme.primary;
|
||||||
return Colors.black;
|
return Colors.black;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(false);
|
assert(false);
|
||||||
|
@ -2776,23 +2776,22 @@ class _RenderChip extends RenderBox {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void debugPaint(PaintingContext context, Offset offset) {
|
void debugPaint(PaintingContext context, Offset offset) {
|
||||||
assert(!_debugShowTapTargetOutlines ||
|
assert(!_debugShowTapTargetOutlines || () {
|
||||||
() {
|
// Draws a rect around the tap targets to help with visualizing where
|
||||||
// Draws a rect around the tap targets to help with visualizing where
|
// they really are.
|
||||||
// they really are.
|
final Paint outlinePaint = Paint()
|
||||||
final Paint outlinePaint = Paint()
|
..color = const Color(0xff800000)
|
||||||
..color = const Color(0xff800000)
|
..strokeWidth = 1.0
|
||||||
..strokeWidth = 1.0
|
..style = PaintingStyle.stroke;
|
||||||
..style = PaintingStyle.stroke;
|
if (deleteIconShowing) {
|
||||||
if (deleteIconShowing) {
|
context.canvas.drawRect(deleteButtonRect.shift(offset), outlinePaint);
|
||||||
context.canvas.drawRect(deleteButtonRect.shift(offset), outlinePaint);
|
}
|
||||||
}
|
context.canvas.drawRect(
|
||||||
context.canvas.drawRect(
|
pressRect.shift(offset),
|
||||||
pressRect.shift(offset),
|
outlinePaint..color = const Color(0xff008000),
|
||||||
outlinePaint..color = const Color(0xff008000),
|
);
|
||||||
);
|
return true;
|
||||||
return true;
|
}());
|
||||||
}());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -425,12 +425,12 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (Directionality.of(context)) {
|
switch (Directionality.of(context)) {
|
||||||
case TextDirection.rtl:
|
case TextDirection.rtl:
|
||||||
_controller.fling(velocity: -visualVelocity);
|
_controller.fling(velocity: -visualVelocity);
|
||||||
break;
|
break;
|
||||||
case TextDirection.ltr:
|
case TextDirection.ltr:
|
||||||
_controller.fling(velocity: visualVelocity);
|
_controller.fling(velocity: visualVelocity);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (_controller.value < 0.5) {
|
} else if (_controller.value < 0.5) {
|
||||||
close();
|
close();
|
||||||
@ -492,16 +492,14 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
|
|||||||
double dragAreaWidth = widget.edgeDragWidth;
|
double dragAreaWidth = widget.edgeDragWidth;
|
||||||
if (widget.edgeDragWidth == null) {
|
if (widget.edgeDragWidth == null) {
|
||||||
switch (textDirection) {
|
switch (textDirection) {
|
||||||
case TextDirection.ltr: {
|
case TextDirection.ltr:
|
||||||
dragAreaWidth = _kEdgeDragWidth +
|
dragAreaWidth = _kEdgeDragWidth +
|
||||||
(drawerIsStart ? padding.left : padding.right);
|
(drawerIsStart ? padding.left : padding.right);
|
||||||
}
|
break;
|
||||||
break;
|
case TextDirection.rtl:
|
||||||
case TextDirection.rtl: {
|
|
||||||
dragAreaWidth = _kEdgeDragWidth +
|
dragAreaWidth = _kEdgeDragWidth +
|
||||||
(drawerIsStart ? padding.right : padding.left);
|
(drawerIsStart ? padding.right : padding.left);
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -898,12 +898,12 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
|
|||||||
items = widget.selectedItemBuilder == null
|
items = widget.selectedItemBuilder == null
|
||||||
? List<Widget>.from(widget.items)
|
? List<Widget>.from(widget.items)
|
||||||
: widget.selectedItemBuilder(context).map((Widget item) {
|
: widget.selectedItemBuilder(context).map((Widget item) {
|
||||||
return Container(
|
return Container(
|
||||||
height: _kMenuItemHeight,
|
height: _kMenuItemHeight,
|
||||||
alignment: AlignmentDirectional.centerStart,
|
alignment: AlignmentDirectional.centerStart,
|
||||||
child: item,
|
child: item,
|
||||||
);
|
);
|
||||||
}).toList();
|
}).toList();
|
||||||
} else {
|
} else {
|
||||||
items = <Widget>[];
|
items = <Widget>[];
|
||||||
}
|
}
|
||||||
|
@ -478,16 +478,15 @@ class OutlineInputBorder extends InputBorder {
|
|||||||
} else {
|
} else {
|
||||||
final double extent = lerpDouble(0.0, gapExtent + gapPadding * 2.0, gapPercentage);
|
final double extent = lerpDouble(0.0, gapExtent + gapPadding * 2.0, gapPercentage);
|
||||||
switch (textDirection) {
|
switch (textDirection) {
|
||||||
case TextDirection.rtl: {
|
case TextDirection.rtl:
|
||||||
final Path path = _gapBorderPath(canvas, center, math.max(0.0, gapStart + gapPadding - extent), extent);
|
final Path path = _gapBorderPath(canvas, center, math.max(0.0, gapStart + gapPadding - extent), extent);
|
||||||
canvas.drawPath(path, paint);
|
canvas.drawPath(path, paint);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case TextDirection.ltr: {
|
case TextDirection.ltr:
|
||||||
final Path path = _gapBorderPath(canvas, center, math.max(0.0, gapStart - gapPadding), extent);
|
final Path path = _gapBorderPath(canvas, center, math.max(0.0, gapStart - gapPadding), extent);
|
||||||
canvas.drawPath(path, paint);
|
canvas.drawPath(path, paint);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -615,7 +615,10 @@ abstract class InkFeature {
|
|||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
void dispose() {
|
void dispose() {
|
||||||
assert(!_debugDisposed);
|
assert(!_debugDisposed);
|
||||||
assert(() { _debugDisposed = true; return true; }());
|
assert(() {
|
||||||
|
_debugDisposed = true;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
_controller._removeFeature(this);
|
_controller._removeFeature(this);
|
||||||
if (onRemoved != null)
|
if (onRemoved != null)
|
||||||
onRemoved();
|
onRemoved();
|
||||||
|
@ -1723,10 +1723,10 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
|
|||||||
final LocalHistoryEntry entry = isPersistent
|
final LocalHistoryEntry entry = isPersistent
|
||||||
? null
|
? null
|
||||||
: LocalHistoryEntry(onRemove: () {
|
: LocalHistoryEntry(onRemove: () {
|
||||||
if (!removedEntry) {
|
if (!removedEntry) {
|
||||||
_removeCurrentBottomSheet();
|
_removeCurrentBottomSheet();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
bottomSheet = _StandardBottomSheet(
|
bottomSheet = _StandardBottomSheet(
|
||||||
key: bottomSheetKey,
|
key: bottomSheetKey,
|
||||||
|
@ -76,7 +76,10 @@ class _ScrollbarState extends State<Scrollbar> with TickerProviderStateMixin {
|
|||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
assert((() { _useCupertinoScrollbar = null; return true; })());
|
assert((() {
|
||||||
|
_useCupertinoScrollbar = null;
|
||||||
|
return true;
|
||||||
|
})());
|
||||||
final ThemeData theme = Theme.of(context);
|
final ThemeData theme = Theme.of(context);
|
||||||
switch (theme.platform) {
|
switch (theme.platform) {
|
||||||
case TargetPlatform.iOS:
|
case TargetPlatform.iOS:
|
||||||
|
@ -440,7 +440,7 @@ class _SelectableTextState extends State<SelectableText> with AutomaticKeepAlive
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (_effectiveFocusNode.hasFocus && _controller.selection.isCollapsed) {
|
if (_effectiveFocusNode.hasFocus && _controller.selection.isCollapsed) {
|
||||||
_showSelectionHandles = false;
|
_showSelectionHandles = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2767,23 +2767,22 @@ class _PaddleSliderTrackShapePathPainter {
|
|||||||
final double stretch = (neckStretchBaseline * t).clamp(0.0, 10.0 * neckStretchBaseline);
|
final double stretch = (neckStretchBaseline * t).clamp(0.0, 10.0 * neckStretchBaseline);
|
||||||
final Offset neckStretch = Offset(0.0, neckStretchBaseline - stretch);
|
final Offset neckStretch = Offset(0.0, neckStretchBaseline - stretch);
|
||||||
|
|
||||||
assert(!_debuggingLabelLocation ||
|
assert(!_debuggingLabelLocation || () {
|
||||||
() {
|
final Offset leftCenter = _topLobeCenter - Offset(leftWidthNeeded, 0.0) + neckStretch;
|
||||||
final Offset leftCenter = _topLobeCenter - Offset(leftWidthNeeded, 0.0) + neckStretch;
|
final Offset rightCenter = _topLobeCenter + Offset(rightWidthNeeded, 0.0) + neckStretch;
|
||||||
final Offset rightCenter = _topLobeCenter + Offset(rightWidthNeeded, 0.0) + neckStretch;
|
final Rect valueRect = Rect.fromLTRB(
|
||||||
final Rect valueRect = Rect.fromLTRB(
|
leftCenter.dx - _topLobeRadius,
|
||||||
leftCenter.dx - _topLobeRadius,
|
leftCenter.dy - _topLobeRadius,
|
||||||
leftCenter.dy - _topLobeRadius,
|
rightCenter.dx + _topLobeRadius,
|
||||||
rightCenter.dx + _topLobeRadius,
|
rightCenter.dy + _topLobeRadius,
|
||||||
rightCenter.dy + _topLobeRadius,
|
);
|
||||||
);
|
final Paint outlinePaint = Paint()
|
||||||
final Paint outlinePaint = Paint()
|
..color = const Color(0xffff0000)
|
||||||
..color = const Color(0xffff0000)
|
..style = PaintingStyle.stroke
|
||||||
..style = PaintingStyle.stroke
|
..strokeWidth = 1.0;
|
||||||
..strokeWidth = 1.0;
|
canvas.drawRect(valueRect, outlinePaint);
|
||||||
canvas.drawRect(valueRect, outlinePaint);
|
return true;
|
||||||
return true;
|
}());
|
||||||
}());
|
|
||||||
|
|
||||||
_addArc(
|
_addArc(
|
||||||
path,
|
path,
|
||||||
|
@ -122,7 +122,7 @@ class _TextFieldSelectionGestureDetectorBuilder extends TextSelectionGestureDete
|
|||||||
break;
|
break;
|
||||||
case TargetPlatform.android:
|
case TargetPlatform.android:
|
||||||
case TargetPlatform.fuchsia:
|
case TargetPlatform.fuchsia:
|
||||||
renderEditable.selectWord(cause: SelectionChangedCause.longPress);
|
renderEditable.selectWord(cause: SelectionChangedCause.longPress);
|
||||||
Feedback.forLongPress(_state.context);
|
Feedback.forLongPress(_state.context);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ class BeveledRectangleBorder extends ShapeBorder {
|
|||||||
case BorderStyle.none:
|
case BorderStyle.none:
|
||||||
break;
|
break;
|
||||||
case BorderStyle.solid:
|
case BorderStyle.solid:
|
||||||
final Path path = getOuterPath(rect, textDirection: textDirection)
|
final Path path = getOuterPath(rect, textDirection: textDirection)
|
||||||
..addPath(getInnerPath(rect, textDirection: textDirection), Offset.zero);
|
..addPath(getInnerPath(rect, textDirection: textDirection), Offset.zero);
|
||||||
canvas.drawPath(path, side.toPaint());
|
canvas.drawPath(path, side.toPaint());
|
||||||
break;
|
break;
|
||||||
|
@ -138,7 +138,7 @@ class ContinuousRectangleBorder extends ShapeBorder {
|
|||||||
return;
|
return;
|
||||||
switch (side.style) {
|
switch (side.style) {
|
||||||
case BorderStyle.none:
|
case BorderStyle.none:
|
||||||
break;
|
break;
|
||||||
case BorderStyle.solid:
|
case BorderStyle.solid:
|
||||||
final Path path = getOuterPath(rect, textDirection: textDirection);
|
final Path path = getOuterPath(rect, textDirection: textDirection);
|
||||||
final Paint paint = side.toPaint();
|
final Paint paint = side.toPaint();
|
||||||
|
@ -275,7 +275,10 @@ class BoxConstraints extends Constraints {
|
|||||||
/// separately provided widths and heights.
|
/// separately provided widths and heights.
|
||||||
Size constrain(Size size) {
|
Size constrain(Size size) {
|
||||||
Size result = Size(constrainWidth(size.width), constrainHeight(size.height));
|
Size result = Size(constrainWidth(size.width), constrainHeight(size.height));
|
||||||
assert(() { result = _debugPropagateDebugSize(size, result); return true; }());
|
assert(() {
|
||||||
|
result = _debugPropagateDebugSize(size, result);
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,7 +301,10 @@ class BoxConstraints extends Constraints {
|
|||||||
Size constrainSizeAndAttemptToPreserveAspectRatio(Size size) {
|
Size constrainSizeAndAttemptToPreserveAspectRatio(Size size) {
|
||||||
if (isTight) {
|
if (isTight) {
|
||||||
Size result = smallest;
|
Size result = smallest;
|
||||||
assert(() { result = _debugPropagateDebugSize(size, result); return true; }());
|
assert(() {
|
||||||
|
result = _debugPropagateDebugSize(size, result);
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,7 +335,10 @@ class BoxConstraints extends Constraints {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Size result = Size(constrainWidth(width), constrainHeight(height));
|
Size result = Size(constrainWidth(width), constrainHeight(height));
|
||||||
assert(() { result = _debugPropagateDebugSize(size, result); return true; }());
|
assert(() {
|
||||||
|
result = _debugPropagateDebugSize(size, result);
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,7 +522,10 @@ class RenderCustomPaint extends RenderProxyBox {
|
|||||||
void _paintWithPainter(Canvas canvas, Offset offset, CustomPainter painter) {
|
void _paintWithPainter(Canvas canvas, Offset offset, CustomPainter painter) {
|
||||||
int debugPreviousCanvasSaveCount;
|
int debugPreviousCanvasSaveCount;
|
||||||
canvas.save();
|
canvas.save();
|
||||||
assert(() { debugPreviousCanvasSaveCount = canvas.getSaveCount(); return true; }());
|
assert(() {
|
||||||
|
debugPreviousCanvasSaveCount = canvas.getSaveCount();
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
if (offset != Offset.zero)
|
if (offset != Offset.zero)
|
||||||
canvas.translate(offset.dx, offset.dy);
|
canvas.translate(offset.dx, offset.dy);
|
||||||
painter.paint(canvas, size);
|
painter.paint(canvas, size);
|
||||||
|
@ -525,14 +525,14 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
|
|||||||
double crossSize;
|
double crossSize;
|
||||||
if (flex == 0) {
|
if (flex == 0) {
|
||||||
switch (_direction) {
|
switch (_direction) {
|
||||||
case Axis.horizontal:
|
case Axis.horizontal:
|
||||||
mainSize = child.getMaxIntrinsicWidth(double.infinity);
|
mainSize = child.getMaxIntrinsicWidth(double.infinity);
|
||||||
crossSize = childSize(child, mainSize);
|
crossSize = childSize(child, mainSize);
|
||||||
break;
|
break;
|
||||||
case Axis.vertical:
|
case Axis.vertical:
|
||||||
mainSize = child.getMaxIntrinsicHeight(double.infinity);
|
mainSize = child.getMaxIntrinsicHeight(double.infinity);
|
||||||
crossSize = childSize(child, mainSize);
|
crossSize = childSize(child, mainSize);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
inflexibleSpace += mainSize;
|
inflexibleSpace += mainSize;
|
||||||
maxCrossSize = math.max(maxCrossSize, crossSize);
|
maxCrossSize = math.max(maxCrossSize, crossSize);
|
||||||
|
@ -110,70 +110,70 @@ class RenderListBody extends RenderBox
|
|||||||
double mainAxisExtent = 0.0;
|
double mainAxisExtent = 0.0;
|
||||||
RenderBox child = firstChild;
|
RenderBox child = firstChild;
|
||||||
switch (axisDirection) {
|
switch (axisDirection) {
|
||||||
case AxisDirection.right:
|
case AxisDirection.right:
|
||||||
final BoxConstraints innerConstraints = BoxConstraints.tightFor(height: constraints.maxHeight);
|
final BoxConstraints innerConstraints = BoxConstraints.tightFor(height: constraints.maxHeight);
|
||||||
while (child != null) {
|
while (child != null) {
|
||||||
child.layout(innerConstraints, parentUsesSize: true);
|
child.layout(innerConstraints, parentUsesSize: true);
|
||||||
final ListBodyParentData childParentData = child.parentData;
|
final ListBodyParentData childParentData = child.parentData;
|
||||||
childParentData.offset = Offset(mainAxisExtent, 0.0);
|
childParentData.offset = Offset(mainAxisExtent, 0.0);
|
||||||
mainAxisExtent += child.size.width;
|
mainAxisExtent += child.size.width;
|
||||||
assert(child.parentData == childParentData);
|
assert(child.parentData == childParentData);
|
||||||
child = childParentData.nextSibling;
|
child = childParentData.nextSibling;
|
||||||
}
|
}
|
||||||
size = constraints.constrain(Size(mainAxisExtent, constraints.maxHeight));
|
size = constraints.constrain(Size(mainAxisExtent, constraints.maxHeight));
|
||||||
break;
|
break;
|
||||||
case AxisDirection.left:
|
case AxisDirection.left:
|
||||||
final BoxConstraints innerConstraints = BoxConstraints.tightFor(height: constraints.maxHeight);
|
final BoxConstraints innerConstraints = BoxConstraints.tightFor(height: constraints.maxHeight);
|
||||||
while (child != null) {
|
while (child != null) {
|
||||||
child.layout(innerConstraints, parentUsesSize: true);
|
child.layout(innerConstraints, parentUsesSize: true);
|
||||||
final ListBodyParentData childParentData = child.parentData;
|
final ListBodyParentData childParentData = child.parentData;
|
||||||
mainAxisExtent += child.size.width;
|
mainAxisExtent += child.size.width;
|
||||||
assert(child.parentData == childParentData);
|
assert(child.parentData == childParentData);
|
||||||
child = childParentData.nextSibling;
|
child = childParentData.nextSibling;
|
||||||
}
|
}
|
||||||
double position = 0.0;
|
double position = 0.0;
|
||||||
child = firstChild;
|
child = firstChild;
|
||||||
while (child != null) {
|
while (child != null) {
|
||||||
final ListBodyParentData childParentData = child.parentData;
|
final ListBodyParentData childParentData = child.parentData;
|
||||||
position += child.size.width;
|
position += child.size.width;
|
||||||
childParentData.offset = Offset(mainAxisExtent - position, 0.0);
|
childParentData.offset = Offset(mainAxisExtent - position, 0.0);
|
||||||
assert(child.parentData == childParentData);
|
assert(child.parentData == childParentData);
|
||||||
child = childParentData.nextSibling;
|
child = childParentData.nextSibling;
|
||||||
}
|
}
|
||||||
size = constraints.constrain(Size(mainAxisExtent, constraints.maxHeight));
|
size = constraints.constrain(Size(mainAxisExtent, constraints.maxHeight));
|
||||||
break;
|
break;
|
||||||
case AxisDirection.down:
|
case AxisDirection.down:
|
||||||
final BoxConstraints innerConstraints = BoxConstraints.tightFor(width: constraints.maxWidth);
|
final BoxConstraints innerConstraints = BoxConstraints.tightFor(width: constraints.maxWidth);
|
||||||
while (child != null) {
|
while (child != null) {
|
||||||
child.layout(innerConstraints, parentUsesSize: true);
|
child.layout(innerConstraints, parentUsesSize: true);
|
||||||
final ListBodyParentData childParentData = child.parentData;
|
final ListBodyParentData childParentData = child.parentData;
|
||||||
childParentData.offset = Offset(0.0, mainAxisExtent);
|
childParentData.offset = Offset(0.0, mainAxisExtent);
|
||||||
mainAxisExtent += child.size.height;
|
mainAxisExtent += child.size.height;
|
||||||
assert(child.parentData == childParentData);
|
assert(child.parentData == childParentData);
|
||||||
child = childParentData.nextSibling;
|
child = childParentData.nextSibling;
|
||||||
}
|
}
|
||||||
size = constraints.constrain(Size(constraints.maxWidth, mainAxisExtent));
|
size = constraints.constrain(Size(constraints.maxWidth, mainAxisExtent));
|
||||||
break;
|
break;
|
||||||
case AxisDirection.up:
|
case AxisDirection.up:
|
||||||
final BoxConstraints innerConstraints = BoxConstraints.tightFor(width: constraints.maxWidth);
|
final BoxConstraints innerConstraints = BoxConstraints.tightFor(width: constraints.maxWidth);
|
||||||
while (child != null) {
|
while (child != null) {
|
||||||
child.layout(innerConstraints, parentUsesSize: true);
|
child.layout(innerConstraints, parentUsesSize: true);
|
||||||
final ListBodyParentData childParentData = child.parentData;
|
final ListBodyParentData childParentData = child.parentData;
|
||||||
mainAxisExtent += child.size.height;
|
mainAxisExtent += child.size.height;
|
||||||
assert(child.parentData == childParentData);
|
assert(child.parentData == childParentData);
|
||||||
child = childParentData.nextSibling;
|
child = childParentData.nextSibling;
|
||||||
}
|
}
|
||||||
double position = 0.0;
|
double position = 0.0;
|
||||||
child = firstChild;
|
child = firstChild;
|
||||||
while (child != null) {
|
while (child != null) {
|
||||||
final ListBodyParentData childParentData = child.parentData;
|
final ListBodyParentData childParentData = child.parentData;
|
||||||
position += child.size.height;
|
position += child.size.height;
|
||||||
childParentData.offset = Offset(0.0, mainAxisExtent - position);
|
childParentData.offset = Offset(0.0, mainAxisExtent - position);
|
||||||
assert(child.parentData == childParentData);
|
assert(child.parentData == childParentData);
|
||||||
child = childParentData.nextSibling;
|
child = childParentData.nextSibling;
|
||||||
}
|
}
|
||||||
size = constraints.constrain(Size(constraints.maxWidth, mainAxisExtent));
|
size = constraints.constrain(Size(constraints.maxWidth, mainAxisExtent));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
assert(size.isFinite);
|
assert(size.isFinite);
|
||||||
}
|
}
|
||||||
|
@ -1027,7 +1027,10 @@ class PipelineOwner {
|
|||||||
Timeline.startSync('Semantics');
|
Timeline.startSync('Semantics');
|
||||||
}
|
}
|
||||||
assert(_semanticsOwner != null);
|
assert(_semanticsOwner != null);
|
||||||
assert(() { _debugDoingSemantics = true; return true; }());
|
assert(() {
|
||||||
|
_debugDoingSemantics = true;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
try {
|
try {
|
||||||
final List<RenderObject> nodesToProcess = _nodesNeedingSemantics.toList()
|
final List<RenderObject> nodesToProcess = _nodesNeedingSemantics.toList()
|
||||||
..sort((RenderObject a, RenderObject b) => a.depth - b.depth);
|
..sort((RenderObject a, RenderObject b) => a.depth - b.depth);
|
||||||
@ -1039,7 +1042,10 @@ class PipelineOwner {
|
|||||||
_semanticsOwner.sendSemanticsUpdate();
|
_semanticsOwner.sendSemanticsUpdate();
|
||||||
} finally {
|
} finally {
|
||||||
assert(_nodesNeedingSemantics.isEmpty);
|
assert(_nodesNeedingSemantics.isEmpty);
|
||||||
assert(() { _debugDoingSemantics = false; return true; }());
|
assert(() {
|
||||||
|
_debugDoingSemantics = false;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
if (!kReleaseMode) {
|
if (!kReleaseMode) {
|
||||||
Timeline.finishSync();
|
Timeline.finishSync();
|
||||||
}
|
}
|
||||||
@ -1681,14 +1687,23 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
|||||||
return true;
|
return true;
|
||||||
}());
|
}());
|
||||||
if (sizedByParent) {
|
if (sizedByParent) {
|
||||||
assert(() { _debugDoingThisResize = true; return true; }());
|
assert(() {
|
||||||
|
_debugDoingThisResize = true;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
try {
|
try {
|
||||||
performResize();
|
performResize();
|
||||||
assert(() { debugAssertDoesMeetConstraints(); return true; }());
|
assert(() {
|
||||||
|
debugAssertDoesMeetConstraints();
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
_debugReportException('performResize', e, stack);
|
_debugReportException('performResize', e, stack);
|
||||||
}
|
}
|
||||||
assert(() { _debugDoingThisResize = false; return true; }());
|
assert(() {
|
||||||
|
_debugDoingThisResize = false;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
}
|
}
|
||||||
RenderObject debugPreviousActiveLayout;
|
RenderObject debugPreviousActiveLayout;
|
||||||
assert(() {
|
assert(() {
|
||||||
@ -1700,7 +1715,10 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
|||||||
try {
|
try {
|
||||||
performLayout();
|
performLayout();
|
||||||
markNeedsSemanticsUpdate();
|
markNeedsSemanticsUpdate();
|
||||||
assert(() { debugAssertDoesMeetConstraints(); return true; }());
|
assert(() {
|
||||||
|
debugAssertDoesMeetConstraints();
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
_debugReportException('performLayout', e, stack);
|
_debugReportException('performLayout', e, stack);
|
||||||
}
|
}
|
||||||
|
@ -707,9 +707,9 @@ class PlatformViewRenderBox extends RenderBox with _PlatformViewGestureMixin {
|
|||||||
assert(hitTestBehavior != null),
|
assert(hitTestBehavior != null),
|
||||||
assert(gestureRecognizers != null),
|
assert(gestureRecognizers != null),
|
||||||
_controller = controller {
|
_controller = controller {
|
||||||
this.hitTestBehavior = hitTestBehavior;
|
this.hitTestBehavior = hitTestBehavior;
|
||||||
updateGestureRecognizers(gestureRecognizers);
|
updateGestureRecognizers(gestureRecognizers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the [controller] for this render object.
|
/// Sets the [controller] for this render object.
|
||||||
///
|
///
|
||||||
@ -722,8 +722,8 @@ class PlatformViewRenderBox extends RenderBox with _PlatformViewGestureMixin {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final bool needsSemanticsUpdate = _controller.viewId != controller.viewId;
|
final bool needsSemanticsUpdate = _controller.viewId != controller.viewId;
|
||||||
_controller = controller;
|
_controller = controller;
|
||||||
markNeedsPaint();
|
markNeedsPaint();
|
||||||
if (needsSemanticsUpdate) {
|
if (needsSemanticsUpdate) {
|
||||||
markNeedsSemanticsUpdate();
|
markNeedsSemanticsUpdate();
|
||||||
}
|
}
|
||||||
@ -738,8 +738,8 @@ class PlatformViewRenderBox extends RenderBox with _PlatformViewGestureMixin {
|
|||||||
///
|
///
|
||||||
/// Any active gesture arena the `PlatformView` participates in is rejected when the
|
/// Any active gesture arena the `PlatformView` participates in is rejected when the
|
||||||
/// set of gesture recognizers is changed.
|
/// set of gesture recognizers is changed.
|
||||||
void updateGestureRecognizers(Set<Factory<OneSequenceGestureRecognizer>> gestureRecognizers) {
|
void updateGestureRecognizers(Set<Factory<OneSequenceGestureRecognizer>> gestureRecognizers) {
|
||||||
_updateGestureRecognizersWithCallBack(gestureRecognizers, _controller.dispatchPointerEvent);
|
_updateGestureRecognizersWithCallBack(gestureRecognizers, _controller.dispatchPointerEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlatformViewController _controller;
|
PlatformViewController _controller;
|
||||||
|
@ -895,7 +895,10 @@ class RenderTable extends RenderBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// beyond this point, unflexedTableWidth is no longer valid
|
// beyond this point, unflexedTableWidth is no longer valid
|
||||||
assert(() { unflexedTableWidth = null; return true; }());
|
assert(() {
|
||||||
|
unflexedTableWidth = null;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
|
|
||||||
// 4. apply the maximum width of the table, shrinking columns as
|
// 4. apply the maximum width of the table, shrinking columns as
|
||||||
// necessary, applying minimum column widths as we go
|
// necessary, applying minimum column widths as we go
|
||||||
|
@ -504,7 +504,7 @@ mixin SchedulerBinding on BindingBase, ServicesBinding {
|
|||||||
FlutterError.reportError(FlutterErrorDetails(
|
FlutterError.reportError(FlutterErrorDetails(
|
||||||
exception: reason,
|
exception: reason,
|
||||||
library: 'scheduler library',
|
library: 'scheduler library',
|
||||||
informationCollector: () sync* {
|
informationCollector: () sync* {
|
||||||
if (count == 1) {
|
if (count == 1) {
|
||||||
// TODO(jacobr): I have added an extra line break in this case.
|
// TODO(jacobr): I have added an extra line break in this case.
|
||||||
yield ErrorDescription(
|
yield ErrorDescription(
|
||||||
@ -1035,7 +1035,10 @@ mixin SchedulerBinding on BindingBase, ServicesBinding {
|
|||||||
void _invokeFrameCallback(FrameCallback callback, Duration timeStamp, [ StackTrace callbackStack ]) {
|
void _invokeFrameCallback(FrameCallback callback, Duration timeStamp, [ StackTrace callbackStack ]) {
|
||||||
assert(callback != null);
|
assert(callback != null);
|
||||||
assert(_FrameCallbackEntry.debugCurrentCallbackStack == null);
|
assert(_FrameCallbackEntry.debugCurrentCallbackStack == null);
|
||||||
assert(() { _FrameCallbackEntry.debugCurrentCallbackStack = callbackStack; return true; }());
|
assert(() {
|
||||||
|
_FrameCallbackEntry.debugCurrentCallbackStack = callbackStack;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
try {
|
try {
|
||||||
callback(timeStamp);
|
callback(timeStamp);
|
||||||
} catch (exception, exceptionStack) {
|
} catch (exception, exceptionStack) {
|
||||||
@ -1054,7 +1057,10 @@ mixin SchedulerBinding on BindingBase, ServicesBinding {
|
|||||||
},
|
},
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
assert(() { _FrameCallbackEntry.debugCurrentCallbackStack = null; return true; }());
|
assert(() {
|
||||||
|
_FrameCallbackEntry.debugCurrentCallbackStack = null;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ class RawKeyEventDataLinux extends RawKeyEventData {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool isModifierPressed(ModifierKey key, {KeyboardSide side = KeyboardSide.any}) {
|
bool isModifierPressed(ModifierKey key, {KeyboardSide side = KeyboardSide.any}) {
|
||||||
return keyHelper.isModifierPressed(key, modifiers, side: side);
|
return keyHelper.isModifierPressed(key, modifiers, side: side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -206,13 +206,13 @@ class GLFWKeyHelper with KeyHelper {
|
|||||||
bool isModifierPressed(ModifierKey key, int modifiers, {KeyboardSide side = KeyboardSide.any}) {
|
bool isModifierPressed(ModifierKey key, int modifiers, {KeyboardSide side = KeyboardSide.any}) {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case ModifierKey.controlModifier:
|
case ModifierKey.controlModifier:
|
||||||
return modifiers & modifierControl != 0;
|
return modifiers & modifierControl != 0;
|
||||||
case ModifierKey.shiftModifier:
|
case ModifierKey.shiftModifier:
|
||||||
return modifiers & modifierShift != 0;
|
return modifiers & modifierShift != 0;
|
||||||
case ModifierKey.altModifier:
|
case ModifierKey.altModifier:
|
||||||
return modifiers & modifierAlt != 0;
|
return modifiers & modifierAlt != 0;
|
||||||
case ModifierKey.metaModifier:
|
case ModifierKey.metaModifier:
|
||||||
return modifiers & modifierMeta != 0;
|
return modifiers & modifierMeta != 0;
|
||||||
case ModifierKey.capsLockModifier:
|
case ModifierKey.capsLockModifier:
|
||||||
return modifiers & modifierCapsLock != 0;
|
return modifiers & modifierCapsLock != 0;
|
||||||
case ModifierKey.numLockModifier:
|
case ModifierKey.numLockModifier:
|
||||||
@ -233,15 +233,15 @@ class GLFWKeyHelper with KeyHelper {
|
|||||||
case ModifierKey.shiftModifier:
|
case ModifierKey.shiftModifier:
|
||||||
case ModifierKey.altModifier:
|
case ModifierKey.altModifier:
|
||||||
case ModifierKey.metaModifier:
|
case ModifierKey.metaModifier:
|
||||||
// Neither GLFW or X11 provide a distinction between left and right modifiers, so defaults to KeyboardSide.any.
|
// Neither GLFW or X11 provide a distinction between left and right modifiers, so defaults to KeyboardSide.any.
|
||||||
// https://code.woboq.org/qt5/include/X11/X.h.html#_M/ShiftMask
|
// https://code.woboq.org/qt5/include/X11/X.h.html#_M/ShiftMask
|
||||||
return KeyboardSide.any;
|
return KeyboardSide.any;
|
||||||
case ModifierKey.capsLockModifier:
|
case ModifierKey.capsLockModifier:
|
||||||
case ModifierKey.numLockModifier:
|
case ModifierKey.numLockModifier:
|
||||||
case ModifierKey.functionModifier:
|
case ModifierKey.functionModifier:
|
||||||
case ModifierKey.symbolModifier:
|
case ModifierKey.symbolModifier:
|
||||||
case ModifierKey.scrollLockModifier:
|
case ModifierKey.scrollLockModifier:
|
||||||
return KeyboardSide.all;
|
return KeyboardSide.all;
|
||||||
}
|
}
|
||||||
assert(false, 'Not handling $key type properly.');
|
assert(false, 'Not handling $key type properly.');
|
||||||
return null;
|
return null;
|
||||||
@ -254,6 +254,6 @@ class GLFWKeyHelper with KeyHelper {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
LogicalKeyboardKey logicalKey(int keyCode) {
|
LogicalKeyboardKey logicalKey(int keyCode) {
|
||||||
return kGlfwToLogicalKey[keyCode];
|
return kGlfwToLogicalKey[keyCode];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -876,7 +876,10 @@ void runApp(Widget app) {
|
|||||||
void debugDumpApp() {
|
void debugDumpApp() {
|
||||||
assert(WidgetsBinding.instance != null);
|
assert(WidgetsBinding.instance != null);
|
||||||
String mode = 'RELEASE MODE';
|
String mode = 'RELEASE MODE';
|
||||||
assert(() { mode = 'CHECKED MODE'; return true; }());
|
assert(() {
|
||||||
|
mode = 'CHECKED MODE';
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
debugPrint('${WidgetsBinding.instance.runtimeType} - $mode');
|
debugPrint('${WidgetsBinding.instance.runtimeType} - $mode');
|
||||||
if (WidgetsBinding.instance.renderViewElement != null) {
|
if (WidgetsBinding.instance.renderViewElement != null) {
|
||||||
debugPrint(WidgetsBinding.instance.renderViewElement.toStringDeep());
|
debugPrint(WidgetsBinding.instance.renderViewElement.toStringDeep());
|
||||||
|
@ -1274,12 +1274,12 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FloatingCursorDragState.End:
|
case FloatingCursorDragState.End:
|
||||||
// We skip animation if no update has happened.
|
// We skip animation if no update has happened.
|
||||||
if (_lastTextPosition != null && _lastBoundedOffset != null) {
|
if (_lastTextPosition != null && _lastBoundedOffset != null) {
|
||||||
_floatingCursorResetController.value = 0.0;
|
_floatingCursorResetController.value = 0.0;
|
||||||
_floatingCursorResetController.animateTo(1.0, duration: _floatingCursorResetTime, curve: Curves.decelerate);
|
_floatingCursorResetController.animateTo(1.0, duration: _floatingCursorResetTime, curve: Curves.decelerate);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1208,7 +1208,10 @@ abstract class State<T extends StatefulWidget> extends Diagnosticable {
|
|||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
void dispose() {
|
void dispose() {
|
||||||
assert(_debugLifecycleState == _StateLifecycle.ready);
|
assert(_debugLifecycleState == _StateLifecycle.ready);
|
||||||
assert(() { _debugLifecycleState = _StateLifecycle.defunct; return true; }());
|
assert(() {
|
||||||
|
_debugLifecycleState = _StateLifecycle.defunct;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Describes the part of the user interface represented by this widget.
|
/// Describes the part of the user interface represented by this widget.
|
||||||
@ -1756,7 +1759,10 @@ class _InactiveElements {
|
|||||||
element.deactivate();
|
element.deactivate();
|
||||||
assert(element._debugLifecycleState == _ElementLifecycle.inactive);
|
assert(element._debugLifecycleState == _ElementLifecycle.inactive);
|
||||||
element.visitChildren(_deactivateRecursively);
|
element.visitChildren(_deactivateRecursively);
|
||||||
assert(() { element.debugDeactivated(); return true; }());
|
assert(() {
|
||||||
|
element.debugDeactivated();
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
}
|
}
|
||||||
|
|
||||||
void add(Element element) {
|
void add(Element element) {
|
||||||
@ -2926,7 +2932,10 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
|||||||
key._register(this);
|
key._register(this);
|
||||||
}
|
}
|
||||||
_updateInheritance();
|
_updateInheritance();
|
||||||
assert(() { _debugLifecycleState = _ElementLifecycle.active; return true; }());
|
assert(() {
|
||||||
|
_debugLifecycleState = _ElementLifecycle.active;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Change the widget used to configure this element.
|
/// Change the widget used to configure this element.
|
||||||
@ -3082,7 +3091,10 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
|||||||
final Element newChild = _retakeInactiveElement(key, newWidget);
|
final Element newChild = _retakeInactiveElement(key, newWidget);
|
||||||
if (newChild != null) {
|
if (newChild != null) {
|
||||||
assert(newChild._parent == null);
|
assert(newChild._parent == null);
|
||||||
assert(() { _debugCheckForCycles(newChild); return true; }());
|
assert(() {
|
||||||
|
_debugCheckForCycles(newChild);
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
newChild._activateWithParent(this, newSlot);
|
newChild._activateWithParent(this, newSlot);
|
||||||
final Element updatedChild = updateChild(newChild, newWidget, newSlot);
|
final Element updatedChild = updateChild(newChild, newWidget, newSlot);
|
||||||
assert(newChild == updatedChild);
|
assert(newChild == updatedChild);
|
||||||
@ -3090,7 +3102,10 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Element newChild = newWidget.createElement();
|
final Element newChild = newWidget.createElement();
|
||||||
assert(() { _debugCheckForCycles(newChild); return true; }());
|
assert(() {
|
||||||
|
_debugCheckForCycles(newChild);
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
newChild.mount(this, newSlot);
|
newChild.mount(this, newSlot);
|
||||||
assert(newChild._debugLifecycleState == _ElementLifecycle.active);
|
assert(newChild._debugLifecycleState == _ElementLifecycle.active);
|
||||||
return newChild;
|
return newChild;
|
||||||
@ -3191,7 +3206,10 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
|||||||
_dependencies?.clear();
|
_dependencies?.clear();
|
||||||
_hadUnsatisfiedDependencies = false;
|
_hadUnsatisfiedDependencies = false;
|
||||||
_updateInheritance();
|
_updateInheritance();
|
||||||
assert(() { _debugLifecycleState = _ElementLifecycle.active; return true; }());
|
assert(() {
|
||||||
|
_debugLifecycleState = _ElementLifecycle.active;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
if (_dirty)
|
if (_dirty)
|
||||||
owner.scheduleBuildFor(this);
|
owner.scheduleBuildFor(this);
|
||||||
if (hadDependencies)
|
if (hadDependencies)
|
||||||
@ -3228,7 +3246,10 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
|||||||
}
|
}
|
||||||
_inheritedWidgets = null;
|
_inheritedWidgets = null;
|
||||||
_active = false;
|
_active = false;
|
||||||
assert(() { _debugLifecycleState = _ElementLifecycle.inactive; return true; }());
|
assert(() {
|
||||||
|
_debugLifecycleState = _ElementLifecycle.inactive;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called, in debug mode, after children have been deactivated (see [deactivate]).
|
/// Called, in debug mode, after children have been deactivated (see [deactivate]).
|
||||||
@ -3260,7 +3281,10 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
|||||||
final GlobalKey key = widget.key;
|
final GlobalKey key = widget.key;
|
||||||
key._unregister(this);
|
key._unregister(this);
|
||||||
}
|
}
|
||||||
assert(() { _debugLifecycleState = _ElementLifecycle.defunct; return true; }());
|
assert(() {
|
||||||
|
_debugLifecycleState = _ElementLifecycle.defunct;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -4075,9 +4099,15 @@ class StatefulElement extends ComponentElement {
|
|||||||
} finally {
|
} finally {
|
||||||
_debugSetAllowIgnoredCallsToMarkNeedsBuild(false);
|
_debugSetAllowIgnoredCallsToMarkNeedsBuild(false);
|
||||||
}
|
}
|
||||||
assert(() { _state._debugLifecycleState = _StateLifecycle.initialized; return true; }());
|
assert(() {
|
||||||
|
_state._debugLifecycleState = _StateLifecycle.initialized;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
_state.didChangeDependencies();
|
_state.didChangeDependencies();
|
||||||
assert(() { _state._debugLifecycleState = _StateLifecycle.ready; return true; }());
|
assert(() {
|
||||||
|
_state._debugLifecycleState = _StateLifecycle.ready;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
super._firstBuild();
|
super._firstBuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4740,7 +4770,10 @@ abstract class RenderObjectElement extends Element {
|
|||||||
void mount(Element parent, dynamic newSlot) {
|
void mount(Element parent, dynamic newSlot) {
|
||||||
super.mount(parent, newSlot);
|
super.mount(parent, newSlot);
|
||||||
_renderObject = widget.createRenderObject(this);
|
_renderObject = widget.createRenderObject(this);
|
||||||
assert(() { _debugUpdateRenderObjectOwner(); return true; }());
|
assert(() {
|
||||||
|
_debugUpdateRenderObjectOwner();
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
assert(_slot == newSlot);
|
assert(_slot == newSlot);
|
||||||
attachRenderObject(newSlot);
|
attachRenderObject(newSlot);
|
||||||
_dirty = false;
|
_dirty = false;
|
||||||
@ -4750,7 +4783,10 @@ abstract class RenderObjectElement extends Element {
|
|||||||
void update(covariant RenderObjectWidget newWidget) {
|
void update(covariant RenderObjectWidget newWidget) {
|
||||||
super.update(newWidget);
|
super.update(newWidget);
|
||||||
assert(widget == newWidget);
|
assert(widget == newWidget);
|
||||||
assert(() { _debugUpdateRenderObjectOwner(); return true; }());
|
assert(() {
|
||||||
|
_debugUpdateRenderObjectOwner();
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
widget.updateRenderObject(this, renderObject);
|
widget.updateRenderObject(this, renderObject);
|
||||||
_dirty = false;
|
_dirty = false;
|
||||||
}
|
}
|
||||||
|
@ -1581,7 +1581,10 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
|
|||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
assert(!_debugLocked);
|
assert(!_debugLocked);
|
||||||
assert(() { _debugLocked = true; return true; }());
|
assert(() {
|
||||||
|
_debugLocked = true;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
for (NavigatorObserver observer in widget.observers)
|
for (NavigatorObserver observer in widget.observers)
|
||||||
observer._navigator = null;
|
observer._navigator = null;
|
||||||
final List<Route<dynamic>> doomed = _poppedRoutes.toList()..addAll(_history);
|
final List<Route<dynamic>> doomed = _poppedRoutes.toList()..addAll(_history);
|
||||||
@ -1591,7 +1594,10 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
|
|||||||
_history.clear();
|
_history.clear();
|
||||||
focusScopeNode.dispose();
|
focusScopeNode.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
assert(() { _debugLocked = false; return true; }());
|
assert(() {
|
||||||
|
_debugLocked = false;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The overlay this navigator uses for its visual presentation.
|
/// The overlay this navigator uses for its visual presentation.
|
||||||
@ -1767,7 +1773,10 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
|
|||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
Future<T> push<T extends Object>(Route<T> route) {
|
Future<T> push<T extends Object>(Route<T> route) {
|
||||||
assert(!_debugLocked);
|
assert(!_debugLocked);
|
||||||
assert(() { _debugLocked = true; return true; }());
|
assert(() {
|
||||||
|
_debugLocked = true;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
assert(route != null);
|
assert(route != null);
|
||||||
assert(route._navigator == null);
|
assert(route._navigator == null);
|
||||||
final Route<dynamic> oldRoute = _history.isNotEmpty ? _history.last : null;
|
final Route<dynamic> oldRoute = _history.isNotEmpty ? _history.last : null;
|
||||||
@ -1783,7 +1792,10 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
|
|||||||
for (NavigatorObserver observer in widget.observers)
|
for (NavigatorObserver observer in widget.observers)
|
||||||
observer.didPush(route, oldRoute);
|
observer.didPush(route, oldRoute);
|
||||||
RouteNotificationMessages.maybeNotifyRouteChange(_routePushedMethod, route, oldRoute);
|
RouteNotificationMessages.maybeNotifyRouteChange(_routePushedMethod, route, oldRoute);
|
||||||
assert(() { _debugLocked = false; return true; }());
|
assert(() {
|
||||||
|
_debugLocked = false;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
_afterNavigation(route);
|
_afterNavigation(route);
|
||||||
return route.popped;
|
return route.popped;
|
||||||
}
|
}
|
||||||
@ -1848,7 +1860,10 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
|
|||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
Future<T> pushReplacement<T extends Object, TO extends Object>(Route<T> newRoute, { TO result }) {
|
Future<T> pushReplacement<T extends Object, TO extends Object>(Route<T> newRoute, { TO result }) {
|
||||||
assert(!_debugLocked);
|
assert(!_debugLocked);
|
||||||
assert(() { _debugLocked = true; return true; }());
|
assert(() {
|
||||||
|
_debugLocked = true;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
final Route<dynamic> oldRoute = _history.last;
|
final Route<dynamic> oldRoute = _history.last;
|
||||||
assert(oldRoute != null && oldRoute._navigator == this);
|
assert(oldRoute != null && oldRoute._navigator == this);
|
||||||
assert(oldRoute.overlayEntries.isNotEmpty);
|
assert(oldRoute.overlayEntries.isNotEmpty);
|
||||||
@ -1877,7 +1892,10 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
|
|||||||
for (NavigatorObserver observer in widget.observers)
|
for (NavigatorObserver observer in widget.observers)
|
||||||
observer.didReplace(newRoute: newRoute, oldRoute: oldRoute);
|
observer.didReplace(newRoute: newRoute, oldRoute: oldRoute);
|
||||||
RouteNotificationMessages.maybeNotifyRouteChange(_routeReplacedMethod, newRoute, oldRoute);
|
RouteNotificationMessages.maybeNotifyRouteChange(_routeReplacedMethod, newRoute, oldRoute);
|
||||||
assert(() { _debugLocked = false; return true; }());
|
assert(() {
|
||||||
|
_debugLocked = false;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
_afterNavigation(newRoute);
|
_afterNavigation(newRoute);
|
||||||
return newRoute.popped;
|
return newRoute.popped;
|
||||||
}
|
}
|
||||||
@ -1903,7 +1921,10 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
|
|||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
Future<T> pushAndRemoveUntil<T extends Object>(Route<T> newRoute, RoutePredicate predicate) {
|
Future<T> pushAndRemoveUntil<T extends Object>(Route<T> newRoute, RoutePredicate predicate) {
|
||||||
assert(!_debugLocked);
|
assert(!_debugLocked);
|
||||||
assert(() { _debugLocked = true; return true; }());
|
assert(() {
|
||||||
|
_debugLocked = true;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
|
|
||||||
// The route that is being pushed on top of
|
// The route that is being pushed on top of
|
||||||
final Route<dynamic> precedingRoute = _history.isNotEmpty ? _history.last : null;
|
final Route<dynamic> precedingRoute = _history.isNotEmpty ? _history.last : null;
|
||||||
@ -1944,7 +1965,10 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
|
|||||||
for (NavigatorObserver observer in widget.observers)
|
for (NavigatorObserver observer in widget.observers)
|
||||||
observer.didPush(newRoute, precedingRoute);
|
observer.didPush(newRoute, precedingRoute);
|
||||||
|
|
||||||
assert(() { _debugLocked = false; return true; }());
|
assert(() {
|
||||||
|
_debugLocked = false;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
_afterNavigation(newRoute);
|
_afterNavigation(newRoute);
|
||||||
return newRoute.popped;
|
return newRoute.popped;
|
||||||
}
|
}
|
||||||
@ -1964,7 +1988,10 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
|
|||||||
assert(newRoute != null);
|
assert(newRoute != null);
|
||||||
if (oldRoute == newRoute)
|
if (oldRoute == newRoute)
|
||||||
return;
|
return;
|
||||||
assert(() { _debugLocked = true; return true; }());
|
assert(() {
|
||||||
|
_debugLocked = true;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
assert(oldRoute._navigator == this);
|
assert(oldRoute._navigator == this);
|
||||||
assert(newRoute._navigator == null);
|
assert(newRoute._navigator == null);
|
||||||
assert(oldRoute.overlayEntries.isNotEmpty);
|
assert(oldRoute.overlayEntries.isNotEmpty);
|
||||||
@ -1990,7 +2017,10 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
|
|||||||
observer.didReplace(newRoute: newRoute, oldRoute: oldRoute);
|
observer.didReplace(newRoute: newRoute, oldRoute: oldRoute);
|
||||||
RouteNotificationMessages.maybeNotifyRouteChange(_routeReplacedMethod, newRoute, oldRoute);
|
RouteNotificationMessages.maybeNotifyRouteChange(_routeReplacedMethod, newRoute, oldRoute);
|
||||||
oldRoute.dispose();
|
oldRoute.dispose();
|
||||||
assert(() { _debugLocked = false; return true; }());
|
assert(() {
|
||||||
|
_debugLocked = false;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Replaces a route on the navigator with a new route. The route to be
|
/// Replaces a route on the navigator with a new route. The route to be
|
||||||
@ -2074,11 +2104,17 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
|
|||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
bool pop<T extends Object>([ T result ]) {
|
bool pop<T extends Object>([ T result ]) {
|
||||||
assert(!_debugLocked);
|
assert(!_debugLocked);
|
||||||
assert(() { _debugLocked = true; return true; }());
|
assert(() {
|
||||||
|
_debugLocked = true;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
final Route<dynamic> route = _history.last;
|
final Route<dynamic> route = _history.last;
|
||||||
assert(route._navigator == this);
|
assert(route._navigator == this);
|
||||||
bool debugPredictedWouldPop;
|
bool debugPredictedWouldPop;
|
||||||
assert(() { debugPredictedWouldPop = !route.willHandlePopInternally; return true; }());
|
assert(() {
|
||||||
|
debugPredictedWouldPop = !route.willHandlePopInternally;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
if (route.didPop(result ?? route.currentResult)) {
|
if (route.didPop(result ?? route.currentResult)) {
|
||||||
assert(debugPredictedWouldPop);
|
assert(debugPredictedWouldPop);
|
||||||
if (_history.length > 1) {
|
if (_history.length > 1) {
|
||||||
@ -2093,13 +2129,19 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
|
|||||||
observer.didPop(route, _history.last);
|
observer.didPop(route, _history.last);
|
||||||
RouteNotificationMessages.maybeNotifyRouteChange(_routePoppedMethod, route, _history.last);
|
RouteNotificationMessages.maybeNotifyRouteChange(_routePoppedMethod, route, _history.last);
|
||||||
} else {
|
} else {
|
||||||
assert(() { _debugLocked = false; return true; }());
|
assert(() {
|
||||||
|
_debugLocked = false;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assert(!debugPredictedWouldPop);
|
assert(!debugPredictedWouldPop);
|
||||||
}
|
}
|
||||||
assert(() { _debugLocked = false; return true; }());
|
assert(() {
|
||||||
|
_debugLocked = false;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
_afterNavigation<dynamic>(route);
|
_afterNavigation<dynamic>(route);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2129,7 +2171,10 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
|
|||||||
void removeRoute(Route<dynamic> route) {
|
void removeRoute(Route<dynamic> route) {
|
||||||
assert(route != null);
|
assert(route != null);
|
||||||
assert(!_debugLocked);
|
assert(!_debugLocked);
|
||||||
assert(() { _debugLocked = true; return true; }());
|
assert(() {
|
||||||
|
_debugLocked = true;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
assert(route._navigator == this);
|
assert(route._navigator == this);
|
||||||
final int index = _history.indexOf(route);
|
final int index = _history.indexOf(route);
|
||||||
assert(index != -1);
|
assert(index != -1);
|
||||||
@ -2141,7 +2186,10 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
|
|||||||
for (NavigatorObserver observer in widget.observers)
|
for (NavigatorObserver observer in widget.observers)
|
||||||
observer.didRemove(route, previousRoute);
|
observer.didRemove(route, previousRoute);
|
||||||
route.dispose();
|
route.dispose();
|
||||||
assert(() { _debugLocked = false; return true; }());
|
assert(() {
|
||||||
|
_debugLocked = false;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
_afterNavigation<dynamic>(nextRoute);
|
_afterNavigation<dynamic>(nextRoute);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2151,7 +2199,10 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
|
|||||||
/// {@macro flutter.widgets.navigator.removeRouteBelow}
|
/// {@macro flutter.widgets.navigator.removeRouteBelow}
|
||||||
void removeRouteBelow(Route<dynamic> anchorRoute) {
|
void removeRouteBelow(Route<dynamic> anchorRoute) {
|
||||||
assert(!_debugLocked);
|
assert(!_debugLocked);
|
||||||
assert(() { _debugLocked = true; return true; }());
|
assert(() {
|
||||||
|
_debugLocked = true;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
assert(anchorRoute._navigator == this);
|
assert(anchorRoute._navigator == this);
|
||||||
final int index = _history.indexOf(anchorRoute) - 1;
|
final int index = _history.indexOf(anchorRoute) - 1;
|
||||||
assert(index >= 0);
|
assert(index >= 0);
|
||||||
@ -2166,7 +2217,10 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
|
|||||||
if (nextRoute != null)
|
if (nextRoute != null)
|
||||||
nextRoute.didChangePrevious(previousRoute);
|
nextRoute.didChangePrevious(previousRoute);
|
||||||
targetRoute.dispose();
|
targetRoute.dispose();
|
||||||
assert(() { _debugLocked = false; return true; }());
|
assert(() {
|
||||||
|
_debugLocked = false;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Complete the lifecycle for a route that has been popped off the navigator.
|
/// Complete the lifecycle for a route that has been popped off the navigator.
|
||||||
|
@ -514,15 +514,15 @@ class _AndroidViewState extends State<AndroidView> {
|
|||||||
}
|
}
|
||||||
if (!isFocused) {
|
if (!isFocused) {
|
||||||
_controller.clearFocus().catchError((dynamic e) {
|
_controller.clearFocus().catchError((dynamic e) {
|
||||||
if (e is MissingPluginException) {
|
if (e is MissingPluginException) {
|
||||||
// We land the framework part of Android platform views keyboard
|
// We land the framework part of Android platform views keyboard
|
||||||
// support before the engine part. There will be a commit range where
|
// support before the engine part. There will be a commit range where
|
||||||
// clearFocus isn't implemented in the engine. When that happens we
|
// clearFocus isn't implemented in the engine. When that happens we
|
||||||
// just swallow the error here. Once the engine part is rolled to the
|
// just swallow the error here. Once the engine part is rolled to the
|
||||||
// framework I'll remove this.
|
// framework I'll remove this.
|
||||||
// TODO(amirh): remove this once the engine's clearFocus is rolled.
|
// TODO(amirh): remove this once the engine's clearFocus is rolled.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -947,7 +947,10 @@ mixin WidgetInspectorService {
|
|||||||
void initServiceExtensions(_RegisterServiceExtensionCallback registerServiceExtensionCallback) {
|
void initServiceExtensions(_RegisterServiceExtensionCallback registerServiceExtensionCallback) {
|
||||||
_registerServiceExtensionCallback = registerServiceExtensionCallback;
|
_registerServiceExtensionCallback = registerServiceExtensionCallback;
|
||||||
assert(!_debugServiceExtensionsRegistered);
|
assert(!_debugServiceExtensionsRegistered);
|
||||||
assert(() { _debugServiceExtensionsRegistered = true; return true; }());
|
assert(() {
|
||||||
|
_debugServiceExtensionsRegistered = true;
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
|
|
||||||
SchedulerBinding.instance.addPersistentFrameCallback(_onFrameStart);
|
SchedulerBinding.instance.addPersistentFrameCallback(_onFrameStart);
|
||||||
|
|
||||||
|
@ -667,92 +667,98 @@ void main() {
|
|||||||
statusLog.clear();
|
statusLog.clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('calling repeat with reverse set to true makes the animation alternate '
|
test(
|
||||||
'between lowerBound and upperBound values on each repeat', () {
|
'calling repeat with reverse set to true makes the animation alternate '
|
||||||
final AnimationController controller = AnimationController(
|
'between lowerBound and upperBound values on each repeat',
|
||||||
duration: const Duration(milliseconds: 100),
|
() {
|
||||||
value: 0.0,
|
final AnimationController controller = AnimationController(
|
||||||
lowerBound: 0.0,
|
duration: const Duration(milliseconds: 100),
|
||||||
upperBound: 1.0,
|
value: 0.0,
|
||||||
vsync: const TestVSync(),
|
lowerBound: 0.0,
|
||||||
);
|
upperBound: 1.0,
|
||||||
|
vsync: const TestVSync(),
|
||||||
|
);
|
||||||
|
|
||||||
expect(controller.value, 0.0);
|
expect(controller.value, 0.0);
|
||||||
|
|
||||||
controller.repeat(reverse: true);
|
controller.repeat(reverse: true);
|
||||||
tick(const Duration(milliseconds: 0));
|
tick(const Duration(milliseconds: 0));
|
||||||
tick(const Duration(milliseconds: 25));
|
tick(const Duration(milliseconds: 25));
|
||||||
expect(controller.value, 0.25);
|
expect(controller.value, 0.25);
|
||||||
|
|
||||||
tick(const Duration(milliseconds: 0));
|
tick(const Duration(milliseconds: 0));
|
||||||
tick(const Duration(milliseconds: 125));
|
tick(const Duration(milliseconds: 125));
|
||||||
expect(controller.value, 0.75);
|
expect(controller.value, 0.75);
|
||||||
|
|
||||||
controller.reset();
|
controller.reset();
|
||||||
controller.value = 1.0;
|
controller.value = 1.0;
|
||||||
expect(controller.value, 1.0);
|
expect(controller.value, 1.0);
|
||||||
|
|
||||||
controller.repeat(reverse: true);
|
controller.repeat(reverse: true);
|
||||||
tick(const Duration(milliseconds: 0));
|
tick(const Duration(milliseconds: 0));
|
||||||
tick(const Duration(milliseconds: 25));
|
tick(const Duration(milliseconds: 25));
|
||||||
expect(controller.value, 0.75);
|
expect(controller.value, 0.75);
|
||||||
|
|
||||||
tick(const Duration(milliseconds: 0));
|
tick(const Duration(milliseconds: 0));
|
||||||
tick(const Duration(milliseconds: 125));
|
tick(const Duration(milliseconds: 125));
|
||||||
expect(controller.value, 0.25);
|
expect(controller.value, 0.25);
|
||||||
|
|
||||||
controller.reset();
|
controller.reset();
|
||||||
controller.value = 0.5;
|
controller.value = 0.5;
|
||||||
expect(controller.value, 0.5);
|
expect(controller.value, 0.5);
|
||||||
|
|
||||||
controller.repeat(reverse: true);
|
controller.repeat(reverse: true);
|
||||||
tick(const Duration(milliseconds: 0));
|
tick(const Duration(milliseconds: 0));
|
||||||
tick(const Duration(milliseconds: 50));
|
tick(const Duration(milliseconds: 50));
|
||||||
expect(controller.value, 1.0);
|
expect(controller.value, 1.0);
|
||||||
|
|
||||||
tick(const Duration(milliseconds: 0));
|
tick(const Duration(milliseconds: 0));
|
||||||
tick(const Duration(milliseconds: 150));
|
tick(const Duration(milliseconds: 150));
|
||||||
expect(controller.value, 0.0);
|
expect(controller.value, 0.0);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
test('calling repeat with specified min and max values makes the animation '
|
test(
|
||||||
'alternate between min and max values on each repeat', () {
|
'calling repeat with specified min and max values makes the animation '
|
||||||
final AnimationController controller = AnimationController(
|
'alternate between min and max values on each repeat',
|
||||||
duration: const Duration(milliseconds: 100),
|
() {
|
||||||
value: 0.0,
|
final AnimationController controller = AnimationController(
|
||||||
lowerBound: 0.0,
|
duration: const Duration(milliseconds: 100),
|
||||||
upperBound: 1.0,
|
value: 0.0,
|
||||||
vsync: const TestVSync(),
|
lowerBound: 0.0,
|
||||||
);
|
upperBound: 1.0,
|
||||||
|
vsync: const TestVSync(),
|
||||||
|
);
|
||||||
|
|
||||||
expect(controller.value, 0.0);
|
expect(controller.value, 0.0);
|
||||||
|
|
||||||
controller.repeat(reverse: true, min: 0.5, max: 1.0);
|
controller.repeat(reverse: true, min: 0.5, max: 1.0);
|
||||||
tick(const Duration(milliseconds: 0));
|
tick(const Duration(milliseconds: 0));
|
||||||
tick(const Duration(milliseconds: 50));
|
tick(const Duration(milliseconds: 50));
|
||||||
expect(controller.value, 0.75);
|
expect(controller.value, 0.75);
|
||||||
|
|
||||||
tick(const Duration(milliseconds: 0));
|
tick(const Duration(milliseconds: 0));
|
||||||
tick(const Duration(milliseconds: 100));
|
tick(const Duration(milliseconds: 100));
|
||||||
expect(controller.value, 1.00);
|
expect(controller.value, 1.00);
|
||||||
|
|
||||||
tick(const Duration(milliseconds: 0));
|
tick(const Duration(milliseconds: 0));
|
||||||
tick(const Duration(milliseconds: 200));
|
tick(const Duration(milliseconds: 200));
|
||||||
expect(controller.value, 0.5);
|
expect(controller.value, 0.5);
|
||||||
|
|
||||||
controller.reset();
|
controller.reset();
|
||||||
controller.value = 0.0;
|
controller.value = 0.0;
|
||||||
expect(controller.value, 0.0);
|
expect(controller.value, 0.0);
|
||||||
|
|
||||||
controller.repeat(reverse: true, min: 1.0, max: 1.0);
|
controller.repeat(reverse: true, min: 1.0, max: 1.0);
|
||||||
tick(const Duration(milliseconds: 0));
|
tick(const Duration(milliseconds: 0));
|
||||||
tick(const Duration(milliseconds: 25));
|
tick(const Duration(milliseconds: 25));
|
||||||
expect(controller.value, 1.0);
|
expect(controller.value, 1.0);
|
||||||
|
|
||||||
tick(const Duration(milliseconds: 0));
|
tick(const Duration(milliseconds: 0));
|
||||||
tick(const Duration(milliseconds: 125));
|
tick(const Duration(milliseconds: 125));
|
||||||
expect(controller.value, 1.0);
|
expect(controller.value, 1.0);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
group('AnimationBehavior', () {
|
group('AnimationBehavior', () {
|
||||||
test('Default values for constructor', () {
|
test('Default values for constructor', () {
|
||||||
|
@ -88,7 +88,10 @@ void main() {
|
|||||||
final List<String> log = <String>[];
|
final List<String> log = <String>[];
|
||||||
|
|
||||||
final VoidCallback listener1 = () { log.add('listener1'); };
|
final VoidCallback listener1 = () { log.add('listener1'); };
|
||||||
final VoidCallback badListener = () { log.add('badListener'); throw null; };
|
final VoidCallback badListener = () {
|
||||||
|
log.add('badListener');
|
||||||
|
throw null;
|
||||||
|
};
|
||||||
final VoidCallback listener2 = () { log.add('listener2'); };
|
final VoidCallback listener2 = () { log.add('listener2'); };
|
||||||
|
|
||||||
controller.addListener(listener1);
|
controller.addListener(listener1);
|
||||||
@ -108,7 +111,10 @@ void main() {
|
|||||||
final List<String> log = <String>[];
|
final List<String> log = <String>[];
|
||||||
|
|
||||||
final AnimationStatusListener listener1 = (AnimationStatus status) { log.add('listener1'); };
|
final AnimationStatusListener listener1 = (AnimationStatus status) { log.add('listener1'); };
|
||||||
final AnimationStatusListener badListener = (AnimationStatus status) { log.add('badListener'); throw null; };
|
final AnimationStatusListener badListener = (AnimationStatus status) {
|
||||||
|
log.add('badListener');
|
||||||
|
throw null;
|
||||||
|
};
|
||||||
final AnimationStatusListener listener2 = (AnimationStatus status) { log.add('listener2'); };
|
final AnimationStatusListener listener2 = (AnimationStatus status) { log.add('listener2'); };
|
||||||
|
|
||||||
controller.addStatusListener(listener1);
|
controller.addStatusListener(listener1);
|
||||||
|
@ -319,7 +319,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('background color is not null', (WidgetTester tester) async {
|
testWidgets('background color is not null', (WidgetTester tester) async {
|
||||||
expect(
|
expect(
|
||||||
() {
|
() {
|
||||||
CupertinoDatePicker(
|
CupertinoDatePicker(
|
||||||
onDateTimeChanged: (_) { },
|
onDateTimeChanged: (_) { },
|
||||||
@ -345,30 +345,30 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('initial date honors minuteInterval', (WidgetTester tester) async {
|
testWidgets('initial date honors minuteInterval', (WidgetTester tester) async {
|
||||||
DateTime newDateTime;
|
DateTime newDateTime;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
CupertinoApp(
|
CupertinoApp(
|
||||||
home: Center(
|
home: Center(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 400,
|
width: 400,
|
||||||
height: 400,
|
height: 400,
|
||||||
child: CupertinoDatePicker(
|
child: CupertinoDatePicker(
|
||||||
onDateTimeChanged: (DateTime d) => newDateTime = d,
|
onDateTimeChanged: (DateTime d) => newDateTime = d,
|
||||||
initialDateTime: DateTime(2018, 10, 10, 10, 3),
|
initialDateTime: DateTime(2018, 10, 10, 10, 3),
|
||||||
minuteInterval: 3,
|
minuteInterval: 3,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
);
|
)
|
||||||
|
);
|
||||||
|
|
||||||
// Drag the minute picker to the next slot (03 -> 06).
|
// Drag the minute picker to the next slot (03 -> 06).
|
||||||
// The `initialDateTime` and the `minuteInterval` values are specifically chosen
|
// The `initialDateTime` and the `minuteInterval` values are specifically chosen
|
||||||
// so that `find.text` finds exactly one widget.
|
// so that `find.text` finds exactly one widget.
|
||||||
await tester.drag(find.text('03'), _kRowOffset);
|
await tester.drag(find.text('03'), _kRowOffset);
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
|
|
||||||
expect(newDateTime.minute, 6);
|
expect(newDateTime.minute, 6);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('changing initialDateTime after first build does not do anything', (WidgetTester tester) async {
|
testWidgets('changing initialDateTime after first build does not do anything', (WidgetTester tester) async {
|
||||||
|
@ -381,85 +381,86 @@ void main() {
|
|||||||
final FlutterError error = FlutterError('Oops');
|
final FlutterError error = FlutterError('Oops');
|
||||||
double errorCount = 0;
|
double errorCount = 0;
|
||||||
|
|
||||||
runZoned(() async {
|
runZoned(
|
||||||
refreshCompleter = Completer<void>.sync();
|
() async {
|
||||||
|
refreshCompleter = Completer<void>.sync();
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
Directionality(
|
Directionality(
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
slivers: <Widget>[
|
slivers: <Widget>[
|
||||||
CupertinoSliverRefreshControl(
|
CupertinoSliverRefreshControl(
|
||||||
builder: builder,
|
builder: builder,
|
||||||
onRefresh: onRefresh,
|
onRefresh: onRefresh,
|
||||||
),
|
),
|
||||||
buildAListOfStuff(),
|
buildAListOfStuff(),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
|
||||||
|
|
||||||
await tester.drag(find.text('0'), const Offset(0.0, 150.0), touchSlopY: 0);
|
await tester.drag(find.text('0'), const Offset(0.0, 150.0), touchSlopY: 0);
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
// Let it start snapping back.
|
// Let it start snapping back.
|
||||||
await tester.pump(const Duration(milliseconds: 50));
|
await tester.pump(const Duration(milliseconds: 50));
|
||||||
|
|
||||||
verifyInOrder(<void>[
|
verifyInOrder(<void>[
|
||||||
mockHelper.builder(
|
mockHelper.builder(
|
||||||
|
any,
|
||||||
|
RefreshIndicatorMode.armed,
|
||||||
|
150.0,
|
||||||
|
100.0, // Default value.
|
||||||
|
60.0, // Default value.
|
||||||
|
),
|
||||||
|
mockHelper.refreshTask(),
|
||||||
|
mockHelper.builder(
|
||||||
|
any,
|
||||||
|
RefreshIndicatorMode.armed,
|
||||||
|
argThat(moreOrLessEquals(127.10396988577114)),
|
||||||
|
100.0, // Default value.
|
||||||
|
60.0, // Default value.
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Reaches refresh state and sliver's at 60.0 in height after a while.
|
||||||
|
await tester.pump(const Duration(seconds: 1));
|
||||||
|
verify(mockHelper.builder(
|
||||||
any,
|
any,
|
||||||
RefreshIndicatorMode.armed,
|
RefreshIndicatorMode.refresh,
|
||||||
150.0,
|
60.0,
|
||||||
100.0, // Default value.
|
100.0, // Default value.
|
||||||
60.0, // Default value.
|
60.0, // Default value.
|
||||||
),
|
));
|
||||||
mockHelper.refreshTask(),
|
|
||||||
mockHelper.builder(
|
// Stays in that state forever until future completes.
|
||||||
|
await tester.pump(const Duration(seconds: 1000));
|
||||||
|
verifyNoMoreInteractions(mockHelper);
|
||||||
|
expect(
|
||||||
|
tester.getTopLeft(find.widgetWithText(Container, '0')),
|
||||||
|
const Offset(0.0, 60.0),
|
||||||
|
);
|
||||||
|
|
||||||
|
refreshCompleter.completeError(error);
|
||||||
|
await tester.pump();
|
||||||
|
|
||||||
|
verify(mockHelper.builder(
|
||||||
any,
|
any,
|
||||||
RefreshIndicatorMode.armed,
|
RefreshIndicatorMode.done,
|
||||||
argThat(moreOrLessEquals(127.10396988577114)),
|
60.0,
|
||||||
100.0, // Default value.
|
100.0, // Default value.
|
||||||
60.0, // Default value.
|
60.0, // Default value.
|
||||||
),
|
));
|
||||||
]);
|
verifyNoMoreInteractions(mockHelper);
|
||||||
|
},
|
||||||
|
onError: (dynamic e) {
|
||||||
|
expect(e, error);
|
||||||
|
expect(errorCount, 0);
|
||||||
|
errorCount++;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
// Reaches refresh state and sliver's at 60.0 in height after a while.
|
debugDefaultTargetPlatformOverride = null;
|
||||||
await tester.pump(const Duration(seconds: 1));
|
|
||||||
verify(mockHelper.builder(
|
|
||||||
any,
|
|
||||||
RefreshIndicatorMode.refresh,
|
|
||||||
60.0,
|
|
||||||
100.0, // Default value.
|
|
||||||
60.0, // Default value.
|
|
||||||
));
|
|
||||||
|
|
||||||
// Stays in that state forever until future completes.
|
|
||||||
await tester.pump(const Duration(seconds: 1000));
|
|
||||||
verifyNoMoreInteractions(mockHelper);
|
|
||||||
expect(
|
|
||||||
tester.getTopLeft(find.widgetWithText(Container, '0')),
|
|
||||||
const Offset(0.0, 60.0),
|
|
||||||
);
|
|
||||||
|
|
||||||
refreshCompleter.completeError(error);
|
|
||||||
await tester.pump();
|
|
||||||
|
|
||||||
verify(mockHelper.builder(
|
|
||||||
any,
|
|
||||||
RefreshIndicatorMode.done,
|
|
||||||
60.0,
|
|
||||||
100.0, // Default value.
|
|
||||||
60.0, // Default value.
|
|
||||||
));
|
|
||||||
verifyNoMoreInteractions(mockHelper);
|
|
||||||
},
|
|
||||||
onError: (dynamic e) {
|
|
||||||
expect(e, error);
|
|
||||||
expect(errorCount, 0);
|
|
||||||
errorCount++;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
debugDefaultTargetPlatformOverride = null;
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -805,15 +805,15 @@ void main() {
|
|||||||
theme: const CupertinoThemeData(brightness: Brightness.dark),
|
theme: const CupertinoThemeData(brightness: Brightness.dark),
|
||||||
home: CupertinoPageScaffold(
|
home: CupertinoPageScaffold(
|
||||||
child: Builder(builder: (BuildContext context) {
|
child: Builder(builder: (BuildContext context) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await showCupertinoModalPopup<void>(
|
await showCupertinoModalPopup<void>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) => const SizedBox(),
|
builder: (BuildContext context) => const SizedBox(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: const Text('tap'),
|
child: const Text('tap'),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -494,22 +494,24 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'Background color of child should change on selection, '
|
'Background color of child should change on selection, '
|
||||||
'and should not change when tapped again', (WidgetTester tester) async {
|
'and should not change when tapped again',
|
||||||
await tester.pumpWidget(setupSimpleSegmentedControl());
|
(WidgetTester tester) async {
|
||||||
|
await tester.pumpWidget(setupSimpleSegmentedControl());
|
||||||
|
|
||||||
expect(getBackgroundColor(tester, 1), CupertinoColors.white);
|
expect(getBackgroundColor(tester, 1), CupertinoColors.white);
|
||||||
|
|
||||||
await tester.tap(find.text('Child 2'));
|
await tester.tap(find.text('Child 2'));
|
||||||
await tester.pumpAndSettle(const Duration(milliseconds: 200));
|
await tester.pumpAndSettle(const Duration(milliseconds: 200));
|
||||||
|
|
||||||
expect(getBackgroundColor(tester, 1), CupertinoColors.activeBlue);
|
expect(getBackgroundColor(tester, 1), CupertinoColors.activeBlue);
|
||||||
|
|
||||||
await tester.tap(find.text('Child 2'));
|
await tester.tap(find.text('Child 2'));
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
|
|
||||||
expect(getBackgroundColor(tester, 1), CupertinoColors.activeBlue);
|
expect(getBackgroundColor(tester, 1), CupertinoColors.activeBlue);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'Children can be non-Text or Icon widgets (in this case, '
|
'Children can be non-Text or Icon widgets (in this case, '
|
||||||
|
@ -482,7 +482,7 @@ void main() {
|
|||||||
expect(tester.widget<Opacity>(find.byType(Opacity).first).opacity, 0.5);
|
expect(tester.widget<Opacity>(find.byType(Opacity).first).opacity, 0.5);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Switch turns opaque after becoming enabled', (WidgetTester tester) async {
|
testWidgets('Switch turns opaque after becoming enabled', (WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const Directionality(
|
const Directionality(
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
|
@ -981,7 +981,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'tapping clear button also calls onChanged when text not empty',
|
'tapping clear button also calls onChanged when text not empty',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
String value = 'text entry';
|
String value = 'text entry';
|
||||||
final TextEditingController controller = TextEditingController();
|
final TextEditingController controller = TextEditingController();
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
@ -2409,7 +2409,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'Double tap shows handles and toolbar if selection is not collapsed',
|
'Double tap shows handles and toolbar if selection is not collapsed',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
final TextEditingController controller = TextEditingController(
|
final TextEditingController controller = TextEditingController(
|
||||||
text: 'abc def ghi',
|
text: 'abc def ghi',
|
||||||
);
|
);
|
||||||
@ -2438,7 +2438,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'Double tap shows toolbar but not handles if selection is collapsed',
|
'Double tap shows toolbar but not handles if selection is collapsed',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
final TextEditingController controller = TextEditingController(
|
final TextEditingController controller = TextEditingController(
|
||||||
text: 'abc def ghi',
|
text: 'abc def ghi',
|
||||||
);
|
);
|
||||||
@ -2467,7 +2467,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'Mouse long press does not show handles nor toolbar',
|
'Mouse long press does not show handles nor toolbar',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
final TextEditingController controller = TextEditingController(
|
final TextEditingController controller = TextEditingController(
|
||||||
text: 'abc def ghi',
|
text: 'abc def ghi',
|
||||||
);
|
);
|
||||||
@ -2499,7 +2499,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'Mouse double tap does not show handles nor toolbar',
|
'Mouse double tap does not show handles nor toolbar',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
final TextEditingController controller = TextEditingController(
|
final TextEditingController controller = TextEditingController(
|
||||||
text: 'abc def ghi',
|
text: 'abc def ghi',
|
||||||
);
|
);
|
||||||
|
@ -137,22 +137,22 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
testWidgets("Theme has default IconThemeData, which is derived from the theme's primary color", (WidgetTester tester) async {
|
testWidgets("Theme has default IconThemeData, which is derived from the theme's primary color", (WidgetTester tester) async {
|
||||||
const Color primaryColor = CupertinoColors.destructiveRed;
|
const Color primaryColor = CupertinoColors.destructiveRed;
|
||||||
const CupertinoThemeData themeData = CupertinoThemeData(primaryColor: primaryColor);
|
const CupertinoThemeData themeData = CupertinoThemeData(primaryColor: primaryColor);
|
||||||
|
|
||||||
final IconThemeData resultingIconTheme = await testIconTheme(tester, themeData);
|
final IconThemeData resultingIconTheme = await testIconTheme(tester, themeData);
|
||||||
|
|
||||||
expect(resultingIconTheme.color, themeData.primaryColor);
|
expect(resultingIconTheme.color, themeData.primaryColor);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('IconTheme.of creates a dependency on iconTheme', (WidgetTester tester) async {
|
testWidgets('IconTheme.of creates a dependency on iconTheme', (WidgetTester tester) async {
|
||||||
IconThemeData iconTheme = await testIconTheme(tester, const CupertinoThemeData(primaryColor: CupertinoColors.destructiveRed));
|
IconThemeData iconTheme = await testIconTheme(tester, const CupertinoThemeData(primaryColor: CupertinoColors.destructiveRed));
|
||||||
|
|
||||||
expect(buildCount, 1);
|
expect(buildCount, 1);
|
||||||
expect(iconTheme.color, CupertinoColors.destructiveRed);
|
expect(iconTheme.color, CupertinoColors.destructiveRed);
|
||||||
|
|
||||||
iconTheme = await testIconTheme(tester, const CupertinoThemeData(primaryColor: CupertinoColors.activeOrange));
|
iconTheme = await testIconTheme(tester, const CupertinoThemeData(primaryColor: CupertinoColors.activeOrange));
|
||||||
expect(buildCount, 2);
|
expect(buildCount, 2);
|
||||||
expect(iconTheme.color, CupertinoColors.activeOrange);
|
expect(iconTheme.color, CupertinoColors.activeOrange);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,10 @@ void main() {
|
|||||||
final VoidCallback listener = () { log.add('listener'); };
|
final VoidCallback listener = () { log.add('listener'); };
|
||||||
final VoidCallback listener1 = () { log.add('listener1'); };
|
final VoidCallback listener1 = () { log.add('listener1'); };
|
||||||
final VoidCallback listener2 = () { log.add('listener2'); };
|
final VoidCallback listener2 = () { log.add('listener2'); };
|
||||||
final VoidCallback badListener = () { log.add('badListener'); throw null; };
|
final VoidCallback badListener = () {
|
||||||
|
log.add('badListener');
|
||||||
|
throw null;
|
||||||
|
};
|
||||||
|
|
||||||
final TestNotifier test = TestNotifier();
|
final TestNotifier test = TestNotifier();
|
||||||
|
|
||||||
|
@ -60,8 +60,8 @@ Future<void> main() async {
|
|||||||
library: 'error handling test',
|
library: 'error handling test',
|
||||||
context: ErrorDescription('testing the error handling logic'),
|
context: ErrorDescription('testing the error handling logic'),
|
||||||
informationCollector: () sync* {
|
informationCollector: () sync* {
|
||||||
yield ErrorDescription('line 1 of extra information');
|
yield ErrorDescription('line 1 of extra information');
|
||||||
yield ErrorHint('line 2 of extra information\n');
|
yield ErrorHint('line 2 of extra information\n');
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
expect(console.join('\n'), matches(
|
expect(console.join('\n'), matches(
|
||||||
|
@ -443,17 +443,26 @@ void main() {
|
|||||||
return ByteData(5); // 0x0000000000
|
return ByteData(5); // 0x0000000000
|
||||||
});
|
});
|
||||||
bool data;
|
bool data;
|
||||||
data = await rootBundle.loadStructuredData<bool>('test', (String value) async { expect(value, '\x00\x00\x00\x00\x00'); return true; });
|
data = await rootBundle.loadStructuredData<bool>('test', (String value) async {
|
||||||
|
expect(value, '\x00\x00\x00\x00\x00');
|
||||||
|
return true;
|
||||||
|
});
|
||||||
expect(data, isTrue);
|
expect(data, isTrue);
|
||||||
expect(completed, isTrue);
|
expect(completed, isTrue);
|
||||||
completed = false;
|
completed = false;
|
||||||
data = await rootBundle.loadStructuredData('test', (String value) async { expect(true, isFalse); return null; });
|
data = await rootBundle.loadStructuredData('test', (String value) async {
|
||||||
|
expect(true, isFalse);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
expect(data, isTrue);
|
expect(data, isTrue);
|
||||||
expect(completed, isFalse);
|
expect(completed, isFalse);
|
||||||
result = await binding.testExtension('evict', <String, String>{'value': 'test'});
|
result = await binding.testExtension('evict', <String, String>{'value': 'test'});
|
||||||
expect(result, <String, String>{'value': ''});
|
expect(result, <String, String>{'value': ''});
|
||||||
expect(completed, isFalse);
|
expect(completed, isFalse);
|
||||||
data = await rootBundle.loadStructuredData<bool>('test', (String value) async { expect(value, '\x00\x00\x00\x00\x00'); return false; });
|
data = await rootBundle.loadStructuredData<bool>('test', (String value) async {
|
||||||
|
expect(value, '\x00\x00\x00\x00\x00');
|
||||||
|
return false;
|
||||||
|
});
|
||||||
expect(data, isFalse);
|
expect(data, isFalse);
|
||||||
expect(completed, isTrue);
|
expect(completed, isTrue);
|
||||||
ServicesBinding.instance.defaultBinaryMessenger.setMockMessageHandler('flutter/assets', null);
|
ServicesBinding.instance.defaultBinaryMessenger.setMockMessageHandler('flutter/assets', null);
|
||||||
|
@ -894,266 +894,280 @@ void main() {
|
|||||||
recognized.clear();
|
recognized.clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
testGesture('On multiple pointers, DragGestureRecognizer is canceled '
|
testGesture(
|
||||||
'when all pointers are canceled (FIFO)', (GestureTester tester) {
|
'On multiple pointers, DragGestureRecognizer is canceled '
|
||||||
// This test simulates the following scenario:
|
'when all pointers are canceled (FIFO)',
|
||||||
// P1 down, P2 down, P1 up, P2 up
|
(GestureTester tester) {
|
||||||
final List<String> logs = <String>[];
|
// This test simulates the following scenario:
|
||||||
final HorizontalDragGestureRecognizer hori = HorizontalDragGestureRecognizer()
|
// P1 down, P2 down, P1 up, P2 up
|
||||||
..onDown = (DragDownDetails details) { logs.add('downH'); }
|
final List<String> logs = <String>[];
|
||||||
..onStart = (DragStartDetails details) { logs.add('startH'); }
|
final HorizontalDragGestureRecognizer hori = HorizontalDragGestureRecognizer()
|
||||||
..onUpdate = (DragUpdateDetails details) { logs.add('updateH'); }
|
..onDown = (DragDownDetails details) { logs.add('downH'); }
|
||||||
..onEnd = (DragEndDetails details) { logs.add('endH'); }
|
..onStart = (DragStartDetails details) { logs.add('startH'); }
|
||||||
..onCancel = () { logs.add('cancelH'); };
|
..onUpdate = (DragUpdateDetails details) { logs.add('updateH'); }
|
||||||
// Competitor
|
..onEnd = (DragEndDetails details) { logs.add('endH'); }
|
||||||
final TapGestureRecognizer vert = TapGestureRecognizer()
|
..onCancel = () { logs.add('cancelH'); };
|
||||||
..onTapDown = (TapDownDetails details) { logs.add('downT'); }
|
// Competitor
|
||||||
..onTapUp = (TapUpDetails details) { logs.add('upT'); }
|
final TapGestureRecognizer vert = TapGestureRecognizer()
|
||||||
..onTapCancel = () {};
|
..onTapDown = (TapDownDetails details) { logs.add('downT'); }
|
||||||
addTearDown(hori.dispose);
|
..onTapUp = (TapUpDetails details) { logs.add('upT'); }
|
||||||
addTearDown(vert.dispose);
|
..onTapCancel = () {};
|
||||||
|
addTearDown(hori.dispose);
|
||||||
|
addTearDown(vert.dispose);
|
||||||
|
|
||||||
final TestPointer pointer1 = TestPointer(4, PointerDeviceKind.touch);
|
final TestPointer pointer1 = TestPointer(4, PointerDeviceKind.touch);
|
||||||
final TestPointer pointer2 = TestPointer(5, PointerDeviceKind.touch);
|
final TestPointer pointer2 = TestPointer(5, PointerDeviceKind.touch);
|
||||||
|
|
||||||
final PointerDownEvent down1 = pointer1.down(const Offset(10.0, 10.0));
|
final PointerDownEvent down1 = pointer1.down(const Offset(10.0, 10.0));
|
||||||
final PointerDownEvent down2 = pointer2.down(const Offset(11.0, 10.0));
|
final PointerDownEvent down2 = pointer2.down(const Offset(11.0, 10.0));
|
||||||
|
|
||||||
hori.addPointer(down1);
|
hori.addPointer(down1);
|
||||||
vert.addPointer(down1);
|
vert.addPointer(down1);
|
||||||
tester.route(down1);
|
tester.route(down1);
|
||||||
tester.closeArena(pointer1.pointer);
|
tester.closeArena(pointer1.pointer);
|
||||||
expect(logs, <String>['downH']);
|
expect(logs, <String>['downH']);
|
||||||
logs.clear();
|
logs.clear();
|
||||||
|
|
||||||
hori.addPointer(down2);
|
hori.addPointer(down2);
|
||||||
vert.addPointer(down2);
|
vert.addPointer(down2);
|
||||||
tester.route(down2);
|
tester.route(down2);
|
||||||
tester.closeArena(pointer2.pointer);
|
tester.closeArena(pointer2.pointer);
|
||||||
expect(logs, <String>[]);
|
expect(logs, <String>[]);
|
||||||
logs.clear();
|
logs.clear();
|
||||||
|
|
||||||
tester.route(pointer1.up());
|
tester.route(pointer1.up());
|
||||||
GestureBinding.instance.gestureArena.sweep(pointer1.pointer);
|
GestureBinding.instance.gestureArena.sweep(pointer1.pointer);
|
||||||
expect(logs, <String>['downT', 'upT']);
|
expect(logs, <String>['downT', 'upT']);
|
||||||
logs.clear();
|
logs.clear();
|
||||||
|
|
||||||
tester.route(pointer2.up());
|
tester.route(pointer2.up());
|
||||||
GestureBinding.instance.gestureArena.sweep(pointer2.pointer);
|
GestureBinding.instance.gestureArena.sweep(pointer2.pointer);
|
||||||
expect(logs, <String>['cancelH']);
|
expect(logs, <String>['cancelH']);
|
||||||
logs.clear();
|
logs.clear();
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
testGesture('On multiple pointers, DragGestureRecognizer is canceled '
|
testGesture(
|
||||||
'when all pointers are canceled (FILO)', (GestureTester tester) {
|
'On multiple pointers, DragGestureRecognizer is canceled '
|
||||||
// This test simulates the following scenario:
|
'when all pointers are canceled (FILO)',
|
||||||
// P1 down, P2 down, P1 up, P2 up
|
(GestureTester tester) {
|
||||||
final List<String> logs = <String>[];
|
// This test simulates the following scenario:
|
||||||
final HorizontalDragGestureRecognizer hori = HorizontalDragGestureRecognizer()
|
// P1 down, P2 down, P1 up, P2 up
|
||||||
..onDown = (DragDownDetails details) { logs.add('downH'); }
|
final List<String> logs = <String>[];
|
||||||
..onStart = (DragStartDetails details) { logs.add('startH'); }
|
final HorizontalDragGestureRecognizer hori = HorizontalDragGestureRecognizer()
|
||||||
..onUpdate = (DragUpdateDetails details) { logs.add('updateH'); }
|
..onDown = (DragDownDetails details) { logs.add('downH'); }
|
||||||
..onEnd = (DragEndDetails details) { logs.add('endH'); }
|
..onStart = (DragStartDetails details) { logs.add('startH'); }
|
||||||
..onCancel = () { logs.add('cancelH'); };
|
..onUpdate = (DragUpdateDetails details) { logs.add('updateH'); }
|
||||||
// Competitor
|
..onEnd = (DragEndDetails details) { logs.add('endH'); }
|
||||||
final TapGestureRecognizer vert = TapGestureRecognizer()
|
..onCancel = () { logs.add('cancelH'); };
|
||||||
..onTapDown = (TapDownDetails details) { logs.add('downT'); }
|
// Competitor
|
||||||
..onTapUp = (TapUpDetails details) { logs.add('upT'); }
|
final TapGestureRecognizer vert = TapGestureRecognizer()
|
||||||
..onTapCancel = () {};
|
..onTapDown = (TapDownDetails details) { logs.add('downT'); }
|
||||||
addTearDown(hori.dispose);
|
..onTapUp = (TapUpDetails details) { logs.add('upT'); }
|
||||||
addTearDown(vert.dispose);
|
..onTapCancel = () {};
|
||||||
|
addTearDown(hori.dispose);
|
||||||
|
addTearDown(vert.dispose);
|
||||||
|
|
||||||
final TestPointer pointer1 = TestPointer(4, PointerDeviceKind.touch);
|
final TestPointer pointer1 = TestPointer(4, PointerDeviceKind.touch);
|
||||||
final TestPointer pointer2 = TestPointer(5, PointerDeviceKind.touch);
|
final TestPointer pointer2 = TestPointer(5, PointerDeviceKind.touch);
|
||||||
|
|
||||||
final PointerDownEvent down1 = pointer1.down(const Offset(10.0, 10.0));
|
final PointerDownEvent down1 = pointer1.down(const Offset(10.0, 10.0));
|
||||||
final PointerDownEvent down2 = pointer2.down(const Offset(11.0, 10.0));
|
final PointerDownEvent down2 = pointer2.down(const Offset(11.0, 10.0));
|
||||||
|
|
||||||
hori.addPointer(down1);
|
hori.addPointer(down1);
|
||||||
vert.addPointer(down1);
|
vert.addPointer(down1);
|
||||||
tester.route(down1);
|
tester.route(down1);
|
||||||
tester.closeArena(pointer1.pointer);
|
tester.closeArena(pointer1.pointer);
|
||||||
expect(logs, <String>['downH']);
|
expect(logs, <String>['downH']);
|
||||||
logs.clear();
|
logs.clear();
|
||||||
|
|
||||||
hori.addPointer(down2);
|
hori.addPointer(down2);
|
||||||
vert.addPointer(down2);
|
vert.addPointer(down2);
|
||||||
tester.route(down2);
|
tester.route(down2);
|
||||||
tester.closeArena(pointer2.pointer);
|
tester.closeArena(pointer2.pointer);
|
||||||
expect(logs, <String>[]);
|
expect(logs, <String>[]);
|
||||||
logs.clear();
|
logs.clear();
|
||||||
|
|
||||||
tester.route(pointer2.up());
|
tester.route(pointer2.up());
|
||||||
GestureBinding.instance.gestureArena.sweep(pointer2.pointer);
|
GestureBinding.instance.gestureArena.sweep(pointer2.pointer);
|
||||||
// Tap is not triggered because pointer2 is not its primary pointer
|
// Tap is not triggered because pointer2 is not its primary pointer
|
||||||
expect(logs, <String>[]);
|
expect(logs, <String>[]);
|
||||||
logs.clear();
|
logs.clear();
|
||||||
|
|
||||||
tester.route(pointer1.up());
|
tester.route(pointer1.up());
|
||||||
GestureBinding.instance.gestureArena.sweep(pointer1.pointer);
|
GestureBinding.instance.gestureArena.sweep(pointer1.pointer);
|
||||||
expect(logs, <String>['cancelH', 'downT', 'upT']);
|
expect(logs, <String>['cancelH', 'downT', 'upT']);
|
||||||
logs.clear();
|
logs.clear();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
});
|
testGesture(
|
||||||
|
'On multiple pointers, DragGestureRecognizer is accepted when the '
|
||||||
|
'first pointer is accepted',
|
||||||
|
(GestureTester tester) {
|
||||||
|
// This test simulates the following scenario:
|
||||||
|
// P1 down, P2 down, P1 moves away, P2 up
|
||||||
|
final List<String> logs = <String>[];
|
||||||
|
final HorizontalDragGestureRecognizer hori = HorizontalDragGestureRecognizer()
|
||||||
|
..onDown = (DragDownDetails details) { logs.add('downH'); }
|
||||||
|
..onStart = (DragStartDetails details) { logs.add('startH'); }
|
||||||
|
..onUpdate = (DragUpdateDetails details) { logs.add('updateH'); }
|
||||||
|
..onEnd = (DragEndDetails details) { logs.add('endH'); }
|
||||||
|
..onCancel = () { logs.add('cancelH'); };
|
||||||
|
// Competitor
|
||||||
|
final TapGestureRecognizer vert = TapGestureRecognizer()
|
||||||
|
..onTapDown = (TapDownDetails details) { logs.add('downT'); }
|
||||||
|
..onTapUp = (TapUpDetails details) { logs.add('upT'); }
|
||||||
|
..onTapCancel = () {};
|
||||||
|
addTearDown(hori.dispose);
|
||||||
|
addTearDown(vert.dispose);
|
||||||
|
|
||||||
testGesture('On multiple pointers, DragGestureRecognizer is accepted when the '
|
final TestPointer pointer1 = TestPointer(4, PointerDeviceKind.touch);
|
||||||
'first pointer is accepted', (GestureTester tester) {
|
final TestPointer pointer2 = TestPointer(5, PointerDeviceKind.touch);
|
||||||
// This test simulates the following scenario:
|
|
||||||
// P1 down, P2 down, P1 moves away, P2 up
|
|
||||||
final List<String> logs = <String>[];
|
|
||||||
final HorizontalDragGestureRecognizer hori = HorizontalDragGestureRecognizer()
|
|
||||||
..onDown = (DragDownDetails details) { logs.add('downH'); }
|
|
||||||
..onStart = (DragStartDetails details) { logs.add('startH'); }
|
|
||||||
..onUpdate = (DragUpdateDetails details) { logs.add('updateH'); }
|
|
||||||
..onEnd = (DragEndDetails details) { logs.add('endH'); }
|
|
||||||
..onCancel = () { logs.add('cancelH'); };
|
|
||||||
// Competitor
|
|
||||||
final TapGestureRecognizer vert = TapGestureRecognizer()
|
|
||||||
..onTapDown = (TapDownDetails details) { logs.add('downT'); }
|
|
||||||
..onTapUp = (TapUpDetails details) { logs.add('upT'); }
|
|
||||||
..onTapCancel = () {};
|
|
||||||
addTearDown(hori.dispose);
|
|
||||||
addTearDown(vert.dispose);
|
|
||||||
|
|
||||||
final TestPointer pointer1 = TestPointer(4, PointerDeviceKind.touch);
|
final PointerDownEvent down1 = pointer1.down(const Offset(10.0, 10.0));
|
||||||
final TestPointer pointer2 = TestPointer(5, PointerDeviceKind.touch);
|
final PointerDownEvent down2 = pointer2.down(const Offset(11.0, 10.0));
|
||||||
|
|
||||||
final PointerDownEvent down1 = pointer1.down(const Offset(10.0, 10.0));
|
hori.addPointer(down1);
|
||||||
final PointerDownEvent down2 = pointer2.down(const Offset(11.0, 10.0));
|
vert.addPointer(down1);
|
||||||
|
tester.route(down1);
|
||||||
|
tester.closeArena(pointer1.pointer);
|
||||||
|
expect(logs, <String>['downH']);
|
||||||
|
logs.clear();
|
||||||
|
|
||||||
hori.addPointer(down1);
|
hori.addPointer(down2);
|
||||||
vert.addPointer(down1);
|
vert.addPointer(down2);
|
||||||
tester.route(down1);
|
tester.route(down2);
|
||||||
tester.closeArena(pointer1.pointer);
|
tester.closeArena(pointer2.pointer);
|
||||||
expect(logs, <String>['downH']);
|
expect(logs, <String>[]);
|
||||||
logs.clear();
|
logs.clear();
|
||||||
|
|
||||||
hori.addPointer(down2);
|
tester.route(pointer1.move(const Offset(100, 100)));
|
||||||
vert.addPointer(down2);
|
expect(logs, <String>['startH']);
|
||||||
tester.route(down2);
|
logs.clear();
|
||||||
tester.closeArena(pointer2.pointer);
|
|
||||||
expect(logs, <String>[]);
|
|
||||||
logs.clear();
|
|
||||||
|
|
||||||
tester.route(pointer1.move(const Offset(100, 100)));
|
tester.route(pointer2.up());
|
||||||
expect(logs, <String>['startH']);
|
GestureBinding.instance.gestureArena.sweep(pointer2.pointer);
|
||||||
logs.clear();
|
expect(logs, <String>[]);
|
||||||
|
logs.clear();
|
||||||
|
|
||||||
tester.route(pointer2.up());
|
tester.route(pointer1.up());
|
||||||
GestureBinding.instance.gestureArena.sweep(pointer2.pointer);
|
GestureBinding.instance.gestureArena.sweep(pointer1.pointer);
|
||||||
expect(logs, <String>[]);
|
expect(logs, <String>['endH']);
|
||||||
logs.clear();
|
logs.clear();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
tester.route(pointer1.up());
|
testGesture(
|
||||||
GestureBinding.instance.gestureArena.sweep(pointer1.pointer);
|
'On multiple pointers, canceled pointers (due to up) do not '
|
||||||
expect(logs, <String>['endH']);
|
'prevent later pointers getting accepted',
|
||||||
logs.clear();
|
(GestureTester tester) {
|
||||||
});
|
// This test simulates the following scenario:
|
||||||
|
// P1 down, P2 down, P1 Up, P2 moves away
|
||||||
|
final List<String> logs = <String>[];
|
||||||
|
final HorizontalDragGestureRecognizer hori = HorizontalDragGestureRecognizer()
|
||||||
|
..onDown = (DragDownDetails details) { logs.add('downH'); }
|
||||||
|
..onStart = (DragStartDetails details) { logs.add('startH'); }
|
||||||
|
..onUpdate = (DragUpdateDetails details) { logs.add('updateH'); }
|
||||||
|
..onEnd = (DragEndDetails details) { logs.add('endH'); }
|
||||||
|
..onCancel = () { logs.add('cancelH'); };
|
||||||
|
// Competitor
|
||||||
|
final TapGestureRecognizer vert = TapGestureRecognizer()
|
||||||
|
..onTapDown = (TapDownDetails details) { logs.add('downT'); }
|
||||||
|
..onTapUp = (TapUpDetails details) { logs.add('upT'); }
|
||||||
|
..onTapCancel = () {};
|
||||||
|
addTearDown(hori.dispose);
|
||||||
|
addTearDown(vert.dispose);
|
||||||
|
|
||||||
testGesture('On multiple pointers, canceled pointers (due to up) do not '
|
final TestPointer pointer1 = TestPointer(4, PointerDeviceKind.touch);
|
||||||
'prevent later pointers getting accepted', (GestureTester tester) {
|
final TestPointer pointer2 = TestPointer(5, PointerDeviceKind.touch);
|
||||||
// This test simulates the following scenario:
|
|
||||||
// P1 down, P2 down, P1 Up, P2 moves away
|
|
||||||
final List<String> logs = <String>[];
|
|
||||||
final HorizontalDragGestureRecognizer hori = HorizontalDragGestureRecognizer()
|
|
||||||
..onDown = (DragDownDetails details) { logs.add('downH'); }
|
|
||||||
..onStart = (DragStartDetails details) { logs.add('startH'); }
|
|
||||||
..onUpdate = (DragUpdateDetails details) { logs.add('updateH'); }
|
|
||||||
..onEnd = (DragEndDetails details) { logs.add('endH'); }
|
|
||||||
..onCancel = () { logs.add('cancelH'); };
|
|
||||||
// Competitor
|
|
||||||
final TapGestureRecognizer vert = TapGestureRecognizer()
|
|
||||||
..onTapDown = (TapDownDetails details) { logs.add('downT'); }
|
|
||||||
..onTapUp = (TapUpDetails details) { logs.add('upT'); }
|
|
||||||
..onTapCancel = () {};
|
|
||||||
addTearDown(hori.dispose);
|
|
||||||
addTearDown(vert.dispose);
|
|
||||||
|
|
||||||
final TestPointer pointer1 = TestPointer(4, PointerDeviceKind.touch);
|
final PointerDownEvent down1 = pointer1.down(const Offset(10.0, 10.0));
|
||||||
final TestPointer pointer2 = TestPointer(5, PointerDeviceKind.touch);
|
final PointerDownEvent down2 = pointer2.down(const Offset(11.0, 10.0));
|
||||||
|
|
||||||
final PointerDownEvent down1 = pointer1.down(const Offset(10.0, 10.0));
|
hori.addPointer(down1);
|
||||||
final PointerDownEvent down2 = pointer2.down(const Offset(11.0, 10.0));
|
vert.addPointer(down1);
|
||||||
|
tester.route(down1);
|
||||||
|
tester.closeArena(pointer1.pointer);
|
||||||
|
expect(logs, <String>['downH']);
|
||||||
|
logs.clear();
|
||||||
|
|
||||||
hori.addPointer(down1);
|
hori.addPointer(down2);
|
||||||
vert.addPointer(down1);
|
vert.addPointer(down2);
|
||||||
tester.route(down1);
|
tester.route(down2);
|
||||||
tester.closeArena(pointer1.pointer);
|
tester.closeArena(pointer2.pointer);
|
||||||
expect(logs, <String>['downH']);
|
expect(logs, <String>[]);
|
||||||
logs.clear();
|
logs.clear();
|
||||||
|
|
||||||
hori.addPointer(down2);
|
tester.route(pointer1.up());
|
||||||
vert.addPointer(down2);
|
GestureBinding.instance.gestureArena.sweep(pointer1.pointer);
|
||||||
tester.route(down2);
|
expect(logs, <String>['downT', 'upT']);
|
||||||
tester.closeArena(pointer2.pointer);
|
logs.clear();
|
||||||
expect(logs, <String>[]);
|
|
||||||
logs.clear();
|
|
||||||
|
|
||||||
tester.route(pointer1.up());
|
tester.route(pointer2.move(const Offset(100, 100)));
|
||||||
GestureBinding.instance.gestureArena.sweep(pointer1.pointer);
|
expect(logs, <String>['startH']);
|
||||||
expect(logs, <String>['downT', 'upT']);
|
logs.clear();
|
||||||
logs.clear();
|
|
||||||
|
|
||||||
tester.route(pointer2.move(const Offset(100, 100)));
|
tester.route(pointer2.up());
|
||||||
expect(logs, <String>['startH']);
|
GestureBinding.instance.gestureArena.sweep(pointer2.pointer);
|
||||||
logs.clear();
|
expect(logs, <String>['endH']);
|
||||||
|
logs.clear();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
tester.route(pointer2.up());
|
testGesture(
|
||||||
GestureBinding.instance.gestureArena.sweep(pointer2.pointer);
|
'On multiple pointers, canceled pointers (due to buttons) do not '
|
||||||
expect(logs, <String>['endH']);
|
'prevent later pointers getting accepted',
|
||||||
logs.clear();
|
(GestureTester tester) {
|
||||||
});
|
// This test simulates the following scenario:
|
||||||
|
// P1 down, P2 down, P1 change buttons, P2 moves away
|
||||||
|
final List<String> logs = <String>[];
|
||||||
|
final HorizontalDragGestureRecognizer hori = HorizontalDragGestureRecognizer()
|
||||||
|
..onDown = (DragDownDetails details) { logs.add('downH'); }
|
||||||
|
..onStart = (DragStartDetails details) { logs.add('startH'); }
|
||||||
|
..onUpdate = (DragUpdateDetails details) { logs.add('updateH'); }
|
||||||
|
..onEnd = (DragEndDetails details) { logs.add('endH'); }
|
||||||
|
..onCancel = () { logs.add('cancelH'); };
|
||||||
|
// Competitor
|
||||||
|
final TapGestureRecognizer vert = TapGestureRecognizer()
|
||||||
|
..onTapDown = (TapDownDetails details) { logs.add('downT'); }
|
||||||
|
..onTapUp = (TapUpDetails details) { logs.add('upT'); }
|
||||||
|
..onTapCancel = () {};
|
||||||
|
addTearDown(hori.dispose);
|
||||||
|
addTearDown(vert.dispose);
|
||||||
|
|
||||||
testGesture('On multiple pointers, canceled pointers (due to buttons) do not '
|
final TestPointer pointer1 = TestPointer(1, PointerDeviceKind.touch);
|
||||||
'prevent later pointers getting accepted', (GestureTester tester) {
|
final TestPointer pointer2 = TestPointer(2, PointerDeviceKind.touch);
|
||||||
// This test simulates the following scenario:
|
|
||||||
// P1 down, P2 down, P1 change buttons, P2 moves away
|
|
||||||
final List<String> logs = <String>[];
|
|
||||||
final HorizontalDragGestureRecognizer hori = HorizontalDragGestureRecognizer()
|
|
||||||
..onDown = (DragDownDetails details) { logs.add('downH'); }
|
|
||||||
..onStart = (DragStartDetails details) { logs.add('startH'); }
|
|
||||||
..onUpdate = (DragUpdateDetails details) { logs.add('updateH'); }
|
|
||||||
..onEnd = (DragEndDetails details) { logs.add('endH'); }
|
|
||||||
..onCancel = () { logs.add('cancelH'); };
|
|
||||||
// Competitor
|
|
||||||
final TapGestureRecognizer vert = TapGestureRecognizer()
|
|
||||||
..onTapDown = (TapDownDetails details) { logs.add('downT'); }
|
|
||||||
..onTapUp = (TapUpDetails details) { logs.add('upT'); }
|
|
||||||
..onTapCancel = () {};
|
|
||||||
addTearDown(hori.dispose);
|
|
||||||
addTearDown(vert.dispose);
|
|
||||||
|
|
||||||
final TestPointer pointer1 = TestPointer(1, PointerDeviceKind.touch);
|
final PointerDownEvent down1 = pointer1.down(const Offset(10.0, 10.0));
|
||||||
final TestPointer pointer2 = TestPointer(2, PointerDeviceKind.touch);
|
final PointerDownEvent down2 = pointer2.down(const Offset(11.0, 10.0));
|
||||||
|
|
||||||
final PointerDownEvent down1 = pointer1.down(const Offset(10.0, 10.0));
|
hori.addPointer(down1);
|
||||||
final PointerDownEvent down2 = pointer2.down(const Offset(11.0, 10.0));
|
vert.addPointer(down1);
|
||||||
|
tester.route(down1);
|
||||||
|
tester.closeArena(pointer1.pointer);
|
||||||
|
|
||||||
hori.addPointer(down1);
|
hori.addPointer(down2);
|
||||||
vert.addPointer(down1);
|
vert.addPointer(down2);
|
||||||
tester.route(down1);
|
tester.route(down2);
|
||||||
tester.closeArena(pointer1.pointer);
|
tester.closeArena(pointer2.pointer);
|
||||||
|
expect(logs, <String>['downH']);
|
||||||
|
logs.clear();
|
||||||
|
|
||||||
hori.addPointer(down2);
|
// Pointer 1 changes buttons, which cancel tap, leaving drag the only
|
||||||
vert.addPointer(down2);
|
// remaining member of arena 1, therefore drag is accepted.
|
||||||
tester.route(down2);
|
tester.route(pointer1.move(const Offset(9.9, 9.9), buttons: kSecondaryButton));
|
||||||
tester.closeArena(pointer2.pointer);
|
expect(logs, <String>['startH']);
|
||||||
expect(logs, <String>['downH']);
|
logs.clear();
|
||||||
logs.clear();
|
|
||||||
|
|
||||||
// Pointer 1 changes buttons, which cancel tap, leaving drag the only
|
tester.route(pointer2.move(const Offset(100, 100)));
|
||||||
// remaining member of arena 1, therefore drag is accepted.
|
expect(logs, <String>['updateH']);
|
||||||
tester.route(pointer1.move(const Offset(9.9, 9.9), buttons: kSecondaryButton));
|
logs.clear();
|
||||||
expect(logs, <String>['startH']);
|
|
||||||
logs.clear();
|
|
||||||
|
|
||||||
tester.route(pointer2.move(const Offset(100, 100)));
|
tester.route(pointer2.up());
|
||||||
expect(logs, <String>['updateH']);
|
GestureBinding.instance.gestureArena.sweep(pointer2.pointer);
|
||||||
logs.clear();
|
expect(logs, <String>['endH']);
|
||||||
|
logs.clear();
|
||||||
tester.route(pointer2.up());
|
},
|
||||||
GestureBinding.instance.gestureArena.sweep(pointer2.pointer);
|
);
|
||||||
expect(logs, <String>['endH']);
|
|
||||||
logs.clear();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ void main() {
|
|||||||
isInHitRegionTwo = false;
|
isInHitRegionTwo = false;
|
||||||
tracker = MouseTracker(
|
tracker = MouseTracker(
|
||||||
GestureBinding.instance.pointerRouter,
|
GestureBinding.instance.pointerRouter,
|
||||||
(Offset _) sync* {
|
(Offset _) sync* {
|
||||||
if (isInHitRegionOne)
|
if (isInHitRegionOne)
|
||||||
yield annotation;
|
yield annotation;
|
||||||
else if (isInHitRegionTwo)
|
else if (isInHitRegionTwo)
|
||||||
|
@ -35,34 +35,34 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('BackButton onPressed overrides default pop behavior', (WidgetTester tester) async {
|
testWidgets('BackButton onPressed overrides default pop behavior', (WidgetTester tester) async {
|
||||||
bool backPressed = false;
|
bool backPressed = false;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: const Material(child: Text('Home')),
|
home: const Material(child: Text('Home')),
|
||||||
routes: <String, WidgetBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/next': (BuildContext context) {
|
'/next': (BuildContext context) {
|
||||||
return Material(
|
return Material(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: BackButton(onPressed: () => backPressed = true),
|
child: BackButton(onPressed: () => backPressed = true),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
|
||||||
},
|
},
|
||||||
)
|
},
|
||||||
);
|
)
|
||||||
|
);
|
||||||
|
|
||||||
tester.state<NavigatorState>(find.byType(Navigator)).pushNamed('/next');
|
tester.state<NavigatorState>(find.byType(Navigator)).pushNamed('/next');
|
||||||
|
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
await tester.tap(find.byType(BackButton));
|
await tester.tap(find.byType(BackButton));
|
||||||
|
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
// We're still on the second page.
|
// We're still on the second page.
|
||||||
expect(find.text('Home'), findsNothing);
|
expect(find.text('Home'), findsNothing);
|
||||||
// But the custom callback is called.
|
// But the custom callback is called.
|
||||||
expect(backPressed, true);
|
expect(backPressed, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('BackButton icon', (WidgetTester tester) async {
|
testWidgets('BackButton icon', (WidgetTester tester) async {
|
||||||
|
@ -239,145 +239,157 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'Chip does not constrain size of label widget if it does not exceed '
|
'Chip does not constrain size of label widget if it does not exceed '
|
||||||
'the available space', (WidgetTester tester) async {
|
'the available space',
|
||||||
const double labelWidth = 50.0;
|
(WidgetTester tester) async {
|
||||||
const double labelHeight = 30.0;
|
const double labelWidth = 50.0;
|
||||||
final Key labelKey = UniqueKey();
|
const double labelHeight = 30.0;
|
||||||
|
final Key labelKey = UniqueKey();
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
_wrapForChip(
|
_wrapForChip(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 500.0,
|
width: 500.0,
|
||||||
height: 500.0,
|
height: 500.0,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Chip(
|
Chip(
|
||||||
label: Container(
|
label: Container(
|
||||||
key: labelKey,
|
key: labelKey,
|
||||||
width: labelWidth,
|
width: labelWidth,
|
||||||
height: labelHeight,
|
height: labelHeight,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
final Size labelSize = tester.getSize(find.byKey(labelKey));
|
|
||||||
expect(labelSize.width, labelWidth);
|
|
||||||
expect(labelSize.height, labelHeight);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets(
|
|
||||||
'Chip constrains the size of the label widget when it exceeds the '
|
|
||||||
'available space', (WidgetTester tester) async {
|
|
||||||
await _testConstrainedLabel(tester);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets(
|
|
||||||
'Chip constrains the size of the label widget when it exceeds the '
|
|
||||||
'available space and the avatar is present', (WidgetTester tester) async {
|
|
||||||
await _testConstrainedLabel(
|
|
||||||
tester,
|
|
||||||
avatar: const CircleAvatar(child: Text('A')),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets(
|
|
||||||
'Chip constrains the size of the label widget when it exceeds the '
|
|
||||||
'available space and the delete icon is present', (WidgetTester tester) async {
|
|
||||||
await _testConstrainedLabel(
|
|
||||||
tester,
|
|
||||||
onDeleted: () { },
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets(
|
|
||||||
'Chip constrains the size of the label widget when it exceeds the '
|
|
||||||
'available space and both avatar and delete icons are present', (WidgetTester tester) async {
|
|
||||||
await _testConstrainedLabel(
|
|
||||||
tester,
|
|
||||||
avatar: const CircleAvatar(child: Text('A')),
|
|
||||||
onDeleted: () { },
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets(
|
|
||||||
'Chip constrains the avatar, label, and delete icons to the bounds of '
|
|
||||||
'the chip when it exceeds the available space', (WidgetTester tester) async {
|
|
||||||
// Regression test for https://github.com/flutter/flutter/issues/11523
|
|
||||||
Widget chipBuilder (String text, {Widget avatar, VoidCallback onDeleted}) {
|
|
||||||
return MaterialApp(
|
|
||||||
home: Scaffold(
|
|
||||||
body: Container(
|
|
||||||
width: 150,
|
|
||||||
child: Column(
|
|
||||||
children: <Widget>[
|
|
||||||
Chip(
|
|
||||||
avatar: avatar,
|
|
||||||
label: Text(text),
|
|
||||||
onDeleted: onDeleted,
|
|
||||||
),
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
void chipRectContains(Rect chipRect, Rect rect) {
|
final Size labelSize = tester.getSize(find.byKey(labelKey));
|
||||||
expect(chipRect.contains(rect.topLeft), true);
|
expect(labelSize.width, labelWidth);
|
||||||
expect(chipRect.contains(rect.topRight), true);
|
expect(labelSize.height, labelHeight);
|
||||||
expect(chipRect.contains(rect.bottomLeft), true);
|
},
|
||||||
expect(chipRect.contains(rect.bottomRight), true);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
Rect chipRect;
|
testWidgets(
|
||||||
Rect avatarRect;
|
'Chip constrains the size of the label widget when it exceeds the '
|
||||||
Rect labelRect;
|
'available space',
|
||||||
Rect deleteIconRect;
|
(WidgetTester tester) async {
|
||||||
const String text = 'Very long text that will be clipped';
|
await _testConstrainedLabel(tester);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
await tester.pumpWidget(chipBuilder(text));
|
testWidgets(
|
||||||
|
'Chip constrains the size of the label widget when it exceeds the '
|
||||||
|
'available space and the avatar is present',
|
||||||
|
(WidgetTester tester) async {
|
||||||
|
await _testConstrainedLabel(
|
||||||
|
tester,
|
||||||
|
avatar: const CircleAvatar(child: Text('A')),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
chipRect = tester.getRect(find.byType(Chip));
|
testWidgets(
|
||||||
labelRect = tester.getRect(find.text(text));
|
'Chip constrains the size of the label widget when it exceeds the '
|
||||||
chipRectContains(chipRect, labelRect);
|
'available space and the delete icon is present',
|
||||||
|
(WidgetTester tester) async {
|
||||||
|
await _testConstrainedLabel(
|
||||||
|
tester,
|
||||||
|
onDeleted: () { },
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
await tester.pumpWidget(chipBuilder(
|
testWidgets(
|
||||||
text,
|
'Chip constrains the size of the label widget when it exceeds the '
|
||||||
avatar: const CircleAvatar(child: Text('A')),
|
'available space and both avatar and delete icons are present',
|
||||||
));
|
(WidgetTester tester) async {
|
||||||
await tester.pumpAndSettle();
|
await _testConstrainedLabel(
|
||||||
|
tester,
|
||||||
|
avatar: const CircleAvatar(child: Text('A')),
|
||||||
|
onDeleted: () { },
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
chipRect = tester.getRect(find.byType(Chip));
|
testWidgets(
|
||||||
avatarRect = tester.getRect(find.byType(CircleAvatar));
|
'Chip constrains the avatar, label, and delete icons to the bounds of '
|
||||||
chipRectContains(chipRect, avatarRect);
|
'the chip when it exceeds the available space',
|
||||||
|
(WidgetTester tester) async {
|
||||||
|
// Regression test for https://github.com/flutter/flutter/issues/11523
|
||||||
|
Widget chipBuilder (String text, {Widget avatar, VoidCallback onDeleted}) {
|
||||||
|
return MaterialApp(
|
||||||
|
home: Scaffold(
|
||||||
|
body: Container(
|
||||||
|
width: 150,
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Chip(
|
||||||
|
avatar: avatar,
|
||||||
|
label: Text(text),
|
||||||
|
onDeleted: onDeleted,
|
||||||
|
),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
labelRect = tester.getRect(find.text(text));
|
void chipRectContains(Rect chipRect, Rect rect) {
|
||||||
chipRectContains(chipRect, labelRect);
|
expect(chipRect.contains(rect.topLeft), true);
|
||||||
|
expect(chipRect.contains(rect.topRight), true);
|
||||||
|
expect(chipRect.contains(rect.bottomLeft), true);
|
||||||
|
expect(chipRect.contains(rect.bottomRight), true);
|
||||||
|
}
|
||||||
|
|
||||||
await tester.pumpWidget(chipBuilder(
|
Rect chipRect;
|
||||||
text,
|
Rect avatarRect;
|
||||||
avatar: const CircleAvatar(child: Text('A')),
|
Rect labelRect;
|
||||||
onDeleted: () {},
|
Rect deleteIconRect;
|
||||||
));
|
const String text = 'Very long text that will be clipped';
|
||||||
await tester.pumpAndSettle();
|
|
||||||
|
|
||||||
chipRect = tester.getRect(find.byType(Chip));
|
await tester.pumpWidget(chipBuilder(text));
|
||||||
avatarRect = tester.getRect(find.byType(CircleAvatar));
|
|
||||||
chipRectContains(chipRect, avatarRect);
|
|
||||||
|
|
||||||
labelRect = tester.getRect(find.text(text));
|
chipRect = tester.getRect(find.byType(Chip));
|
||||||
chipRectContains(chipRect, labelRect);
|
labelRect = tester.getRect(find.text(text));
|
||||||
|
chipRectContains(chipRect, labelRect);
|
||||||
|
|
||||||
deleteIconRect = tester.getRect(find.byIcon(Icons.cancel));
|
await tester.pumpWidget(chipBuilder(
|
||||||
chipRectContains(chipRect, deleteIconRect);
|
text,
|
||||||
});
|
avatar: const CircleAvatar(child: Text('A')),
|
||||||
|
));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
chipRect = tester.getRect(find.byType(Chip));
|
||||||
|
avatarRect = tester.getRect(find.byType(CircleAvatar));
|
||||||
|
chipRectContains(chipRect, avatarRect);
|
||||||
|
|
||||||
|
labelRect = tester.getRect(find.text(text));
|
||||||
|
chipRectContains(chipRect, labelRect);
|
||||||
|
|
||||||
|
await tester.pumpWidget(chipBuilder(
|
||||||
|
text,
|
||||||
|
avatar: const CircleAvatar(child: Text('A')),
|
||||||
|
onDeleted: () {},
|
||||||
|
));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
chipRect = tester.getRect(find.byType(Chip));
|
||||||
|
avatarRect = tester.getRect(find.byType(CircleAvatar));
|
||||||
|
chipRectContains(chipRect, avatarRect);
|
||||||
|
|
||||||
|
labelRect = tester.getRect(find.text(text));
|
||||||
|
chipRectContains(chipRect, labelRect);
|
||||||
|
|
||||||
|
deleteIconRect = tester.getRect(find.byIcon(Icons.cancel));
|
||||||
|
chipRectContains(chipRect, deleteIconRect);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
testWidgets('Chip in row works ok', (WidgetTester tester) async {
|
testWidgets('Chip in row works ok', (WidgetTester tester) async {
|
||||||
const TextStyle style = TextStyle(fontFamily: 'Ahem', fontSize: 10.0);
|
const TextStyle style = TextStyle(fontFamily: 'Ahem', fontSize: 10.0);
|
||||||
@ -807,12 +819,12 @@ void main() {
|
|||||||
StatefulBuilder(builder: (BuildContext context, StateSetter setState) {
|
StatefulBuilder(builder: (BuildContext context, StateSetter setState) {
|
||||||
return RawChip(
|
return RawChip(
|
||||||
onDeleted: deletable
|
onDeleted: deletable
|
||||||
? () {
|
? () {
|
||||||
setState(() {
|
setState(() {
|
||||||
wasDeleted = true;
|
wasDeleted = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
deleteIcon: Container(width: 40.0, height: 40.0, key: deleteButtonKey),
|
deleteIcon: Container(width: 40.0, height: 40.0, key: deleteButtonKey),
|
||||||
label: Text('Chip', key: labelKey),
|
label: Text('Chip', key: labelKey),
|
||||||
shape: const StadiumBorder(),
|
shape: const StadiumBorder(),
|
||||||
@ -923,12 +935,12 @@ void main() {
|
|||||||
return RawChip(
|
return RawChip(
|
||||||
avatar: avatar,
|
avatar: avatar,
|
||||||
onSelected: selectable != null
|
onSelected: selectable != null
|
||||||
? (bool value) {
|
? (bool value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
selected = value;
|
selected = value;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
selected: selected,
|
selected: selected,
|
||||||
label: Text('Chip', key: labelKey),
|
label: Text('Chip', key: labelKey),
|
||||||
shape: const StadiumBorder(),
|
shape: const StadiumBorder(),
|
||||||
@ -1005,12 +1017,12 @@ void main() {
|
|||||||
StatefulBuilder(builder: (BuildContext context, StateSetter setState) {
|
StatefulBuilder(builder: (BuildContext context, StateSetter setState) {
|
||||||
return RawChip(
|
return RawChip(
|
||||||
onSelected: selectable != null
|
onSelected: selectable != null
|
||||||
? (bool value) {
|
? (bool value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
selected = value;
|
selected = value;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
selected: selected,
|
selected: selected,
|
||||||
label: Text('Chip', key: labelKey),
|
label: Text('Chip', key: labelKey),
|
||||||
shape: const StadiumBorder(),
|
shape: const StadiumBorder(),
|
||||||
@ -1082,12 +1094,12 @@ void main() {
|
|||||||
return RawChip(
|
return RawChip(
|
||||||
avatar: avatar,
|
avatar: avatar,
|
||||||
onSelected: selectable != null
|
onSelected: selectable != null
|
||||||
? (bool value) {
|
? (bool value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
selected = value;
|
selected = value;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
selected: selected,
|
selected: selected,
|
||||||
label: Text('Chip', key: labelKey),
|
label: Text('Chip', key: labelKey),
|
||||||
shape: const StadiumBorder(),
|
shape: const StadiumBorder(),
|
||||||
@ -1229,19 +1241,19 @@ void main() {
|
|||||||
selected: isSelectable && value,
|
selected: isSelectable && value,
|
||||||
label: Text('$value'),
|
label: Text('$value'),
|
||||||
onSelected: isSelectable
|
onSelected: isSelectable
|
||||||
? (bool newValue) {
|
? (bool newValue) {
|
||||||
setState(() {
|
setState(() {
|
||||||
value = newValue;
|
value = newValue;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
onPressed: isPressable
|
onPressed: isPressable
|
||||||
? () {
|
? () {
|
||||||
setState(() {
|
setState(() {
|
||||||
value = true;
|
value = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
@ -176,16 +176,17 @@ void main() {
|
|||||||
await tester.pumpWidget(wrap(
|
await tester.pumpWidget(wrap(
|
||||||
child: StatefulBuilder(
|
child: StatefulBuilder(
|
||||||
builder: (BuildContext context, StateSetter setState) {
|
builder: (BuildContext context, StateSetter setState) {
|
||||||
return ExpandIcon(
|
return ExpandIcon(
|
||||||
isExpanded: expanded,
|
isExpanded: expanded,
|
||||||
onPressed: (bool isExpanded) {
|
onPressed: (bool isExpanded) {
|
||||||
setState(() {
|
setState(() {
|
||||||
expanded = !isExpanded;
|
expanded = !isExpanded;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
color: Colors.indigo,
|
color: Colors.indigo,
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
));
|
));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
iconTheme = tester.firstWidget(find.byType(IconTheme).last);
|
iconTheme = tester.firstWidget(find.byType(IconTheme).last);
|
||||||
@ -201,17 +202,18 @@ void main() {
|
|||||||
await tester.pumpWidget(wrap(
|
await tester.pumpWidget(wrap(
|
||||||
child: StatefulBuilder(
|
child: StatefulBuilder(
|
||||||
builder: (BuildContext context, StateSetter setState) {
|
builder: (BuildContext context, StateSetter setState) {
|
||||||
return ExpandIcon(
|
return ExpandIcon(
|
||||||
isExpanded: expanded,
|
isExpanded: expanded,
|
||||||
onPressed: (bool isExpanded) {
|
onPressed: (bool isExpanded) {
|
||||||
setState(() {
|
setState(() {
|
||||||
expanded = !isExpanded;
|
expanded = !isExpanded;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
color: Colors.indigo,
|
color: Colors.indigo,
|
||||||
expandedColor: Colors.teal,
|
expandedColor: Colors.teal,
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
));
|
));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
iconTheme = tester.firstWidget(find.byType(IconTheme).last);
|
iconTheme = tester.firstWidget(find.byType(IconTheme).last);
|
||||||
|
@ -636,132 +636,135 @@ void main() {
|
|||||||
expect(callbackResults['isExpanded'], equals(false));
|
expect(callbackResults['isExpanded'], equals(false));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('didUpdateWidget accounts for toggling between ExpansionPanelList'
|
testWidgets(
|
||||||
'and ExpansionPaneList.radio', (WidgetTester tester) async {
|
'didUpdateWidget accounts for toggling between ExpansionPanelList'
|
||||||
bool isRadioList = false;
|
'and ExpansionPaneList.radio',
|
||||||
final List<bool> _panelExpansionState = <bool>[
|
(WidgetTester tester) async {
|
||||||
false,
|
bool isRadioList = false;
|
||||||
false,
|
final List<bool> _panelExpansionState = <bool>[
|
||||||
false,
|
false,
|
||||||
];
|
false,
|
||||||
|
false,
|
||||||
|
];
|
||||||
|
|
||||||
ExpansionPanelList buildRadioExpansionPanelList() {
|
ExpansionPanelList buildRadioExpansionPanelList() {
|
||||||
return ExpansionPanelList.radio(
|
return ExpansionPanelList.radio(
|
||||||
initialOpenPanelValue: 2,
|
initialOpenPanelValue: 2,
|
||||||
children: <ExpansionPanelRadio>[
|
children: <ExpansionPanelRadio>[
|
||||||
ExpansionPanelRadio(
|
ExpansionPanelRadio(
|
||||||
headerBuilder: (BuildContext context, bool isExpanded) {
|
headerBuilder: (BuildContext context, bool isExpanded) {
|
||||||
return Text(isExpanded ? 'B' : 'A');
|
return Text(isExpanded ? 'B' : 'A');
|
||||||
},
|
},
|
||||||
body: const SizedBox(height: 100.0),
|
body: const SizedBox(height: 100.0),
|
||||||
value: 0,
|
value: 0,
|
||||||
),
|
|
||||||
ExpansionPanelRadio(
|
|
||||||
headerBuilder: (BuildContext context, bool isExpanded) {
|
|
||||||
return Text(isExpanded ? 'D' : 'C');
|
|
||||||
},
|
|
||||||
body: const SizedBox(height: 100.0),
|
|
||||||
value: 1,
|
|
||||||
),
|
|
||||||
ExpansionPanelRadio(
|
|
||||||
headerBuilder: (BuildContext context, bool isExpanded) {
|
|
||||||
return Text(isExpanded ? 'F' : 'E');
|
|
||||||
},
|
|
||||||
body: const SizedBox(height: 100.0),
|
|
||||||
value: 2,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
ExpansionPanelList buildExpansionPanelList(Function setState) {
|
|
||||||
return ExpansionPanelList(
|
|
||||||
expansionCallback: (int index, _) => setState(() { _panelExpansionState[index] = !_panelExpansionState[index]; }),
|
|
||||||
children: <ExpansionPanel>[
|
|
||||||
ExpansionPanel(
|
|
||||||
isExpanded: _panelExpansionState[0],
|
|
||||||
headerBuilder: (BuildContext context, bool isExpanded) {
|
|
||||||
return Text(isExpanded ? 'B' : 'A');
|
|
||||||
},
|
|
||||||
body: const SizedBox(height: 100.0),
|
|
||||||
),
|
|
||||||
ExpansionPanel(
|
|
||||||
isExpanded: _panelExpansionState[1],
|
|
||||||
headerBuilder: (BuildContext context, bool isExpanded) {
|
|
||||||
return Text(isExpanded ? 'D' : 'C');
|
|
||||||
},
|
|
||||||
body: const SizedBox(height: 100.0),
|
|
||||||
),
|
|
||||||
ExpansionPanel(
|
|
||||||
isExpanded: _panelExpansionState[2],
|
|
||||||
headerBuilder: (BuildContext context, bool isExpanded) {
|
|
||||||
return Text(isExpanded ? 'F' : 'E');
|
|
||||||
},
|
|
||||||
body: const SizedBox(height: 100.0),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
await tester.pumpWidget(
|
|
||||||
StatefulBuilder(
|
|
||||||
builder: (BuildContext context, StateSetter setState) {
|
|
||||||
return MaterialApp(
|
|
||||||
home: Scaffold(
|
|
||||||
body: SingleChildScrollView(
|
|
||||||
child: isRadioList
|
|
||||||
? buildRadioExpansionPanelList()
|
|
||||||
: buildExpansionPanelList(setState)
|
|
||||||
),
|
|
||||||
floatingActionButton: FloatingActionButton(
|
|
||||||
onPressed: () => setState(() { isRadioList = !isRadioList; }),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
ExpansionPanelRadio(
|
||||||
},
|
headerBuilder: (BuildContext context, bool isExpanded) {
|
||||||
),
|
return Text(isExpanded ? 'D' : 'C');
|
||||||
);
|
},
|
||||||
|
body: const SizedBox(height: 100.0),
|
||||||
|
value: 1,
|
||||||
|
),
|
||||||
|
ExpansionPanelRadio(
|
||||||
|
headerBuilder: (BuildContext context, bool isExpanded) {
|
||||||
|
return Text(isExpanded ? 'F' : 'E');
|
||||||
|
},
|
||||||
|
body: const SizedBox(height: 100.0),
|
||||||
|
value: 2,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
expect(find.text('A'), findsOneWidget);
|
ExpansionPanelList buildExpansionPanelList(Function setState) {
|
||||||
expect(find.text('B'), findsNothing);
|
return ExpansionPanelList(
|
||||||
expect(find.text('C'), findsOneWidget);
|
expansionCallback: (int index, _) => setState(() { _panelExpansionState[index] = !_panelExpansionState[index]; }),
|
||||||
expect(find.text('D'), findsNothing);
|
children: <ExpansionPanel>[
|
||||||
expect(find.text('E'), findsOneWidget);
|
ExpansionPanel(
|
||||||
expect(find.text('F'), findsNothing);
|
isExpanded: _panelExpansionState[0],
|
||||||
|
headerBuilder: (BuildContext context, bool isExpanded) {
|
||||||
|
return Text(isExpanded ? 'B' : 'A');
|
||||||
|
},
|
||||||
|
body: const SizedBox(height: 100.0),
|
||||||
|
),
|
||||||
|
ExpansionPanel(
|
||||||
|
isExpanded: _panelExpansionState[1],
|
||||||
|
headerBuilder: (BuildContext context, bool isExpanded) {
|
||||||
|
return Text(isExpanded ? 'D' : 'C');
|
||||||
|
},
|
||||||
|
body: const SizedBox(height: 100.0),
|
||||||
|
),
|
||||||
|
ExpansionPanel(
|
||||||
|
isExpanded: _panelExpansionState[2],
|
||||||
|
headerBuilder: (BuildContext context, bool isExpanded) {
|
||||||
|
return Text(isExpanded ? 'F' : 'E');
|
||||||
|
},
|
||||||
|
body: const SizedBox(height: 100.0),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
await tester.tap(find.byType(ExpandIcon).at(0));
|
await tester.pumpWidget(
|
||||||
await tester.tap(find.byType(ExpandIcon).at(1));
|
StatefulBuilder(
|
||||||
await tester.pumpAndSettle();
|
builder: (BuildContext context, StateSetter setState) {
|
||||||
|
return MaterialApp(
|
||||||
|
home: Scaffold(
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
child: isRadioList
|
||||||
|
? buildRadioExpansionPanelList()
|
||||||
|
: buildExpansionPanelList(setState)
|
||||||
|
),
|
||||||
|
floatingActionButton: FloatingActionButton(
|
||||||
|
onPressed: () => setState(() { isRadioList = !isRadioList; }),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
expect(find.text('A'), findsNothing);
|
expect(find.text('A'), findsOneWidget);
|
||||||
expect(find.text('B'), findsOneWidget);
|
expect(find.text('B'), findsNothing);
|
||||||
expect(find.text('C'), findsNothing);
|
expect(find.text('C'), findsOneWidget);
|
||||||
expect(find.text('D'), findsOneWidget);
|
expect(find.text('D'), findsNothing);
|
||||||
expect(find.text('E'), findsOneWidget);
|
expect(find.text('E'), findsOneWidget);
|
||||||
expect(find.text('F'), findsNothing);
|
expect(find.text('F'), findsNothing);
|
||||||
|
|
||||||
// ExpansionPanelList --> ExpansionPanelList.radio
|
await tester.tap(find.byType(ExpandIcon).at(0));
|
||||||
await tester.tap(find.byType(FloatingActionButton));
|
await tester.tap(find.byType(ExpandIcon).at(1));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
expect(find.text('A'), findsOneWidget);
|
expect(find.text('A'), findsNothing);
|
||||||
expect(find.text('B'), findsNothing);
|
expect(find.text('B'), findsOneWidget);
|
||||||
expect(find.text('C'), findsOneWidget);
|
expect(find.text('C'), findsNothing);
|
||||||
expect(find.text('D'), findsNothing);
|
expect(find.text('D'), findsOneWidget);
|
||||||
expect(find.text('E'), findsNothing);
|
expect(find.text('E'), findsOneWidget);
|
||||||
expect(find.text('F'), findsOneWidget);
|
expect(find.text('F'), findsNothing);
|
||||||
|
|
||||||
// ExpansionPanelList.radio --> ExpansionPanelList
|
// ExpansionPanelList --> ExpansionPanelList.radio
|
||||||
await tester.tap(find.byType(FloatingActionButton));
|
await tester.tap(find.byType(FloatingActionButton));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
expect(find.text('A'), findsNothing);
|
expect(find.text('A'), findsOneWidget);
|
||||||
expect(find.text('B'), findsOneWidget);
|
expect(find.text('B'), findsNothing);
|
||||||
expect(find.text('C'), findsNothing);
|
expect(find.text('C'), findsOneWidget);
|
||||||
expect(find.text('D'), findsOneWidget);
|
expect(find.text('D'), findsNothing);
|
||||||
expect(find.text('E'), findsOneWidget);
|
expect(find.text('E'), findsNothing);
|
||||||
expect(find.text('F'), findsNothing);
|
expect(find.text('F'), findsOneWidget);
|
||||||
});
|
|
||||||
|
// ExpansionPanelList.radio --> ExpansionPanelList
|
||||||
|
await tester.tap(find.byType(FloatingActionButton));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
expect(find.text('A'), findsNothing);
|
||||||
|
expect(find.text('B'), findsOneWidget);
|
||||||
|
expect(find.text('C'), findsNothing);
|
||||||
|
expect(find.text('D'), findsOneWidget);
|
||||||
|
expect(find.text('E'), findsOneWidget);
|
||||||
|
expect(find.text('F'), findsNothing);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
testWidgets('No duplicate global keys at layout/build time', (WidgetTester tester) async {
|
testWidgets('No duplicate global keys at layout/build time', (WidgetTester tester) async {
|
||||||
// Regression test for https://github.com/flutter/flutter/issues/13780
|
// Regression test for https://github.com/flutter/flutter/issues/13780
|
||||||
|
@ -29,8 +29,7 @@ void main() {
|
|||||||
expect(popupMenuTheme.textStyle, null);
|
expect(popupMenuTheme.textStyle, null);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Default PopupMenuThemeData debugFillProperties',
|
testWidgets('Default PopupMenuThemeData debugFillProperties', (WidgetTester tester) async {
|
||||||
(WidgetTester tester) async {
|
|
||||||
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
|
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
|
||||||
const PopupMenuThemeData().debugFillProperties(builder);
|
const PopupMenuThemeData().debugFillProperties(builder);
|
||||||
|
|
||||||
@ -42,8 +41,7 @@ void main() {
|
|||||||
expect(description, <String>[]);
|
expect(description, <String>[]);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('PopupMenuThemeData implements debugFillProperties',
|
testWidgets('PopupMenuThemeData implements debugFillProperties', (WidgetTester tester) async {
|
||||||
(WidgetTester tester) async {
|
|
||||||
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
|
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
|
||||||
PopupMenuThemeData(
|
PopupMenuThemeData(
|
||||||
color: const Color(0xFFFFFFFF),
|
color: const Color(0xFFFFFFFF),
|
||||||
|
@ -1559,51 +1559,51 @@ void main() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Drawer opens correctly with custom edgeDragWidth', (WidgetTester tester) async {
|
testWidgets('Drawer opens correctly with custom edgeDragWidth', (WidgetTester tester) async {
|
||||||
// The default edge drag width is 20.0.
|
// The default edge drag width is 20.0.
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
drawer: const Drawer(
|
drawer: const Drawer(
|
||||||
child: Text('Drawer'),
|
child: Text('Drawer'),
|
||||||
),
|
),
|
||||||
body: const Text('Scaffold body'),
|
body: const Text('Scaffold body'),
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
title: const Text('Title'),
|
title: const Text('Title'),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
ScaffoldState scaffoldState = tester.state(find.byType(Scaffold));
|
);
|
||||||
expect(scaffoldState.isDrawerOpen, false);
|
ScaffoldState scaffoldState = tester.state(find.byType(Scaffold));
|
||||||
|
expect(scaffoldState.isDrawerOpen, false);
|
||||||
|
|
||||||
await tester.dragFrom(const Offset(35, 100), const Offset(300, 0));
|
await tester.dragFrom(const Offset(35, 100), const Offset(300, 0));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(scaffoldState.isDrawerOpen, false);
|
expect(scaffoldState.isDrawerOpen, false);
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
drawer: const Drawer(
|
drawer: const Drawer(
|
||||||
child: Text('Drawer'),
|
child: Text('Drawer'),
|
||||||
),
|
),
|
||||||
drawerEdgeDragWidth: 40.0,
|
drawerEdgeDragWidth: 40.0,
|
||||||
body: const Text('Scaffold Body'),
|
body: const Text('Scaffold Body'),
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
title: const Text('Title'),
|
title: const Text('Title'),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
scaffoldState = tester.state(find.byType(Scaffold));
|
);
|
||||||
expect(scaffoldState.isDrawerOpen, false);
|
scaffoldState = tester.state(find.byType(Scaffold));
|
||||||
|
expect(scaffoldState.isDrawerOpen, false);
|
||||||
|
|
||||||
await tester.dragFrom(const Offset(35, 100), const Offset(300, 0));
|
await tester.dragFrom(const Offset(35, 100), const Offset(300, 0));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(scaffoldState.isDrawerOpen, true);
|
expect(scaffoldState.isDrawerOpen, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Nested scaffold body insets', (WidgetTester tester) async {
|
testWidgets('Nested scaffold body insets', (WidgetTester tester) async {
|
||||||
// Regression test for https://github.com/flutter/flutter/issues/20295
|
// Regression test for https://github.com/flutter/flutter/issues/20295
|
||||||
|
@ -1548,8 +1548,7 @@ void main() {
|
|||||||
expect(renderObject.size.height, 200);
|
expect(renderObject.size.height, 200);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets(
|
testWidgets('Slider implements debugFillProperties', (WidgetTester tester) async {
|
||||||
'Slider implements debugFillProperties', (WidgetTester tester) async {
|
|
||||||
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
|
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
|
||||||
|
|
||||||
const Slider(
|
const Slider(
|
||||||
|
@ -6887,7 +6887,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'Tap in empty text field does not show handles nor toolbar',
|
'Tap in empty text field does not show handles nor toolbar',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
final TextEditingController controller = TextEditingController();
|
final TextEditingController controller = TextEditingController();
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
@ -6932,7 +6932,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'Long press in empty text field shows handles and toolbar',
|
'Long press in empty text field shows handles and toolbar',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
final TextEditingController controller = TextEditingController();
|
final TextEditingController controller = TextEditingController();
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
@ -6979,7 +6979,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'Double tap in empty text field shows toolbar but not handles',
|
'Double tap in empty text field shows toolbar but not handles',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
final TextEditingController controller = TextEditingController();
|
final TextEditingController controller = TextEditingController();
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
@ -7004,7 +7004,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'Mouse tap does not show handles nor toolbar',
|
'Mouse tap does not show handles nor toolbar',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
final TextEditingController controller = TextEditingController(
|
final TextEditingController controller = TextEditingController(
|
||||||
text: 'abc def ghi',
|
text: 'abc def ghi',
|
||||||
);
|
);
|
||||||
@ -7037,7 +7037,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'Mouse long press does not show handles nor toolbar',
|
'Mouse long press does not show handles nor toolbar',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
final TextEditingController controller = TextEditingController(
|
final TextEditingController controller = TextEditingController(
|
||||||
text: 'abc def ghi',
|
text: 'abc def ghi',
|
||||||
);
|
);
|
||||||
@ -7070,7 +7070,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'Mouse double tap does not show handles nor toolbar',
|
'Mouse double tap does not show handles nor toolbar',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
final TextEditingController controller = TextEditingController(
|
final TextEditingController controller = TextEditingController(
|
||||||
text: 'abc def ghi',
|
text: 'abc def ghi',
|
||||||
);
|
);
|
||||||
|
@ -176,7 +176,10 @@ void main() {
|
|||||||
child: Center(
|
child: Center(
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
autovalidate: true,
|
autovalidate: true,
|
||||||
validator: (String value) { _validateCalled++; return null; },
|
validator: (String value) {
|
||||||
|
_validateCalled++;
|
||||||
|
return null;
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -199,7 +202,10 @@ void main() {
|
|||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
enabled: true,
|
enabled: true,
|
||||||
autovalidate: true,
|
autovalidate: true,
|
||||||
validator: (String value) { _validateCalled += 1; return null; },
|
validator: (String value) {
|
||||||
|
_validateCalled += 1;
|
||||||
|
return null;
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -58,7 +58,7 @@ void main() {
|
|||||||
expect(theme.data.borderWidth, null);
|
expect(theme.data.borderWidth, null);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Default ToggleButtonsThemeData debugFillProperties', (WidgetTester tester) async {
|
testWidgets('Default ToggleButtonsThemeData debugFillProperties', (WidgetTester tester) async {
|
||||||
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
|
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
|
||||||
const ToggleButtonsThemeData().debugFillProperties(builder);
|
const ToggleButtonsThemeData().debugFillProperties(builder);
|
||||||
|
|
||||||
@ -90,12 +90,12 @@ void main() {
|
|||||||
borderWidth: 2.0,
|
borderWidth: 2.0,
|
||||||
).debugFillProperties(builder);
|
).debugFillProperties(builder);
|
||||||
|
|
||||||
final List<String> description = builder.properties
|
final List<String> description = builder.properties
|
||||||
.where((DiagnosticsNode node) => !node.isFiltered(DiagnosticLevel.info))
|
.where((DiagnosticsNode node) => !node.isFiltered(DiagnosticLevel.info))
|
||||||
.map((DiagnosticsNode node) => node.toString())
|
.map((DiagnosticsNode node) => node.toString())
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
expect(description, <String>[
|
expect(description, <String>[
|
||||||
'textStyle.inherit: true',
|
'textStyle.inherit: true',
|
||||||
'textStyle.size: 10.0',
|
'textStyle.size: 10.0',
|
||||||
'constraints: BoxConstraints(0.0<=w<=Infinity, 10.0<=h<=20.0)',
|
'constraints: BoxConstraints(0.0<=w<=Infinity, 10.0<=h<=20.0)',
|
||||||
|
@ -115,8 +115,7 @@ void main() {
|
|||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
test(
|
test('When high-res device and high-res asset not present in bundle then return main variant', () {
|
||||||
'When high-res device and high-res asset not present in bundle then return main variant', () {
|
|
||||||
const String mainAssetPath = 'assets/normalFolder/normalFile.png';
|
const String mainAssetPath = 'assets/normalFolder/normalFile.png';
|
||||||
|
|
||||||
final Map<String, List<String>> assetBundleMap =
|
final Map<String, List<String>> assetBundleMap =
|
||||||
|
@ -113,7 +113,7 @@ class LoadErrorImageProvider extends ImageProvider<LoadErrorImageProvider> {
|
|||||||
throw Error();
|
throw Error();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<LoadErrorImageProvider> obtainKey(ImageConfiguration configuration) {
|
Future<LoadErrorImageProvider> obtainKey(ImageConfiguration configuration) {
|
||||||
return SynchronousFuture<LoadErrorImageProvider>(this);
|
return SynchronousFuture<LoadErrorImageProvider>(this);
|
||||||
}
|
}
|
||||||
@ -127,7 +127,7 @@ class LoadErrorCompleterImageProvider extends ImageProvider<LoadErrorCompleterIm
|
|||||||
return OneFrameImageStreamCompleter(completer.future);
|
return OneFrameImageStreamCompleter(completer.future);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<LoadErrorCompleterImageProvider> obtainKey(ImageConfiguration configuration) {
|
Future<LoadErrorCompleterImageProvider> obtainKey(ImageConfiguration configuration) {
|
||||||
return SynchronousFuture<LoadErrorCompleterImageProvider>(this);
|
return SynchronousFuture<LoadErrorCompleterImageProvider>(this);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,10 @@ import '../flutter_test_alternative.dart';
|
|||||||
|
|
||||||
class RenderTestBox extends RenderBox {
|
class RenderTestBox extends RenderBox {
|
||||||
double value = 0.0;
|
double value = 0.0;
|
||||||
double next() { value += 1.0; return value; }
|
double next() {
|
||||||
|
value += 1.0;
|
||||||
|
return value;
|
||||||
|
}
|
||||||
@override
|
@override
|
||||||
double computeMinIntrinsicWidth(double height) => next();
|
double computeMinIntrinsicWidth(double height) => next();
|
||||||
@override
|
@override
|
||||||
|
@ -312,7 +312,7 @@ class FakeIosPlatformViewsController {
|
|||||||
|
|
||||||
class FakeHtmlPlatformViewsController {
|
class FakeHtmlPlatformViewsController {
|
||||||
FakeHtmlPlatformViewsController() {
|
FakeHtmlPlatformViewsController() {
|
||||||
SystemChannels.platform_views.setMockMethodCallHandler(_onMethodCall);
|
SystemChannels.platform_views.setMockMethodCallHandler(_onMethodCall);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterable<FakeHtmlPlatformView> get views => _views.values;
|
Iterable<FakeHtmlPlatformView> get views => _views.values;
|
||||||
|
@ -226,11 +226,11 @@ void main() {
|
|||||||
const Intent(ValueKey<String>('foo')).debugFillProperties(builder);
|
const Intent(ValueKey<String>('foo')).debugFillProperties(builder);
|
||||||
|
|
||||||
final List<String> description = builder.properties
|
final List<String> description = builder.properties
|
||||||
.where((DiagnosticsNode node) {
|
.where((DiagnosticsNode node) {
|
||||||
return !node.isFiltered(DiagnosticLevel.info);
|
return !node.isFiltered(DiagnosticLevel.info);
|
||||||
})
|
})
|
||||||
.map((DiagnosticsNode node) => node.toString())
|
.map((DiagnosticsNode node) => node.toString())
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
expect(description, equals(<String>['key: [<\'foo\'>]']));
|
expect(description, equals(<String>['key: [<\'foo\'>]']));
|
||||||
});
|
});
|
||||||
@ -257,11 +257,11 @@ void main() {
|
|||||||
Actions(actions: const <LocalKey, ActionFactory>{}, child: Container()).debugFillProperties(builder);
|
Actions(actions: const <LocalKey, ActionFactory>{}, child: Container()).debugFillProperties(builder);
|
||||||
|
|
||||||
final List<String> description = builder.properties
|
final List<String> description = builder.properties
|
||||||
.where((DiagnosticsNode node) {
|
.where((DiagnosticsNode node) {
|
||||||
return !node.isFiltered(DiagnosticLevel.info);
|
return !node.isFiltered(DiagnosticLevel.info);
|
||||||
})
|
})
|
||||||
.map((DiagnosticsNode node) => node.toString())
|
.map((DiagnosticsNode node) => node.toString())
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
expect(description[0], equalsIgnoringHashCodes('dispatcher: ActionDispatcher#00000'));
|
expect(description[0], equalsIgnoringHashCodes('dispatcher: ActionDispatcher#00000'));
|
||||||
expect(description[1], equals('actions: {}'));
|
expect(description[1], equals('actions: {}'));
|
||||||
@ -278,11 +278,11 @@ void main() {
|
|||||||
).debugFillProperties(builder);
|
).debugFillProperties(builder);
|
||||||
|
|
||||||
final List<String> description = builder.properties
|
final List<String> description = builder.properties
|
||||||
.where((DiagnosticsNode node) {
|
.where((DiagnosticsNode node) {
|
||||||
return !node.isFiltered(DiagnosticLevel.info);
|
return !node.isFiltered(DiagnosticLevel.info);
|
||||||
})
|
})
|
||||||
.map((DiagnosticsNode node) => node.toString())
|
.map((DiagnosticsNode node) => node.toString())
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
expect(description[0], equalsIgnoringHashCodes('dispatcher: ActionDispatcher#00000'));
|
expect(description[0], equalsIgnoringHashCodes('dispatcher: ActionDispatcher#00000'));
|
||||||
expect(description[1], equals('actions: {[<\'bar\'>]: Closure: () => TestAction}'));
|
expect(description[1], equals('actions: {[<\'bar\'>]: Closure: () => TestAction}'));
|
||||||
|
@ -982,8 +982,7 @@ void main() {
|
|||||||
feedback: Text('Dragging'),
|
feedback: Text('Dragging'),
|
||||||
),
|
),
|
||||||
DragTarget<int>(
|
DragTarget<int>(
|
||||||
builder:
|
builder: (BuildContext context, List<int> data, List<dynamic> rejects) {
|
||||||
(BuildContext context, List<int> data, List<dynamic> rejects) {
|
|
||||||
return Container(
|
return Container(
|
||||||
height: 100.0,
|
height: 100.0,
|
||||||
child: rejects.isNotEmpty
|
child: rejects.isNotEmpty
|
||||||
@ -1041,8 +1040,7 @@ void main() {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
DragTarget<int>(
|
DragTarget<int>(
|
||||||
builder:
|
builder: (BuildContext context, List<int> data, List<dynamic> rejects) {
|
||||||
(BuildContext context, List<int> data, List<dynamic> rejects) {
|
|
||||||
return Container(
|
return Container(
|
||||||
height: 100.0,
|
height: 100.0,
|
||||||
child: rejects.isNotEmpty
|
child: rejects.isNotEmpty
|
||||||
|
@ -1055,12 +1055,12 @@ Future<void> main() async {
|
|||||||
bool _isVisible(Element node) {
|
bool _isVisible(Element node) {
|
||||||
bool isVisible = true;
|
bool isVisible = true;
|
||||||
node.visitAncestorElements((Element ancestor) {
|
node.visitAncestorElements((Element ancestor) {
|
||||||
final RenderObject r = ancestor.renderObject;
|
final RenderObject r = ancestor.renderObject;
|
||||||
if (r is RenderOpacity && r.opacity == 0) {
|
if (r is RenderOpacity && r.opacity == 0) {
|
||||||
isVisible = false;
|
isVisible = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
return isVisible;
|
return isVisible;
|
||||||
}
|
}
|
||||||
@ -2222,39 +2222,40 @@ Future<void> main() async {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// Load image before measuring the `Rect` of the `RenderImage`.
|
// Load image before measuring the `Rect` of the `RenderImage`.
|
||||||
imageProvider.complete();
|
imageProvider.complete();
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
final RenderImage renderImage = tester.renderObject(
|
final RenderImage renderImage = tester.renderObject(
|
||||||
find.descendant(of: find.byKey(imageKey1), matching: find.byType(RawImage))
|
find.descendant(of: find.byKey(imageKey1), matching: find.byType(RawImage))
|
||||||
);
|
);
|
||||||
|
|
||||||
// Before push image1 should be laid out correctly.
|
// Before push image1 should be laid out correctly.
|
||||||
expect(renderImage.size, const Size(100, 100));
|
expect(renderImage.size, const Size(100, 100));
|
||||||
|
|
||||||
navigatorKey.currentState.push(route2);
|
navigatorKey.currentState.push(route2);
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
|
|
||||||
final TestGesture gesture = await tester.startGesture(const Offset(0.01, 300));
|
final TestGesture gesture = await tester.startGesture(const Offset(0.01, 300));
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
|
|
||||||
// Move (almost) across the screen, to make the animation as close to finish
|
// Move (almost) across the screen, to make the animation as close to finish
|
||||||
// as possible.
|
// as possible.
|
||||||
await gesture.moveTo(const Offset(800, 200));
|
await gesture.moveTo(const Offset(800, 200));
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
|
|
||||||
// image1 should snap to the top left corner of the Row widget.
|
// image1 should snap to the top left corner of the Row widget.
|
||||||
expect(
|
expect(
|
||||||
tester.getRect(find.byKey(imageKey1, skipOffstage: false)),
|
tester.getRect(find.byKey(imageKey1, skipOffstage: false)),
|
||||||
rectMoreOrLessEquals(tester.getTopLeft(find.widgetWithText(Row, '1')) & const Size(100, 100), epsilon: 0.01),
|
rectMoreOrLessEquals(tester.getTopLeft(find.widgetWithText(Row, '1')) & const Size(100, 100), epsilon: 0.01),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Text should respect the correct final size of image1.
|
// Text should respect the correct final size of image1.
|
||||||
expect(
|
expect(
|
||||||
tester.getTopRight(find.byKey(imageKey1, skipOffstage: false)).dx,
|
tester.getTopRight(find.byKey(imageKey1, skipOffstage: false)).dx,
|
||||||
moreOrLessEquals(tester.getTopLeft(find.text('1')).dx, epsilon: 0.01),
|
moreOrLessEquals(tester.getTopLeft(find.text('1')).dx, epsilon: 0.01),
|
||||||
);
|
);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
// Regression test for https://github.com/flutter/flutter/issues/40239.
|
// Regression test for https://github.com/flutter/flutter/issues/40239.
|
||||||
testWidgets(
|
testWidgets(
|
||||||
|
@ -190,8 +190,8 @@ void main() {
|
|||||||
|
|
||||||
// Make child wider and higher than the viewport.
|
// Make child wider and higher than the viewport.
|
||||||
setState(() {
|
setState(() {
|
||||||
childWidth = 900.0;
|
childWidth = 900.0;
|
||||||
childHeight = 900.0;
|
childHeight = 900.0;
|
||||||
});
|
});
|
||||||
|
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
@ -294,9 +294,7 @@ void main() {
|
|||||||
expect(built, 2);
|
expect(built, 2);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('SliverLayoutBuilder and Inherited -- do not rebuild when not using inherited',
|
testWidgets('SliverLayoutBuilder and Inherited -- do not rebuild when not using inherited', (WidgetTester tester) async {
|
||||||
(WidgetTester tester) async {
|
|
||||||
|
|
||||||
int built = 0;
|
int built = 0;
|
||||||
final Widget target = Directionality(
|
final Widget target = Directionality(
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
|
@ -58,7 +58,7 @@ void main() {
|
|||||||
events.add(event);
|
events.add(event);
|
||||||
},
|
},
|
||||||
onPointerUp: (PointerUpEvent event) {
|
onPointerUp: (PointerUpEvent event) {
|
||||||
events.add(event);
|
events.add(event);
|
||||||
},
|
},
|
||||||
onPointerMove: (PointerMoveEvent event) {
|
onPointerMove: (PointerMoveEvent event) {
|
||||||
events.add(event);
|
events.add(event);
|
||||||
|
@ -413,7 +413,7 @@ void main() {
|
|||||||
// │ │
|
// │ │
|
||||||
// ────────────────────────────
|
// ────────────────────────────
|
||||||
testWidgets('non-rect partially overlapping, wrong painting order, check disabled', (WidgetTester tester) async {
|
testWidgets('non-rect partially overlapping, wrong painting order, check disabled', (WidgetTester tester) async {
|
||||||
final List<Widget> children = <Widget>[
|
final List<Widget> children = <Widget>[
|
||||||
Positioned.fromRect(
|
Positioned.fromRect(
|
||||||
rect: const Rect.fromLTWH(150, 150, 150, 150),
|
rect: const Rect.fromLTWH(150, 150, 150, 150),
|
||||||
child: Container(
|
child: Container(
|
||||||
|
@ -622,8 +622,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets(
|
testWidgets('Android view can claim gesture after all pointers are up', (WidgetTester tester) async {
|
||||||
'Android view can claim gesture after all pointers are up', (WidgetTester tester) async {
|
|
||||||
final int currentViewId = platformViewsRegistry.getNextPlatformViewId();
|
final int currentViewId = platformViewsRegistry.getNextPlatformViewId();
|
||||||
final FakeAndroidPlatformViewsController viewsController = FakeAndroidPlatformViewsController();
|
final FakeAndroidPlatformViewsController viewsController = FakeAndroidPlatformViewsController();
|
||||||
viewsController.registerViewType('webview');
|
viewsController.registerViewType('webview');
|
||||||
@ -1762,8 +1761,7 @@ void main() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets(
|
testWidgets('PlatformViewSurface can claim gesture after all pointers are up', (WidgetTester tester) async {
|
||||||
'PlatformViewSurface can claim gesture after all pointers are up', (WidgetTester tester) async {
|
|
||||||
bool verticalDragAcceptedByParent = false;
|
bool verticalDragAcceptedByParent = false;
|
||||||
// The long press recognizer rejects the gesture after the PlatformViewSurface gets the pointer up event.
|
// The long press recognizer rejects the gesture after the PlatformViewSurface gets the pointer up event.
|
||||||
// This test makes sure that the PlatformViewSurface can win the gesture after it got the pointer up event.
|
// This test makes sure that the PlatformViewSurface can win the gesture after it got the pointer up event.
|
||||||
|
@ -35,8 +35,7 @@ class OnTapPage extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('Push and Pop should send platform messages',
|
testWidgets('Push and Pop should send platform messages', (WidgetTester tester) async {
|
||||||
(WidgetTester tester) async {
|
|
||||||
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
|
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
|
||||||
'/': (BuildContext context) => OnTapPage(
|
'/': (BuildContext context) => OnTapPage(
|
||||||
id: '/',
|
id: '/',
|
||||||
@ -52,8 +51,7 @@ void main() {
|
|||||||
|
|
||||||
final List<MethodCall> log = <MethodCall>[];
|
final List<MethodCall> log = <MethodCall>[];
|
||||||
|
|
||||||
SystemChannels.navigation
|
SystemChannels.navigation.setMockMethodCallHandler((MethodCall methodCall) async {
|
||||||
.setMockMethodCallHandler((MethodCall methodCall) async {
|
|
||||||
log.add(methodCall);
|
log.add(methodCall);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -103,8 +101,7 @@ void main() {
|
|||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Replace should send platform messages',
|
testWidgets('Replace should send platform messages', (WidgetTester tester) async {
|
||||||
(WidgetTester tester) async {
|
|
||||||
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
|
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
|
||||||
'/': (BuildContext context) => OnTapPage(
|
'/': (BuildContext context) => OnTapPage(
|
||||||
id: '/',
|
id: '/',
|
||||||
@ -121,8 +118,7 @@ void main() {
|
|||||||
|
|
||||||
final List<MethodCall> log = <MethodCall>[];
|
final List<MethodCall> log = <MethodCall>[];
|
||||||
|
|
||||||
SystemChannels.navigation
|
SystemChannels.navigation.setMockMethodCallHandler((MethodCall methodCall) async {
|
||||||
.setMockMethodCallHandler((MethodCall methodCall) async {
|
|
||||||
log.add(methodCall);
|
log.add(methodCall);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -350,7 +350,10 @@ void main() {
|
|||||||
Directionality(
|
Directionality(
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
child: NotificationListener<OverscrollNotification>(
|
child: NotificationListener<OverscrollNotification>(
|
||||||
onNotification: (OverscrollNotification message) { scrolled = true; return false; },
|
onNotification: (OverscrollNotification message) {
|
||||||
|
scrolled = true;
|
||||||
|
return false;
|
||||||
|
},
|
||||||
child: ListView(
|
child: ListView(
|
||||||
primary: true,
|
primary: true,
|
||||||
children: const <Widget>[],
|
children: const <Widget>[],
|
||||||
@ -368,7 +371,10 @@ void main() {
|
|||||||
Directionality(
|
Directionality(
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
child: NotificationListener<OverscrollNotification>(
|
child: NotificationListener<OverscrollNotification>(
|
||||||
onNotification: (OverscrollNotification message) { scrolled = true; return false; },
|
onNotification: (OverscrollNotification message) {
|
||||||
|
scrolled = true;
|
||||||
|
return false;
|
||||||
|
},
|
||||||
child: ListView(
|
child: ListView(
|
||||||
primary: false,
|
primary: false,
|
||||||
children: const <Widget>[],
|
children: const <Widget>[],
|
||||||
@ -386,7 +392,10 @@ void main() {
|
|||||||
Directionality(
|
Directionality(
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
child: NotificationListener<OverscrollNotification>(
|
child: NotificationListener<OverscrollNotification>(
|
||||||
onNotification: (OverscrollNotification message) { scrolled = true; return false; },
|
onNotification: (OverscrollNotification message) {
|
||||||
|
scrolled = true;
|
||||||
|
return false;
|
||||||
|
},
|
||||||
child: ListView(
|
child: ListView(
|
||||||
primary: false,
|
primary: false,
|
||||||
physics: const AlwaysScrollableScrollPhysics(),
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
@ -405,7 +414,10 @@ void main() {
|
|||||||
Directionality(
|
Directionality(
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
child: NotificationListener<OverscrollNotification>(
|
child: NotificationListener<OverscrollNotification>(
|
||||||
onNotification: (OverscrollNotification message) { scrolled = true; return false; },
|
onNotification: (OverscrollNotification message) {
|
||||||
|
scrolled = true;
|
||||||
|
return false;
|
||||||
|
},
|
||||||
child: ListView(
|
child: ListView(
|
||||||
primary: true,
|
primary: true,
|
||||||
physics: const ScrollPhysics(),
|
physics: const ScrollPhysics(),
|
||||||
|
@ -1379,8 +1379,7 @@ void main() {
|
|||||||
final FocusNode focusNode = FocusNode();
|
final FocusNode focusNode = FocusNode();
|
||||||
|
|
||||||
String clipboardContent = '';
|
String clipboardContent = '';
|
||||||
SystemChannels.platform
|
SystemChannels.platform.setMockMethodCallHandler((MethodCall methodCall) async {
|
||||||
.setMockMethodCallHandler((MethodCall methodCall) async {
|
|
||||||
if (methodCall.method == 'Clipboard.setData')
|
if (methodCall.method == 'Clipboard.setData')
|
||||||
clipboardContent = methodCall.arguments['text'];
|
clipboardContent = methodCall.arguments['text'];
|
||||||
else if (methodCall.method == 'Clipboard.getData')
|
else if (methodCall.method == 'Clipboard.getData')
|
||||||
@ -2308,7 +2307,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'tap moves cursor to the edge of the word it tapped on (iOS)',
|
'tap moves cursor to the edge of the word it tapped on (iOS)',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(platform: TargetPlatform.iOS),
|
theme: ThemeData(platform: TargetPlatform.iOS),
|
||||||
@ -2340,7 +2339,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'tap moves cursor to the position tapped (Android)',
|
'tap moves cursor to the position tapped (Android)',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
const MaterialApp(
|
||||||
home: Material(
|
home: Material(
|
||||||
@ -2372,7 +2371,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'two slow taps do not trigger a word selection (iOS)',
|
'two slow taps do not trigger a word selection (iOS)',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(platform: TargetPlatform.iOS),
|
theme: ThemeData(platform: TargetPlatform.iOS),
|
||||||
@ -2407,7 +2406,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'double tap selects word and first tap of double tap moves cursor (iOS)',
|
'double tap selects word and first tap of double tap moves cursor (iOS)',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(platform: TargetPlatform.iOS),
|
theme: ThemeData(platform: TargetPlatform.iOS),
|
||||||
@ -2453,7 +2452,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'double tap selects word and first tap of double tap moves cursor and shows toolbar (Android)',
|
'double tap selects word and first tap of double tap moves cursor and shows toolbar (Android)',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
const MaterialApp(
|
||||||
home: Material(
|
home: Material(
|
||||||
@ -2498,7 +2497,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'double tap on top of cursor also selects word (Android)',
|
'double tap on top of cursor also selects word (Android)',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
const MaterialApp(
|
||||||
home: Material(
|
home: Material(
|
||||||
@ -2547,7 +2546,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'double tap hold selects word (iOS)',
|
'double tap hold selects word (iOS)',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(platform: TargetPlatform.iOS),
|
theme: ThemeData(platform: TargetPlatform.iOS),
|
||||||
@ -2594,7 +2593,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'tap after a double tap select is not affected (iOS)',
|
'tap after a double tap select is not affected (iOS)',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(platform: TargetPlatform.iOS),
|
theme: ThemeData(platform: TargetPlatform.iOS),
|
||||||
@ -2641,7 +2640,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'long press moves cursor to the exact long press position and shows toolbar (iOS)',
|
'long press moves cursor to the exact long press position and shows toolbar (iOS)',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(platform: TargetPlatform.iOS),
|
theme: ThemeData(platform: TargetPlatform.iOS),
|
||||||
@ -2674,7 +2673,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'long press selects word and shows toolbar (Android)',
|
'long press selects word and shows toolbar (Android)',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
const MaterialApp(
|
||||||
@ -2706,7 +2705,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'long press tap cannot initiate a double tap (iOS)',
|
'long press tap cannot initiate a double tap (iOS)',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(platform: TargetPlatform.iOS),
|
theme: ThemeData(platform: TargetPlatform.iOS),
|
||||||
@ -2742,7 +2741,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'long press drag moves the cursor under the drag and shows toolbar on lift (iOS)',
|
'long press drag moves the cursor under the drag and shows toolbar on lift (iOS)',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(platform: TargetPlatform.iOS),
|
theme: ThemeData(platform: TargetPlatform.iOS),
|
||||||
@ -2898,7 +2897,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'long tap after a double tap select is not affected (iOS)',
|
'long tap after a double tap select is not affected (iOS)',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(platform: TargetPlatform.iOS),
|
theme: ThemeData(platform: TargetPlatform.iOS),
|
||||||
@ -2942,7 +2941,7 @@ void main() {
|
|||||||
//convert
|
//convert
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'double tap after a long tap is not affected (iOS)',
|
'double tap after a long tap is not affected (iOS)',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(platform: TargetPlatform.iOS),
|
theme: ThemeData(platform: TargetPlatform.iOS),
|
||||||
@ -2984,7 +2983,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'double tap chains work (iOS)',
|
'double tap chains work (iOS)',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(platform: TargetPlatform.iOS),
|
theme: ThemeData(platform: TargetPlatform.iOS),
|
||||||
@ -3238,7 +3237,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'strut basic single line',
|
'strut basic single line',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(platform: TargetPlatform.android),
|
theme: ThemeData(platform: TargetPlatform.android),
|
||||||
@ -3261,7 +3260,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'strut TextStyle increases height',
|
'strut TextStyle increases height',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(platform: TargetPlatform.android),
|
theme: ThemeData(platform: TargetPlatform.android),
|
||||||
@ -3308,7 +3307,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'strut basic multi line',
|
'strut basic multi line',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(platform: TargetPlatform.android),
|
theme: ThemeData(platform: TargetPlatform.android),
|
||||||
@ -3332,7 +3331,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'strut no force small strut',
|
'strut no force small strut',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(platform: TargetPlatform.android),
|
theme: ThemeData(platform: TargetPlatform.android),
|
||||||
@ -3364,7 +3363,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'strut no force large strut',
|
'strut no force large strut',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(platform: TargetPlatform.android),
|
theme: ThemeData(platform: TargetPlatform.android),
|
||||||
@ -3393,7 +3392,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'strut height override',
|
'strut height override',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(platform: TargetPlatform.android),
|
theme: ThemeData(platform: TargetPlatform.android),
|
||||||
@ -3422,7 +3421,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'strut forces field taller',
|
'strut forces field taller',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
theme: ThemeData(platform: TargetPlatform.android),
|
theme: ThemeData(platform: TargetPlatform.android),
|
||||||
@ -3636,7 +3635,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'Mouse tap does not show handles nor toolbar',
|
'Mouse tap does not show handles nor toolbar',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
const MaterialApp(
|
||||||
home: Material(
|
home: Material(
|
||||||
@ -3665,7 +3664,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'Mouse long press does not show handles nor toolbar',
|
'Mouse long press does not show handles nor toolbar',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
const MaterialApp(
|
||||||
home: Material(
|
home: Material(
|
||||||
@ -3694,7 +3693,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'Mouse double tap does not show handles nor toolbar',
|
'Mouse double tap does not show handles nor toolbar',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
const MaterialApp(
|
||||||
home: Material(
|
home: Material(
|
||||||
|
@ -193,9 +193,9 @@ void main() {
|
|||||||
Actions(
|
Actions(
|
||||||
actions: <LocalKey, ActionFactory>{
|
actions: <LocalKey, ActionFactory>{
|
||||||
TestAction.key: () => TestAction(onInvoke: (FocusNode node, Intent intent) {
|
TestAction.key: () => TestAction(onInvoke: (FocusNode node, Intent intent) {
|
||||||
invoked = true;
|
invoked = true;
|
||||||
return true;
|
return true;
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
child: Shortcuts(
|
child: Shortcuts(
|
||||||
manager: testManager,
|
manager: testManager,
|
||||||
|
@ -34,7 +34,7 @@ Future<void> testSliverFixedExtentList(WidgetTester tester, List<String> items)
|
|||||||
SliverFixedExtentList(
|
SliverFixedExtentList(
|
||||||
itemExtent: 900,
|
itemExtent: 900,
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
(BuildContext context, int index) {
|
(BuildContext context, int index) {
|
||||||
return Center(
|
return Center(
|
||||||
key: ValueKey<String>(items[index]),
|
key: ValueKey<String>(items[index]),
|
||||||
child: KeepAlive(
|
child: KeepAlive(
|
||||||
@ -268,7 +268,9 @@ void main() {
|
|||||||
expect(find.text('4'), findsOneWidget);
|
expect(find.text('4'), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('SliverGrid Correctly layout children after rearranging', (WidgetTester tester) async {
|
testWidgets(
|
||||||
|
'SliverGrid Correctly layout children after rearranging',
|
||||||
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(const TestSliverGrid(
|
await tester.pumpWidget(const TestSliverGrid(
|
||||||
<Widget>[
|
<Widget>[
|
||||||
Text('item0', key: Key('0')),
|
Text('item0', key: Key('0')),
|
||||||
@ -299,7 +301,9 @@ void main() {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
testWidgets('SliverFixedExtentList Correctly layout children after rearranging', (WidgetTester tester) async {
|
testWidgets(
|
||||||
|
'SliverFixedExtentList Correctly layout children after rearranging',
|
||||||
|
(WidgetTester tester) async {
|
||||||
await tester.pumpWidget(const TestSliverFixedExtentList(
|
await tester.pumpWidget(const TestSliverFixedExtentList(
|
||||||
<Widget>[
|
<Widget>[
|
||||||
Text('item0', key: Key('0')),
|
Text('item0', key: Key('0')),
|
||||||
@ -363,7 +367,7 @@ void main() {
|
|||||||
SliverFixedExtentList(
|
SliverFixedExtentList(
|
||||||
itemExtent: 200,
|
itemExtent: 200,
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
(BuildContext context, int index) {
|
(BuildContext context, int index) {
|
||||||
if (index <= 6) {
|
if (index <= 6) {
|
||||||
return Center(child: Text('Page $index'));
|
return Center(child: Text('Page $index'));
|
||||||
}
|
}
|
||||||
@ -395,7 +399,7 @@ void main() {
|
|||||||
SliverFixedExtentList(
|
SliverFixedExtentList(
|
||||||
itemExtent: 200,
|
itemExtent: 200,
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
(BuildContext context, int index) {
|
(BuildContext context, int index) {
|
||||||
if (index <= 6) {
|
if (index <= 6) {
|
||||||
return Center(child: Text('Page $index'));
|
return Center(child: Text('Page $index'));
|
||||||
}
|
}
|
||||||
|
@ -551,8 +551,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Regression test for https://github.com/flutter/flutter/issues/37032.
|
// Regression test for https://github.com/flutter/flutter/issues/37032.
|
||||||
testWidgets("selection handle's GestureDetector should not cover the entire screen",
|
testWidgets("selection handle's GestureDetector should not cover the entire screen", (WidgetTester tester) async {
|
||||||
(WidgetTester tester) async {
|
|
||||||
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
|
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
|
||||||
final TextEditingController controller = TextEditingController(text: 'a');
|
final TextEditingController controller = TextEditingController(text: 'a');
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class _AndroidBuilderImpl extends AndroidBuilder {
|
|||||||
@required AndroidBuildInfo androidBuildInfo,
|
@required AndroidBuildInfo androidBuildInfo,
|
||||||
@required String target,
|
@required String target,
|
||||||
}) async {
|
}) async {
|
||||||
if (!project.android.isUsingGradle) {
|
if (!project.android.isUsingGradle) {
|
||||||
throwToolExit(
|
throwToolExit(
|
||||||
'The build process for Android has changed, and the current project configuration '
|
'The build process for Android has changed, and the current project configuration '
|
||||||
'is no longer valid. Please consult\n\n'
|
'is no longer valid. Please consult\n\n'
|
||||||
|
@ -275,7 +275,7 @@ class FlutterWebTestBootstrapBuilder implements Builder {
|
|||||||
assetPath, contents, Runtime.builtIn.map((Runtime runtime) => runtime.name).toSet());
|
assetPath, contents, Runtime.builtIn.map((Runtime runtime) => runtime.name).toSet());
|
||||||
|
|
||||||
if (metadata.testOn.evaluate(SuitePlatform(Runtime.chrome))) {
|
if (metadata.testOn.evaluate(SuitePlatform(Runtime.chrome))) {
|
||||||
await buildStep.writeAsString(id.addExtension('.browser_test.dart'), '''
|
await buildStep.writeAsString(id.addExtension('.browser_test.dart'), '''
|
||||||
import 'dart:ui' as ui;
|
import 'dart:ui' as ui;
|
||||||
import 'dart:html';
|
import 'dart:html';
|
||||||
import 'dart:js';
|
import 'dart:js';
|
||||||
|
@ -284,7 +284,8 @@ String _filterOverrideWarnings(String message) {
|
|||||||
// ! front_end 0.1.0-alpha.0 from path ../../bin/cache/dart-sdk/lib/front_end
|
// ! front_end 0.1.0-alpha.0 from path ../../bin/cache/dart-sdk/lib/front_end
|
||||||
if (message == 'Warning: You are using these overridden dependencies:') {
|
if (message == 'Warning: You are using these overridden dependencies:') {
|
||||||
return null;
|
return null;
|
||||||
} if (message.contains(_analyzerWarning)) {
|
}
|
||||||
|
if (message.contains(_analyzerWarning)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return message;
|
return message;
|
||||||
|
@ -505,7 +505,7 @@ class ValidationResult {
|
|||||||
return terminal.color(leadingBox, TerminalColor.green);
|
return terminal.color(leadingBox, TerminalColor.green);
|
||||||
case ValidationType.notAvailable:
|
case ValidationType.notAvailable:
|
||||||
case ValidationType.partial:
|
case ValidationType.partial:
|
||||||
return terminal.color(leadingBox, TerminalColor.yellow);
|
return terminal.color(leadingBox, TerminalColor.yellow);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -61,8 +61,7 @@ class FuchsiaSdk {
|
|||||||
Stream<String> syslogs(String id) {
|
Stream<String> syslogs(String id) {
|
||||||
Process process;
|
Process process;
|
||||||
try {
|
try {
|
||||||
final StreamController<String> controller =
|
final StreamController<String> controller = StreamController<String>(onCancel: () {
|
||||||
StreamController<String>(onCancel: () {
|
|
||||||
process.kill();
|
process.kill();
|
||||||
});
|
});
|
||||||
if (fuchsiaArtifacts.sshConfig == null ||
|
if (fuchsiaArtifacts.sshConfig == null ||
|
||||||
|
@ -38,7 +38,7 @@ Future<void> buildMacOS({
|
|||||||
await processPodsIfNeeded(flutterProject.macos, getMacOSBuildDirectory(), buildInfo.mode);
|
await processPodsIfNeeded(flutterProject.macos, getMacOSBuildDirectory(), buildInfo.mode);
|
||||||
// If the xcfilelists do not exist, create empty version.
|
// If the xcfilelists do not exist, create empty version.
|
||||||
if (!flutterProject.macos.inputFileList.existsSync()) {
|
if (!flutterProject.macos.inputFileList.existsSync()) {
|
||||||
flutterProject.macos.inputFileList.createSync(recursive: true);
|
flutterProject.macos.inputFileList.createSync(recursive: true);
|
||||||
}
|
}
|
||||||
if (!flutterProject.macos.outputFileList.existsSync()) {
|
if (!flutterProject.macos.outputFileList.existsSync()) {
|
||||||
flutterProject.macos.outputFileList.createSync(recursive: true);
|
flutterProject.macos.outputFileList.createSync(recursive: true);
|
||||||
|
@ -85,7 +85,7 @@ class MDnsObservatoryDiscovery {
|
|||||||
buffer.writeln('There are multiple observatory ports available.');
|
buffer.writeln('There are multiple observatory ports available.');
|
||||||
buffer.writeln('Rerun this command with one of the following passed in as the appId:');
|
buffer.writeln('Rerun this command with one of the following passed in as the appId:');
|
||||||
buffer.writeln('');
|
buffer.writeln('');
|
||||||
for (final String uniqueDomainName in uniqueDomainNames) {
|
for (final String uniqueDomainName in uniqueDomainNames) {
|
||||||
buffer.writeln(' flutter attach --app-id ${uniqueDomainName.replaceAll('.$dartObservatoryName', '')}');
|
buffer.writeln(' flutter attach --app-id ${uniqueDomainName.replaceAll('.$dartObservatoryName', '')}');
|
||||||
}
|
}
|
||||||
throwToolExit(buffer.toString());
|
throwToolExit(buffer.toString());
|
||||||
|
@ -534,17 +534,17 @@ Future<void> injectPlugins(FlutterProject project, {bool checkProjects = false})
|
|||||||
await _writeMacOSPluginRegistrant(project, plugins);
|
await _writeMacOSPluginRegistrant(project, plugins);
|
||||||
}
|
}
|
||||||
for (final XcodeBasedProject subproject in <XcodeBasedProject>[project.ios, project.macos]) {
|
for (final XcodeBasedProject subproject in <XcodeBasedProject>[project.ios, project.macos]) {
|
||||||
if (!project.isModule && (!checkProjects || subproject.existsSync())) {
|
if (!project.isModule && (!checkProjects || subproject.existsSync())) {
|
||||||
final CocoaPods cocoaPods = CocoaPods();
|
final CocoaPods cocoaPods = CocoaPods();
|
||||||
if (plugins.isNotEmpty) {
|
if (plugins.isNotEmpty) {
|
||||||
await cocoaPods.setupPodfile(subproject);
|
await cocoaPods.setupPodfile(subproject);
|
||||||
|
}
|
||||||
|
/// The user may have a custom maintained Podfile that they're running `pod install`
|
||||||
|
/// on themselves.
|
||||||
|
else if (subproject.podfile.existsSync() && subproject.podfileLock.existsSync()) {
|
||||||
|
cocoaPods.addPodsDependencyToFlutterXcconfig(subproject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/// The user may have a custom maintained Podfile that they're running `pod install`
|
|
||||||
/// on themselves.
|
|
||||||
else if (subproject.podfile.existsSync() && subproject.podfileLock.existsSync()) {
|
|
||||||
cocoaPods.addPodsDependencyToFlutterXcconfig(subproject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (featureFlags.isWebEnabled && project.web.existsSync()) {
|
if (featureFlags.isWebEnabled && project.web.existsSync()) {
|
||||||
await _writeWebPluginRegistrant(project, plugins);
|
await _writeWebPluginRegistrant(project, plugins);
|
||||||
|
@ -102,7 +102,7 @@ FlutterPlatform installHook({
|
|||||||
platformPluginRegistration ??= (FlutterPlatform platform) {
|
platformPluginRegistration ??= (FlutterPlatform platform) {
|
||||||
hack.registerPlatformPlugin(
|
hack.registerPlatformPlugin(
|
||||||
<Runtime>[Runtime.vm],
|
<Runtime>[Runtime.vm],
|
||||||
() {
|
() {
|
||||||
return platform;
|
return platform;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -417,7 +417,8 @@ class FlutterPlatform extends PlatformPlugin {
|
|||||||
await server.close(force: true);
|
await server.close(force: true);
|
||||||
});
|
});
|
||||||
final Completer<WebSocket> webSocket = Completer<WebSocket>();
|
final Completer<WebSocket> webSocket = Completer<WebSocket>();
|
||||||
server.listen((HttpRequest request) {
|
server.listen(
|
||||||
|
(HttpRequest request) {
|
||||||
if (!webSocket.isCompleted) {
|
if (!webSocket.isCompleted) {
|
||||||
webSocket.complete(WebSocketTransformer.upgrade(request));
|
webSocket.complete(WebSocketTransformer.upgrade(request));
|
||||||
}
|
}
|
||||||
|
@ -282,17 +282,18 @@ class FlutterWebPlatform extends PlatformPlugin {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> close() => _closeMemo.runOnce(() async {
|
Future<void> close() => _closeMemo.runOnce(() async {
|
||||||
final List<Future<dynamic>> futures = _browserManagers.values
|
final List<Future<dynamic>> futures = _browserManagers.values
|
||||||
.map<Future<dynamic>>((Future<BrowserManager> future) async {
|
.map<Future<dynamic>>((Future<BrowserManager> future) async {
|
||||||
final BrowserManager result = await future;
|
final BrowserManager result = await future;
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await result.close();
|
await result.close();
|
||||||
}).toList();
|
})
|
||||||
futures.add(_server.close());
|
.toList();
|
||||||
await Future.wait<void>(futures);
|
futures.add(_server.close());
|
||||||
});
|
await Future.wait<void>(futures);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class OneOffHandler {
|
class OneOffHandler {
|
||||||
@ -414,18 +415,19 @@ class BrowserManager {
|
|||||||
// Whenever we get a message, no matter which child channel it's for, we the
|
// Whenever we get a message, no matter which child channel it's for, we the
|
||||||
// know browser is still running code which means the user isn't debugging.
|
// know browser is still running code which means the user isn't debugging.
|
||||||
_channel = MultiChannel<dynamic>(
|
_channel = MultiChannel<dynamic>(
|
||||||
webSocket.cast<String>().transform(jsonDocument).changeStream((Stream<Object> stream) {
|
webSocket.cast<String>().transform(jsonDocument).changeStream((Stream<Object> stream) {
|
||||||
return stream.map((Object message) {
|
return stream.map((Object message) {
|
||||||
if (!_closed) {
|
if (!_closed) {
|
||||||
_timer.reset();
|
_timer.reset();
|
||||||
}
|
}
|
||||||
for (RunnerSuiteController controller in _controllers) {
|
for (RunnerSuiteController controller in _controllers) {
|
||||||
controller.setDebugging(false);
|
controller.setDebugging(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return message;
|
return message;
|
||||||
});
|
});
|
||||||
}));
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
_environment = _loadBrowserEnvironment();
|
_environment = _loadBrowserEnvironment();
|
||||||
_channel.stream.listen(_onMessage, onDone: close);
|
_channel.stream.listen(_onMessage, onDone: close);
|
||||||
@ -579,10 +581,11 @@ class BrowserManager {
|
|||||||
final VirtualChannel<dynamic> virtualChannel = _channel.virtualChannel();
|
final VirtualChannel<dynamic> virtualChannel = _channel.virtualChannel();
|
||||||
final int suiteChannelID = virtualChannel.id;
|
final int suiteChannelID = virtualChannel.id;
|
||||||
final StreamChannel<dynamic> suiteChannel = virtualChannel.transformStream(
|
final StreamChannel<dynamic> suiteChannel = virtualChannel.transformStream(
|
||||||
StreamTransformer<dynamic, dynamic>.fromHandlers(handleDone: (EventSink<dynamic> sink) {
|
StreamTransformer<dynamic, dynamic>.fromHandlers(handleDone: (EventSink<dynamic> sink) {
|
||||||
closeIframe();
|
closeIframe();
|
||||||
sink.close();
|
sink.close();
|
||||||
}));
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
return await _pool.withResource<RunnerSuite>(() async {
|
return await _pool.withResource<RunnerSuite>(() async {
|
||||||
_channel.sink.add(<String, Object>{
|
_channel.sink.add(<String, Object>{
|
||||||
|
@ -66,7 +66,7 @@ class FlutterVersion {
|
|||||||
final String remote = channel.substring(0, slash);
|
final String remote = channel.substring(0, slash);
|
||||||
_repositoryUrl = _runGit('git ls-remote --get-url $remote');
|
_repositoryUrl = _runGit('git ls-remote --get-url $remote');
|
||||||
_channel = channel.substring(slash + 1);
|
_channel = channel.substring(slash + 1);
|
||||||
} else if (channel.isEmpty) {
|
} else if (channel.isEmpty) {
|
||||||
_channel = 'unknown';
|
_channel = 'unknown';
|
||||||
} else {
|
} else {
|
||||||
_channel = channel;
|
_channel = channel;
|
||||||
|
@ -467,13 +467,13 @@ abstract class ServiceObject {
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case 'Event':
|
case 'Event':
|
||||||
serviceObject = ServiceEvent._empty(owner);
|
serviceObject = ServiceEvent._empty(owner);
|
||||||
break;
|
break;
|
||||||
case 'FlutterView':
|
case 'FlutterView':
|
||||||
serviceObject = FlutterView._empty(owner.vm);
|
serviceObject = FlutterView._empty(owner.vm);
|
||||||
break;
|
break;
|
||||||
case 'Isolate':
|
case 'Isolate':
|
||||||
serviceObject = Isolate._empty(owner.vm);
|
serviceObject = Isolate._empty(owner.vm);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// If we don't have a model object for this service object type, as a
|
// If we don't have a model object for this service object type, as a
|
||||||
// fallback return a ServiceMap object.
|
// fallback return a ServiceMap object.
|
||||||
@ -811,7 +811,7 @@ class VM extends ServiceObjectOwner {
|
|||||||
final String mapId = map['id'];
|
final String mapId = map['id'];
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'Isolate': {
|
case 'Isolate':
|
||||||
// Check cache.
|
// Check cache.
|
||||||
Isolate isolate = _isolateCache[mapId];
|
Isolate isolate = _isolateCache[mapId];
|
||||||
if (isolate == null) {
|
if (isolate == null) {
|
||||||
@ -829,9 +829,7 @@ class VM extends ServiceObjectOwner {
|
|||||||
isolate.updateFromMap(map);
|
isolate.updateFromMap(map);
|
||||||
}
|
}
|
||||||
return isolate;
|
return isolate;
|
||||||
}
|
case 'FlutterView':
|
||||||
break;
|
|
||||||
case 'FlutterView': {
|
|
||||||
FlutterView view = _viewCache[mapId];
|
FlutterView view = _viewCache[mapId];
|
||||||
if (view == null) {
|
if (view == null) {
|
||||||
// Add new view to the cache.
|
// Add new view to the cache.
|
||||||
@ -841,8 +839,6 @@ class VM extends ServiceObjectOwner {
|
|||||||
view.updateFromMap(map);
|
view.updateFromMap(map);
|
||||||
}
|
}
|
||||||
return view;
|
return view;
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
throw VMServiceObjectLoadError(
|
throw VMServiceObjectLoadError(
|
||||||
'VM.getFromMap called for something other than an isolate', map);
|
'VM.getFromMap called for something other than an isolate', map);
|
||||||
|
@ -138,9 +138,11 @@ Use the 'android' tool to install them:
|
|||||||
hardware = 'goldfish';
|
hardware = 'goldfish';
|
||||||
buildCharacteristics = 'unused';
|
buildCharacteristics = 'unused';
|
||||||
exitCode = -1;
|
exitCode = -1;
|
||||||
when(mockProcessManager.run(argThat(contains('getprop')),
|
when(mockProcessManager.run(
|
||||||
stderrEncoding: anyNamed('stderrEncoding'),
|
argThat(contains('getprop')),
|
||||||
stdoutEncoding: anyNamed('stdoutEncoding'))).thenAnswer((_) {
|
stderrEncoding: anyNamed('stderrEncoding'),
|
||||||
|
stdoutEncoding: anyNamed('stdoutEncoding'),
|
||||||
|
)).thenAnswer((_) {
|
||||||
final StringBuffer buf = StringBuffer()
|
final StringBuffer buf = StringBuffer()
|
||||||
..writeln('[ro.hardware]: [$hardware]')..writeln(
|
..writeln('[ro.hardware]: [$hardware]')..writeln(
|
||||||
'[ro.build.characteristics]: [$buildCharacteristics]');
|
'[ro.build.characteristics]: [$buildCharacteristics]');
|
||||||
@ -215,9 +217,11 @@ Use the 'android' tool to install them:
|
|||||||
setUp(() {
|
setUp(() {
|
||||||
hardware = 'unknown';
|
hardware = 'unknown';
|
||||||
buildCharacteristics = 'unused';
|
buildCharacteristics = 'unused';
|
||||||
when(mockProcessManager.run(argThat(contains('getprop')),
|
when(mockProcessManager.run(
|
||||||
stderrEncoding: anyNamed('stderrEncoding'),
|
argThat(contains('getprop')),
|
||||||
stdoutEncoding: anyNamed('stdoutEncoding'))).thenAnswer((_) {
|
stderrEncoding: anyNamed('stderrEncoding'),
|
||||||
|
stdoutEncoding: anyNamed('stdoutEncoding'),
|
||||||
|
)).thenAnswer((_) {
|
||||||
final StringBuffer buf = StringBuffer()
|
final StringBuffer buf = StringBuffer()
|
||||||
..writeln('[ro.hardware]: [$hardware]')
|
..writeln('[ro.hardware]: [$hardware]')
|
||||||
..writeln('[ro.build.characteristics]: [$buildCharacteristics]');
|
..writeln('[ro.build.characteristics]: [$buildCharacteristics]');
|
||||||
@ -312,9 +316,11 @@ flutter:
|
|||||||
setUp(() {
|
setUp(() {
|
||||||
hardware = 'goldfish'; // Known emulator
|
hardware = 'goldfish'; // Known emulator
|
||||||
socketWasCreated = false;
|
socketWasCreated = false;
|
||||||
when(mockProcessManager.run(argThat(contains('getprop')),
|
when(mockProcessManager.run(
|
||||||
stderrEncoding: anyNamed('stderrEncoding'),
|
argThat(contains('getprop')),
|
||||||
stdoutEncoding: anyNamed('stdoutEncoding'))).thenAnswer((_) {
|
stderrEncoding: anyNamed('stderrEncoding'),
|
||||||
|
stdoutEncoding: anyNamed('stdoutEncoding'),
|
||||||
|
)).thenAnswer((_) {
|
||||||
final StringBuffer buf = StringBuffer()
|
final StringBuffer buf = StringBuffer()
|
||||||
..writeln('[ro.hardware]: [$hardware]');
|
..writeln('[ro.hardware]: [$hardware]');
|
||||||
final ProcessResult result = ProcessResult(1, 0, buf.toString(), '');
|
final ProcessResult result = ProcessResult(1, 0, buf.toString(), '');
|
||||||
|
@ -483,8 +483,7 @@ $assetsSection
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('AssetBundle assets from scanned paths', () {
|
group('AssetBundle assets from scanned paths', () {
|
||||||
testUsingContext(
|
testUsingContext('Two assets are bundled when scanning their directory', () async {
|
||||||
'Two assets are bundled when scanning their directory', () async {
|
|
||||||
establishFlutterRoot();
|
establishFlutterRoot();
|
||||||
writeEmptySchemaFile(fs);
|
writeEmptySchemaFile(fs);
|
||||||
|
|
||||||
@ -514,8 +513,7 @@ $assetsSection
|
|||||||
FileSystem: () => testFileSystem,
|
FileSystem: () => testFileSystem,
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext(
|
testUsingContext('Two assets are bundled when listing one and scanning second directory', () async {
|
||||||
'Two assets are bundled when listing one and scanning second directory', () async {
|
|
||||||
establishFlutterRoot();
|
establishFlutterRoot();
|
||||||
writeEmptySchemaFile(fs);
|
writeEmptySchemaFile(fs);
|
||||||
|
|
||||||
@ -545,8 +543,7 @@ $assetsSection
|
|||||||
FileSystem: () => testFileSystem,
|
FileSystem: () => testFileSystem,
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext(
|
testUsingContext('One asset is bundled with variant, scanning wrong directory', () async {
|
||||||
'One asset is bundled with variant, scanning wrong directory', () async {
|
|
||||||
establishFlutterRoot();
|
establishFlutterRoot();
|
||||||
writeEmptySchemaFile(fs);
|
writeEmptySchemaFile(fs);
|
||||||
|
|
||||||
@ -573,8 +570,7 @@ $assetsSection
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('AssetBundle assets from scanned paths with MemoryFileSystem', () {
|
group('AssetBundle assets from scanned paths with MemoryFileSystem', () {
|
||||||
testUsingContext(
|
testUsingContext('One asset is bundled with variant, scanning directory', () async {
|
||||||
'One asset is bundled with variant, scanning directory', () async {
|
|
||||||
establishFlutterRoot();
|
establishFlutterRoot();
|
||||||
writeEmptySchemaFile(fs);
|
writeEmptySchemaFile(fs);
|
||||||
|
|
||||||
@ -603,8 +599,7 @@ $assetsSection
|
|||||||
FileSystem: () => testFileSystem,
|
FileSystem: () => testFileSystem,
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext(
|
testUsingContext('No asset is bundled with variant, no assets or directories are listed', () async {
|
||||||
'No asset is bundled with variant, no assets or directories are listed', () async {
|
|
||||||
establishFlutterRoot();
|
establishFlutterRoot();
|
||||||
writeEmptySchemaFile(fs);
|
writeEmptySchemaFile(fs);
|
||||||
|
|
||||||
@ -632,8 +627,7 @@ $assetsSection
|
|||||||
FileSystem: () => testFileSystem,
|
FileSystem: () => testFileSystem,
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext(
|
testUsingContext('Expect error generating manifest, wrong non-existing directory is listed', () async {
|
||||||
'Expect error generating manifest, wrong non-existing directory is listed', () async {
|
|
||||||
establishFlutterRoot();
|
establishFlutterRoot();
|
||||||
writeEmptySchemaFile(fs);
|
writeEmptySchemaFile(fs);
|
||||||
|
|
||||||
|
@ -29,10 +29,10 @@ Future<void> syncAndAsyncError() {
|
|||||||
|
|
||||||
Future<void> delayedThrow(FakeAsync time) {
|
Future<void> delayedThrow(FakeAsync time) {
|
||||||
final Future<void> result =
|
final Future<void> result =
|
||||||
Future<void>.delayed(const Duration(milliseconds: 10))
|
Future<void>.delayed(const Duration(milliseconds: 10))
|
||||||
.then((_) {
|
.then((_) {
|
||||||
throw 'Delayed Doom';
|
throw 'Delayed Doom';
|
||||||
});
|
});
|
||||||
time.elapse(const Duration(seconds: 1));
|
time.elapse(const Duration(seconds: 1));
|
||||||
time.flushMicrotasks();
|
time.flushMicrotasks();
|
||||||
return result;
|
return result;
|
||||||
@ -154,9 +154,9 @@ void main() {
|
|||||||
await FakeAsync().run((FakeAsync time) {
|
await FakeAsync().run((FakeAsync time) {
|
||||||
unawaited(runZoned(() async {
|
unawaited(runZoned(() async {
|
||||||
final Future<void> f = asyncGuard<void>(() => delayedThrow(time))
|
final Future<void> f = asyncGuard<void>(() => delayedThrow(time))
|
||||||
.catchError((Object e, StackTrace s) {
|
.catchError((Object e, StackTrace s) {
|
||||||
caughtByCatchError = true;
|
caughtByCatchError = true;
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await f;
|
await f;
|
||||||
} on String {
|
} on String {
|
||||||
@ -189,10 +189,12 @@ void main() {
|
|||||||
final Completer<void> completer = Completer<void>();
|
final Completer<void> completer = Completer<void>();
|
||||||
await FakeAsync().run((FakeAsync time) {
|
await FakeAsync().run((FakeAsync time) {
|
||||||
unawaited(runZoned(() async {
|
unawaited(runZoned(() async {
|
||||||
final Future<void> f = asyncGuard<void>(() => delayedThrow(time),
|
final Future<void> f = asyncGuard<void>(
|
||||||
onError: (Object e, StackTrace s) {
|
() => delayedThrow(time),
|
||||||
caughtByOnError = true;
|
onError: (Object e, StackTrace s) {
|
||||||
});
|
caughtByOnError = true;
|
||||||
|
},
|
||||||
|
);
|
||||||
try {
|
try {
|
||||||
await f;
|
await f;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -151,7 +151,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('default character choice without displayAcceptedCharacters', () async {
|
testUsingContext('default character choice without displayAcceptedCharacters', () async {
|
||||||
terminalUnderTest.usesTerminalUi = true;
|
terminalUnderTest.usesTerminalUi = true;
|
||||||
mockStdInStream = Stream<String>.fromFutures(<Future<String>>[
|
mockStdInStream = Stream<String>.fromFutures(<Future<String>>[
|
||||||
Future<String>.value('\n'), // Not in accepted list
|
Future<String>.value('\n'), // Not in accepted list
|
||||||
]).asBroadcastStream();
|
]).asBroadcastStream();
|
||||||
|
@ -60,13 +60,13 @@ void main() {
|
|||||||
} else if (platform.isLinux) {
|
} else if (platform.isLinux) {
|
||||||
hostPlatform = HostPlatform.linux_x64;
|
hostPlatform = HostPlatform.linux_x64;
|
||||||
} else if (platform.isMacOS) {
|
} else if (platform.isMacOS) {
|
||||||
hostPlatform = HostPlatform.darwin_x64;
|
hostPlatform = HostPlatform.darwin_x64;
|
||||||
} else {
|
} else {
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
final String skyEngineLine = platform.isWindows
|
final String skyEngineLine = platform.isWindows
|
||||||
? r'sky_engine:file:///C:/bin/cache/pkg/sky_engine/lib/'
|
? r'sky_engine:file:///C:/bin/cache/pkg/sky_engine/lib/'
|
||||||
: 'sky_engine:file:///bin/cache/pkg/sky_engine/lib/';
|
: 'sky_engine:file:///bin/cache/pkg/sky_engine/lib/';
|
||||||
fs.file('.packages')
|
fs.file('.packages')
|
||||||
..createSync()
|
..createSync()
|
||||||
..writeAsStringSync('''
|
..writeAsStringSync('''
|
||||||
@ -368,9 +368,10 @@ class FakeKernelCompiler implements KernelCompiler {
|
|||||||
String fileSystemScheme,
|
String fileSystemScheme,
|
||||||
bool targetProductVm = false,
|
bool targetProductVm = false,
|
||||||
String platformDill,
|
String platformDill,
|
||||||
String initializeFromDill}) async {
|
String initializeFromDill,
|
||||||
fs.file(outputFilePath).createSync(recursive: true);
|
}) async {
|
||||||
return CompilerOutput(outputFilePath, 0, null);
|
fs.file(outputFilePath).createSync(recursive: true);
|
||||||
|
return CompilerOutput(outputFilePath, 0, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,9 +32,9 @@ void main() {
|
|||||||
|
|
||||||
test('Can run a build', () => testbed.run(() async {
|
test('Can run a build', () => testbed.run(() async {
|
||||||
when(mockBuildSystem.build(any, any, buildSystemConfig: anyNamed('buildSystemConfig')))
|
when(mockBuildSystem.build(any, any, buildSystemConfig: anyNamed('buildSystemConfig')))
|
||||||
.thenAnswer((Invocation invocation) async {
|
.thenAnswer((Invocation invocation) async {
|
||||||
return BuildResult(success: true);
|
return BuildResult(success: true);
|
||||||
});
|
});
|
||||||
final CommandRunner<void> commandRunner = createTestCommandRunner(AssembleCommand());
|
final CommandRunner<void> commandRunner = createTestCommandRunner(AssembleCommand());
|
||||||
await commandRunner.run(<String>['assemble', '-o Output', 'debug_macos_bundle_flutter_assets']);
|
await commandRunner.run(<String>['assemble', '-o Output', 'debug_macos_bundle_flutter_assets']);
|
||||||
final BufferLogger bufferLogger = logger;
|
final BufferLogger bufferLogger = logger;
|
||||||
@ -44,9 +44,9 @@ void main() {
|
|||||||
|
|
||||||
test('Throws ToolExit if not provided with output', () => testbed.run(() async {
|
test('Throws ToolExit if not provided with output', () => testbed.run(() async {
|
||||||
when(mockBuildSystem.build(any, any, buildSystemConfig: anyNamed('buildSystemConfig')))
|
when(mockBuildSystem.build(any, any, buildSystemConfig: anyNamed('buildSystemConfig')))
|
||||||
.thenAnswer((Invocation invocation) async {
|
.thenAnswer((Invocation invocation) async {
|
||||||
return BuildResult(success: true);
|
return BuildResult(success: true);
|
||||||
});
|
});
|
||||||
final CommandRunner<void> commandRunner = createTestCommandRunner(AssembleCommand());
|
final CommandRunner<void> commandRunner = createTestCommandRunner(AssembleCommand());
|
||||||
|
|
||||||
expect(commandRunner.run(<String>['assemble', 'debug_macos_bundle_flutter_assets']), throwsA(isInstanceOf<ToolExit>()));
|
expect(commandRunner.run(<String>['assemble', 'debug_macos_bundle_flutter_assets']), throwsA(isInstanceOf<ToolExit>()));
|
||||||
@ -54,9 +54,9 @@ void main() {
|
|||||||
|
|
||||||
test('Throws ToolExit if called with non-existent rule', () => testbed.run(() async {
|
test('Throws ToolExit if called with non-existent rule', () => testbed.run(() async {
|
||||||
when(mockBuildSystem.build(any, any, buildSystemConfig: anyNamed('buildSystemConfig')))
|
when(mockBuildSystem.build(any, any, buildSystemConfig: anyNamed('buildSystemConfig')))
|
||||||
.thenAnswer((Invocation invocation) async {
|
.thenAnswer((Invocation invocation) async {
|
||||||
return BuildResult(success: true);
|
return BuildResult(success: true);
|
||||||
});
|
});
|
||||||
final CommandRunner<void> commandRunner = createTestCommandRunner(AssembleCommand());
|
final CommandRunner<void> commandRunner = createTestCommandRunner(AssembleCommand());
|
||||||
|
|
||||||
expect(commandRunner.run(<String>['assemble', '-o Output', 'undefined']), throwsA(isInstanceOf<ToolExit>()));
|
expect(commandRunner.run(<String>['assemble', '-o Output', 'undefined']), throwsA(isInstanceOf<ToolExit>()));
|
||||||
@ -64,13 +64,13 @@ void main() {
|
|||||||
|
|
||||||
test('Only writes input and output files when the values change', () => testbed.run(() async {
|
test('Only writes input and output files when the values change', () => testbed.run(() async {
|
||||||
when(mockBuildSystem.build(any, any, buildSystemConfig: anyNamed('buildSystemConfig')))
|
when(mockBuildSystem.build(any, any, buildSystemConfig: anyNamed('buildSystemConfig')))
|
||||||
.thenAnswer((Invocation invocation) async {
|
.thenAnswer((Invocation invocation) async {
|
||||||
return BuildResult(
|
return BuildResult(
|
||||||
success: true,
|
success: true,
|
||||||
inputFiles: <File>[fs.file('foo')..createSync()],
|
inputFiles: <File>[fs.file('foo')..createSync()],
|
||||||
outputFiles: <File>[fs.file('bar')..createSync()],
|
outputFiles: <File>[fs.file('bar')..createSync()],
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
final CommandRunner<void> commandRunner = createTestCommandRunner(AssembleCommand());
|
final CommandRunner<void> commandRunner = createTestCommandRunner(AssembleCommand());
|
||||||
await commandRunner.run(<String>['assemble', '-o Output', '--build-outputs=outputs', '--build-inputs=inputs', 'debug_macos_bundle_flutter_assets']);
|
await commandRunner.run(<String>['assemble', '-o Output', '--build-outputs=outputs', '--build-inputs=inputs', 'debug_macos_bundle_flutter_assets']);
|
||||||
@ -90,12 +90,12 @@ void main() {
|
|||||||
|
|
||||||
|
|
||||||
when(mockBuildSystem.build(any, any, buildSystemConfig: anyNamed('buildSystemConfig')))
|
when(mockBuildSystem.build(any, any, buildSystemConfig: anyNamed('buildSystemConfig')))
|
||||||
.thenAnswer((Invocation invocation) async {
|
.thenAnswer((Invocation invocation) async {
|
||||||
return BuildResult(
|
return BuildResult(
|
||||||
success: true,
|
success: true,
|
||||||
inputFiles: <File>[fs.file('foo'), fs.file('fizz')..createSync()],
|
inputFiles: <File>[fs.file('foo'), fs.file('fizz')..createSync()],
|
||||||
outputFiles: <File>[fs.file('bar'), fs.file(fs.path.join('.dart_tool', 'fizz2'))..createSync(recursive: true)]);
|
outputFiles: <File>[fs.file('bar'), fs.file(fs.path.join('.dart_tool', 'fizz2'))..createSync(recursive: true)]);
|
||||||
});
|
});
|
||||||
await commandRunner.run(<String>['assemble', '-o Output', '--build-outputs=outputs', '--build-inputs=inputs', 'debug_macos_bundle_flutter_assets']);
|
await commandRunner.run(<String>['assemble', '-o Output', '--build-outputs=outputs', '--build-inputs=inputs', 'debug_macos_bundle_flutter_assets']);
|
||||||
|
|
||||||
expect(inputs.readAsStringSync(), contains('foo'));
|
expect(inputs.readAsStringSync(), contains('foo'));
|
||||||
|
@ -47,8 +47,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('Fuchsia build fails gracefully when', () {
|
group('Fuchsia build fails gracefully when', () {
|
||||||
testUsingContext('there is no Fuchsia project',
|
testUsingContext('there is no Fuchsia project', () async {
|
||||||
() async {
|
|
||||||
final BuildCommand command = BuildCommand();
|
final BuildCommand command = BuildCommand();
|
||||||
applyMocksToCommand(command);
|
applyMocksToCommand(command);
|
||||||
expect(
|
expect(
|
||||||
|
@ -52,7 +52,7 @@ void main() {
|
|||||||
macosPlatform = MockPlatform();
|
macosPlatform = MockPlatform();
|
||||||
notMacosPlatform = MockPlatform();
|
notMacosPlatform = MockPlatform();
|
||||||
when(mockProcess.exitCode).thenAnswer((Invocation invocation) async {
|
when(mockProcess.exitCode).thenAnswer((Invocation invocation) async {
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
when(mockProcess.stderr).thenAnswer((Invocation invocation) {
|
when(mockProcess.stderr).thenAnswer((Invocation invocation) {
|
||||||
return const Stream<List<int>>.empty();
|
return const Stream<List<int>>.empty();
|
||||||
|
@ -733,10 +733,10 @@ class AsyncCrashingValidator extends DoctorValidator {
|
|||||||
@override
|
@override
|
||||||
Future<ValidationResult> validate() {
|
Future<ValidationResult> validate() {
|
||||||
const Duration delay = Duration(seconds: 1);
|
const Duration delay = Duration(seconds: 1);
|
||||||
final Future<ValidationResult> result = Future<ValidationResult>
|
final Future<ValidationResult> result = Future<ValidationResult>.delayed(delay)
|
||||||
.delayed(delay).then((_) {
|
.then((_) {
|
||||||
throw 'fatal error';
|
throw 'fatal error';
|
||||||
});
|
});
|
||||||
_time.elapse(const Duration(seconds: 1));
|
_time.elapse(const Duration(seconds: 1));
|
||||||
_time.flushMicrotasks();
|
_time.flushMicrotasks();
|
||||||
return result;
|
return result;
|
||||||
|
@ -230,7 +230,7 @@ Future<ProcessResult> _runFlutterTest(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Test just a specific test file.
|
// Test just a specific test file.
|
||||||
testPath = fs.path.join(testDirectory, '${testName}_test.dart');
|
testPath = fs.path.join(testDirectory, '${testName}_test.dart');
|
||||||
final File testFile = fs.file(testPath);
|
final File testFile = fs.file(testPath);
|
||||||
if (!testFile.existsSync()) {
|
if (!testFile.existsSync()) {
|
||||||
fail('missing test file: $testFile');
|
fail('missing test file: $testFile');
|
||||||
|
@ -274,17 +274,17 @@ Future<void> verifyCrashReportSent(RequestInfo crashInfo, {
|
|||||||
|
|
||||||
class MockCrashReportSender extends MockClient {
|
class MockCrashReportSender extends MockClient {
|
||||||
MockCrashReportSender(RequestInfo crashInfo) : super((Request request) async {
|
MockCrashReportSender(RequestInfo crashInfo) : super((Request request) async {
|
||||||
MockCrashReportSender.sendCalls++;
|
MockCrashReportSender.sendCalls++;
|
||||||
crashInfo.method = request.method;
|
crashInfo.method = request.method;
|
||||||
crashInfo.uri = request.url;
|
crashInfo.uri = request.url;
|
||||||
|
|
||||||
// A very ad-hoc multipart request parser. Good enough for this test.
|
// A very ad-hoc multipart request parser. Good enough for this test.
|
||||||
String boundary = request.headers['Content-Type'];
|
String boundary = request.headers['Content-Type'];
|
||||||
boundary = boundary.substring(boundary.indexOf('boundary=') + 9);
|
boundary = boundary.substring(boundary.indexOf('boundary=') + 9);
|
||||||
crashInfo.fields = Map<String, String>.fromIterable(
|
crashInfo.fields = Map<String, String>.fromIterable(
|
||||||
utf8.decode(request.bodyBytes)
|
utf8.decode(request.bodyBytes)
|
||||||
.split('--$boundary')
|
.split('--$boundary')
|
||||||
.map<List<String>>((String part) {
|
.map<List<String>>((String part) {
|
||||||
final Match nameMatch = RegExp(r'name="(.*)"').firstMatch(part);
|
final Match nameMatch = RegExp(r'name="(.*)"').firstMatch(part);
|
||||||
if (nameMatch == null) {
|
if (nameMatch == null) {
|
||||||
return null;
|
return null;
|
||||||
@ -293,29 +293,28 @@ class MockCrashReportSender extends MockClient {
|
|||||||
final String value = part.split('\n').skip(2).join('\n').trim();
|
final String value = part.split('\n').skip(2).join('\n').trim();
|
||||||
return <String>[name, value];
|
return <String>[name, value];
|
||||||
})
|
})
|
||||||
.where((List<String> pair) => pair != null),
|
.where((List<String> pair) => pair != null),
|
||||||
key: (dynamic key) {
|
key: (dynamic key) {
|
||||||
final List<String> pair = key;
|
final List<String> pair = key;
|
||||||
return pair[0];
|
return pair[0];
|
||||||
},
|
},
|
||||||
value: (dynamic value) {
|
value: (dynamic value) {
|
||||||
final List<String> pair = value;
|
final List<String> pair = value;
|
||||||
return pair[1];
|
return pair[1];
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
'test-report-id',
|
'test-report-id',
|
||||||
200,
|
200,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
static int sendCalls = 0;
|
static int sendCalls = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CrashingCrashReportSender extends MockClient {
|
class CrashingCrashReportSender extends MockClient {
|
||||||
CrashingCrashReportSender(Object exception)
|
CrashingCrashReportSender(Object exception) : super((Request request) async {
|
||||||
: super((Request request) async {
|
|
||||||
throw exception;
|
throw exception;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user