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
c63be2af
Commit
c63be2af
authored
Jun 05, 2017
by
Alexandre Ardhuin
Committed by
GitHub
Jun 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apply prefer_asserts_in_initializer_list lint (#10483)
parent
69e23538
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
88 additions
and
109 deletions
+88
-109
animation_controller.dart
packages/flutter/lib/src/animation/animation_controller.dart
+14
-16
animations.dart
packages/flutter/lib/src/animation/animations.dart
+8
-12
tween.dart
packages/flutter/lib/src/animation/tween.dart
+2
-3
bottom_tab_bar.dart
packages/flutter/lib/src/cupertino/bottom_tab_bar.dart
+5
-6
page.dart
packages/flutter/lib/src/cupertino/page.dart
+15
-16
slider.dart
packages/flutter/lib/src/cupertino/slider.dart
+2
-2
switch.dart
packages/flutter/lib/src/cupertino/switch.dart
+8
-8
drag_details.dart
packages/flutter/lib/src/gestures/drag_details.dart
+12
-18
lsq_solver.dart
packages/flutter/lib/src/gestures/lsq_solver.dart
+3
-4
multidrag.dart
packages/flutter/lib/src/gestures/multidrag.dart
+6
-8
scale.dart
packages/flutter/lib/src/gestures/scale.dart
+9
-10
tap.dart
packages/flutter/lib/src/gestures/tap.dart
+4
-6
No files found.
packages/flutter/lib/src/animation/animation_controller.dart
View file @
c63be2af
...
...
@@ -115,12 +115,11 @@ class AnimationController extends Animation<double>
this
.
lowerBound
:
0.0
,
this
.
upperBound
:
1.0
,
@required
TickerProvider
vsync
,
})
{
assert
(
lowerBound
!=
null
);
assert
(
upperBound
!=
null
);
assert
(
upperBound
>=
lowerBound
);
assert
(
vsync
!=
null
);
_direction
=
_AnimationDirection
.
forward
;
})
:
assert
(
lowerBound
!=
null
),
assert
(
upperBound
!=
null
),
assert
(
upperBound
>=
lowerBound
),
assert
(
vsync
!=
null
),
_direction
=
_AnimationDirection
.
forward
{
_ticker
=
vsync
.
createTicker
(
_tick
);
_internalSetValue
(
value
??
lowerBound
);
}
...
...
@@ -146,11 +145,11 @@ class AnimationController extends Animation<double>
this
.
duration
,
this
.
debugLabel
,
@required
TickerProvider
vsync
,
})
:
lowerBound
=
double
.
NEGATIVE_INFINITY
,
upperBound
=
double
.
INFINITY
{
assert
(
value
!=
null
);
assert
(
vsync
!=
null
);
_direction
=
_AnimationDirection
.
forward
;
})
:
assert
(
value
!=
null
)
,
assert
(
vsync
!=
null
),
lowerBound
=
double
.
NEGATIVE_INFINITY
,
upperBound
=
double
.
INFINITY
,
_direction
=
_AnimationDirection
.
forward
{
_ticker
=
vsync
.
createTicker
(
_tick
);
_internalSetValue
(
value
);
}
...
...
@@ -496,11 +495,10 @@ class AnimationController extends Animation<double>
class
_InterpolationSimulation
extends
Simulation
{
_InterpolationSimulation
(
this
.
_begin
,
this
.
_end
,
Duration
duration
,
this
.
_curve
)
:
_durationInSeconds
=
duration
.
inMicroseconds
/
Duration
.
MICROSECONDS_PER_SECOND
{
assert
(
_durationInSeconds
>
0.0
);
assert
(
_begin
!=
null
);
assert
(
_end
!=
null
);
}
:
assert
(
_begin
!=
null
),
assert
(
_end
!=
null
),
assert
(
duration
!=
null
&&
duration
.
inMicroseconds
>
0
),
_durationInSeconds
=
duration
.
inMicroseconds
/
Duration
.
MICROSECONDS_PER_SECOND
;
final
double
_durationInSeconds
;
final
double
_begin
;
...
...
packages/flutter/lib/src/animation/animations.dart
View file @
c63be2af
...
...
@@ -247,9 +247,8 @@ class ReverseAnimation extends Animation<double>
/// Creates a reverse animation.
///
/// The parent argument must not be null.
ReverseAnimation
(
this
.
parent
)
{
assert
(
parent
!=
null
);
}
ReverseAnimation
(
this
.
parent
)
:
assert
(
parent
!=
null
);
/// The animation whose value and direction this animation is reversing.
final
Animation
<
double
>
parent
;
...
...
@@ -331,9 +330,8 @@ class CurvedAnimation extends Animation<double> with AnimationWithParentMixin<do
@required
this
.
parent
,
@required
this
.
curve
,
this
.
reverseCurve
})
{
assert
(
parent
!=
null
);
assert
(
curve
!=
null
);
})
:
assert
(
parent
!=
null
),
assert
(
curve
!=
null
)
{
_updateCurveDirection
(
parent
.
status
);
parent
.
addStatusListener
(
_updateCurveDirection
);
}
...
...
@@ -441,8 +439,8 @@ class TrainHoppingAnimation extends Animation<double>
///
/// The current train argument must not be null but the next train argument
/// can be null.
TrainHoppingAnimation
(
this
.
_currentTrain
,
this
.
_nextTrain
,
{
this
.
onSwitchedTrain
})
{
assert
(
_currentTrain
!=
null
);
TrainHoppingAnimation
(
this
.
_currentTrain
,
this
.
_nextTrain
,
{
this
.
onSwitchedTrain
})
:
assert
(
_currentTrain
!=
null
)
{
if
(
_nextTrain
!=
null
)
{
if
(
_currentTrain
.
value
>
_nextTrain
.
value
)
{
_mode
=
_TrainHoppingMode
.
maximize
;
...
...
@@ -552,10 +550,8 @@ abstract class CompoundAnimation<T> extends Animation<T>
CompoundAnimation
({
@required
this
.
first
,
@required
this
.
next
,
})
{
assert
(
first
!=
null
);
assert
(
next
!=
null
);
}
})
:
assert
(
first
!=
null
),
assert
(
next
!=
null
);
/// The first sub-animation. Its status takes precedence if neither are
/// animating.
...
...
packages/flutter/lib/src/animation/tween.dart
View file @
c63be2af
...
...
@@ -291,9 +291,8 @@ class CurveTween extends Animatable<double> {
/// Creates a curve tween.
///
/// The [curve] argument must not be null.
CurveTween
({
@required
this
.
curve
})
{
assert
(
curve
!=
null
);
}
CurveTween
({
@required
this
.
curve
})
:
assert
(
curve
!=
null
);
/// The curve to use when transforming the value of the animation.
Curve
curve
;
...
...
packages/flutter/lib/src/cupertino/bottom_tab_bar.dart
View file @
c63be2af
...
...
@@ -41,12 +41,11 @@ class CupertinoTabBar extends StatelessWidget {
this
.
activeColor
:
CupertinoColors
.
activeBlue
,
this
.
inactiveColor
:
CupertinoColors
.
inactiveGray
,
this
.
iconSize
:
24.0
,
})
:
super
(
key:
key
)
{
assert
(
items
!=
null
);
assert
(
items
.
length
>=
2
);
assert
(
0
<=
currentIndex
&&
currentIndex
<
items
.
length
);
assert
(
iconSize
!=
null
);
}
})
:
assert
(
items
!=
null
),
assert
(
items
.
length
>=
2
),
assert
(
0
<=
currentIndex
&&
currentIndex
<
items
.
length
),
assert
(
iconSize
!=
null
),
super
(
key:
key
);
/// The interactive items laid out within the bottom navigation bar.
final
List
<
BottomNavigationBarItem
>
items
;
...
...
packages/flutter/lib/src/cupertino/page.dart
View file @
c63be2af
...
...
@@ -25,7 +25,7 @@ final FractionalOffsetTween _kBottomUpTween = new FractionalOffsetTween(
end:
FractionalOffset
.
topLeft
,
);
// Custom decoration from no shadow to page shadow mimicking iOS page
// Custom decoration from no shadow to page shadow mimicking iOS page
// transitions using gradients.
final
DecorationTween
_kGradientShadowTween
=
new
DecorationTween
(
begin:
_CupertinoEdgeShadowDecoration
.
none
,
// No decoration initially.
...
...
@@ -36,27 +36,27 @@ final DecorationTween _kGradientShadowTween = new DecorationTween(
end:
FractionalOffset
.
topRight
,
// Eyeballed gradient used to mimic a drop shadow on the left side only.
colors:
const
<
Color
>[
const
Color
(
0x00000000
),
const
Color
(
0x00000000
),
const
Color
(
0x04000000
),
const
Color
(
0x12000000
),
const
Color
(
0x38000000
)
],
stops:
const
<
double
>[
0.0
,
0.3
,
0.6
,
1.0
],
),
),
),
);
/// A custom [Decoration] used to paint an extra shadow on the left edge of the
/// box it's decorating. It's like a [BoxDecoration] with only a gradient except
/// A custom [Decoration] used to paint an extra shadow on the left edge of the
/// box it's decorating. It's like a [BoxDecoration] with only a gradient except
/// it paints to the left of the box instead of behind the box.
class
_CupertinoEdgeShadowDecoration
extends
Decoration
{
const
_CupertinoEdgeShadowDecoration
({
this
.
edgeGradient
});
/// A Decoration with no decorating properties.
static
const
_CupertinoEdgeShadowDecoration
none
=
static
const
_CupertinoEdgeShadowDecoration
none
=
const
_CupertinoEdgeShadowDecoration
();
/// A gradient to draw to the left of the box being decorated.
/// A gradient to draw to the left of the box being decorated.
/// FractionalOffsets are relative to the original box translated one box
/// width to the left.
final
LinearGradient
edgeGradient
;
...
...
@@ -65,8 +65,8 @@ class _CupertinoEdgeShadowDecoration extends Decoration {
///
/// See also [Decoration.lerp].
static
_CupertinoEdgeShadowDecoration
lerp
(
_CupertinoEdgeShadowDecoration
a
,
_CupertinoEdgeShadowDecoration
b
,
_CupertinoEdgeShadowDecoration
a
,
_CupertinoEdgeShadowDecoration
b
,
double
t
)
{
if
(
a
==
null
&&
b
==
null
)
...
...
@@ -89,7 +89,7 @@ class _CupertinoEdgeShadowDecoration extends Decoration {
return
_CupertinoEdgeShadowDecoration
.
lerp
(
this
,
null
,
t
);
return
_CupertinoEdgeShadowDecoration
.
lerp
(
this
,
b
,
t
);
}
@override
_CupertinoEdgeShadowPainter
createBoxPainter
([
VoidCallback
onChanged
])
{
return
new
_CupertinoEdgeShadowPainter
(
this
,
onChanged
);
...
...
@@ -114,7 +114,7 @@ class _CupertinoEdgeShadowDecoration extends Decoration {
/// A [BoxPainter] used to draw the page transition shadow using gradients.
class
_CupertinoEdgeShadowPainter
extends
BoxPainter
{
_CupertinoEdgeShadowPainter
(
@required
this
.
_decoration
,
@required
this
.
_decoration
,
VoidCallback
onChange
)
:
assert
(
_decoration
!=
null
),
super
(
onChange
);
...
...
@@ -126,9 +126,9 @@ class _CupertinoEdgeShadowPainter extends BoxPainter {
final
LinearGradient
gradient
=
_decoration
.
edgeGradient
;
if
(
gradient
==
null
)
return
;
// The drawable space for the gradient is a rect with the same size as
// The drawable space for the gradient is a rect with the same size as
// its parent box one box width to the left of the box.
final
Rect
rect
=
final
Rect
rect
=
(
offset
&
configuration
.
size
).
translate
(-
configuration
.
size
.
width
,
0.0
);
final
Paint
paint
=
new
Paint
()
..
shader
=
gradient
.
createShader
(
rect
);
...
...
@@ -249,9 +249,8 @@ class CupertinoBackGestureController extends NavigationGestureController {
CupertinoBackGestureController
({
@required
NavigatorState
navigator
,
@required
this
.
controller
,
})
:
super
(
navigator
)
{
assert
(
controller
!=
null
);
}
})
:
assert
(
controller
!=
null
),
super
(
navigator
);
/// The animation controller that the route uses to drive its transition
/// animation.
...
...
packages/flutter/lib/src/cupertino/slider.dart
View file @
c63be2af
...
...
@@ -192,11 +192,11 @@ class _RenderCupertinoSlider extends RenderConstrainedBox implements SemanticsAc
Color
activeColor
,
this
.
onChanged
,
TickerProvider
vsync
,
})
:
_value
=
value
,
})
:
assert
(
value
!=
null
&&
value
>=
0.0
&&
value
<=
1.0
),
_value
=
value
,
_divisions
=
divisions
,
_activeColor
=
activeColor
,
super
(
additionalConstraints:
const
BoxConstraints
.
tightFor
(
width:
_kSliderWidth
,
height:
_kSliderHeight
))
{
assert
(
value
!=
null
&&
value
>=
0.0
&&
value
<=
1.0
);
_drag
=
new
HorizontalDragGestureRecognizer
()
..
onStart
=
_handleDragStart
..
onUpdate
=
_handleDragUpdate
...
...
packages/flutter/lib/src/cupertino/switch.dart
View file @
c63be2af
...
...
@@ -141,14 +141,14 @@ class _RenderCupertinoSwitch extends RenderConstrainedBox implements SemanticsAc
@required
Color
activeColor
,
ValueChanged
<
bool
>
onChanged
,
@required
TickerProvider
vsync
,
})
:
_value
=
value
,
_activeColor
=
activeColor
,
_onChanged
=
onChanged
,
_vsync
=
vsync
,
super
(
additionalConstraints:
const
BoxConstraints
.
tightFor
(
width:
_kSwitchWidth
,
height:
_kSwitchHeight
))
{
assert
(
value
!=
null
);
assert
(
activeColor
!=
null
);
assert
(
vsync
!=
null
);
})
:
assert
(
value
!=
null
)
,
assert
(
activeColor
!=
null
)
,
assert
(
vsync
!=
null
)
,
_value
=
value
,
_activeColor
=
activeColor
,
_onChanged
=
onChanged
,
_vsync
=
vsync
,
super
(
additionalConstraints:
const
BoxConstraints
.
tightFor
(
width:
_kSwitchWidth
,
height:
_kSwitchHeight
))
{
_tap
=
new
TapGestureRecognizer
()
..
onTapDown
=
_handleTapDown
..
onTap
=
_handleTap
...
...
packages/flutter/lib/src/gestures/drag_details.dart
View file @
c63be2af
...
...
@@ -20,9 +20,8 @@ class DragDownDetails {
/// Creates details for a [GestureDragDownCallback].
///
/// The [globalPosition] argument must not be null.
DragDownDetails
({
this
.
globalPosition
:
Offset
.
zero
})
{
assert
(
globalPosition
!=
null
);
}
DragDownDetails
({
this
.
globalPosition
:
Offset
.
zero
})
:
assert
(
globalPosition
!=
null
);
/// The global position at which the pointer contacted the screen.
///
...
...
@@ -53,9 +52,8 @@ class DragStartDetails {
/// Creates details for a [GestureDragStartCallback].
///
/// The [globalPosition] argument must not be null.
DragStartDetails
({
this
.
globalPosition
:
Offset
.
zero
})
{
assert
(
globalPosition
!=
null
);
}
DragStartDetails
({
this
.
globalPosition
:
Offset
.
zero
})
:
assert
(
globalPosition
!=
null
);
/// The global position at which the pointer contacted the screen.
///
...
...
@@ -99,12 +97,10 @@ class DragUpdateDetails {
this
.
delta
:
Offset
.
zero
,
this
.
primaryDelta
,
@required
this
.
globalPosition
})
{
assert
(
delta
!=
null
);
assert
(
primaryDelta
==
null
||
(
primaryDelta
==
delta
.
dx
&&
delta
.
dy
==
0.0
)
||
(
primaryDelta
==
delta
.
dy
&&
delta
.
dx
==
0.0
));
}
})
:
assert
(
delta
!=
null
),
assert
(
primaryDelta
==
null
||
(
primaryDelta
==
delta
.
dx
&&
delta
.
dy
==
0.0
)
||
(
primaryDelta
==
delta
.
dy
&&
delta
.
dx
==
0.0
));
/// The amount the pointer has moved since the previous update.
///
...
...
@@ -158,12 +154,10 @@ class DragEndDetails {
DragEndDetails
({
this
.
velocity
:
Velocity
.
zero
,
this
.
primaryVelocity
,
})
{
assert
(
velocity
!=
null
);
assert
(
primaryVelocity
==
null
||
primaryVelocity
==
velocity
.
pixelsPerSecond
.
dx
||
primaryVelocity
==
velocity
.
pixelsPerSecond
.
dy
);
}
})
:
assert
(
velocity
!=
null
),
assert
(
primaryVelocity
==
null
||
primaryVelocity
==
velocity
.
pixelsPerSecond
.
dx
||
primaryVelocity
==
velocity
.
pixelsPerSecond
.
dy
);
/// The velocity the pointer was moving when it stopped contacting the screen.
///
...
...
packages/flutter/lib/src/gestures/lsq_solver.dart
View file @
c63be2af
...
...
@@ -75,10 +75,9 @@ class LeastSquaresSolver {
/// Creates a least-squares solver.
///
/// The [x], [y], and [w] arguments must not be null.
LeastSquaresSolver
(
this
.
x
,
this
.
y
,
this
.
w
)
{
assert
(
x
.
length
==
y
.
length
);
assert
(
y
.
length
==
w
.
length
);
}
LeastSquaresSolver
(
this
.
x
,
this
.
y
,
this
.
w
)
:
assert
(
x
.
length
==
y
.
length
),
assert
(
y
.
length
==
w
.
length
);
/// The x-coordinates of each data point.
final
List
<
double
>
x
;
...
...
packages/flutter/lib/src/gestures/multidrag.dart
View file @
c63be2af
...
...
@@ -27,9 +27,8 @@ abstract class MultiDragPointerState {
/// Creates per-pointer state for a [MultiDragGestureRecognizer].
///
/// The [initialPosition] argument must not be null.
MultiDragPointerState
(
this
.
initialPosition
)
{
assert
(
initialPosition
!=
null
);
}
MultiDragPointerState
(
this
.
initialPosition
)
:
assert
(
initialPosition
!=
null
);
/// The global coordinates of the pointer when the pointer contacted the screen.
final
Offset
initialPosition
;
...
...
@@ -396,8 +395,9 @@ class VerticalMultiDragGestureRecognizer extends MultiDragGestureRecognizer<_Ver
}
class
_DelayedPointerState
extends
MultiDragPointerState
{
_DelayedPointerState
(
Offset
initialPosition
,
Duration
delay
)
:
super
(
initialPosition
)
{
assert
(
delay
!=
null
);
_DelayedPointerState
(
Offset
initialPosition
,
Duration
delay
)
:
assert
(
delay
!=
null
),
super
(
initialPosition
)
{
_timer
=
new
Timer
(
delay
,
_delayPassed
);
}
...
...
@@ -481,9 +481,7 @@ class DelayedMultiDragGestureRecognizer extends MultiDragGestureRecognizer<_Dela
/// can be changed for specific behaviors.
DelayedMultiDragGestureRecognizer
({
this
.
delay
:
kLongPressTimeout
})
{
assert
(
delay
!=
null
);
}
})
:
assert
(
delay
!=
null
);
/// The amount of time the pointer must remain in the same place for the drag
/// to be recognized.
...
...
packages/flutter/lib/src/gestures/scale.dart
View file @
c63be2af
...
...
@@ -32,9 +32,8 @@ class ScaleStartDetails {
/// Creates details for [GestureScaleStartCallback].
///
/// The [focalPoint] argument must not be null.
ScaleStartDetails
({
this
.
focalPoint
:
Offset
.
zero
})
{
assert
(
focalPoint
!=
null
);
}
ScaleStartDetails
({
this
.
focalPoint
:
Offset
.
zero
})
:
assert
(
focalPoint
!=
null
);
/// The initial focal point of the pointers in contact with the screen.
/// Reported in global coordinates.
...
...
@@ -50,10 +49,11 @@ class ScaleUpdateDetails {
///
/// The [focalPoint] and [scale] arguments must not be null. The [scale]
/// argument must be greater than or equal to zero.
ScaleUpdateDetails
({
this
.
focalPoint
:
Offset
.
zero
,
this
.
scale
:
1.0
})
{
assert
(
focalPoint
!=
null
);
assert
(
scale
!=
null
&&
scale
>=
0.0
);
}
ScaleUpdateDetails
({
this
.
focalPoint
:
Offset
.
zero
,
this
.
scale
:
1.0
,
})
:
assert
(
focalPoint
!=
null
),
assert
(
scale
!=
null
&&
scale
>=
0.0
);
/// The focal point of the pointers in contact with the screen. Reported in
/// global coordinates.
...
...
@@ -72,9 +72,8 @@ class ScaleEndDetails {
/// Creates details for [GestureScaleEndCallback].
///
/// The [velocity] argument must not be null.
ScaleEndDetails
({
this
.
velocity
:
Velocity
.
zero
})
{
assert
(
velocity
!=
null
);
}
ScaleEndDetails
({
this
.
velocity
:
Velocity
.
zero
})
:
assert
(
velocity
!=
null
);
/// The velocity of the last pointer to be lifted off of the screen.
final
Velocity
velocity
;
...
...
packages/flutter/lib/src/gestures/tap.dart
View file @
c63be2af
...
...
@@ -12,9 +12,8 @@ class TapDownDetails {
/// Creates details for a [GestureTapDownCallback].
///
/// The [globalPosition] argument must not be null.
TapDownDetails
({
this
.
globalPosition
:
Offset
.
zero
})
{
assert
(
globalPosition
!=
null
);
}
TapDownDetails
({
this
.
globalPosition
:
Offset
.
zero
})
:
assert
(
globalPosition
!=
null
);
/// The global position at which the pointer contacted the screen.
final
Offset
globalPosition
;
...
...
@@ -32,9 +31,8 @@ class TapUpDetails {
/// Creates details for a [GestureTapUpCallback].
///
/// The [globalPosition] argument must not be null.
TapUpDetails
({
this
.
globalPosition
:
Offset
.
zero
})
{
assert
(
globalPosition
!=
null
);
}
TapUpDetails
({
this
.
globalPosition
:
Offset
.
zero
})
:
assert
(
globalPosition
!=
null
);
/// The global position at which the pointer contacted the screen.
final
Offset
globalPosition
;
...
...
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