Remove references to Window, and switch usages to PlatformDispatcher or SingletonFlutterWindow (#69617)

* Remove references to dart:ui.Window, and point usages to PlatformDispatcher or SingletonFlutterWindow, as appropriate

* remove new test platform dispatchers

* Amend documentation
This commit is contained in:
Greg Spencer
2020-11-09 15:26:29 -08:00
committed by GitHub
parent 3b7718c27d
commit bbc0161669
34 changed files with 331 additions and 267 deletions

View File

@@ -31,7 +31,7 @@ EnumIndex<OffsetType> _offsetTypeIndex = EnumIndex<OffsetType>(OffsetType.values
/// identified by [finder].
///
/// The requested offset is returned in logical pixels, which can be translated
/// to device pixels via [Window.devicePixelRatio].
/// to device pixels via [dart:ui.FlutterView.devicePixelRatio].
class GetOffset extends CommandWithTarget {
/// The `finder` looks for an element to get its rect.
GetOffset(SerializableFinder finder, this.offsetType, { Duration? timeout }) : super(finder, timeout: timeout);
@@ -56,7 +56,7 @@ class GetOffset extends CommandWithTarget {
/// The result of the [GetOffset] command.
///
/// The offset is provided in logical pixels, which can be translated
/// to device pixels via [Window.devicePixelRatio].
/// to device pixels via [dart:ui.FlutterView.devicePixelRatio].
class GetOffsetResult extends Result {
/// Creates a result with the offset defined by [dx] and [dy].
const GetOffsetResult({ this.dx = 0.0, this.dy = 0.0});
@@ -64,13 +64,13 @@ class GetOffsetResult extends Result {
/// The x component of the offset in logical pixels.
///
/// The value can be translated to device pixels via
/// [Window.devicePixelRatio].
/// [dart:ui.FlutterView.devicePixelRatio].
final double dx;
/// The y component of the offset in logical pixels.
///
/// The value can be translated to device pixels via
/// [Window.devicePixelRatio].
/// [dart:ui.FlutterView.devicePixelRatio].
final double dy;
/// Deserializes the result from JSON.

View File

@@ -227,7 +227,8 @@ abstract class FlutterDriver {
await sendCommand(WaitForCondition(const NoTransientCallbacks(), timeout: timeout));
}
/// Waits until the next [Window.onReportTimings] is called.
/// Waits until the next [dart:ui.PlatformDispatcher.onReportTimings] is
/// called.
///
/// Use this method to wait for the first frame to be rasterized during the
/// app launch.
@@ -246,7 +247,7 @@ abstract class FlutterDriver {
/// Returns the point at the top left of the widget identified by `finder`.
///
/// The offset is expressed in logical pixels and can be translated to
/// device pixels via [Window.devicePixelRatio].
/// device pixels via [dart:ui.FlutterView.devicePixelRatio].
Future<DriverOffset> getTopLeft(SerializableFinder finder, { Duration timeout }) async {
return _getOffset(finder, OffsetType.topLeft, timeout: timeout);
}
@@ -254,7 +255,7 @@ abstract class FlutterDriver {
/// Returns the point at the top right of the widget identified by `finder`.
///
/// The offset is expressed in logical pixels and can be translated to
/// device pixels via [Window.devicePixelRatio].
/// device pixels via [dart:ui.FlutterView.devicePixelRatio].
Future<DriverOffset> getTopRight(SerializableFinder finder, { Duration timeout }) async {
return _getOffset(finder, OffsetType.topRight, timeout: timeout);
}
@@ -262,7 +263,7 @@ abstract class FlutterDriver {
/// Returns the point at the bottom left of the widget identified by `finder`.
///
/// The offset is expressed in logical pixels and can be translated to
/// device pixels via [Window.devicePixelRatio].
/// device pixels via [dart:ui.FlutterView.devicePixelRatio].
Future<DriverOffset> getBottomLeft(SerializableFinder finder, { Duration timeout }) async {
return _getOffset(finder, OffsetType.bottomLeft, timeout: timeout);
}
@@ -270,7 +271,7 @@ abstract class FlutterDriver {
/// Returns the point at the bottom right of the widget identified by `finder`.
///
/// The offset is expressed in logical pixels and can be translated to
/// device pixels via [Window.devicePixelRatio].
/// device pixels via [dart:ui.FlutterView.devicePixelRatio].
Future<DriverOffset> getBottomRight(SerializableFinder finder, { Duration timeout }) async {
return _getOffset(finder, OffsetType.bottomRight, timeout: timeout);
}
@@ -278,7 +279,7 @@ abstract class FlutterDriver {
/// Returns the point at the center of the widget identified by `finder`.
///
/// The offset is expressed in logical pixels and can be translated to
/// device pixels via [Window.devicePixelRatio].
/// device pixels via [dart:ui.FlutterView.devicePixelRatio].
Future<DriverOffset> getCenter(SerializableFinder finder, { Duration timeout }) async {
return _getOffset(finder, OffsetType.center, timeout: timeout);
}