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
6a88c221
Unverified
Commit
6a88c221
authored
May 26, 2022
by
chunhtai
Committed by
GitHub
May 26, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SelectableRegion does not merge child semantics nodes (#104659)
parent
3e7e01c8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
1 deletion
+78
-1
selectable_region.dart
packages/flutter/lib/src/widgets/selectable_region.dart
+1
-0
selectable_region_test.dart
packages/flutter/test/widgets/selectable_region_test.dart
+77
-1
No files found.
packages/flutter/lib/src/widgets/selectable_region.dart
View file @
6a88c221
...
...
@@ -780,6 +780,7 @@ class _SelectableRegionState extends State<SelectableRegion> with TextSelectionD
child:
Actions
(
actions:
_actions
,
child:
Focus
(
includeSemantics:
false
,
focusNode:
widget
.
focusNode
,
child:
SelectionContainer
(
registrar:
this
,
...
...
packages/flutter/test/widgets/selectable_region_test.dart
View file @
6a88c221
...
...
@@ -10,6 +10,7 @@ import 'package:flutter/services.dart';
import
'package:flutter_test/flutter_test.dart'
;
import
'../widgets/clipboard_utils.dart'
;
import
'semantics_tester.dart'
;
Offset
textOffsetToPosition
(
RenderParagraph
paragraph
,
int
offset
)
{
const
Rect
caret
=
Rect
.
fromLTWH
(
0.0
,
0.0
,
2.0
,
20.0
);
...
...
@@ -34,7 +35,7 @@ void main() {
TestDefaultBinaryMessengerBinding
.
instance
!.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
SystemChannels
.
platform
,
null
);
});
group
(
'Select
ionArea
'
,
()
{
group
(
'Select
ableRegion
'
,
()
{
testWidgets
(
'mouse selection sends correct events'
,
(
WidgetTester
tester
)
async
{
final
UniqueKey
spy
=
UniqueKey
();
await
tester
.
pumpWidget
(
...
...
@@ -94,6 +95,81 @@ void main() {
);
});
testWidgets
(
'does not merge semantics node of the children'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
MaterialApp
(
home:
SelectableRegion
(
focusNode:
FocusNode
(),
selectionControls:
materialTextSelectionControls
,
child:
Scaffold
(
body:
Center
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
const
Text
(
'Line one'
),
const
Text
(
'Line two'
),
ElevatedButton
(
onPressed:
()
{},
child:
const
Text
(
'Button'
),
)
],
),
),
),
),
),
);
expect
(
semantics
,
hasSemantics
(
TestSemantics
.
root
(
children:
<
TestSemantics
>[
TestSemantics
(
textDirection:
TextDirection
.
ltr
,
children:
<
TestSemantics
>[
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
scopesRoute
],
children:
<
TestSemantics
>[
TestSemantics
(
label:
'Line one'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
label:
'Line two'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isButton
,
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isEnabled
,
SemanticsFlag
.
isFocusable
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
label:
'Button'
,
textDirection:
TextDirection
.
ltr
,
),
],
),
],
),
],
),
],
),
ignoreRect:
true
,
ignoreTransform:
true
,
ignoreId:
true
,
),
);
semantics
.
dispose
();
});
testWidgets
(
'mouse selection always cancels previous selection'
,
(
WidgetTester
tester
)
async
{
final
UniqueKey
spy
=
UniqueKey
();
await
tester
.
pumpWidget
(
...
...
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