This reverts commit fdf87edd2fadb3ba3219d23792f0210384533e1b.
This commit is contained in:
parent
d9252f95f9
commit
c44e5a32b5
@ -8,7 +8,6 @@ import 'dart:math' as math;
|
|||||||
import 'dart:ui' show lerpDouble, hashValues;
|
import 'dart:ui' show lerpDouble, hashValues;
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:vector_math/vector_math_64.dart' show Matrix4;
|
|
||||||
|
|
||||||
import 'box.dart';
|
import 'box.dart';
|
||||||
import 'object.dart';
|
import 'object.dart';
|
||||||
@ -708,22 +707,6 @@ class RenderIndexedStack extends RenderStack {
|
|||||||
context.paintChild(child, childParentData.offset + offset);
|
context.paintChild(child, childParentData.offset + offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void applyPaintTransform(RenderObject child, Matrix4 transform) {
|
|
||||||
if (firstChild == null || index == null)
|
|
||||||
return;
|
|
||||||
final RenderBox childAtIndex = _childAtIndex();
|
|
||||||
if (child != childAtIndex)
|
|
||||||
// It is possible that the offstage widgets want to paint themselves.
|
|
||||||
// For example, the Material widget tries to paint all
|
|
||||||
// InkFeatures under its subtree as long as they are not disposed. In
|
|
||||||
// such case, we give it a zero transform to prevent them from painting.
|
|
||||||
// https://github.com/flutter/flutter/issues/59963
|
|
||||||
transform.setZero();
|
|
||||||
else
|
|
||||||
super.applyPaintTransform(child, transform);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||||
super.debugFillProperties(properties);
|
super.debugFillProperties(properties);
|
||||||
|
@ -341,19 +341,11 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('Dropdown button control test', (WidgetTester tester) async {
|
testWidgets('Dropdown button control test', (WidgetTester tester) async {
|
||||||
String value = 'one';
|
String value = 'one';
|
||||||
StateSetter setState;
|
|
||||||
void didChangeValue(String newValue) {
|
void didChangeValue(String newValue) {
|
||||||
setState(() {
|
|
||||||
value = newValue;
|
value = newValue;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget build() {
|
Widget build() => buildFrame(value: value, onChanged: didChangeValue);
|
||||||
return StatefulBuilder(builder: (BuildContext context, StateSetter setter) {
|
|
||||||
setState = setter;
|
|
||||||
return buildFrame(value: value, onChanged: didChangeValue);
|
|
||||||
},);
|
|
||||||
}
|
|
||||||
|
|
||||||
await tester.pumpWidget(build());
|
await tester.pumpWidget(build());
|
||||||
|
|
||||||
@ -388,16 +380,11 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('Dropdown button with no app', (WidgetTester tester) async {
|
testWidgets('Dropdown button with no app', (WidgetTester tester) async {
|
||||||
String value = 'one';
|
String value = 'one';
|
||||||
StateSetter setState;
|
|
||||||
void didChangeValue(String newValue) {
|
void didChangeValue(String newValue) {
|
||||||
setState(() {
|
|
||||||
value = newValue;
|
value = newValue;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget build() {
|
Widget build() {
|
||||||
return StatefulBuilder(builder: (BuildContext context, StateSetter setter) {
|
|
||||||
setState = setter;
|
|
||||||
return Directionality(
|
return Directionality(
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
child: Navigator(
|
child: Navigator(
|
||||||
@ -407,14 +394,13 @@ void main() {
|
|||||||
settings: settings,
|
settings: settings,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return Material(
|
return Material(
|
||||||
child: buildFrame(value: value, onChanged: didChangeValue),
|
child: buildFrame(value: 'one', onChanged: didChangeValue),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await tester.pumpWidget(build());
|
await tester.pumpWidget(build());
|
||||||
@ -2500,22 +2486,15 @@ void main() {
|
|||||||
testWidgets('DropdownButton onTap callback is called when defined', (WidgetTester tester) async {
|
testWidgets('DropdownButton onTap callback is called when defined', (WidgetTester tester) async {
|
||||||
int dropdownButtonTapCounter = 0;
|
int dropdownButtonTapCounter = 0;
|
||||||
String value = 'one';
|
String value = 'one';
|
||||||
StateSetter setState;
|
|
||||||
|
|
||||||
void onChanged(String newValue) {
|
void onChanged(String newValue) { value = newValue; }
|
||||||
setState(() {
|
|
||||||
value = newValue;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
void onTap() { dropdownButtonTapCounter += 1; }
|
void onTap() { dropdownButtonTapCounter += 1; }
|
||||||
|
|
||||||
Widget build() {
|
Widget build() => buildFrame(
|
||||||
return StatefulBuilder(builder: (BuildContext context, StateSetter setter) {
|
value: value,
|
||||||
setState = setter;
|
onChanged: onChanged,
|
||||||
return buildFrame(value: value, onChanged: onChanged, onTap: onTap,);
|
onTap: onTap,
|
||||||
},);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
await tester.pumpWidget(build());
|
await tester.pumpWidget(build());
|
||||||
|
|
||||||
expect(dropdownButtonTapCounter, 0);
|
expect(dropdownButtonTapCounter, 0);
|
||||||
@ -2551,15 +2530,8 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('DropdownMenuItem onTap callback is called when defined', (WidgetTester tester) async {
|
testWidgets('DropdownMenuItem onTap callback is called when defined', (WidgetTester tester) async {
|
||||||
String value = 'one';
|
String value = 'one';
|
||||||
int currentIndex = -1;
|
|
||||||
StateSetter setState;
|
|
||||||
void onChanged(String newValue) {
|
|
||||||
setState(() {
|
|
||||||
currentIndex = -1;
|
|
||||||
value = newValue;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
final List<int> menuItemTapCounters = <int>[0, 0, 0, 0];
|
final List<int> menuItemTapCounters = <int>[0, 0, 0, 0];
|
||||||
|
void onChanged(String newValue) { value = newValue; }
|
||||||
|
|
||||||
final List<VoidCallback> onTapCallbacks = <VoidCallback>[
|
final List<VoidCallback> onTapCallbacks = <VoidCallback>[
|
||||||
() { menuItemTapCounters[0] += 1; },
|
() { menuItemTapCounters[0] += 1; },
|
||||||
@ -2568,10 +2540,9 @@ void main() {
|
|||||||
() { menuItemTapCounters[3] += 1; },
|
() { menuItemTapCounters[3] += 1; },
|
||||||
];
|
];
|
||||||
|
|
||||||
Widget build() {
|
int currentIndex = -1;
|
||||||
return StatefulBuilder(builder: (BuildContext context, StateSetter setter) {
|
await tester.pumpWidget(
|
||||||
setState = setter;
|
TestApp(
|
||||||
return TestApp(
|
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
child: Material(
|
child: Material(
|
||||||
child: RepaintBoundary(
|
child: RepaintBoundary(
|
||||||
@ -2589,11 +2560,8 @@ void main() {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
await tester.pumpWidget(build());
|
|
||||||
|
|
||||||
// Tap dropdown button.
|
// Tap dropdown button.
|
||||||
await tester.tap(find.text('one'));
|
await tester.tap(find.text('one'));
|
||||||
|
@ -434,36 +434,4 @@ void main() {
|
|||||||
throw 'Expected: paint.color.alpha == 0, found: ${paint.color.alpha}';
|
throw 'Expected: paint.color.alpha == 0, found: ${paint.color.alpha}';
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Does the Ink widget render anything if it have ancestor IndexedStack', (WidgetTester tester) async {
|
|
||||||
// Regressing test for https://github.com/flutter/flutter/issues/59963
|
|
||||||
int index = 0;
|
|
||||||
Widget build() => Directionality(
|
|
||||||
textDirection: TextDirection.ltr,
|
|
||||||
child: Material(
|
|
||||||
child: IndexedStack(
|
|
||||||
index: index,
|
|
||||||
children: <Widget>[
|
|
||||||
Ink(width: 100, height: 100, decoration: const BoxDecoration(color: Colors.black)),
|
|
||||||
Ink(width: 50, height: 50, decoration: const BoxDecoration(color: Colors.red)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
await tester.pumpWidget(build());
|
|
||||||
|
|
||||||
final RenderBox box = Material.of(tester.element(find.byType(IndexedStack))) as RenderBox;
|
|
||||||
|
|
||||||
expect(box, paints..rect(rect: const Rect.fromLTRB(0.0, 0.0, 100.0, 100.0), color: Color(Colors.black.value)));
|
|
||||||
|
|
||||||
// update index, child do not at index should not be painted by have a zero
|
|
||||||
// transform.
|
|
||||||
index = 1;
|
|
||||||
await tester.pumpWidget(build());
|
|
||||||
|
|
||||||
expect(box, paints..transform(
|
|
||||||
matrix4: equals(<dynamic>[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]),
|
|
||||||
));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user