Make sure fab semantics end up on top (#34512)

This commit is contained in:
Dan Field 2019-06-14 14:47:54 -07:00 committed by GitHub
parent 8f75d53735
commit 1427fef8f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 6 deletions

View File

@ -462,11 +462,9 @@ class FloatingActionButton extends StatelessWidget {
); );
if (tooltip != null) { if (tooltip != null) {
result = MergeSemantics( result = Tooltip(
child: Tooltip( message: tooltip,
message: tooltip, child: result,
child: result,
),
); );
} }
@ -477,7 +475,7 @@ class FloatingActionButton extends StatelessWidget {
); );
} }
return result; return MergeSemantics(child: result);
} }
@override @override

View File

@ -763,6 +763,22 @@ void main() {
paintsExactlyCountTimes(#clipPath, 0), paintsExactlyCountTimes(#clipPath, 0),
); );
}); });
testWidgets('Can find FloatingActionButton semantics', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
home: FloatingActionButton(onPressed: () {}),
));
expect(
tester.getSemantics(find.byType(FloatingActionButton)),
matchesSemantics(
hasTapAction: true,
hasEnabledState: true,
isButton: true,
isEnabled: true,
),
);
}, semanticsEnabled: true);
} }
Offset _rightEdgeOfFab(WidgetTester tester) { Offset _rightEdgeOfFab(WidgetTester tester) {