Reverts https://github.com/flutter/flutter/pull/159072 which was flagged as a perf regression in https://github.com/flutter/flutter/issues/159337. Reverting to see if the perf regression was really related to this change or was impacted by another change. See https://github.com/flutter/flutter/issues/159337#issuecomment-2504418480 for context.
This commit is contained in:
parent
7453ffd22d
commit
08e26a3ffc
@ -1283,16 +1283,12 @@ class _InkResponseState extends State<_InkResponseStateWidget>
|
|||||||
assert(widget.debugCheckContext(context));
|
assert(widget.debugCheckContext(context));
|
||||||
super.build(context); // See AutomaticKeepAliveClientMixin.
|
super.build(context); // See AutomaticKeepAliveClientMixin.
|
||||||
|
|
||||||
final ThemeData theme = Theme.of(context);
|
|
||||||
const Set<MaterialState> highlightableStates = <MaterialState>{MaterialState.focused, MaterialState.hovered, MaterialState.pressed};
|
|
||||||
final Set<MaterialState> nonHighlightableStates = statesController.value.difference(highlightableStates);
|
|
||||||
// Each highlightable state will be resolved separately to get the corresponding color.
|
|
||||||
// For this resolution to be correct, the non-highlightable states should be preserved.
|
|
||||||
final Set<MaterialState> pressed = <MaterialState>{...nonHighlightableStates, MaterialState.pressed};
|
|
||||||
final Set<MaterialState> focused = <MaterialState>{...nonHighlightableStates, MaterialState.focused};
|
|
||||||
final Set<MaterialState> hovered = <MaterialState>{...nonHighlightableStates, MaterialState.hovered};
|
|
||||||
|
|
||||||
Color getHighlightColorForType(_HighlightType type) {
|
Color getHighlightColorForType(_HighlightType type) {
|
||||||
|
const Set<MaterialState> pressed = <MaterialState>{MaterialState.pressed};
|
||||||
|
const Set<MaterialState> focused = <MaterialState>{MaterialState.focused};
|
||||||
|
const Set<MaterialState> hovered = <MaterialState>{MaterialState.hovered};
|
||||||
|
|
||||||
|
final ThemeData theme = Theme.of(context);
|
||||||
return switch (type) {
|
return switch (type) {
|
||||||
// The pressed state triggers a ripple (ink splash), per the current
|
// The pressed state triggers a ripple (ink splash), per the current
|
||||||
// Material Design spec. A separate highlight is no longer used.
|
// Material Design spec. A separate highlight is no longer used.
|
||||||
|
@ -11,10 +11,6 @@ import '../widgets/feedback_tester.dart';
|
|||||||
import '../widgets/semantics_tester.dart';
|
import '../widgets/semantics_tester.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
RenderObject getInkFeatures(WidgetTester tester) {
|
|
||||||
return tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
|
||||||
}
|
|
||||||
|
|
||||||
testWidgets('InkWell gestures control test', (WidgetTester tester) async {
|
testWidgets('InkWell gestures control test', (WidgetTester tester) async {
|
||||||
final List<String> log = <String>[];
|
final List<String> log = <String>[];
|
||||||
|
|
||||||
@ -174,7 +170,7 @@ void main() {
|
|||||||
await gesture.addPointer();
|
await gesture.addPointer();
|
||||||
await gesture.moveTo(tester.getCenter(find.byType(SizedBox)));
|
await gesture.moveTo(tester.getCenter(find.byType(SizedBox)));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
expect(inkFeatures, paints..rect(rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0), color: const Color(0xff00ff00)));
|
expect(inkFeatures, paints..rect(rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0), color: const Color(0xff00ff00)));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -213,7 +209,7 @@ void main() {
|
|||||||
await gesture.addPointer();
|
await gesture.addPointer();
|
||||||
await gesture.moveTo(tester.getCenter(find.byType(SizedBox)));
|
await gesture.moveTo(tester.getCenter(find.byType(SizedBox)));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
expect(inkFeatures, paints..rect(rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0), color: const Color(0xff00ff00)));
|
expect(inkFeatures, paints..rect(rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0), color: const Color(0xff00ff00)));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -244,7 +240,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
expect(inkFeatures, paintsExactlyCountTimes(#drawRect, 0));
|
expect(inkFeatures, paintsExactlyCountTimes(#drawRect, 0));
|
||||||
focusNode.requestFocus();
|
focusNode.requestFocus();
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
@ -293,7 +289,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
expect(inkFeatures, paintsExactlyCountTimes(#drawRect, 0));
|
expect(inkFeatures, paintsExactlyCountTimes(#drawRect, 0));
|
||||||
focusNode.requestFocus();
|
focusNode.requestFocus();
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
@ -331,101 +327,13 @@ void main() {
|
|||||||
));
|
));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
final TestGesture gesture = await tester.startGesture(tester.getRect(find.byType(InkWell)).center);
|
final TestGesture gesture = await tester.startGesture(tester.getRect(find.byType(InkWell)).center);
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
expect(inkFeatures, paints..rect(rect: const Rect.fromLTRB(0, 0, 100, 100), color: pressedColor.withAlpha(0)));
|
expect(inkFeatures, paints..rect(rect: const Rect.fromLTRB(0, 0, 100, 100), color: pressedColor.withAlpha(0)));
|
||||||
await tester.pumpAndSettle(); // Let the press highlight animation finish.
|
await tester.pumpAndSettle(); // Let the press highlight animation finish.
|
||||||
expect(inkFeatures, paints..rect(rect: const Rect.fromLTRB(0, 0, 100, 100), color: pressedColor));
|
expect(inkFeatures, paints..rect(rect: const Rect.fromLTRB(0, 0, 100, 100), color: pressedColor));
|
||||||
await gesture.up();
|
await gesture.up();
|
||||||
});
|
});
|
||||||
|
|
||||||
group('Ink well overlayColor resolution respects WidgetState.selected', () {
|
|
||||||
const Color selectedHoveredColor = Color(0xff00ff00);
|
|
||||||
const Color selectedFocusedColor = Color(0xff0000ff);
|
|
||||||
const Color selectedPressedColor = Color(0xff00ffff);
|
|
||||||
const Rect inkRect = Rect.fromLTRB(0, 0, 100, 100);
|
|
||||||
|
|
||||||
Widget boilerplate({ FocusNode? focusNode }) {
|
|
||||||
final WidgetStatesController statesController = WidgetStatesController(<MaterialState>{MaterialState.selected});
|
|
||||||
addTearDown(statesController.dispose);
|
|
||||||
|
|
||||||
return Material(
|
|
||||||
child: Directionality(
|
|
||||||
textDirection: TextDirection.ltr,
|
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.topLeft,
|
|
||||||
child: SizedBox(
|
|
||||||
width: 100,
|
|
||||||
height: 100,
|
|
||||||
child: InkWell(
|
|
||||||
splashFactory: NoSplash.splashFactory,
|
|
||||||
focusNode: focusNode,
|
|
||||||
statesController: statesController,
|
|
||||||
overlayColor: WidgetStateProperty.resolveWith<Color>((Set<WidgetState> states) {
|
|
||||||
if (states.contains(WidgetState.selected)) {
|
|
||||||
if (states.contains(WidgetState.pressed)) {
|
|
||||||
return selectedPressedColor;
|
|
||||||
}
|
|
||||||
if (states.contains(WidgetState.hovered)) {
|
|
||||||
return selectedHoveredColor;
|
|
||||||
}
|
|
||||||
if (states.contains(WidgetState.focused)) {
|
|
||||||
return selectedFocusedColor;
|
|
||||||
}
|
|
||||||
return const Color(0xffbadbad); // Shouldn't happen.
|
|
||||||
} else {
|
|
||||||
return Colors.black;
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
onTap: () { },
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
testWidgets('when focused', (WidgetTester tester) async {
|
|
||||||
FocusManager.instance.highlightStrategy = FocusHighlightStrategy.alwaysTraditional;
|
|
||||||
final FocusNode focusNode = FocusNode(debugLabel: 'Ink Focus');
|
|
||||||
addTearDown(focusNode.dispose);
|
|
||||||
|
|
||||||
await tester.pumpWidget(boilerplate(focusNode: focusNode));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
|
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
|
||||||
expect(inkFeatures, paintsExactlyCountTimes(#drawRect, 0));
|
|
||||||
focusNode.requestFocus();
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
|
|
||||||
expect(inkFeatures, paints..rect(rect: inkRect, color: selectedFocusedColor));
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('when hovered', (WidgetTester tester) async {
|
|
||||||
await tester.pumpWidget(boilerplate());
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
|
|
||||||
final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse);
|
|
||||||
await gesture.addPointer();
|
|
||||||
await gesture.moveTo(tester.getCenter(find.byType(SizedBox)));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
|
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
|
||||||
expect(inkFeatures, paints..rect(rect: inkRect, color: selectedHoveredColor));
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('when pressed', (WidgetTester tester) async {
|
|
||||||
await tester.pumpWidget(boilerplate());
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
|
|
||||||
final TestGesture gesture = await tester.startGesture(tester.getRect(find.byType(InkWell)).center);
|
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
|
||||||
expect(inkFeatures, paints..rect(rect: inkRect, color: selectedPressedColor.withAlpha(0)));
|
|
||||||
await tester.pumpAndSettle(); // Let the press highlight animation finish.
|
|
||||||
expect(inkFeatures, paints..rect(rect: inkRect, color: selectedPressedColor));
|
|
||||||
await gesture.up();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('ink response splashColor matches splashColor parameter', (WidgetTester tester) async {
|
testWidgets('ink response splashColor matches splashColor parameter', (WidgetTester tester) async {
|
||||||
FocusManager.instance.highlightStrategy = FocusHighlightStrategy.alwaysTouch;
|
FocusManager.instance.highlightStrategy = FocusHighlightStrategy.alwaysTouch;
|
||||||
final FocusNode focusNode = FocusNode(debugLabel: 'Ink Focus');
|
final FocusNode focusNode = FocusNode(debugLabel: 'Ink Focus');
|
||||||
@ -459,7 +367,7 @@ void main() {
|
|||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
final TestGesture gesture = await tester.startGesture(tester.getRect(find.byType(InkWell)).center);
|
final TestGesture gesture = await tester.startGesture(tester.getRect(find.byType(InkWell)).center);
|
||||||
await tester.pump(const Duration(milliseconds: 200)); // unconfirmed splash is well underway
|
await tester.pump(const Duration(milliseconds: 200)); // unconfirmed splash is well underway
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
expect(inkFeatures, paints..circle(x: 50, y: 50, color: splashColor));
|
expect(inkFeatures, paints..circle(x: 50, y: 50, color: splashColor));
|
||||||
await gesture.up();
|
await gesture.up();
|
||||||
focusNode.dispose();
|
focusNode.dispose();
|
||||||
@ -509,7 +417,7 @@ void main() {
|
|||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
final TestGesture gesture = await tester.startGesture(tester.getRect(find.byType(InkWell)).center);
|
final TestGesture gesture = await tester.startGesture(tester.getRect(find.byType(InkWell)).center);
|
||||||
await tester.pump(const Duration(milliseconds: 200)); // unconfirmed splash is well underway
|
await tester.pump(const Duration(milliseconds: 200)); // unconfirmed splash is well underway
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
expect(inkFeatures, paints..circle(x: 50, y: 50, color: splashColor));
|
expect(inkFeatures, paints..circle(x: 50, y: 50, color: splashColor));
|
||||||
await gesture.up();
|
await gesture.up();
|
||||||
focusNode.dispose();
|
focusNode.dispose();
|
||||||
@ -538,7 +446,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
expect(inkFeatures, paintsExactlyCountTimes(#drawCircle, 0));
|
expect(inkFeatures, paintsExactlyCountTimes(#drawCircle, 0));
|
||||||
focusNode.requestFocus();
|
focusNode.requestFocus();
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
@ -569,7 +477,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
expect(inkFeatures, paintsExactlyCountTimes(#drawRRect, 0));
|
expect(inkFeatures, paintsExactlyCountTimes(#drawRRect, 0));
|
||||||
|
|
||||||
focusNode.requestFocus();
|
focusNode.requestFocus();
|
||||||
@ -605,7 +513,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
expect(inkFeatures, paintsExactlyCountTimes(#drawRRect, 0));
|
expect(inkFeatures, paintsExactlyCountTimes(#drawRRect, 0));
|
||||||
|
|
||||||
// Hover the ink well.
|
// Hover the ink well.
|
||||||
@ -647,7 +555,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
expect(inkFeatures, paintsExactlyCountTimes(#clipPath, 0));
|
expect(inkFeatures, paintsExactlyCountTimes(#clipPath, 0));
|
||||||
expect(inkFeatures, paintsExactlyCountTimes(#drawRRect, 0));
|
expect(inkFeatures, paintsExactlyCountTimes(#drawRRect, 0));
|
||||||
|
|
||||||
@ -699,7 +607,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
expect(inkFeatures, paintsExactlyCountTimes(#clipPath, 0));
|
expect(inkFeatures, paintsExactlyCountTimes(#clipPath, 0));
|
||||||
expect(inkFeatures, paintsExactlyCountTimes(#drawRRect, 0));
|
expect(inkFeatures, paintsExactlyCountTimes(#drawRRect, 0));
|
||||||
|
|
||||||
@ -752,7 +660,7 @@ testWidgets('InkResponse radius can be updated', (WidgetTester tester) async {
|
|||||||
}
|
}
|
||||||
await tester.pumpWidget(boilerplate(10));
|
await tester.pumpWidget(boilerplate(10));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
expect(inkFeatures, paintsExactlyCountTimes(#drawCircle, 0));
|
expect(inkFeatures, paintsExactlyCountTimes(#drawCircle, 0));
|
||||||
|
|
||||||
focusNode.requestFocus();
|
focusNode.requestFocus();
|
||||||
@ -793,7 +701,7 @@ testWidgets('InkResponse radius can be updated', (WidgetTester tester) async {
|
|||||||
|
|
||||||
await tester.pumpWidget(boilerplate(BoxShape.circle));
|
await tester.pumpWidget(boilerplate(BoxShape.circle));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
expect(inkFeatures, paintsExactlyCountTimes(#drawCircle, 0));
|
expect(inkFeatures, paintsExactlyCountTimes(#drawCircle, 0));
|
||||||
expect(inkFeatures, paintsExactlyCountTimes(#drawRRect, 0));
|
expect(inkFeatures, paintsExactlyCountTimes(#drawRRect, 0));
|
||||||
|
|
||||||
@ -834,7 +742,7 @@ testWidgets('InkResponse radius can be updated', (WidgetTester tester) async {
|
|||||||
|
|
||||||
await tester.pumpWidget(boilerplate(BorderRadius.circular(10)));
|
await tester.pumpWidget(boilerplate(BorderRadius.circular(10)));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
expect(inkFeatures, paintsExactlyCountTimes(#drawRRect, 0));
|
expect(inkFeatures, paintsExactlyCountTimes(#drawRRect, 0));
|
||||||
|
|
||||||
focusNode.requestFocus();
|
focusNode.requestFocus();
|
||||||
@ -883,7 +791,7 @@ testWidgets('InkResponse radius can be updated', (WidgetTester tester) async {
|
|||||||
|
|
||||||
await tester.pumpWidget(boilerplate(BorderRadius.circular(20)));
|
await tester.pumpWidget(boilerplate(BorderRadius.circular(20)));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
expect(inkFeatures, paintsExactlyCountTimes(#clipPath, 0));
|
expect(inkFeatures, paintsExactlyCountTimes(#clipPath, 0));
|
||||||
|
|
||||||
focusNode.requestFocus();
|
focusNode.requestFocus();
|
||||||
@ -954,7 +862,7 @@ testWidgets('InkResponse radius can be updated', (WidgetTester tester) async {
|
|||||||
await tester.pumpWidget(boilerplate(BorderRadius.circular(20)));
|
await tester.pumpWidget(boilerplate(BorderRadius.circular(20)));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
expect(inkFeatures, paintsExactlyCountTimes(#clipPath, 0));
|
expect(inkFeatures, paintsExactlyCountTimes(#clipPath, 0));
|
||||||
|
|
||||||
final TestGesture gesture = await tester.startGesture(tester.getRect(find.byType(InkWell)).center);
|
final TestGesture gesture = await tester.startGesture(tester.getRect(find.byType(InkWell)).center);
|
||||||
@ -1037,7 +945,7 @@ testWidgets('InkResponse radius can be updated', (WidgetTester tester) async {
|
|||||||
),
|
),
|
||||||
));
|
));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
expect(inkFeatures, paintsExactlyCountTimes(#drawRect, 0));
|
expect(inkFeatures, paintsExactlyCountTimes(#drawRect, 0));
|
||||||
focusNode.requestFocus();
|
focusNode.requestFocus();
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
@ -2140,7 +2048,7 @@ testWidgets('InkResponse radius can be updated', (WidgetTester tester) async {
|
|||||||
expect(log, equals(<String>['tap-down', 'double-tap']));
|
expect(log, equals(<String>['tap-down', 'double-tap']));
|
||||||
|
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
expect(inkFeatures, paintsExactlyCountTimes(#drawRect, 0));
|
expect(inkFeatures, paintsExactlyCountTimes(#drawRect, 0));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2185,7 +2093,7 @@ testWidgets('InkResponse radius can be updated', (WidgetTester tester) async {
|
|||||||
expect(log, equals(<String>['tap-down', 'tap-down', 'tap-cancel', 'double-tap']));
|
expect(log, equals(<String>['tap-down', 'tap-down', 'tap-cancel', 'double-tap']));
|
||||||
|
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
expect(inkFeatures, paintsExactlyCountTimes(#drawCircle, 0));
|
expect(inkFeatures, paintsExactlyCountTimes(#drawCircle, 0));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2263,7 +2171,7 @@ testWidgets('InkResponse radius can be updated', (WidgetTester tester) async {
|
|||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
await gesture.moveTo(const Offset(10, 10)); // fade out the overlay
|
await gesture.moveTo(const Offset(10, 10)); // fade out the overlay
|
||||||
await tester.pump(); // trigger the fade out animation
|
await tester.pump(); // trigger the fade out animation
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
// Fadeout begins with the MaterialStates.hovered overlay color
|
// Fadeout begins with the MaterialStates.hovered overlay color
|
||||||
expect(inkFeatures, paints..rect(rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0), color: const Color(0xff00ff00)));
|
expect(inkFeatures, paints..rect(rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0), color: const Color(0xff00ff00)));
|
||||||
// 50ms fadeout is 50% complete, overlay color alpha goes from 0xff to 0x80
|
// 50ms fadeout is 50% complete, overlay color alpha goes from 0xff to 0x80
|
||||||
@ -2328,7 +2236,7 @@ testWidgets('InkResponse radius can be updated', (WidgetTester tester) async {
|
|||||||
await tester.pump(const Duration(milliseconds: 200));
|
await tester.pump(const Duration(milliseconds: 200));
|
||||||
|
|
||||||
// No splash should be painted.
|
// No splash should be painted.
|
||||||
final RenderObject inkFeatures = getInkFeatures(tester);
|
final RenderObject inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
|
||||||
expect(inkFeatures, paintsExactlyCountTimes(#drawCircle, 0));
|
expect(inkFeatures, paintsExactlyCountTimes(#drawCircle, 0));
|
||||||
|
|
||||||
await gesture.up();
|
await gesture.up();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user