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
1196dbe9
Unverified
Commit
1196dbe9
authored
Feb 13, 2019
by
jslavitz
Committed by
GitHub
Feb 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes a cursor offset mistake for Material on iOS (#27851)
* Fixes offset and unblocks roll
parent
a5af29e8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
26 deletions
+27
-26
button.dart
packages/flutter/lib/src/cupertino/button.dart
+0
-5
text_field.dart
packages/flutter/lib/src/material/text_field.dart
+1
-1
text_field_test.dart
packages/flutter/test/material/text_field_test.dart
+2
-2
editable_text_cursor_test.dart
packages/flutter/test/widgets/editable_text_cursor_test.dart
+24
-18
No files found.
packages/flutter/lib/src/cupertino/button.dart
View file @
1196dbe9
...
@@ -110,11 +110,6 @@ class CupertinoButton extends StatefulWidget {
...
@@ -110,11 +110,6 @@ class CupertinoButton extends StatefulWidget {
/// Defaults to round corners of 8 logical pixels.
/// Defaults to round corners of 8 logical pixels.
final
BorderRadius
borderRadius
;
final
BorderRadius
borderRadius
;
/// The shape of the button.
///
/// Defaults to a super ellipse with
// final ShapeBorder shape;
final
bool
_filled
;
final
bool
_filled
;
/// Whether the button is enabled or disabled. Buttons are disabled by default. To
/// Whether the button is enabled or disabled. Buttons are disabled by default. To
...
...
packages/flutter/lib/src/material/text_field.dart
View file @
1196dbe9
...
@@ -778,7 +778,7 @@ class _TextFieldState extends State<TextField> with AutomaticKeepAliveClientMixi
...
@@ -778,7 +778,7 @@ class _TextFieldState extends State<TextField> with AutomaticKeepAliveClientMixi
//
//
// This value is in device pixels, not logical pixels as is typically used
// This value is in device pixels, not logical pixels as is typically used
// throughout the codebase.
// throughout the codebase.
const
int
_iOSHorizontalOffset
=
2
;
const
int
_iOSHorizontalOffset
=
-
2
;
cursorOffset
=
Offset
(
_iOSHorizontalOffset
/
MediaQuery
.
of
(
context
).
devicePixelRatio
,
0
);
cursorOffset
=
Offset
(
_iOSHorizontalOffset
/
MediaQuery
.
of
(
context
).
devicePixelRatio
,
0
);
break
;
break
;
...
...
packages/flutter/test/material/text_field_test.dart
View file @
1196dbe9
...
@@ -4326,14 +4326,14 @@ void main() {
...
@@ -4326,14 +4326,14 @@ void main() {
expect
(
lastCharEndpoint
.
length
,
1
);
expect
(
lastCharEndpoint
.
length
,
1
);
// The last character is now on screen.
// The last character is now on screen.
expect
(
lastCharEndpoint
[
0
].
point
.
dx
,
moreOrLessEquals
(
79
7.3333129882812
));
expect
(
lastCharEndpoint
[
0
].
point
.
dx
,
moreOrLessEquals
(
79
8.6666870117188
));
final
List
<
TextSelectionPoint
>
firstCharEndpoint
=
renderEditable
.
getEndpointsForSelection
(
final
List
<
TextSelectionPoint
>
firstCharEndpoint
=
renderEditable
.
getEndpointsForSelection
(
const
TextSelection
.
collapsed
(
offset:
0
),
// First character's position.
const
TextSelection
.
collapsed
(
offset:
0
),
// First character's position.
);
);
expect
(
firstCharEndpoint
.
length
,
1
);
expect
(
firstCharEndpoint
.
length
,
1
);
// The first character is now offscreen to the left.
// The first character is now offscreen to the left.
expect
(
firstCharEndpoint
[
0
].
point
.
dx
,
moreOrLessEquals
(-
25
8.6666870117187
5
));
expect
(
firstCharEndpoint
[
0
].
point
.
dx
,
moreOrLessEquals
(-
25
7.3333129882812
5
));
});
});
testWidgets
(
testWidgets
(
...
...
packages/flutter/test/widgets/editable_text_cursor_test.dart
View file @
1196dbe9
...
@@ -512,7 +512,9 @@ void main() {
...
@@ -512,7 +512,9 @@ void main() {
expect
(
controller
.
selection
.
baseOffset
,
text
.
length
);
expect
(
controller
.
selection
.
baseOffset
,
text
.
length
);
});
});
testWidgets
(
'Floating cursor is painted'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Floating cursor is painted on iOS'
,
(
WidgetTester
tester
)
async
{
final
TextEditingController
controller
=
TextEditingController
();
const
TextStyle
textStyle
=
TextStyle
();
const
String
text
=
'hello world this is fun and cool and awesome!'
;
const
String
text
=
'hello world this is fun and cool and awesome!'
;
controller
.
text
=
text
;
controller
.
text
=
text
;
final
FocusNode
focusNode
=
FocusNode
();
final
FocusNode
focusNode
=
FocusNode
();
...
@@ -544,7 +546,7 @@ void main() {
...
@@ -544,7 +546,7 @@ void main() {
editableTextState
.
updateFloatingCursor
(
editableTextState
.
updateFloatingCursor
(
RawFloatingCursorPoint
(
RawFloatingCursorPoint
(
state:
FloatingCursorDragState
.
Update
,
state:
FloatingCursorDragState
.
Update
,
offset:
const
Offset
(
20
,
20
)
,
offset:
const
Offset
(
20
,
20
)
),
),
);
);
await
tester
.
pump
();
await
tester
.
pump
();
...
@@ -552,41 +554,45 @@ void main() {
...
@@ -552,41 +554,45 @@ void main() {
expect
(
editable
,
paints
expect
(
editable
,
paints
..
rrect
(
..
rrect
(
rrect:
RRect
.
fromRectAndRadius
(
rrect:
RRect
.
fromRectAndRadius
(
Rect
.
fromLTRB
(
46
4.6666564941406
,
2.0833332538604736
,
466.6666564941406
,
14.083333015441895
),
Rect
.
fromLTRB
(
46
3.3333435058594
,
2.0833332538604736
,
465.3333435058594
,
14.083333015441895
),
const
Radius
.
circular
(
2.0
)
,
const
Radius
.
circular
(
2.0
)
),
),
color:
const
Color
(
0xff8e8e93
))
color:
const
Color
(
0xff8e8e93
),
)
..
rrect
(
..
rrect
(
rrect:
RRect
.
fromRectAndRadius
(
rrect:
RRect
.
fromRectAndRadius
(
Rect
.
fromLTRB
(
46
5.1666564941406
,
1.0833336114883423
,
468.1666564941406
,
15.083333969116211
),
Rect
.
fromLTRB
(
46
3.8333435058594
,
1.0833336114883423
,
466.8333435058594
,
15.083333969116211
),
const
Radius
.
circular
(
1.0
),
const
Radius
.
circular
(
1.0
),
),
),
color:
const
Color
(
0xbf2196f3
))
color:
const
Color
(
0xbf2196f3
),
)
);
);
// Moves the cursor right a few characters.
// Moves the cursor right a few characters.
editableTextState
.
updateFloatingCursor
(
editableTextState
.
updateFloatingCursor
(
RawFloatingCursorPoint
(
RawFloatingCursorPoint
(
state:
FloatingCursorDragState
.
Update
,
state:
FloatingCursorDragState
.
Update
,
offset:
const
Offset
(-
250
,
20
)));
offset:
const
Offset
(-
250
,
20
)
),
);
expect
(
find
.
byType
(
EditableText
),
paints
expect
(
find
.
byType
(
EditableText
),
paints
..
rrect
(
..
rrect
(
rrect:
RRect
.
fromRectAndRadius
(
rrect:
RRect
.
fromRectAndRadius
(
Rect
.
fromLTRB
(
19
2.6666717529297
,
2.0833332538604736
,
194.6666717529297
,
14.083333015441895
),
Rect
.
fromLTRB
(
19
1.3333282470703
,
2.0833332538604736
,
193.3333282470703
,
14.083333015441895
),
const
Radius
.
circular
(
2.0
)
,
const
Radius
.
circular
(
2.0
)
),
),
color:
const
Color
(
0xff8e8e93
))
color:
const
Color
(
0xff8e8e93
)
)
..
rrect
(
..
rrect
(
rrect:
RRect
.
fromRectAndRadius
(
rrect:
RRect
.
fromRectAndRadius
(
Rect
.
fromLTRB
(
19
5.16665649414062
,
1.0833336114883423
,
198.16665649414062
,
15.083333969116211
),
Rect
.
fromLTRB
(
19
3.83334350585938
,
1.0833336114883423
,
196.83334350585938
,
15.083333969116211
),
const
Radius
.
circular
(
1.0
),
const
Radius
.
circular
(
1.0
)
)
,
),
color:
const
Color
(
0xbf2196f3
),
color:
const
Color
(
0xbf2196f3
)
)
)
);
);
editableTextState
.
updateFloatingCursor
(
RawFloatingCursorPoint
(
state:
FloatingCursorDragState
.
End
));
editableTextState
.
updateFloatingCursor
(
RawFloatingCursorPoint
(
state:
FloatingCursorDragState
.
End
));
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
});
});
}
}
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