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
7b0293d6
Unverified
Commit
7b0293d6
authored
Oct 06, 2023
by
fzyzcjy
Committed by
GitHub
Oct 06, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tiny improve code style by using records instead of lists (#135886)
parent
bf1cdb15
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
19 deletions
+20
-19
text_selection.dart
packages/flutter/lib/src/widgets/text_selection.dart
+20
-19
No files found.
packages/flutter/lib/src/widgets/text_selection.dart
View file @
7b0293d6
...
@@ -1025,7 +1025,7 @@ class SelectionOverlay {
...
@@ -1025,7 +1025,7 @@ class SelectionOverlay {
context:
context
,
context:
context
,
below:
magnifierConfiguration
.
shouldDisplayHandlesInMagnifier
below:
magnifierConfiguration
.
shouldDisplayHandlesInMagnifier
?
null
?
null
:
_handles
?.
firs
t
,
:
_handles
?.
star
t
,
builder:
(
_
)
=>
builtMagnifier
);
builder:
(
_
)
=>
builtMagnifier
);
}
}
...
@@ -1333,7 +1333,7 @@ class SelectionOverlay {
...
@@ -1333,7 +1333,7 @@ class SelectionOverlay {
/// A pair of handles. If this is non-null, there are always 2, though the
/// A pair of handles. If this is non-null, there are always 2, though the
/// second is hidden when the selection is collapsed.
/// second is hidden when the selection is collapsed.
List
<
OverlayEntry
>
?
_handles
;
({
OverlayEntry
start
,
OverlayEntry
end
})
?
_handles
;
/// A copy/paste toolbar.
/// A copy/paste toolbar.
OverlayEntry
?
_toolbar
;
OverlayEntry
?
_toolbar
;
...
@@ -1351,11 +1351,12 @@ class SelectionOverlay {
...
@@ -1351,11 +1351,12 @@ class SelectionOverlay {
return
;
return
;
}
}
_handles
=
<
OverlayEntry
>[
_handles
=
(
OverlayEntry
(
builder:
_buildStartHandle
),
start:
OverlayEntry
(
builder:
_buildStartHandle
),
OverlayEntry
(
builder:
_buildEndHandle
),
end:
OverlayEntry
(
builder:
_buildEndHandle
),
];
);
Overlay
.
of
(
context
,
rootOverlay:
true
,
debugRequiredFor:
debugRequiredFor
).
insertAll
(
_handles
!);
Overlay
.
of
(
context
,
rootOverlay:
true
,
debugRequiredFor:
debugRequiredFor
)
.
insertAll
(<
OverlayEntry
>[
_handles
!.
start
,
_handles
!.
end
]);
}
}
/// {@template flutter.widgets.SelectionOverlay.hideHandles}
/// {@template flutter.widgets.SelectionOverlay.hideHandles}
...
@@ -1363,10 +1364,10 @@ class SelectionOverlay {
...
@@ -1363,10 +1364,10 @@ class SelectionOverlay {
/// {@endtemplate}
/// {@endtemplate}
void
hideHandles
()
{
void
hideHandles
()
{
if
(
_handles
!=
null
)
{
if
(
_handles
!=
null
)
{
_handles
!
[
0
]
.
remove
();
_handles
!
.
start
.
remove
();
_handles
!
[
0
]
.
dispose
();
_handles
!
.
start
.
dispose
();
_handles
!
[
1
]
.
remove
();
_handles
!
.
end
.
remove
();
_handles
!
[
1
]
.
dispose
();
_handles
!
.
end
.
dispose
();
_handles
=
null
;
_handles
=
null
;
}
}
}
}
...
@@ -1444,8 +1445,8 @@ class SelectionOverlay {
...
@@ -1444,8 +1445,8 @@ class SelectionOverlay {
SchedulerBinding
.
instance
.
addPostFrameCallback
((
Duration
duration
)
{
SchedulerBinding
.
instance
.
addPostFrameCallback
((
Duration
duration
)
{
_buildScheduled
=
false
;
_buildScheduled
=
false
;
if
(
_handles
!=
null
)
{
if
(
_handles
!=
null
)
{
_handles
!
[
0
]
.
markNeedsBuild
();
_handles
!
.
start
.
markNeedsBuild
();
_handles
!
[
1
]
.
markNeedsBuild
();
_handles
!
.
end
.
markNeedsBuild
();
}
}
_toolbar
?.
markNeedsBuild
();
_toolbar
?.
markNeedsBuild
();
if
(
_contextMenuController
.
isShown
)
{
if
(
_contextMenuController
.
isShown
)
{
...
@@ -1456,8 +1457,8 @@ class SelectionOverlay {
...
@@ -1456,8 +1457,8 @@ class SelectionOverlay {
});
});
}
else
{
}
else
{
if
(
_handles
!=
null
)
{
if
(
_handles
!=
null
)
{
_handles
!
[
0
]
.
markNeedsBuild
();
_handles
!
.
start
.
markNeedsBuild
();
_handles
!
[
1
]
.
markNeedsBuild
();
_handles
!
.
end
.
markNeedsBuild
();
}
}
_toolbar
?.
markNeedsBuild
();
_toolbar
?.
markNeedsBuild
();
if
(
_contextMenuController
.
isShown
)
{
if
(
_contextMenuController
.
isShown
)
{
...
@@ -1474,10 +1475,10 @@ class SelectionOverlay {
...
@@ -1474,10 +1475,10 @@ class SelectionOverlay {
void
hide
()
{
void
hide
()
{
_magnifierController
.
hide
();
_magnifierController
.
hide
();
if
(
_handles
!=
null
)
{
if
(
_handles
!=
null
)
{
_handles
!
[
0
]
.
remove
();
_handles
!
.
start
.
remove
();
_handles
!
[
0
]
.
dispose
();
_handles
!
.
start
.
dispose
();
_handles
!
[
1
]
.
remove
();
_handles
!
.
end
.
remove
();
_handles
!
[
1
]
.
dispose
();
_handles
!
.
end
.
dispose
();
_handles
=
null
;
_handles
=
null
;
}
}
if
(
_toolbar
!=
null
||
_contextMenuController
.
isShown
||
_spellCheckToolbarController
.
isShown
)
{
if
(
_toolbar
!=
null
||
_contextMenuController
.
isShown
||
_spellCheckToolbarController
.
isShown
)
{
...
...
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