@@ -10,6 +10,7 @@ import 'package:flutter/rendering.dart';
10
10
import 'package:flutter/services.dart' ;
11
11
import 'package:flutter_test/flutter_test.dart' ;
12
12
13
+ import '../rendering/mock_canvas.dart' ;
13
14
import '../widgets/semantics_tester.dart' ;
14
15
15
16
Widget buildSliverAppBarApp ({
@@ -1103,6 +1104,48 @@ void main() {
1103
1104
expect (find.byIcon (Icons .menu), findsNothing);
1104
1105
});
1105
1106
1107
+ testWidgets ('AppBar ink splash draw on the correct canvas' , (WidgetTester tester) async {
1108
+ // This is a regression test for https://github.com/flutter/flutter/issues/58665
1109
+ final Key key = UniqueKey ();
1110
+ await tester.pumpWidget (
1111
+ MaterialApp (
1112
+ home: Center (
1113
+ child: AppBar (
1114
+ title: const Text ('Abc' ),
1115
+ actions: < Widget > [
1116
+ IconButton (
1117
+ key: key,
1118
+ icon: const Icon (Icons .add_circle),
1119
+ tooltip: 'First button' ,
1120
+ onPressed: () {},
1121
+ ),
1122
+ ],
1123
+ flexibleSpace: DecoratedBox (
1124
+ decoration: BoxDecoration (
1125
+ gradient: LinearGradient (
1126
+ begin: const Alignment (0.0 , - 1.0 ),
1127
+ end: const Alignment (- 0.04 , 1.0 ),
1128
+ colors: < Color > [Colors .blue.shade500, Colors .blue.shade800],
1129
+ ),
1130
+ ),
1131
+ ),
1132
+ ),
1133
+ ),
1134
+ ),
1135
+ );
1136
+ final RenderObject painter = tester.renderObject (
1137
+ find.descendant (
1138
+ of: find.descendant (
1139
+ of: find.byType (AppBar ),
1140
+ matching: find.byType (Stack ),
1141
+ ),
1142
+ matching: find.byType (Material )
1143
+ )
1144
+ );
1145
+ await tester.tap (find.byKey (key));
1146
+ expect (painter, paints..save ()..translate ()..save ()..translate ()..circle (x: 24.0 , y: 28.0 ));
1147
+ });
1148
+
1106
1149
testWidgets ('AppBar handles loose children 0' , (WidgetTester tester) async {
1107
1150
final GlobalKey key = GlobalKey ();
1108
1151
await tester.pumpWidget (
0 commit comments