Added byTooltip() to CommonFinders (#6178)

This commit is contained in:
Hans Muller
2016-10-03 12:52:06 -07:00
committed by GitHub
parent 4d8f4f421a
commit b329894b4d
5 changed files with 20 additions and 41 deletions

View File

@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart';
import 'all_elements.dart';
@@ -124,6 +124,21 @@ class CommonFinders {
return new _WidgetPredicateFinder(predicate, skipOffstage: skipOffstage);
}
/// Finds Tooltip widgets with the given message.
///
/// Example:
///
/// expect(tester, hasWidget(find.byTooltip('Back')));
///
/// If the `skipOffstage` argument is true (the default), then this skips
/// nodes that are [Offstage] or that are from inactive [Route]s.
Finder byTooltip(String message, { bool skipOffstage: true }) {
return byWidgetPredicate(
(Widget widget) => widget is Tooltip && widget.message == message,
skipOffstage: skipOffstage,
);
}
/// Finds widgets using an element predicate.
///
/// Example: