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
6471a34d
Unverified
Commit
6471a34d
authored
Dec 15, 2020
by
Jesse
Committed by
GitHub
Dec 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup nullability for ImplicitlyAnimatedWidgetState (#72091)
parent
84a7a611
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
52 deletions
+50
-52
material.dart
packages/flutter/lib/src/material/material.dart
+3
-3
theme.dart
packages/flutter/lib/src/material/theme.dart
+1
-1
fade_in_image.dart
packages/flutter/lib/src/widgets/fade_in_image.dart
+3
-3
implicit_animations.dart
packages/flutter/lib/src/widgets/implicit_animations.dart
+41
-43
tween_animation_builder.dart
...ages/flutter/lib/src/widgets/tween_animation_builder.dart
+2
-2
No files found.
packages/flutter/lib/src/material/material.dart
View file @
6471a34d
...
...
@@ -777,8 +777,8 @@ class _MaterialInteriorState extends AnimatedWidgetBaseState<_MaterialInterior>
@override
Widget
build
(
BuildContext
context
)
{
final
ShapeBorder
shape
=
_border
!.
evaluate
(
animation
!
)!;
final
double
elevation
=
_elevation
!.
evaluate
(
animation
!
);
final
ShapeBorder
shape
=
_border
!.
evaluate
(
animation
)!;
final
double
elevation
=
_elevation
!.
evaluate
(
animation
);
return
PhysicalShape
(
child:
_ShapeBorderPaint
(
child:
widget
.
child
,
...
...
@@ -792,7 +792,7 @@ class _MaterialInteriorState extends AnimatedWidgetBaseState<_MaterialInterior>
clipBehavior:
widget
.
clipBehavior
,
elevation:
elevation
,
color:
ElevationOverlay
.
applyOverlay
(
context
,
widget
.
color
,
elevation
),
shadowColor:
_shadowColor
!.
evaluate
(
animation
!
)!,
shadowColor:
_shadowColor
!.
evaluate
(
animation
)!,
);
}
}
...
...
packages/flutter/lib/src/material/theme.dart
View file @
6471a34d
...
...
@@ -230,7 +230,7 @@ class _AnimatedThemeState extends AnimatedWidgetBaseState<AnimatedTheme> {
Widget
build
(
BuildContext
context
)
{
return
Theme
(
child:
widget
.
child
,
data:
_data
!.
evaluate
(
animation
!
),
data:
_data
!.
evaluate
(
animation
),
);
}
...
...
packages/flutter/lib/src/widgets/fade_in_image.dart
View file @
6471a34d
...
...
@@ -464,7 +464,7 @@ class _AnimatedFadeOutFadeInState extends ImplicitlyAnimatedWidgetState<_Animate
@override
void
didUpdateTweens
()
{
_placeholderOpacityAnimation
=
animation
!
.
drive
(
TweenSequence
<
double
>(<
TweenSequenceItem
<
double
>>[
_placeholderOpacityAnimation
=
animation
.
drive
(
TweenSequence
<
double
>(<
TweenSequenceItem
<
double
>>[
TweenSequenceItem
<
double
>(
tween:
_placeholderOpacity
!.
chain
(
CurveTween
(
curve:
widget
.
fadeOutCurve
)),
weight:
widget
.
fadeOutDuration
.
inMilliseconds
.
toDouble
(),
...
...
@@ -480,7 +480,7 @@ class _AnimatedFadeOutFadeInState extends ImplicitlyAnimatedWidgetState<_Animate
}
});
_targetOpacityAnimation
=
animation
!
.
drive
(
TweenSequence
<
double
>(<
TweenSequenceItem
<
double
>>[
_targetOpacityAnimation
=
animation
.
drive
(
TweenSequence
<
double
>(<
TweenSequenceItem
<
double
>>[
TweenSequenceItem
<
double
>(
tween:
ConstantTween
<
double
>(
0
),
weight:
widget
.
fadeOutDuration
.
inMilliseconds
.
toDouble
(),
...
...
@@ -493,7 +493,7 @@ class _AnimatedFadeOutFadeInState extends ImplicitlyAnimatedWidgetState<_Animate
if
(!
widget
.
isTargetLoaded
&&
_isValid
(
_placeholderOpacity
!)
&&
_isValid
(
_targetOpacity
!))
{
// Jump (don't fade) back to the placeholder image, so as to be ready
// for the full animation when the new target image becomes ready.
controller
!.
value
=
controller
!
.
upperBound
;
controller
.
value
=
controller
.
upperBound
;
}
}
...
...
packages/flutter/lib/src/widgets/implicit_animations.dart
View file @
6471a34d
...
...
@@ -352,22 +352,21 @@ typedef TweenVisitor<T extends Object> = Tween<T>? Function(Tween<T>? tween, T t
abstract
class
ImplicitlyAnimatedWidgetState
<
T
extends
ImplicitlyAnimatedWidget
>
extends
State
<
T
>
with
SingleTickerProviderStateMixin
<
T
>
{
/// The animation controller driving this widget's implicit animations.
@protected
AnimationController
?
get
controller
=>
_controller
;
AnimationController
?
_controller
;
AnimationController
get
controller
=>
_controller
;
late
final
AnimationController
_controller
=
AnimationController
(
duration:
widget
.
duration
,
debugLabel:
kDebugMode
?
widget
.
toStringShort
()
:
null
,
vsync:
this
,
);
/// The animation driving this widget's implicit animations.
Animation
<
double
>
?
get
animation
=>
_animation
;
Animation
<
double
>?
_animation
;
Animation
<
double
>
get
animation
=>
_animation
;
late
Animation
<
double
>
_animation
=
_createCurve
()
;
@override
void
initState
()
{
super
.
initState
();
_controller
=
AnimationController
(
duration:
widget
.
duration
,
debugLabel:
kDebugMode
?
widget
.
toStringShort
()
:
null
,
vsync:
this
,
);
_controller
!.
addStatusListener
((
AnimationStatus
status
)
{
_controller
.
addStatusListener
((
AnimationStatus
status
)
{
switch
(
status
)
{
case
AnimationStatus
.
completed
:
if
(
widget
.
onEnd
!=
null
)
...
...
@@ -378,7 +377,6 @@ abstract class ImplicitlyAnimatedWidgetState<T extends ImplicitlyAnimatedWidget>
case
AnimationStatus
.
reverse
:
}
});
_updateCurve
();
_constructTweens
();
didUpdateTweens
();
}
...
...
@@ -387,27 +385,27 @@ abstract class ImplicitlyAnimatedWidgetState<T extends ImplicitlyAnimatedWidget>
void
didUpdateWidget
(
T
oldWidget
)
{
super
.
didUpdateWidget
(
oldWidget
);
if
(
widget
.
curve
!=
oldWidget
.
curve
)
_
upd
ateCurve
();
_controller
!
.
duration
=
widget
.
duration
;
_
animation
=
_cre
ateCurve
();
_controller
.
duration
=
widget
.
duration
;
if
(
_constructTweens
())
{
forEachTween
((
Tween
<
dynamic
>?
tween
,
dynamic
targetValue
,
TweenConstructor
<
dynamic
>
constructor
)
{
_updateTween
(
tween
,
targetValue
);
return
tween
;
});
_controller
!
_controller
..
value
=
0.0
..
forward
();
didUpdateTweens
();
}
}
void
_upd
ateCurve
()
{
_animation
=
CurvedAnimation
(
parent:
_controller
!
,
curve:
widget
.
curve
);
CurvedAnimation
_cre
ateCurve
()
{
return
CurvedAnimation
(
parent:
_controller
,
curve:
widget
.
curve
);
}
@override
void
dispose
()
{
_controller
!
.
dispose
();
_controller
.
dispose
();
super
.
dispose
();
}
...
...
@@ -419,7 +417,7 @@ abstract class ImplicitlyAnimatedWidgetState<T extends ImplicitlyAnimatedWidget>
if
(
tween
==
null
)
return
;
tween
..
begin
=
tween
.
evaluate
(
_animation
!
)
..
begin
=
tween
.
evaluate
(
_animation
)
..
end
=
targetValue
;
}
...
...
@@ -552,7 +550,7 @@ abstract class AnimatedWidgetBaseState<T extends ImplicitlyAnimatedWidget> exten
@override
void
initState
()
{
super
.
initState
();
controller
!
.
addListener
(
_handleAnimationChanged
);
controller
.
addListener
(
_handleAnimationChanged
);
}
void
_handleAnimationChanged
()
{
...
...
@@ -776,7 +774,7 @@ class _AnimatedContainerState extends AnimatedWidgetBaseState<AnimatedContainer>
@override
Widget
build
(
BuildContext
context
)
{
final
Animation
<
double
>
animation
=
this
.
animation
!
;
final
Animation
<
double
>
animation
=
this
.
animation
;
return
Container
(
child:
widget
.
child
,
alignment:
_alignment
?.
evaluate
(
animation
),
...
...
@@ -907,7 +905,7 @@ class _AnimatedPaddingState extends AnimatedWidgetBaseState<AnimatedPadding> {
Widget
build
(
BuildContext
context
)
{
return
Padding
(
padding:
_padding
!
.
evaluate
(
animation
!
)
.
evaluate
(
animation
)
.
clamp
(
EdgeInsets
.
zero
,
EdgeInsetsGeometry
.
infinity
),
child:
widget
.
child
,
);
...
...
@@ -1058,9 +1056,9 @@ class _AnimatedAlignState extends AnimatedWidgetBaseState<AnimatedAlign> {
@override
Widget
build
(
BuildContext
context
)
{
return
Align
(
alignment:
_alignment
!.
evaluate
(
animation
!
)!,
heightFactor:
_heightFactorTween
?.
evaluate
(
animation
!
),
widthFactor:
_widthFactorTween
?.
evaluate
(
animation
!
),
alignment:
_alignment
!.
evaluate
(
animation
)!,
heightFactor:
_heightFactorTween
?.
evaluate
(
animation
),
widthFactor:
_widthFactorTween
?.
evaluate
(
animation
),
child:
widget
.
child
,
);
}
...
...
@@ -1255,12 +1253,12 @@ class _AnimatedPositionedState extends AnimatedWidgetBaseState<AnimatedPositione
Widget
build
(
BuildContext
context
)
{
return
Positioned
(
child:
widget
.
child
,
left:
_left
?.
evaluate
(
animation
!
),
top:
_top
?.
evaluate
(
animation
!
),
right:
_right
?.
evaluate
(
animation
!
),
bottom:
_bottom
?.
evaluate
(
animation
!
),
width:
_width
?.
evaluate
(
animation
!
),
height:
_height
?.
evaluate
(
animation
!
),
left:
_left
?.
evaluate
(
animation
),
top:
_top
?.
evaluate
(
animation
),
right:
_right
?.
evaluate
(
animation
),
bottom:
_bottom
?.
evaluate
(
animation
),
width:
_width
?.
evaluate
(
animation
),
height:
_height
?.
evaluate
(
animation
),
);
}
...
...
@@ -1392,12 +1390,12 @@ class _AnimatedPositionedDirectionalState extends AnimatedWidgetBaseState<Animat
return
Positioned
.
directional
(
textDirection:
Directionality
.
of
(
context
),
child:
widget
.
child
,
start:
_start
?.
evaluate
(
animation
!
),
top:
_top
?.
evaluate
(
animation
!
),
end:
_end
?.
evaluate
(
animation
!
),
bottom:
_bottom
?.
evaluate
(
animation
!
),
width:
_width
?.
evaluate
(
animation
!
),
height:
_height
?.
evaluate
(
animation
!
),
start:
_start
?.
evaluate
(
animation
),
top:
_top
?.
evaluate
(
animation
),
end:
_end
?.
evaluate
(
animation
),
bottom:
_bottom
?.
evaluate
(
animation
),
width:
_width
?.
evaluate
(
animation
),
height:
_height
?.
evaluate
(
animation
),
);
}
...
...
@@ -1529,7 +1527,7 @@ class _AnimatedOpacityState extends ImplicitlyAnimatedWidgetState<AnimatedOpacit
@override
void
didUpdateTweens
()
{
_opacityAnimation
=
animation
!
.
drive
(
_opacity
!);
_opacityAnimation
=
animation
.
drive
(
_opacity
!);
}
@override
...
...
@@ -1662,7 +1660,7 @@ class _SliverAnimatedOpacityState extends ImplicitlyAnimatedWidgetState<SliverAn
@override
void
didUpdateTweens
()
{
_opacityAnimation
=
animation
!
.
drive
(
_opacity
!);
_opacityAnimation
=
animation
.
drive
(
_opacity
!);
}
@override
...
...
@@ -1792,7 +1790,7 @@ class _AnimatedDefaultTextStyleState extends AnimatedWidgetBaseState<AnimatedDef
@override
Widget
build
(
BuildContext
context
)
{
return
DefaultTextStyle
(
style:
_style
!.
evaluate
(
animation
!
),
style:
_style
!.
evaluate
(
animation
),
textAlign:
widget
.
textAlign
,
softWrap:
widget
.
softWrap
,
overflow:
widget
.
overflow
,
...
...
@@ -1925,11 +1923,11 @@ class _AnimatedPhysicalModelState extends AnimatedWidgetBaseState<AnimatedPhysic
child:
widget
.
child
,
shape:
widget
.
shape
,
clipBehavior:
widget
.
clipBehavior
,
borderRadius:
_borderRadius
!.
evaluate
(
animation
!
),
elevation:
_elevation
!.
evaluate
(
animation
!
),
color:
widget
.
animateColor
?
_color
!.
evaluate
(
animation
!
)!
:
widget
.
color
,
borderRadius:
_borderRadius
!.
evaluate
(
animation
),
elevation:
_elevation
!.
evaluate
(
animation
),
color:
widget
.
animateColor
?
_color
!.
evaluate
(
animation
)!
:
widget
.
color
,
shadowColor:
widget
.
animateShadowColor
?
_shadowColor
!.
evaluate
(
animation
!
)!
?
_shadowColor
!.
evaluate
(
animation
)!
:
widget
.
shadowColor
,
);
}
...
...
packages/flutter/lib/src/widgets/tween_animation_builder.dart
View file @
6471a34d
...
...
@@ -203,7 +203,7 @@ class _TweenAnimationBuilderState<T extends Object> extends AnimatedWidgetBaseSt
_currentTween
!.
begin
??=
_currentTween
!.
end
;
super
.
initState
();
if
(
_currentTween
!.
begin
!=
_currentTween
!.
end
)
{
controller
!
.
forward
();
controller
.
forward
();
}
}
...
...
@@ -221,6 +221,6 @@ class _TweenAnimationBuilderState<T extends Object> extends AnimatedWidgetBaseSt
@override
Widget
build
(
BuildContext
context
)
{
return
widget
.
builder
(
context
,
_currentTween
!.
evaluate
(
animation
!
),
widget
.
child
);
return
widget
.
builder
(
context
,
_currentTween
!.
evaluate
(
animation
),
widget
.
child
);
}
}
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