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
e4ebcdf6
Commit
e4ebcdf6
authored
Jul 27, 2019
by
LongCatIsLooong
Committed by
Jonah Williams
Jul 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use SizedBox instead of Container for building collapsed selection (#37048)
parent
e7d611df
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
1 deletion
+40
-1
text_selection.dart
packages/flutter/lib/src/cupertino/text_selection.dart
+1
-1
text_selection_test.dart
packages/flutter/test/widgets/text_selection_test.dart
+39
-0
No files found.
packages/flutter/lib/src/cupertino/text_selection.dart
View file @
e4ebcdf6
...
@@ -402,7 +402,7 @@ class _CupertinoTextSelectionControls extends TextSelectionControls {
...
@@ -402,7 +402,7 @@ class _CupertinoTextSelectionControls extends TextSelectionControls {
);
);
// iOS doesn't draw anything for collapsed selections.
// iOS doesn't draw anything for collapsed selections.
case
TextSelectionHandleType
.
collapsed
:
case
TextSelectionHandleType
.
collapsed
:
return
Container
();
return
const
SizedBox
();
}
}
assert
(
type
!=
null
);
assert
(
type
!=
null
);
return
null
;
return
null
;
...
...
packages/flutter/test/widgets/text_selection_test.dart
View file @
e4ebcdf6
...
@@ -7,6 +7,7 @@ import 'package:flutter/gestures.dart' show PointerDeviceKind;
...
@@ -7,6 +7,7 @@ import 'package:flutter/gestures.dart' show PointerDeviceKind;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/foundation.dart'
show
debugDefaultTargetPlatformOverride
;
void
main
(
)
{
void
main
(
)
{
int
tapCount
;
int
tapCount
;
...
@@ -516,6 +517,44 @@ void main() {
...
@@ -516,6 +517,44 @@ void main() {
expect
(
state
.
showToolbarCalled
,
isFalse
);
expect
(
state
.
showToolbarCalled
,
isFalse
);
expect
(
renderEditable
.
selectWordsInRangeCalled
,
isFalse
);
expect
(
renderEditable
.
selectWordsInRangeCalled
,
isFalse
);
});
});
// Regression test for https://github.com/flutter/flutter/issues/37032.
testWidgets
(
"selection handle's GestureDetector should not cover the entire screen"
,
(
WidgetTester
tester
)
async
{
debugDefaultTargetPlatformOverride
=
TargetPlatform
.
iOS
;
final
TextEditingController
controller
=
TextEditingController
(
text:
'a'
);
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
TextField
(
autofocus:
true
,
controller:
controller
,
),
),
),
);
await
tester
.
pumpAndSettle
();
final
Finder
gestureDetector
=
find
.
descendant
(
of:
find
.
byType
(
Visibility
),
matching:
find
.
descendant
(
of:
find
.
byType
(
FadeTransition
),
matching:
find
.
byType
(
GestureDetector
),
),
);
expect
(
gestureDetector
,
findsOneWidget
);
// The GestureDetector's size should not exceed that of the TextField.
final
Rect
hitRect
=
tester
.
getRect
(
gestureDetector
);
final
Rect
textFieldRect
=
tester
.
getRect
(
find
.
byType
(
TextField
));
expect
(
hitRect
.
size
.
width
,
lessThan
(
textFieldRect
.
size
.
width
));
expect
(
hitRect
.
size
.
height
,
lessThan
(
textFieldRect
.
size
.
height
));
debugDefaultTargetPlatformOverride
=
null
;
});
}
}
class
FakeTextSelectionGestureDetectorBuilderDelegate
implements
TextSelectionGestureDetectorBuilderDelegate
{
class
FakeTextSelectionGestureDetectorBuilderDelegate
implements
TextSelectionGestureDetectorBuilderDelegate
{
...
...
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