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
4465f688
Unverified
Commit
4465f688
authored
Jun 18, 2021
by
creativecreatorormaybenot
Committed by
GitHub
Jun 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make buildHandle onTap optional (#84806)
parent
6cb43572
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
39 additions
and
7 deletions
+39
-7
desktop_text_selection.dart
...ges/flutter/lib/src/cupertino/desktop_text_selection.dart
+1
-1
text_selection.dart
packages/flutter/lib/src/cupertino/text_selection.dart
+1
-1
desktop_text_selection.dart
...ages/flutter/lib/src/material/desktop_text_selection.dart
+1
-1
text_selection.dart
packages/flutter/lib/src/material/text_selection.dart
+1
-1
text_selection.dart
packages/flutter/lib/src/widgets/text_selection.dart
+1
-1
text_field_test.dart
packages/flutter/test/cupertino/text_field_test.dart
+1
-1
text_selection_test.dart
packages/flutter/test/material/text_selection_test.dart
+32
-0
editable_text_test.dart
packages/flutter/test/widgets/editable_text_test.dart
+1
-1
No files found.
packages/flutter/lib/src/cupertino/desktop_text_selection.dart
View file @
4465f688
...
...
@@ -67,7 +67,7 @@ class _CupertinoDesktopTextSelectionControls extends TextSelectionControls {
/// Builds the text selection handles, but desktop has none.
@override
Widget
buildHandle
(
BuildContext
context
,
TextSelectionHandleType
type
,
double
textLineHeight
,
VoidCallback
?
onTap
)
{
Widget
buildHandle
(
BuildContext
context
,
TextSelectionHandleType
type
,
double
textLineHeight
,
[
VoidCallback
?
onTap
]
)
{
return
const
SizedBox
.
shrink
();
}
...
...
packages/flutter/lib/src/cupertino/text_selection.dart
View file @
4465f688
...
...
@@ -247,7 +247,7 @@ class CupertinoTextSelectionControls extends TextSelectionControls {
/// Builder for iOS text selection edges.
@override
Widget
buildHandle
(
BuildContext
context
,
TextSelectionHandleType
type
,
double
textLineHeight
,
VoidCallback
?
onTap
)
{
Widget
buildHandle
(
BuildContext
context
,
TextSelectionHandleType
type
,
double
textLineHeight
,
[
VoidCallback
?
onTap
]
)
{
// iOS selection handles do not respond to taps.
// We want a size that's a vertical line the height of the text plus a 18.0
...
...
packages/flutter/lib/src/material/desktop_text_selection.dart
View file @
4465f688
...
...
@@ -53,7 +53,7 @@ class _DesktopTextSelectionControls extends TextSelectionControls {
/// Builds the text selection handles, but desktop has none.
@override
Widget
buildHandle
(
BuildContext
context
,
TextSelectionHandleType
type
,
double
textLineHeight
,
VoidCallback
?
onTap
)
{
Widget
buildHandle
(
BuildContext
context
,
TextSelectionHandleType
type
,
double
textLineHeight
,
[
VoidCallback
?
onTap
]
)
{
return
const
SizedBox
.
shrink
();
}
...
...
packages/flutter/lib/src/material/text_selection.dart
View file @
4465f688
...
...
@@ -54,7 +54,7 @@ class MaterialTextSelectionControls extends TextSelectionControls {
/// Builder for material-style text selection handles.
@override
Widget
buildHandle
(
BuildContext
context
,
TextSelectionHandleType
type
,
double
textHeight
,
VoidCallback
?
onTap
)
{
Widget
buildHandle
(
BuildContext
context
,
TextSelectionHandleType
type
,
double
textHeight
,
[
VoidCallback
?
onTap
]
)
{
final
ThemeData
theme
=
Theme
.
of
(
context
);
final
Color
handleColor
=
TextSelectionTheme
.
of
(
context
).
selectionHandleColor
??
theme
.
colorScheme
.
primary
;
final
Widget
handle
=
SizedBox
(
...
...
packages/flutter/lib/src/widgets/text_selection.dart
View file @
4465f688
...
...
@@ -119,7 +119,7 @@ abstract class TextSelectionControls {
/// interaction is allowed. As a counterexample, the default selection handle
/// on iOS [cupertinoTextSelectionControls] does not call [onTap] at all,
/// since its handles are not meant to be tapped.
Widget
buildHandle
(
BuildContext
context
,
TextSelectionHandleType
type
,
double
textLineHeight
,
VoidCallback
?
onTap
);
Widget
buildHandle
(
BuildContext
context
,
TextSelectionHandleType
type
,
double
textLineHeight
,
[
VoidCallback
?
onTap
]
);
/// Get the anchor point of the handle relative to itself. The anchor point is
/// the point that is aligned with a specific point in the text. A handle
...
...
packages/flutter/test/cupertino/text_field_test.dart
View file @
4465f688
...
...
@@ -35,7 +35,7 @@ class MockClipboard {
class
MockTextSelectionControls
extends
TextSelectionControls
{
@override
Widget
buildHandle
(
BuildContext
context
,
TextSelectionHandleType
type
,
double
textLineHeight
,
VoidCallback
?
onTap
)
{
Widget
buildHandle
(
BuildContext
context
,
TextSelectionHandleType
type
,
double
textLineHeight
,
[
VoidCallback
?
onTap
]
)
{
throw
UnimplementedError
();
}
...
...
packages/flutter/test/material/text_selection_test.dart
View file @
4465f688
...
...
@@ -581,6 +581,38 @@ void main() {
matchesGoldenFile
(
'transparent_handle.png'
),
);
});
testWidgets
(
'works with 3 positional parameters'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
Theme
(
data:
ThemeData
(
textSelectionTheme:
const
TextSelectionThemeData
(
selectionHandleColor:
Color
(
0x550000AA
),
),
),
child:
Builder
(
builder:
(
BuildContext
context
)
{
return
Container
(
color:
Colors
.
white
,
height:
800
,
width:
800
,
child:
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
250
),
child:
FittedBox
(
child:
materialTextSelectionControls
.
buildHandle
(
context
,
TextSelectionHandleType
.
right
,
10.0
,
),
),
),
);
},
),
));
// No expect here as this should simply compile / not throw any
// exceptions while building. The test will fail if this either does
// not compile or if the tester catches an exception, which we do
// not take here.
});
});
testWidgets
(
'Paste only appears when clipboard has contents'
,
(
WidgetTester
tester
)
async
{
...
...
packages/flutter/test/widgets/editable_text_test.dart
View file @
4465f688
...
...
@@ -7569,7 +7569,7 @@ class MockTextSelectionControls extends Fake implements TextSelectionControls {
}
@override
Widget
buildHandle
(
BuildContext
context
,
TextSelectionHandleType
type
,
double
textLineHeight
,
VoidCallback
?
onTap
)
{
Widget
buildHandle
(
BuildContext
context
,
TextSelectionHandleType
type
,
double
textLineHeight
,
[
VoidCallback
?
onTap
]
)
{
return
Container
();
}
...
...
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