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
5344ed71
Unverified
Commit
5344ed71
authored
Mar 25, 2021
by
Jonah Williams
Committed by
GitHub
Mar 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter] use null aware operators for function invocations (#79003)
parent
8893e89d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
38 deletions
+20
-38
bottom_navigation_bar.dart
packages/flutter/lib/src/material/bottom_navigation_bar.dart
+1
-2
data_table.dart
packages/flutter/lib/src/material/data_table.dart
+2
-2
drawer.dart
packages/flutter/lib/src/material/drawer.dart
+4
-8
ink_well.dart
packages/flutter/lib/src/material/ink_well.dart
+8
-16
selectable_text.dart
packages/flutter/lib/src/material/selectable_text.dart
+1
-2
object.dart
packages/flutter/lib/src/rendering/object.dart
+4
-8
No files found.
packages/flutter/lib/src/material/bottom_navigation_bar.dart
View file @
5344ed71
...
...
@@ -985,8 +985,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
unselectedLabelStyle:
effectiveUnselectedLabelStyle
,
enableFeedback:
widget
.
enableFeedback
??
bottomTheme
.
enableFeedback
??
true
,
onTap:
()
{
if
(
widget
.
onTap
!=
null
)
widget
.
onTap
!(
i
);
widget
.
onTap
?.
call
(
i
);
},
colorTween:
colorTween
,
flex:
_evaluateFlex
(
_animations
[
i
]),
...
...
packages/flutter/lib/src/material/data_table.dart
View file @
5344ed71
...
...
@@ -1018,7 +1018,7 @@ class DataTable extends StatelessWidget {
tableRows
[
rowIndex
].
children
![
0
]
=
_buildCheckbox
(
context:
context
,
checked:
row
.
selected
,
onRowTap:
()
=>
row
.
onSelectChanged
!=
null
?
row
.
onSelectChanged
!(!
row
.
selected
)
:
null
,
onRowTap:
()
=>
row
.
onSelectChanged
?.
call
(!
row
.
selected
)
,
onCheckboxChanged:
row
.
onSelectChanged
,
overlayColor:
row
.
color
??
effectiveDataRowColor
,
tristate:
false
,
...
...
@@ -1084,7 +1084,7 @@ class DataTable extends StatelessWidget {
onLongPress:
cell
.
onLongPress
,
onTapCancel:
cell
.
onTapCancel
,
onTapDown:
cell
.
onTapDown
,
onSelectChanged:
()
=>
row
.
onSelectChanged
!=
null
?
row
.
onSelectChanged
!(!
row
.
selected
)
:
null
,
onSelectChanged:
()
=>
row
.
onSelectChanged
?.
call
(!
row
.
selected
)
,
overlayColor:
row
.
color
??
effectiveDataRowColor
,
);
rowIndex
+=
1
;
...
...
packages/flutter/lib/src/material/drawer.dart
View file @
5344ed71
...
...
@@ -460,13 +460,11 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
switch
(
Directionality
.
of
(
context
))
{
case
TextDirection
.
rtl
:
_controller
.
fling
(
velocity:
-
visualVelocity
);
if
(
widget
.
drawerCallback
!=
null
)
widget
.
drawerCallback
!(
visualVelocity
<
0.0
);
widget
.
drawerCallback
?.
call
(
visualVelocity
<
0.0
);
break
;
case
TextDirection
.
ltr
:
_controller
.
fling
(
velocity:
visualVelocity
);
if
(
widget
.
drawerCallback
!=
null
)
widget
.
drawerCallback
!(
visualVelocity
>
0.0
);
widget
.
drawerCallback
?.
call
(
visualVelocity
>
0.0
);
break
;
}
}
else
if
(
_controller
.
value
<
0.5
)
{
...
...
@@ -481,15 +479,13 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
/// Typically called by [ScaffoldState.openDrawer].
void
open
()
{
_controller
.
fling
(
velocity:
1.0
);
if
(
widget
.
drawerCallback
!=
null
)
widget
.
drawerCallback
!(
true
);
widget
.
drawerCallback
?.
call
(
true
);
}
/// Starts an animation to close the drawer.
void
close
()
{
_controller
.
fling
(
velocity:
-
1.0
);
if
(
widget
.
drawerCallback
!=
null
)
widget
.
drawerCallback
!(
false
);
widget
.
drawerCallback
?.
call
(
false
);
}
late
ColorTween
_scrimColorTween
;
...
...
packages/flutter/lib/src/material/ink_well.dart
View file @
5344ed71
...
...
@@ -865,12 +865,11 @@ class _InkResponseState extends State<_InkResponseStateWidget>
switch
(
type
)
{
case
_HighlightType
.
pressed
:
if
(
widget
.
onHighlightChanged
!=
null
)
widget
.
onHighlightChanged
!(
value
);
widget
.
onHighlightChanged
?.
call
(
value
);
break
;
case
_HighlightType
.
hover
:
if
(
callOnHover
&&
widget
.
onHover
!=
null
)
widget
.
onHover
!
(
value
);
if
(
callOnHover
)
widget
.
onHover
?.
call
(
value
);
break
;
case
_HighlightType
.
focus
:
break
;
...
...
@@ -951,18 +950,14 @@ class _InkResponseState extends State<_InkResponseStateWidget>
void
_handleFocusUpdate
(
bool
hasFocus
)
{
_hasFocus
=
hasFocus
;
_updateFocusHighlights
();
if
(
widget
.
onFocusChange
!=
null
)
{
widget
.
onFocusChange
!(
hasFocus
);
}
widget
.
onFocusChange
?.
call
(
hasFocus
);
}
void
_handleTapDown
(
TapDownDetails
details
)
{
if
(
_anyChildInkResponsePressed
)
return
;
_startSplash
(
details:
details
);
if
(
widget
.
onTapDown
!=
null
)
{
widget
.
onTapDown
!(
details
);
}
widget
.
onTapDown
?.
call
(
details
);
}
void
_startSplash
({
TapDownDetails
?
details
,
BuildContext
?
context
})
{
...
...
@@ -991,24 +986,21 @@ class _InkResponseState extends State<_InkResponseStateWidget>
if
(
widget
.
onTap
!=
null
)
{
if
(
widget
.
enableFeedback
)
Feedback
.
forTap
(
context
);
widget
.
onTap
!
();
widget
.
onTap
?.
call
();
}
}
void
_handleTapCancel
()
{
_currentSplash
?.
cancel
();
_currentSplash
=
null
;
if
(
widget
.
onTapCancel
!=
null
)
{
widget
.
onTapCancel
!();
}
widget
.
onTapCancel
?.
call
();
updateHighlight
(
_HighlightType
.
pressed
,
value:
false
);
}
void
_handleDoubleTap
()
{
_currentSplash
?.
confirm
();
_currentSplash
=
null
;
if
(
widget
.
onDoubleTap
!=
null
)
widget
.
onDoubleTap
!();
widget
.
onDoubleTap
?.
call
();
}
void
_handleLongPress
()
{
...
...
packages/flutter/lib/src/material/selectable_text.dart
View file @
5344ed71
...
...
@@ -94,8 +94,7 @@ class _SelectableTextSelectionGestureDetectorBuilder extends TextSelectionGestur
break
;
}
}
if
(
_state
.
widget
.
onTap
!=
null
)
_state
.
widget
.
onTap
!();
_state
.
widget
.
onTap
?.
call
();
}
@override
...
...
packages/flutter/lib/src/rendering/object.dart
View file @
5344ed71
...
...
@@ -176,8 +176,7 @@ class PaintingContext extends ClipContext {
assert
(()
{
if
(
debugProfilePaintsEnabled
)
Timeline
.
startSync
(
'
${child.runtimeType}
'
,
arguments:
timelineArgumentsIndicatingLandmarkEvent
);
if
(
debugOnProfilePaint
!=
null
)
debugOnProfilePaint
!(
child
);
debugOnProfilePaint
?.
call
(
child
);
return
true
;
}());
...
...
@@ -830,8 +829,7 @@ class PipelineOwner {
/// Used to notify the pipeline owner that an associated render object wishes
/// to update its visual appearance.
void
requestVisualUpdate
()
{
if
(
onNeedVisualUpdate
!=
null
)
onNeedVisualUpdate
!();
onNeedVisualUpdate
?.
call
();
}
/// The unique object managed by this pipeline that has no parent.
...
...
@@ -1029,8 +1027,7 @@ class PipelineOwner {
if
(
_outstandingSemanticsHandles
==
1
)
{
assert
(
_semanticsOwner
==
null
);
_semanticsOwner
=
SemanticsOwner
();
if
(
onSemanticsOwnerCreated
!=
null
)
onSemanticsOwnerCreated
!();
onSemanticsOwnerCreated
?.
call
();
}
return
SemanticsHandle
.
_
(
this
,
listener
);
}
...
...
@@ -1041,8 +1038,7 @@ class PipelineOwner {
if
(
_outstandingSemanticsHandles
==
0
)
{
_semanticsOwner
!.
dispose
();
_semanticsOwner
=
null
;
if
(
onSemanticsOwnerDisposed
!=
null
)
onSemanticsOwnerDisposed
!();
onSemanticsOwnerDisposed
?.
call
();
}
}
...
...
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