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
a217bbb6
Unverified
Commit
a217bbb6
authored
Mar 18, 2022
by
Justin McCandless
Committed by
GitHub
Mar 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide toolbar after select all on desktop (#100261)
parent
795fe375
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
0 deletions
+62
-0
desktop_text_selection.dart
...ges/flutter/lib/src/cupertino/desktop_text_selection.dart
+6
-0
desktop_text_selection.dart
...ages/flutter/lib/src/material/desktop_text_selection.dart
+6
-0
text_field_test.dart
packages/flutter/test/material/text_field_test.dart
+50
-0
No files found.
packages/flutter/lib/src/cupertino/desktop_text_selection.dart
View file @
a217bbb6
...
...
@@ -77,6 +77,12 @@ class _CupertinoDesktopTextSelectionControls extends TextSelectionControls {
Offset
getHandleAnchor
(
TextSelectionHandleType
type
,
double
textLineHeight
)
{
return
Offset
.
zero
;
}
@override
void
handleSelectAll
(
TextSelectionDelegate
delegate
)
{
super
.
handleSelectAll
(
delegate
);
delegate
.
hideToolbar
();
}
}
/// Text selection controls that follows Mac design conventions.
...
...
packages/flutter/lib/src/material/desktop_text_selection.dart
View file @
a217bbb6
...
...
@@ -73,6 +73,12 @@ class _DesktopTextSelectionControls extends TextSelectionControls {
value
.
text
.
isNotEmpty
&&
!(
value
.
selection
.
start
==
0
&&
value
.
selection
.
end
==
value
.
text
.
length
);
}
@override
void
handleSelectAll
(
TextSelectionDelegate
delegate
)
{
super
.
handleSelectAll
(
delegate
);
delegate
.
hideToolbar
();
}
}
/// Text selection controls that loosely follows Material design conventions.
...
...
packages/flutter/test/material/text_field_test.dart
View file @
a217bbb6
...
...
@@ -10125,6 +10125,56 @@ void main() {
expect
(
cursorRight
,
inputWidth
-
kCaretGap
);
});
testWidgets
(
'Text selection menu hides after select all on desktop'
,
(
WidgetTester
tester
)
async
{
final
TextEditingController
controller
=
TextEditingController
(
text:
'Atwater Peel Sherbrooke Bonaventure'
,
);
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Material
(
child:
TextField
(
controller:
controller
,
),
),
),
);
final
String
selectAll
=
defaultTargetPlatform
==
TargetPlatform
.
macOS
?
'Select All'
:
'Select all'
;
expect
(
find
.
text
(
selectAll
),
findsNothing
);
expect
(
find
.
text
(
'Copy'
),
findsNothing
);
final
TestGesture
gesture
=
await
tester
.
startGesture
(
const
Offset
(
10.0
,
0.0
)
+
textOffsetToPosition
(
tester
,
controller
.
text
.
length
),
kind:
PointerDeviceKind
.
mouse
,
buttons:
kSecondaryMouseButton
,
);
addTearDown
(
gesture
.
removePointer
);
await
tester
.
pump
();
await
gesture
.
up
();
await
tester
.
pumpAndSettle
();
expect
(
controller
.
value
.
selection
,
TextSelection
.
collapsed
(
offset:
controller
.
text
.
length
,
affinity:
TextAffinity
.
upstream
,
),
);
expect
(
find
.
text
(
selectAll
),
findsOneWidget
);
await
tester
.
tapAt
(
tester
.
getCenter
(
find
.
text
(
selectAll
)));
await
tester
.
pump
();
expect
(
find
.
text
(
selectAll
),
findsNothing
);
expect
(
find
.
text
(
'Copy'
),
findsNothing
);
},
variant:
TargetPlatformVariant
.
desktop
(),
skip:
isContextMenuProvidedByPlatform
,
// [intended] only applies to platforms where we supply the context menu.
);
// Regressing test for https://github.com/flutter/flutter/issues/70625
testWidgets
(
'TextFields can inherit [FloatingLabelBehaviour] from InputDecorationTheme.'
,
(
WidgetTester
tester
)
async
{
final
FocusNode
focusNode
=
FocusNode
();
...
...
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