Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
3c24c5bd
Unverified
Commit
3c24c5bd
authored
May 31, 2019
by
Michael Goderbauer
Committed by
GitHub
May 31, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document that offsets are returned in logical pixels (#33620)
parent
55d98ddd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
3 deletions
+30
-3
geometry.dart
packages/flutter_driver/lib/src/common/geometry.dart
+15
-3
driver.dart
packages/flutter_driver/lib/src/driver/driver.dart
+15
-0
No files found.
packages/flutter_driver/lib/src/common/geometry.dart
View file @
3c24c5bd
...
...
@@ -27,8 +27,11 @@ enum OffsetType {
EnumIndex
<
OffsetType
>
_offsetTypeIndex
=
EnumIndex
<
OffsetType
>(
OffsetType
.
values
);
/// A Flutter Driver command that return the [offsetType] from the RenderObject
/// A Flutter Driver command that return
s
the [offsetType] from the RenderObject
/// identified by [finder].
///
/// The requested offset is returned in logical pixels, which can be translated
/// to device pixels via [Window.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
);
...
...
@@ -51,14 +54,23 @@ class GetOffset extends CommandWithTarget {
}
/// The result of the [GetRect] command.
///
/// The offset is provided in logical pixels, which can be translated
/// to device pixels via [Window.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
});
/// The x component of the offset.
/// The x component of the offset in logical pixels.
///
/// The value can be translated to device pixels via
/// [Window.devicePixelRatio].
final
double
dx
;
/// The y component of the offset.
/// The y component of the offset in logical pixels.
///
/// The value can be translated to device pixels via
/// [Window.devicePixelRatio].
final
double
dy
;
/// Deserializes the result from JSON.
...
...
packages/flutter_driver/lib/src/driver/driver.dart
View file @
3c24c5bd
...
...
@@ -483,26 +483,41 @@ 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].
Future
<
DriverOffset
>
getTopLeft
(
SerializableFinder
finder
,
{
Duration
timeout
})
async
{
return
_getOffset
(
finder
,
OffsetType
.
topLeft
,
timeout:
timeout
);
}
/// 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].
Future
<
DriverOffset
>
getTopRight
(
SerializableFinder
finder
,
{
Duration
timeout
})
async
{
return
_getOffset
(
finder
,
OffsetType
.
topRight
,
timeout:
timeout
);
}
/// 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].
Future
<
DriverOffset
>
getBottomLeft
(
SerializableFinder
finder
,
{
Duration
timeout
})
async
{
return
_getOffset
(
finder
,
OffsetType
.
bottomLeft
,
timeout:
timeout
);
}
/// 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].
Future
<
DriverOffset
>
getBottomRight
(
SerializableFinder
finder
,
{
Duration
timeout
})
async
{
return
_getOffset
(
finder
,
OffsetType
.
bottomRight
,
timeout:
timeout
);
}
/// 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].
Future
<
DriverOffset
>
getCenter
(
SerializableFinder
finder
,
{
Duration
timeout
})
async
{
return
_getOffset
(
finder
,
OffsetType
.
center
,
timeout:
timeout
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment