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
a01113de
Unverified
Commit
a01113de
authored
Sep 28, 2020
by
Alexandre Ardhuin
Committed by
GitHub
Sep 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
migration of material files to nullsafety (#66633)
parent
549de844
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
265 additions
and
288 deletions
+265
-288
arc.dart
packages/flutter/lib/src/material/arc.dart
+59
-59
bottom_sheet_theme.dart
packages/flutter/lib/src/material/bottom_sheet_theme.dart
+13
-15
colors.dart
packages/flutter/lib/src/material/colors.dart
+15
-17
constants.dart
packages/flutter/lib/src/material/constants.dart
+0
-2
curves.dart
packages/flutter/lib/src/material/curves.dart
+0
-2
floating_action_button_theme.dart
...lutter/lib/src/material/floating_action_button_theme.dart
+23
-25
flutter_logo.dart
packages/flutter/lib/src/material/flutter_logo.dart
+3
-5
grid_tile.dart
packages/flutter/lib/src/material/grid_tile.dart
+6
-8
icons.dart
packages/flutter/lib/src/material/icons.dart
+0
-2
material_state.dart
packages/flutter/lib/src/material/material_state.dart
+16
-18
text_theme.dart
packages/flutter/lib/src/material/text_theme.dart
+74
-76
toggleable.dart
packages/flutter/lib/src/material/toggleable.dart
+33
-35
typography.dart
packages/flutter/lib/src/material/typography.dart
+23
-24
No files found.
packages/flutter/lib/src/material/arc.dart
View file @
a01113de
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'dart:math'
as
math
;
import
'dart:math'
as
math
;
import
'dart:ui'
show
lerpDouble
;
import
'dart:ui'
show
lerpDouble
;
...
@@ -38,15 +36,18 @@ class MaterialPointArcTween extends Tween<Offset> {
...
@@ -38,15 +36,18 @@ class MaterialPointArcTween extends Tween<Offset> {
/// first used, but the arguments can be null if the values are going to be
/// first used, but the arguments can be null if the values are going to be
/// filled in later.
/// filled in later.
MaterialPointArcTween
({
MaterialPointArcTween
({
Offset
begin
,
Offset
?
begin
,
Offset
end
,
Offset
?
end
,
})
:
super
(
begin:
begin
,
end:
end
);
})
:
super
(
begin:
begin
,
end:
end
);
bool
_dirty
=
true
;
bool
_dirty
=
true
;
void
_initialize
()
{
void
_initialize
()
{
assert
(
begin
!=
null
);
assert
(
this
.
begin
!=
null
);
assert
(
end
!=
null
);
assert
(
this
.
end
!=
null
);
final
Offset
begin
=
this
.
begin
!;
final
Offset
end
=
this
.
end
!;
// An explanation with a diagram can be found at https://goo.gl/vMSdRg
// An explanation with a diagram can be found at https://goo.gl/vMSdRg
final
Offset
delta
=
end
-
begin
;
final
Offset
delta
=
end
-
begin
;
...
@@ -55,12 +56,12 @@ class MaterialPointArcTween extends Tween<Offset> {
...
@@ -55,12 +56,12 @@ class MaterialPointArcTween extends Tween<Offset> {
final
double
distanceFromAtoB
=
delta
.
distance
;
final
double
distanceFromAtoB
=
delta
.
distance
;
final
Offset
c
=
Offset
(
end
.
dx
,
begin
.
dy
);
final
Offset
c
=
Offset
(
end
.
dx
,
begin
.
dy
);
double
sweepAngle
()
=>
2.0
*
math
.
asin
(
distanceFromAtoB
/
(
2.0
*
_radius
));
double
sweepAngle
()
=>
2.0
*
math
.
asin
(
distanceFromAtoB
/
(
2.0
*
_radius
!
));
if
(
deltaX
>
_kOnAxisDelta
&&
deltaY
>
_kOnAxisDelta
)
{
if
(
deltaX
>
_kOnAxisDelta
&&
deltaY
>
_kOnAxisDelta
)
{
if
(
deltaX
<
deltaY
)
{
if
(
deltaX
<
deltaY
)
{
_radius
=
distanceFromAtoB
*
distanceFromAtoB
/
(
c
-
begin
).
distance
/
2.0
;
_radius
=
distanceFromAtoB
*
distanceFromAtoB
/
(
c
-
begin
).
distance
/
2.0
;
_center
=
Offset
(
end
.
dx
+
_radius
*
(
begin
.
dx
-
end
.
dx
).
sign
,
end
.
dy
);
_center
=
Offset
(
end
.
dx
+
_radius
!
*
(
begin
.
dx
-
end
.
dx
).
sign
,
end
.
dy
);
if
(
begin
.
dx
<
end
.
dx
)
{
if
(
begin
.
dx
<
end
.
dx
)
{
_beginAngle
=
sweepAngle
()
*
(
begin
.
dy
-
end
.
dy
).
sign
;
_beginAngle
=
sweepAngle
()
*
(
begin
.
dy
-
end
.
dy
).
sign
;
_endAngle
=
0.0
;
_endAngle
=
0.0
;
...
@@ -70,13 +71,13 @@ class MaterialPointArcTween extends Tween<Offset> {
...
@@ -70,13 +71,13 @@ class MaterialPointArcTween extends Tween<Offset> {
}
}
}
else
{
}
else
{
_radius
=
distanceFromAtoB
*
distanceFromAtoB
/
(
c
-
end
).
distance
/
2.0
;
_radius
=
distanceFromAtoB
*
distanceFromAtoB
/
(
c
-
end
).
distance
/
2.0
;
_center
=
Offset
(
begin
.
dx
,
begin
.
dy
+
(
end
.
dy
-
begin
.
dy
).
sign
*
_radius
);
_center
=
Offset
(
begin
.
dx
,
begin
.
dy
+
(
end
.
dy
-
begin
.
dy
).
sign
*
_radius
!
);
if
(
begin
.
dy
<
end
.
dy
)
{
if
(
begin
.
dy
<
end
.
dy
)
{
_beginAngle
=
-
math
.
pi
/
2.0
;
_beginAngle
=
-
math
.
pi
/
2.0
;
_endAngle
=
_beginAngle
+
sweepAngle
()
*
(
end
.
dx
-
begin
.
dx
).
sign
;
_endAngle
=
_beginAngle
!
+
sweepAngle
()
*
(
end
.
dx
-
begin
.
dx
).
sign
;
}
else
{
}
else
{
_beginAngle
=
math
.
pi
/
2.0
;
_beginAngle
=
math
.
pi
/
2.0
;
_endAngle
=
_beginAngle
+
sweepAngle
()
*
(
begin
.
dx
-
end
.
dx
).
sign
;
_endAngle
=
_beginAngle
!
+
sweepAngle
()
*
(
begin
.
dx
-
end
.
dx
).
sign
;
}
}
}
}
assert
(
_beginAngle
!=
null
);
assert
(
_beginAngle
!=
null
);
...
@@ -90,56 +91,56 @@ class MaterialPointArcTween extends Tween<Offset> {
...
@@ -90,56 +91,56 @@ class MaterialPointArcTween extends Tween<Offset> {
/// The center of the circular arc, null if [begin] and [end] are horizontally or
/// The center of the circular arc, null if [begin] and [end] are horizontally or
/// vertically aligned, or if either is null.
/// vertically aligned, or if either is null.
Offset
get
center
{
Offset
?
get
center
{
if
(
begin
==
null
||
end
==
null
)
if
(
begin
==
null
||
end
==
null
)
return
null
;
return
null
;
if
(
_dirty
)
if
(
_dirty
)
_initialize
();
_initialize
();
return
_center
;
return
_center
;
}
}
Offset
_center
;
Offset
?
_center
;
/// The radius of the circular arc, null if [begin] and [end] are horizontally or
/// The radius of the circular arc, null if [begin] and [end] are horizontally or
/// vertically aligned, or if either is null.
/// vertically aligned, or if either is null.
double
get
radius
{
double
?
get
radius
{
if
(
begin
==
null
||
end
==
null
)
if
(
begin
==
null
||
end
==
null
)
return
null
;
return
null
;
if
(
_dirty
)
if
(
_dirty
)
_initialize
();
_initialize
();
return
_radius
;
return
_radius
;
}
}
double
_radius
;
double
?
_radius
;
/// The beginning of the arc's sweep in radians, measured from the positive x
/// The beginning of the arc's sweep in radians, measured from the positive x
/// axis. Positive angles turn clockwise.
/// axis. Positive angles turn clockwise.
///
///
/// This will be null if [begin] and [end] are horizontally or vertically
/// This will be null if [begin] and [end] are horizontally or vertically
/// aligned, or if either is null.
/// aligned, or if either is null.
double
get
beginAngle
{
double
?
get
beginAngle
{
if
(
begin
==
null
||
end
==
null
)
if
(
begin
==
null
||
end
==
null
)
return
null
;
return
null
;
if
(
_dirty
)
if
(
_dirty
)
_initialize
();
_initialize
();
return
_beginAngle
;
return
_beginAngle
;
}
}
double
_beginAngle
;
double
?
_beginAngle
;
/// The end of the arc's sweep in radians, measured from the positive x axis.
/// The end of the arc's sweep in radians, measured from the positive x axis.
/// Positive angles turn clockwise.
/// Positive angles turn clockwise.
///
///
/// This will be null if [begin] and [end] are horizontally or vertically
/// This will be null if [begin] and [end] are horizontally or vertically
/// aligned, or if either is null.
/// aligned, or if either is null.
double
get
endAngle
{
double
?
get
endAngle
{
if
(
begin
==
null
||
end
==
null
)
if
(
begin
==
null
||
end
==
null
)
return
null
;
return
null
;
if
(
_dirty
)
if
(
_dirty
)
_initialize
();
_initialize
();
return
_beginAngle
;
return
_beginAngle
;
}
}
double
_endAngle
;
double
?
_endAngle
;
@override
@override
set
begin
(
Offset
value
)
{
set
begin
(
Offset
?
value
)
{
if
(
value
!=
begin
)
{
if
(
value
!=
begin
)
{
super
.
begin
=
value
;
super
.
begin
=
value
;
_dirty
=
true
;
_dirty
=
true
;
...
@@ -147,7 +148,7 @@ class MaterialPointArcTween extends Tween<Offset> {
...
@@ -147,7 +148,7 @@ class MaterialPointArcTween extends Tween<Offset> {
}
}
@override
@override
set
end
(
Offset
value
)
{
set
end
(
Offset
?
value
)
{
if
(
value
!=
end
)
{
if
(
value
!=
end
)
{
super
.
end
=
value
;
super
.
end
=
value
;
_dirty
=
true
;
_dirty
=
true
;
...
@@ -159,15 +160,15 @@ class MaterialPointArcTween extends Tween<Offset> {
...
@@ -159,15 +160,15 @@ class MaterialPointArcTween extends Tween<Offset> {
if
(
_dirty
)
if
(
_dirty
)
_initialize
();
_initialize
();
if
(
t
==
0.0
)
if
(
t
==
0.0
)
return
begin
;
return
begin
!
;
if
(
t
==
1.0
)
if
(
t
==
1.0
)
return
end
;
return
end
!
;
if
(
_beginAngle
==
null
||
_endAngle
==
null
)
if
(
_beginAngle
==
null
||
_endAngle
==
null
)
return
Offset
.
lerp
(
begin
,
end
,
t
);
return
Offset
.
lerp
(
begin
,
end
,
t
)
!
;
final
double
angle
=
lerpDouble
(
_beginAngle
,
_endAngle
,
t
);
final
double
angle
=
lerpDouble
(
_beginAngle
,
_endAngle
,
t
)
!
;
final
double
x
=
math
.
cos
(
angle
)
*
_radius
;
final
double
x
=
math
.
cos
(
angle
)
*
_radius
!
;
final
double
y
=
math
.
sin
(
angle
)
*
_radius
;
final
double
y
=
math
.
sin
(
angle
)
*
_radius
!
;
return
_center
+
Offset
(
x
,
y
);
return
_center
!
+
Offset
(
x
,
y
);
}
}
@override
@override
...
@@ -200,8 +201,8 @@ typedef _KeyFunc<T> = double Function(T input);
...
@@ -200,8 +201,8 @@ typedef _KeyFunc<T> = double Function(T input);
// Select the element for which the key function returns the maximum value.
// Select the element for which the key function returns the maximum value.
T
_maxBy
<
T
>(
Iterable
<
T
>
input
,
_KeyFunc
<
T
>
keyFunc
)
{
T
_maxBy
<
T
>(
Iterable
<
T
>
input
,
_KeyFunc
<
T
>
keyFunc
)
{
T
maxValue
;
late
T
maxValue
;
double
maxKey
;
double
?
maxKey
;
for
(
final
T
value
in
input
)
{
for
(
final
T
value
in
input
)
{
final
double
key
=
keyFunc
(
value
);
final
double
key
=
keyFunc
(
value
);
if
(
maxKey
==
null
||
key
>
maxKey
)
{
if
(
maxKey
==
null
||
key
>
maxKey
)
{
...
@@ -238,8 +239,8 @@ class MaterialRectArcTween extends RectTween {
...
@@ -238,8 +239,8 @@ class MaterialRectArcTween extends RectTween {
/// first used, but the arguments can be null if the values are going to be
/// first used, but the arguments can be null if the values are going to be
/// filled in later.
/// filled in later.
MaterialRectArcTween
({
MaterialRectArcTween
({
Rect
begin
,
Rect
?
begin
,
Rect
end
,
Rect
?
end
,
})
:
super
(
begin:
begin
,
end:
end
);
})
:
super
(
begin:
begin
,
end:
end
);
bool
_dirty
=
true
;
bool
_dirty
=
true
;
...
@@ -247,21 +248,21 @@ class MaterialRectArcTween extends RectTween {
...
@@ -247,21 +248,21 @@ class MaterialRectArcTween extends RectTween {
void
_initialize
()
{
void
_initialize
()
{
assert
(
begin
!=
null
);
assert
(
begin
!=
null
);
assert
(
end
!=
null
);
assert
(
end
!=
null
);
final
Offset
centersVector
=
end
.
center
-
begin
.
center
;
final
Offset
centersVector
=
end
!.
center
-
begin
!
.
center
;
final
_Diagonal
diagonal
=
_maxBy
<
_Diagonal
>(
_allDiagonals
,
(
_Diagonal
d
)
=>
_diagonalSupport
(
centersVector
,
d
));
final
_Diagonal
diagonal
=
_maxBy
<
_Diagonal
>(
_allDiagonals
,
(
_Diagonal
d
)
=>
_diagonalSupport
(
centersVector
,
d
));
_beginArc
=
MaterialPointArcTween
(
_beginArc
=
MaterialPointArcTween
(
begin:
_cornerFor
(
begin
,
diagonal
.
beginId
),
begin:
_cornerFor
(
begin
!
,
diagonal
.
beginId
),
end:
_cornerFor
(
end
,
diagonal
.
beginId
),
end:
_cornerFor
(
end
!
,
diagonal
.
beginId
),
);
);
_endArc
=
MaterialPointArcTween
(
_endArc
=
MaterialPointArcTween
(
begin:
_cornerFor
(
begin
,
diagonal
.
endId
),
begin:
_cornerFor
(
begin
!
,
diagonal
.
endId
),
end:
_cornerFor
(
end
,
diagonal
.
endId
),
end:
_cornerFor
(
end
!
,
diagonal
.
endId
),
);
);
_dirty
=
false
;
_dirty
=
false
;
}
}
double
_diagonalSupport
(
Offset
centersVector
,
_Diagonal
diagonal
)
{
double
_diagonalSupport
(
Offset
centersVector
,
_Diagonal
diagonal
)
{
final
Offset
delta
=
_cornerFor
(
begin
,
diagonal
.
endId
)
-
_cornerFor
(
begin
,
diagonal
.
beginId
);
final
Offset
delta
=
_cornerFor
(
begin
!,
diagonal
.
endId
)
-
_cornerFor
(
begin
!
,
diagonal
.
beginId
);
final
double
length
=
delta
.
distance
;
final
double
length
=
delta
.
distance
;
return
centersVector
.
dx
*
delta
.
dx
/
length
+
centersVector
.
dy
*
delta
.
dy
/
length
;
return
centersVector
.
dx
*
delta
.
dx
/
length
+
centersVector
.
dy
*
delta
.
dy
/
length
;
}
}
...
@@ -273,33 +274,32 @@ class MaterialRectArcTween extends RectTween {
...
@@ -273,33 +274,32 @@ class MaterialRectArcTween extends RectTween {
case
_CornerId
.
bottomLeft
:
return
rect
.
bottomLeft
;
case
_CornerId
.
bottomLeft
:
return
rect
.
bottomLeft
;
case
_CornerId
.
bottomRight
:
return
rect
.
bottomRight
;
case
_CornerId
.
bottomRight
:
return
rect
.
bottomRight
;
}
}
return
Offset
.
zero
;
}
}
/// The path of the corresponding [begin], [end] rectangle corners that lead
/// The path of the corresponding [begin], [end] rectangle corners that lead
/// the animation.
/// the animation.
MaterialPointArcTween
get
beginArc
{
MaterialPointArcTween
?
get
beginArc
{
if
(
begin
==
null
)
if
(
begin
==
null
)
return
null
;
return
null
;
if
(
_dirty
)
if
(
_dirty
)
_initialize
();
_initialize
();
return
_beginArc
;
return
_beginArc
;
}
}
MaterialPointArcTween
_beginArc
;
late
MaterialPointArcTween
_beginArc
;
/// The path of the corresponding [begin], [end] rectangle corners that trail
/// The path of the corresponding [begin], [end] rectangle corners that trail
/// the animation.
/// the animation.
MaterialPointArcTween
get
endArc
{
MaterialPointArcTween
?
get
endArc
{
if
(
end
==
null
)
if
(
end
==
null
)
return
null
;
return
null
;
if
(
_dirty
)
if
(
_dirty
)
_initialize
();
_initialize
();
return
_endArc
;
return
_endArc
;
}
}
MaterialPointArcTween
_endArc
;
late
MaterialPointArcTween
_endArc
;
@override
@override
set
begin
(
Rect
value
)
{
set
begin
(
Rect
?
value
)
{
if
(
value
!=
begin
)
{
if
(
value
!=
begin
)
{
super
.
begin
=
value
;
super
.
begin
=
value
;
_dirty
=
true
;
_dirty
=
true
;
...
@@ -307,7 +307,7 @@ class MaterialRectArcTween extends RectTween {
...
@@ -307,7 +307,7 @@ class MaterialRectArcTween extends RectTween {
}
}
@override
@override
set
end
(
Rect
value
)
{
set
end
(
Rect
?
value
)
{
if
(
value
!=
end
)
{
if
(
value
!=
end
)
{
super
.
end
=
value
;
super
.
end
=
value
;
_dirty
=
true
;
_dirty
=
true
;
...
@@ -319,9 +319,9 @@ class MaterialRectArcTween extends RectTween {
...
@@ -319,9 +319,9 @@ class MaterialRectArcTween extends RectTween {
if
(
_dirty
)
if
(
_dirty
)
_initialize
();
_initialize
();
if
(
t
==
0.0
)
if
(
t
==
0.0
)
return
begin
;
return
begin
!
;
if
(
t
==
1.0
)
if
(
t
==
1.0
)
return
end
;
return
end
!
;
return
Rect
.
fromPoints
(
_beginArc
.
lerp
(
t
),
_endArc
.
lerp
(
t
));
return
Rect
.
fromPoints
(
_beginArc
.
lerp
(
t
),
_endArc
.
lerp
(
t
));
}
}
...
@@ -354,8 +354,8 @@ class MaterialRectCenterArcTween extends RectTween {
...
@@ -354,8 +354,8 @@ class MaterialRectCenterArcTween extends RectTween {
/// first used, but the arguments can be null if the values are going to be
/// first used, but the arguments can be null if the values are going to be
/// filled in later.
/// filled in later.
MaterialRectCenterArcTween
({
MaterialRectCenterArcTween
({
Rect
begin
,
Rect
?
begin
,
Rect
end
,
Rect
?
end
,
})
:
super
(
begin:
begin
,
end:
end
);
})
:
super
(
begin:
begin
,
end:
end
);
bool
_dirty
=
true
;
bool
_dirty
=
true
;
...
@@ -364,25 +364,25 @@ class MaterialRectCenterArcTween extends RectTween {
...
@@ -364,25 +364,25 @@ class MaterialRectCenterArcTween extends RectTween {
assert
(
begin
!=
null
);
assert
(
begin
!=
null
);
assert
(
end
!=
null
);
assert
(
end
!=
null
);
_centerArc
=
MaterialPointArcTween
(
_centerArc
=
MaterialPointArcTween
(
begin:
begin
.
center
,
begin:
begin
!
.
center
,
end:
end
.
center
,
end:
end
!
.
center
,
);
);
_dirty
=
false
;
_dirty
=
false
;
}
}
/// If [begin] and [end] are non-null, returns a tween that interpolates along
/// If [begin] and [end] are non-null, returns a tween that interpolates along
/// a circular arc between [begin]'s [Rect.center] and [end]'s [Rect.center].
/// a circular arc between [begin]'s [Rect.center] and [end]'s [Rect.center].
MaterialPointArcTween
get
centerArc
{
MaterialPointArcTween
?
get
centerArc
{
if
(
begin
==
null
||
end
==
null
)
if
(
begin
==
null
||
end
==
null
)
return
null
;
return
null
;
if
(
_dirty
)
if
(
_dirty
)
_initialize
();
_initialize
();
return
_centerArc
;
return
_centerArc
;
}
}
MaterialPointArcTween
_centerArc
;
late
MaterialPointArcTween
_centerArc
;
@override
@override
set
begin
(
Rect
value
)
{
set
begin
(
Rect
?
value
)
{
if
(
value
!=
begin
)
{
if
(
value
!=
begin
)
{
super
.
begin
=
value
;
super
.
begin
=
value
;
_dirty
=
true
;
_dirty
=
true
;
...
@@ -390,7 +390,7 @@ class MaterialRectCenterArcTween extends RectTween {
...
@@ -390,7 +390,7 @@ class MaterialRectCenterArcTween extends RectTween {
}
}
@override
@override
set
end
(
Rect
value
)
{
set
end
(
Rect
?
value
)
{
if
(
value
!=
end
)
{
if
(
value
!=
end
)
{
super
.
end
=
value
;
super
.
end
=
value
;
_dirty
=
true
;
_dirty
=
true
;
...
@@ -402,12 +402,12 @@ class MaterialRectCenterArcTween extends RectTween {
...
@@ -402,12 +402,12 @@ class MaterialRectCenterArcTween extends RectTween {
if
(
_dirty
)
if
(
_dirty
)
_initialize
();
_initialize
();
if
(
t
==
0.0
)
if
(
t
==
0.0
)
return
begin
;
return
begin
!
;
if
(
t
==
1.0
)
if
(
t
==
1.0
)
return
end
;
return
end
!
;
final
Offset
center
=
_centerArc
.
lerp
(
t
);
final
Offset
center
=
_centerArc
.
lerp
(
t
);
final
double
width
=
lerpDouble
(
begin
.
width
,
end
.
width
,
t
)
;
final
double
width
=
lerpDouble
(
begin
!.
width
,
end
!.
width
,
t
)!
;
final
double
height
=
lerpDouble
(
begin
.
height
,
end
.
height
,
t
)
;
final
double
height
=
lerpDouble
(
begin
!.
height
,
end
!.
height
,
t
)!
;
return
Rect
.
fromLTWH
(
center
.
dx
-
width
/
2.0
,
center
.
dy
-
height
/
2.0
,
width
,
height
);
return
Rect
.
fromLTWH
(
center
.
dx
-
width
/
2.0
,
center
.
dy
-
height
/
2.0
,
width
,
height
);
}
}
...
...
packages/flutter/lib/src/material/bottom_sheet_theme.dart
View file @
a01113de
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'dart:ui'
show
lerpDouble
;
import
'dart:ui'
show
lerpDouble
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
...
@@ -41,43 +39,43 @@ class BottomSheetThemeData with Diagnosticable {
...
@@ -41,43 +39,43 @@ class BottomSheetThemeData with Diagnosticable {
/// Default value for [BottomSheet.backgroundColor].
/// Default value for [BottomSheet.backgroundColor].
///
///
/// If null, [BottomSheet] defaults to [Material]'s default.
/// If null, [BottomSheet] defaults to [Material]'s default.
final
Color
backgroundColor
;
final
Color
?
backgroundColor
;
/// Default value for [BottomSheet.elevation].
/// Default value for [BottomSheet.elevation].
///
///
/// {@macro flutter.material.material.elevation}
/// {@macro flutter.material.material.elevation}
///
///
/// If null, [BottomSheet] defaults to 0.0.
/// If null, [BottomSheet] defaults to 0.0.
final
double
elevation
;
final
double
?
elevation
;
/// Value for [BottomSheet.backgroundColor] when the Bottom sheet is presented
/// Value for [BottomSheet.backgroundColor] when the Bottom sheet is presented
/// as a modal bottom sheet.
/// as a modal bottom sheet.
final
Color
modalBackgroundColor
;
final
Color
?
modalBackgroundColor
;
/// Value for [BottomSheet.elevation] when the Bottom sheet is presented as a
/// Value for [BottomSheet.elevation] when the Bottom sheet is presented as a
/// modal bottom sheet.
/// modal bottom sheet.
final
double
modalElevation
;
final
double
?
modalElevation
;
/// Default value for [BottomSheet.shape].
/// Default value for [BottomSheet.shape].
///
///
/// If null, no overriding shape is specified for [BottomSheet], so the
/// If null, no overriding shape is specified for [BottomSheet], so the
/// [BottomSheet] is rectangular.
/// [BottomSheet] is rectangular.
final
ShapeBorder
shape
;
final
ShapeBorder
?
shape
;
/// Default value for [BottomSheet.clipBehavior].
/// Default value for [BottomSheet.clipBehavior].
///
///
/// If null, [BottomSheet] uses [Clip.none].
/// If null, [BottomSheet] uses [Clip.none].
final
Clip
clipBehavior
;
final
Clip
?
clipBehavior
;
/// Creates a copy of this object with the given fields replaced with the
/// Creates a copy of this object with the given fields replaced with the
/// new values.
/// new values.
BottomSheetThemeData
copyWith
({
BottomSheetThemeData
copyWith
({
Color
backgroundColor
,
Color
?
backgroundColor
,
double
elevation
,
double
?
elevation
,
Color
modalBackgroundColor
,
Color
?
modalBackgroundColor
,
double
modalElevation
,
double
?
modalElevation
,
ShapeBorder
shape
,
ShapeBorder
?
shape
,
Clip
clipBehavior
,
Clip
?
clipBehavior
,
})
{
})
{
return
BottomSheetThemeData
(
return
BottomSheetThemeData
(
backgroundColor:
backgroundColor
??
this
.
backgroundColor
,
backgroundColor:
backgroundColor
??
this
.
backgroundColor
,
...
@@ -94,7 +92,7 @@ class BottomSheetThemeData with Diagnosticable {
...
@@ -94,7 +92,7 @@ class BottomSheetThemeData with Diagnosticable {
/// If both arguments are null then null is returned.
/// If both arguments are null then null is returned.
///
///
/// {@macro dart.ui.shadow.lerp}
/// {@macro dart.ui.shadow.lerp}
static
BottomSheetThemeData
lerp
(
BottomSheetThemeData
a
,
BottomSheetThemeData
b
,
double
t
)
{
static
BottomSheetThemeData
?
lerp
(
BottomSheetThemeData
?
a
,
BottomSheetThemeData
?
b
,
double
t
)
{
assert
(
t
!=
null
);
assert
(
t
!=
null
);
if
(
a
==
null
&&
b
==
null
)
if
(
a
==
null
&&
b
==
null
)
return
null
;
return
null
;
...
...
packages/flutter/lib/src/material/colors.dart
View file @
a01113de
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'dart:ui'
show
Color
;
import
'dart:ui'
show
Color
;
import
'package:flutter/painting.dart'
;
import
'package:flutter/painting.dart'
;
...
@@ -27,34 +25,34 @@ class MaterialColor extends ColorSwatch<int> {
...
@@ -27,34 +25,34 @@ class MaterialColor extends ColorSwatch<int> {
const
MaterialColor
(
int
primary
,
Map
<
int
,
Color
>
swatch
)
:
super
(
primary
,
swatch
);
const
MaterialColor
(
int
primary
,
Map
<
int
,
Color
>
swatch
)
:
super
(
primary
,
swatch
);
/// The lightest shade.
/// The lightest shade.
Color
get
shade50
=>
this
[
50
];
Color
get
shade50
=>
this
[
50
]
!
;
/// The second lightest shade.
/// The second lightest shade.
Color
get
shade100
=>
this
[
100
];
Color
get
shade100
=>
this
[
100
]
!
;
/// The third lightest shade.
/// The third lightest shade.
Color
get
shade200
=>
this
[
200
];
Color
get
shade200
=>
this
[
200
]
!
;
/// The fourth lightest shade.
/// The fourth lightest shade.
Color
get
shade300
=>
this
[
300
];
Color
get
shade300
=>
this
[
300
]
!
;
/// The fifth lightest shade.
/// The fifth lightest shade.
Color
get
shade400
=>
this
[
400
];
Color
get
shade400
=>
this
[
400
]
!
;
/// The default shade.
/// The default shade.
Color
get
shade500
=>
this
[
500
];
Color
get
shade500
=>
this
[
500
]
!
;
/// The fourth darkest shade.
/// The fourth darkest shade.
Color
get
shade600
=>
this
[
600
];
Color
get
shade600
=>
this
[
600
]
!
;
/// The third darkest shade.
/// The third darkest shade.
Color
get
shade700
=>
this
[
700
];
Color
get
shade700
=>
this
[
700
]
!
;
/// The second darkest shade.
/// The second darkest shade.
Color
get
shade800
=>
this
[
800
];
Color
get
shade800
=>
this
[
800
]
!
;
/// The darkest shade.
/// The darkest shade.
Color
get
shade900
=>
this
[
900
];
Color
get
shade900
=>
this
[
900
]
!
;
}
}
/// Defines a single accent color as well a swatch of four shades of the
/// Defines a single accent color as well a swatch of four shades of the
...
@@ -75,19 +73,19 @@ class MaterialAccentColor extends ColorSwatch<int> {
...
@@ -75,19 +73,19 @@ class MaterialAccentColor extends ColorSwatch<int> {
const
MaterialAccentColor
(
int
primary
,
Map
<
int
,
Color
>
swatch
)
:
super
(
primary
,
swatch
);
const
MaterialAccentColor
(
int
primary
,
Map
<
int
,
Color
>
swatch
)
:
super
(
primary
,
swatch
);
/// The lightest shade.
/// The lightest shade.
Color
get
shade50
=>
this
[
50
];
Color
get
shade50
=>
this
[
50
]
!
;
/// The second lightest shade.
/// The second lightest shade.
Color
get
shade100
=>
this
[
100
];
Color
get
shade100
=>
this
[
100
]
!
;
/// The default shade.
/// The default shade.
Color
get
shade200
=>
this
[
200
];
Color
get
shade200
=>
this
[
200
]
!
;
/// The second darkest shade.
/// The second darkest shade.
Color
get
shade400
=>
this
[
400
];
Color
get
shade400
=>
this
[
400
]
!
;
/// The darkest shade.
/// The darkest shade.
Color
get
shade700
=>
this
[
700
];
Color
get
shade700
=>
this
[
700
]
!
;
}
}
/// [Color] and [ColorSwatch] constants which represent Material design's
/// [Color] and [ColorSwatch] constants which represent Material design's
...
...
packages/flutter/lib/src/material/constants.dart
View file @
a01113de
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter/painting.dart'
;
import
'package:flutter/painting.dart'
;
/// The minimum dimension of any interactive region according to Material
/// The minimum dimension of any interactive region according to Material
...
...
packages/flutter/lib/src/material/curves.dart
View file @
a01113de
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter/animation.dart'
;
import
'package:flutter/animation.dart'
;
// The easing curves of the Material Library
// The easing curves of the Material Library
...
...
packages/flutter/lib/src/material/floating_action_button_theme.dart
View file @
a01113de
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'dart:ui'
show
lerpDouble
;
import
'dart:ui'
show
lerpDouble
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
...
@@ -48,63 +46,63 @@ class FloatingActionButtonThemeData with Diagnosticable {
...
@@ -48,63 +46,63 @@ class FloatingActionButtonThemeData with Diagnosticable {
/// Color to be used for the unselected, enabled [FloatingActionButton]'s
/// Color to be used for the unselected, enabled [FloatingActionButton]'s
/// foreground.
/// foreground.
final
Color
foregroundColor
;
final
Color
?
foregroundColor
;
/// Color to be used for the unselected, enabled [FloatingActionButton]'s
/// Color to be used for the unselected, enabled [FloatingActionButton]'s
/// background.
/// background.
final
Color
backgroundColor
;
final
Color
?
backgroundColor
;
/// The color to use for filling the button when the button has input focus.
/// The color to use for filling the button when the button has input focus.
final
Color
focusColor
;
final
Color
?
focusColor
;
/// The color to use for filling the button when the button has a pointer
/// The color to use for filling the button when the button has a pointer
/// hovering over it.
/// hovering over it.
final
Color
hoverColor
;
final
Color
?
hoverColor
;
/// The splash color for this [FloatingActionButton]'s [InkWell].
/// The splash color for this [FloatingActionButton]'s [InkWell].
final
Color
splashColor
;
final
Color
?
splashColor
;
/// The z-coordinate to be used for the unselected, enabled
/// The z-coordinate to be used for the unselected, enabled
/// [FloatingActionButton]'s elevation foreground.
/// [FloatingActionButton]'s elevation foreground.
final
double
elevation
;
final
double
?
elevation
;
/// The z-coordinate at which to place this button relative to its parent when
/// The z-coordinate at which to place this button relative to its parent when
/// the button has the input focus.
/// the button has the input focus.
///
///
/// This controls the size of the shadow below the floating action button.
/// This controls the size of the shadow below the floating action button.
final
double
focusElevation
;
final
double
?
focusElevation
;
/// The z-coordinate at which to place this button relative to its parent when
/// The z-coordinate at which to place this button relative to its parent when
/// the button is enabled and has a pointer hovering over it.
/// the button is enabled and has a pointer hovering over it.
///
///
/// This controls the size of the shadow below the floating action button.
/// This controls the size of the shadow below the floating action button.
final
double
hoverElevation
;
final
double
?
hoverElevation
;
/// The z-coordinate to be used for the disabled [FloatingActionButton]'s
/// The z-coordinate to be used for the disabled [FloatingActionButton]'s
/// elevation foreground.
/// elevation foreground.
final
double
disabledElevation
;
final
double
?
disabledElevation
;
/// The z-coordinate to be used for the selected, enabled
/// The z-coordinate to be used for the selected, enabled
/// [FloatingActionButton]'s elevation foreground.
/// [FloatingActionButton]'s elevation foreground.
final
double
highlightElevation
;
final
double
?
highlightElevation
;
/// The shape to be used for the floating action button's [Material].
/// The shape to be used for the floating action button's [Material].
final
ShapeBorder
shape
;
final
ShapeBorder
?
shape
;
/// Creates a copy of this object with the given fields replaced with the
/// Creates a copy of this object with the given fields replaced with the
/// new values.
/// new values.
FloatingActionButtonThemeData
copyWith
({
FloatingActionButtonThemeData
copyWith
({
Color
foregroundColor
,
Color
?
foregroundColor
,
Color
backgroundColor
,
Color
?
backgroundColor
,
Color
focusColor
,
Color
?
focusColor
,
Color
hoverColor
,
Color
?
hoverColor
,
Color
splashColor
,
Color
?
splashColor
,
double
elevation
,
double
?
elevation
,
double
focusElevation
,
double
?
focusElevation
,
double
hoverElevation
,
double
?
hoverElevation
,
double
disabledElevation
,
double
?
disabledElevation
,
double
highlightElevation
,
double
?
highlightElevation
,
ShapeBorder
shape
,
ShapeBorder
?
shape
,
})
{
})
{
return
FloatingActionButtonThemeData
(
return
FloatingActionButtonThemeData
(
foregroundColor:
foregroundColor
??
this
.
foregroundColor
,
foregroundColor:
foregroundColor
??
this
.
foregroundColor
,
...
@@ -126,7 +124,7 @@ class FloatingActionButtonThemeData with Diagnosticable {
...
@@ -126,7 +124,7 @@ class FloatingActionButtonThemeData with Diagnosticable {
/// If both arguments are null then null is returned.
/// If both arguments are null then null is returned.
///
///
/// {@macro dart.ui.shadow.lerp}
/// {@macro dart.ui.shadow.lerp}
static
FloatingActionButtonThemeData
lerp
(
FloatingActionButtonThemeData
a
,
FloatingActionButtonThemeData
b
,
double
t
)
{
static
FloatingActionButtonThemeData
?
lerp
(
FloatingActionButtonThemeData
?
a
,
FloatingActionButtonThemeData
?
b
,
double
t
)
{
assert
(
t
!=
null
);
assert
(
t
!=
null
);
if
(
a
==
null
&&
b
==
null
)
if
(
a
==
null
&&
b
==
null
)
return
null
;
return
null
;
...
...
packages/flutter/lib/src/material/flutter_logo.dart
View file @
a01113de
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
/// The Flutter logo, in widget form. This widget respects the [IconTheme].
/// The Flutter logo, in widget form. This widget respects the [IconTheme].
...
@@ -22,7 +20,7 @@ class FlutterLogo extends StatelessWidget {
...
@@ -22,7 +20,7 @@ class FlutterLogo extends StatelessWidget {
/// The [textColor], [style], [duration], and [curve] arguments must not be
/// The [textColor], [style], [duration], and [curve] arguments must not be
/// null.
/// null.
const
FlutterLogo
({
const
FlutterLogo
({
Key
key
,
Key
?
key
,
this
.
size
,
this
.
size
,
this
.
textColor
=
const
Color
(
0xFF757575
),
this
.
textColor
=
const
Color
(
0xFF757575
),
this
.
style
=
FlutterLogoStyle
.
markOnly
,
this
.
style
=
FlutterLogoStyle
.
markOnly
,
...
@@ -41,7 +39,7 @@ class FlutterLogo extends StatelessWidget {
...
@@ -41,7 +39,7 @@ class FlutterLogo extends StatelessWidget {
/// Defaults to the current [IconTheme] size, if any. If there is no
/// Defaults to the current [IconTheme] size, if any. If there is no
/// [IconTheme], or it does not specify an explicit size, then it defaults to
/// [IconTheme], or it does not specify an explicit size, then it defaults to
/// 24.0.
/// 24.0.
final
double
size
;
final
double
?
size
;
/// The color used to paint the "Flutter" text on the logo, if [style] is
/// The color used to paint the "Flutter" text on the logo, if [style] is
/// [FlutterLogoStyle.horizontal] or [FlutterLogoStyle.stacked].
/// [FlutterLogoStyle.horizontal] or [FlutterLogoStyle.stacked].
...
@@ -64,7 +62,7 @@ class FlutterLogo extends StatelessWidget {
...
@@ -64,7 +62,7 @@ class FlutterLogo extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
final
IconThemeData
iconTheme
=
IconTheme
.
of
(
context
);
final
IconThemeData
iconTheme
=
IconTheme
.
of
(
context
);
final
double
iconSize
=
size
??
iconTheme
.
size
;
final
double
?
iconSize
=
size
??
iconTheme
.
size
;
return
AnimatedContainer
(
return
AnimatedContainer
(
width:
iconSize
,
width:
iconSize
,
height:
iconSize
,
height:
iconSize
,
...
...
packages/flutter/lib/src/material/grid_tile.dart
View file @
a01113de
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
/// A tile in a material design grid list.
/// A tile in a material design grid list.
...
@@ -23,22 +21,22 @@ class GridTile extends StatelessWidget {
...
@@ -23,22 +21,22 @@ class GridTile extends StatelessWidget {
///
///
/// Must have a child. Does not typically have both a header and a footer.
/// Must have a child. Does not typically have both a header and a footer.
const
GridTile
({
const
GridTile
({
Key
key
,
Key
?
key
,
this
.
header
,
this
.
header
,
this
.
footer
,
this
.
footer
,
@
required
this
.
child
,
required
this
.
child
,
})
:
assert
(
child
!=
null
),
})
:
assert
(
child
!=
null
),
super
(
key:
key
);
super
(
key:
key
);
/// The widget to show over the top of this grid tile.
/// The widget to show over the top of this grid tile.
///
///
/// Typically a [GridTileBar].
/// Typically a [GridTileBar].
final
Widget
header
;
final
Widget
?
header
;
/// The widget to show over the bottom of this grid tile.
/// The widget to show over the bottom of this grid tile.
///
///
/// Typically a [GridTileBar].
/// Typically a [GridTileBar].
final
Widget
footer
;
final
Widget
?
footer
;
/// The widget that fills the tile.
/// The widget that fills the tile.
///
///
...
@@ -60,14 +58,14 @@ class GridTile extends StatelessWidget {
...
@@ -60,14 +58,14 @@ class GridTile extends StatelessWidget {
top:
0.0
,
top:
0.0
,
left:
0.0
,
left:
0.0
,
right:
0.0
,
right:
0.0
,
child:
header
,
child:
header
!
,
),
),
if
(
footer
!=
null
)
if
(
footer
!=
null
)
Positioned
(
Positioned
(
left:
0.0
,
left:
0.0
,
bottom:
0.0
,
bottom:
0.0
,
right:
0.0
,
right:
0.0
,
child:
footer
,
child:
footer
!
,
),
),
],
],
);
);
...
...
packages/flutter/lib/src/material/icons.dart
View file @
a01113de
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/widgets.dart';
import 'package:flutter/widgets.dart';
/// Identifiers for the supported material design icons.
/// Identifiers for the supported material design icons.
packages/flutter/lib/src/material/material_state.dart
View file @
a01113de
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'dart:ui'
show
Color
;
import
'dart:ui'
show
Color
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
...
@@ -76,7 +74,7 @@ enum MaterialState {
...
@@ -76,7 +74,7 @@ enum MaterialState {
/// Signature for the function that returns a value of type `T` based on a given
/// Signature for the function that returns a value of type `T` based on a given
/// set of states.
/// set of states.
typedef
MaterialPropertyResolver
<
T
>
=
T
Function
(
Set
<
MaterialState
>
states
);
typedef
MaterialPropertyResolver
<
T
>
=
T
?
Function
(
Set
<
MaterialState
>
states
);
/// Defines a [Color] that is also a [MaterialStateProperty].
/// Defines a [Color] that is also a [MaterialStateProperty].
///
///
...
@@ -139,7 +137,7 @@ abstract class MaterialStateColor extends Color implements MaterialStateProperty
...
@@ -139,7 +137,7 @@ abstract class MaterialStateColor extends Color implements MaterialStateProperty
/// Returns a [Color] that's to be used when a Material component is in the
/// Returns a [Color] that's to be used when a Material component is in the
/// specified state.
/// specified state.
@override
@override
Color
resolve
(
Set
<
MaterialState
>
states
);
Color
?
resolve
(
Set
<
MaterialState
>
states
);
}
}
/// A [MaterialStateColor] created from a [MaterialPropertyResolver<Color>]
/// A [MaterialStateColor] created from a [MaterialPropertyResolver<Color>]
...
@@ -150,7 +148,7 @@ abstract class MaterialStateColor extends Color implements MaterialStateProperty
...
@@ -150,7 +148,7 @@ abstract class MaterialStateColor extends Color implements MaterialStateProperty
///
///
/// Used by [MaterialStateColor.resolveWith].
/// Used by [MaterialStateColor.resolveWith].
class
_MaterialStateColor
extends
MaterialStateColor
{
class
_MaterialStateColor
extends
MaterialStateColor
{
_MaterialStateColor
(
this
.
_resolve
)
:
super
(
_resolve
(
_defaultStates
).
value
);
_MaterialStateColor
(
this
.
_resolve
)
:
super
(
_resolve
(
_defaultStates
)
!
.
value
);
final
MaterialPropertyResolver
<
Color
>
_resolve
;
final
MaterialPropertyResolver
<
Color
>
_resolve
;
...
@@ -158,7 +156,7 @@ class _MaterialStateColor extends MaterialStateColor {
...
@@ -158,7 +156,7 @@ class _MaterialStateColor extends MaterialStateColor {
static
const
Set
<
MaterialState
>
_defaultStates
=
<
MaterialState
>{};
static
const
Set
<
MaterialState
>
_defaultStates
=
<
MaterialState
>{};
@override
@override
Color
resolve
(
Set
<
MaterialState
>
states
)
=>
_resolve
(
states
);
Color
?
resolve
(
Set
<
MaterialState
>
states
)
=>
_resolve
(
states
);
}
}
/// Defines a [MouseCursor] whose value depends on a set of [MaterialState]s which
/// Defines a [MouseCursor] whose value depends on a set of [MaterialState]s which
...
@@ -224,7 +222,7 @@ abstract class MaterialStateMouseCursor extends MouseCursor implements MaterialS
...
@@ -224,7 +222,7 @@ abstract class MaterialStateMouseCursor extends MouseCursor implements MaterialS
@protected
@protected
@override
@override
MouseCursorSession
createSession
(
int
device
)
{
MouseCursorSession
createSession
(
int
device
)
{
return
resolve
(<
MaterialState
>{}).
createSession
(
device
);
return
resolve
(<
MaterialState
>{})
!
.
createSession
(
device
);
}
}
/// Returns a [MouseCursor] that's to be used when a Material component is in
/// Returns a [MouseCursor] that's to be used when a Material component is in
...
@@ -232,7 +230,7 @@ abstract class MaterialStateMouseCursor extends MouseCursor implements MaterialS
...
@@ -232,7 +230,7 @@ abstract class MaterialStateMouseCursor extends MouseCursor implements MaterialS
///
///
/// This method should never return null.
/// This method should never return null.
@override
@override
MouseCursor
resolve
(
Set
<
MaterialState
>
states
);
MouseCursor
?
resolve
(
Set
<
MaterialState
>
states
);
/// A mouse cursor for clickable material widgets, which resolves differently
/// A mouse cursor for clickable material widgets, which resolves differently
/// when the widget is disabled.
/// when the widget is disabled.
...
@@ -263,9 +261,9 @@ abstract class MaterialStateMouseCursor extends MouseCursor implements MaterialS
...
@@ -263,9 +261,9 @@ abstract class MaterialStateMouseCursor extends MouseCursor implements MaterialS
class
_EnabledAndDisabledMouseCursor
extends
MaterialStateMouseCursor
{
class
_EnabledAndDisabledMouseCursor
extends
MaterialStateMouseCursor
{
const
_EnabledAndDisabledMouseCursor
({
const
_EnabledAndDisabledMouseCursor
({
this
.
enabledCursor
,
required
this
.
enabledCursor
,
this
.
disabledCursor
,
required
this
.
disabledCursor
,
this
.
name
,
required
this
.
name
,
});
});
final
MouseCursor
enabledCursor
;
final
MouseCursor
enabledCursor
;
...
@@ -349,7 +347,7 @@ abstract class MaterialStateProperty<T> {
...
@@ -349,7 +347,7 @@ abstract class MaterialStateProperty<T> {
/// Widgets like [TextButton] and [ElevatedButton] apply this method to their
/// Widgets like [TextButton] and [ElevatedButton] apply this method to their
/// current [MaterialState]s to compute colors and other visual parameters
/// current [MaterialState]s to compute colors and other visual parameters
/// at build time.
/// at build time.
T
resolve
(
Set
<
MaterialState
>
states
);
T
?
resolve
(
Set
<
MaterialState
>
states
);
/// Resolves the value for the given set of states if `value` is a
/// Resolves the value for the given set of states if `value` is a
/// [MaterialStateProperty], otherwise returns the value itself.
/// [MaterialStateProperty], otherwise returns the value itself.
...
@@ -357,9 +355,9 @@ abstract class MaterialStateProperty<T> {
...
@@ -357,9 +355,9 @@ abstract class MaterialStateProperty<T> {
/// This is useful for widgets that have parameters which can optionally be a
/// This is useful for widgets that have parameters which can optionally be a
/// [MaterialStateProperty]. For example, [InkWell.mouseCursor] can be a
/// [MaterialStateProperty]. For example, [InkWell.mouseCursor] can be a
/// [MouseCursor] or a [MaterialStateProperty<MouseCursor>].
/// [MouseCursor] or a [MaterialStateProperty<MouseCursor>].
static
T
resolveAs
<
T
>(
T
value
,
Set
<
MaterialState
>
states
)
{
static
T
?
resolveAs
<
T
>(
T
?
value
,
Set
<
MaterialState
>
states
)
{
if
(
value
is
MaterialStateProperty
<
T
>)
{
if
(
value
is
MaterialStateProperty
<
T
>)
{
final
MaterialStateProperty
<
T
>
property
=
value
;
final
MaterialStateProperty
<
T
>
property
=
value
as
MaterialStateProperty
<
T
>
;
return
property
.
resolve
(
states
);
return
property
.
resolve
(
states
);
}
}
return
value
;
return
value
;
...
@@ -371,7 +369,7 @@ abstract class MaterialStateProperty<T> {
...
@@ -371,7 +369,7 @@ abstract class MaterialStateProperty<T> {
/// Convenience method for creating a [MaterialStateProperty] that resolves
/// Convenience method for creating a [MaterialStateProperty] that resolves
/// to a single value for all states.
/// to a single value for all states.
static
MaterialStateProperty
<
T
>
all
<
T
>(
T
value
)
=>
_MaterialStatePropertyAll
<
T
>(
value
);
static
MaterialStateProperty
<
T
>
all
<
T
>(
T
?
value
)
=>
_MaterialStatePropertyAll
<
T
>(
value
);
}
}
class
_MaterialStatePropertyWith
<
T
>
implements
MaterialStateProperty
<
T
>
{
class
_MaterialStatePropertyWith
<
T
>
implements
MaterialStateProperty
<
T
>
{
...
@@ -380,16 +378,16 @@ class _MaterialStatePropertyWith<T> implements MaterialStateProperty<T> {
...
@@ -380,16 +378,16 @@ class _MaterialStatePropertyWith<T> implements MaterialStateProperty<T> {
final
MaterialPropertyResolver
<
T
>
_resolve
;
final
MaterialPropertyResolver
<
T
>
_resolve
;
@override
@override
T
resolve
(
Set
<
MaterialState
>
states
)
=>
_resolve
(
states
);
T
?
resolve
(
Set
<
MaterialState
>
states
)
=>
_resolve
(
states
);
}
}
class
_MaterialStatePropertyAll
<
T
>
implements
MaterialStateProperty
<
T
>
{
class
_MaterialStatePropertyAll
<
T
>
implements
MaterialStateProperty
<
T
>
{
_MaterialStatePropertyAll
(
this
.
value
);
_MaterialStatePropertyAll
(
this
.
value
);
final
T
value
;
final
T
?
value
;
@override
@override
T
resolve
(
Set
<
MaterialState
>
states
)
=>
value
;
T
?
resolve
(
Set
<
MaterialState
>
states
)
=>
value
;
@override
@override
String
toString
()
=>
'MaterialStateProperty.all(
$value
)'
;
String
toString
()
=>
'MaterialStateProperty.all(
$value
)'
;
...
...
packages/flutter/lib/src/material/text_theme.dart
View file @
a01113de
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/painting.dart'
;
import
'package:flutter/painting.dart'
;
...
@@ -113,16 +111,16 @@ class TextTheme with Diagnosticable {
...
@@ -113,16 +111,16 @@ class TextTheme with Diagnosticable {
/// If you do decide to create your own text theme, consider using one of
/// If you do decide to create your own text theme, consider using one of
/// those predefined themes as a starting point for [copyWith] or [apply].
/// those predefined themes as a starting point for [copyWith] or [apply].
const
TextTheme
({
const
TextTheme
({
TextStyle
headline1
,
TextStyle
?
headline1
,
TextStyle
headline2
,
TextStyle
?
headline2
,
TextStyle
headline3
,
TextStyle
?
headline3
,
TextStyle
headline4
,
TextStyle
?
headline4
,
TextStyle
headline5
,
TextStyle
?
headline5
,
TextStyle
headline6
,
TextStyle
?
headline6
,
TextStyle
subtitle1
,
TextStyle
?
subtitle1
,
TextStyle
subtitle2
,
TextStyle
?
subtitle2
,
TextStyle
bodyText1
,
TextStyle
?
bodyText1
,
TextStyle
bodyText2
,
TextStyle
?
bodyText2
,
this
.
caption
,
this
.
caption
,
this
.
button
,
this
.
button
,
this
.
overline
,
this
.
overline
,
...
@@ -130,52 +128,52 @@ class TextTheme with Diagnosticable {
...
@@ -130,52 +128,52 @@ class TextTheme with Diagnosticable {
'This is the term used in the 2014 version of material design. The modern term is headline1. '
'This is the term used in the 2014 version of material design. The modern term is headline1. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
display4
,
TextStyle
?
display4
,
@Deprecated
(
@Deprecated
(
'This is the term used in the 2014 version of material design. The modern term is headline2. '
'This is the term used in the 2014 version of material design. The modern term is headline2. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
display3
,
TextStyle
?
display3
,
@Deprecated
(
@Deprecated
(
'This is the term used in the 2014 version of material design. The modern term is headline3. '
'This is the term used in the 2014 version of material design. The modern term is headline3. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
display2
,
TextStyle
?
display2
,
@Deprecated
(
@Deprecated
(
'This is the term used in the 2014 version of material design. The modern term is headline4. '
'This is the term used in the 2014 version of material design. The modern term is headline4. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
display1
,
TextStyle
?
display1
,
@Deprecated
(
@Deprecated
(
'This is the term used in the 2014 version of material design. The modern term is headline5. '
'This is the term used in the 2014 version of material design. The modern term is headline5. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
headline
,
TextStyle
?
headline
,
@Deprecated
(
@Deprecated
(
'This is the term used in the 2014 version of material design. The modern term is headline6. '
'This is the term used in the 2014 version of material design. The modern term is headline6. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
title
,
TextStyle
?
title
,
@Deprecated
(
@Deprecated
(
'This is the term used in the 2014 version of material design. The modern term is subtitle1. '
'This is the term used in the 2014 version of material design. The modern term is subtitle1. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
subhead
,
TextStyle
?
subhead
,
@Deprecated
(
@Deprecated
(
'This is the term used in the 2014 version of material design. The modern term is subtitle2. '
'This is the term used in the 2014 version of material design. The modern term is subtitle2. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
subtitle
,
TextStyle
?
subtitle
,
@Deprecated
(
@Deprecated
(
'This is the term used in the 2014 version of material design. The modern term is bodyText1. '
'This is the term used in the 2014 version of material design. The modern term is bodyText1. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
body2
,
TextStyle
?
body2
,
@Deprecated
(
@Deprecated
(
'This is the term used in the 2014 version of material design. The modern term is bodyText2. '
'This is the term used in the 2014 version of material design. The modern term is bodyText2. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
body1
,
TextStyle
?
body1
,
})
:
assert
(
})
:
assert
(
(
headline1
==
null
&&
headline2
==
null
&&
headline3
==
null
&&
headline4
==
null
&&
headline5
==
null
&&
headline6
==
null
&&
(
headline1
==
null
&&
headline2
==
null
&&
headline3
==
null
&&
headline4
==
null
&&
headline5
==
null
&&
headline6
==
null
&&
subtitle1
==
null
&&
subtitle2
==
null
&&
subtitle1
==
null
&&
subtitle2
==
null
&&
...
@@ -195,49 +193,49 @@ class TextTheme with Diagnosticable {
...
@@ -195,49 +193,49 @@ class TextTheme with Diagnosticable {
bodyText2
=
bodyText2
??
body1
;
bodyText2
=
bodyText2
??
body1
;
/// Extremely large text.
/// Extremely large text.
final
TextStyle
headline1
;
final
TextStyle
?
headline1
;
/// Very, very large text.
/// Very, very large text.
///
///
/// Used for the date in the dialog shown by [showDatePicker].
/// Used for the date in the dialog shown by [showDatePicker].
final
TextStyle
headline2
;
final
TextStyle
?
headline2
;
/// Very large text.
/// Very large text.
final
TextStyle
headline3
;
final
TextStyle
?
headline3
;
/// Large text.
/// Large text.
final
TextStyle
headline4
;
final
TextStyle
?
headline4
;
/// Used for large text in dialogs (e.g., the month and year in the dialog
/// Used for large text in dialogs (e.g., the month and year in the dialog
/// shown by [showDatePicker]).
/// shown by [showDatePicker]).
final
TextStyle
headline5
;
final
TextStyle
?
headline5
;
/// Used for the primary text in app bars and dialogs (e.g., [AppBar.title]
/// Used for the primary text in app bars and dialogs (e.g., [AppBar.title]
/// and [AlertDialog.title]).
/// and [AlertDialog.title]).
final
TextStyle
headline6
;
final
TextStyle
?
headline6
;
/// Used for the primary text in lists (e.g., [ListTile.title]).
/// Used for the primary text in lists (e.g., [ListTile.title]).
final
TextStyle
subtitle1
;
final
TextStyle
?
subtitle1
;
/// For medium emphasis text that's a little smaller than [subtitle1].
/// For medium emphasis text that's a little smaller than [subtitle1].
final
TextStyle
subtitle2
;
final
TextStyle
?
subtitle2
;
/// Used for emphasizing text that would otherwise be [bodyText2].
/// Used for emphasizing text that would otherwise be [bodyText2].
final
TextStyle
bodyText1
;
final
TextStyle
?
bodyText1
;
/// The default text style for [Material].
/// The default text style for [Material].
final
TextStyle
bodyText2
;
final
TextStyle
?
bodyText2
;
/// Used for auxiliary text associated with images.
/// Used for auxiliary text associated with images.
final
TextStyle
caption
;
final
TextStyle
?
caption
;
/// Used for text on [ElevatedButton], [TextButton] and [OutlinedButton].
/// Used for text on [ElevatedButton], [TextButton] and [OutlinedButton].
final
TextStyle
button
;
final
TextStyle
?
button
;
/// The smallest style.
/// The smallest style.
///
///
/// Typically used for captions or to introduce a (larger) headline.
/// Typically used for captions or to introduce a (larger) headline.
final
TextStyle
overline
;
final
TextStyle
?
overline
;
/// Extremely large text.
/// Extremely large text.
///
///
...
@@ -247,7 +245,7 @@ class TextTheme with Diagnosticable {
...
@@ -247,7 +245,7 @@ class TextTheme with Diagnosticable {
'This is the term used in the 2014 version of material design. The modern term is headline1. '
'This is the term used in the 2014 version of material design. The modern term is headline1. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
get
display4
=>
headline1
;
TextStyle
?
get
display4
=>
headline1
;
/// Very, very large text.
/// Very, very large text.
///
///
...
@@ -257,7 +255,7 @@ class TextTheme with Diagnosticable {
...
@@ -257,7 +255,7 @@ class TextTheme with Diagnosticable {
'This is the term used in the 2014 version of material design. The modern term is headline2. '
'This is the term used in the 2014 version of material design. The modern term is headline2. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
get
display3
=>
headline2
;
TextStyle
?
get
display3
=>
headline2
;
/// Very large text.
/// Very large text.
///
///
...
@@ -267,7 +265,7 @@ class TextTheme with Diagnosticable {
...
@@ -267,7 +265,7 @@ class TextTheme with Diagnosticable {
'This is the term used in the 2014 version of material design. The modern term is headline3. '
'This is the term used in the 2014 version of material design. The modern term is headline3. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
get
display2
=>
headline3
;
TextStyle
?
get
display2
=>
headline3
;
/// Large text.
/// Large text.
///
///
...
@@ -277,7 +275,7 @@ class TextTheme with Diagnosticable {
...
@@ -277,7 +275,7 @@ class TextTheme with Diagnosticable {
'This is the term used in the 2014 version of material design. The modern term is headline4. '
'This is the term used in the 2014 version of material design. The modern term is headline4. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
get
display1
=>
headline4
;
TextStyle
?
get
display1
=>
headline4
;
/// Used for large text in dialogs.
/// Used for large text in dialogs.
///
///
...
@@ -287,7 +285,7 @@ class TextTheme with Diagnosticable {
...
@@ -287,7 +285,7 @@ class TextTheme with Diagnosticable {
'This is the term used in the 2014 version of material design. The modern term is headline5. '
'This is the term used in the 2014 version of material design. The modern term is headline5. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
get
headline
=>
headline5
;
TextStyle
?
get
headline
=>
headline5
;
/// Used for the primary text in app bars and dialogs.
/// Used for the primary text in app bars and dialogs.
///
///
...
@@ -297,7 +295,7 @@ class TextTheme with Diagnosticable {
...
@@ -297,7 +295,7 @@ class TextTheme with Diagnosticable {
'This is the term used in the 2014 version of material design. The modern term is headline6. '
'This is the term used in the 2014 version of material design. The modern term is headline6. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
get
title
=>
headline6
;
TextStyle
?
get
title
=>
headline6
;
/// Used for the primary text in lists (e.g., [ListTile.title]).
/// Used for the primary text in lists (e.g., [ListTile.title]).
///
///
...
@@ -307,7 +305,7 @@ class TextTheme with Diagnosticable {
...
@@ -307,7 +305,7 @@ class TextTheme with Diagnosticable {
'This is the term used in the 2014 version of material design. The modern term is subtitle1. '
'This is the term used in the 2014 version of material design. The modern term is subtitle1. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
get
subhead
=>
subtitle1
;
TextStyle
?
get
subhead
=>
subtitle1
;
/// For medium emphasis text that's a little smaller than [subhead].
/// For medium emphasis text that's a little smaller than [subhead].
///
///
...
@@ -317,7 +315,7 @@ class TextTheme with Diagnosticable {
...
@@ -317,7 +315,7 @@ class TextTheme with Diagnosticable {
'This is the term used in the 2014 version of material design. The modern term is subtitle2. '
'This is the term used in the 2014 version of material design. The modern term is subtitle2. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
get
subtitle
=>
subtitle2
;
TextStyle
?
get
subtitle
=>
subtitle2
;
/// Used for emphasizing text that would otherwise be [body1].
/// Used for emphasizing text that would otherwise be [body1].
///
///
...
@@ -328,7 +326,7 @@ class TextTheme with Diagnosticable {
...
@@ -328,7 +326,7 @@ class TextTheme with Diagnosticable {
'This is the term used in the 2014 version of material design. The modern term is bodyText1. '
'This is the term used in the 2014 version of material design. The modern term is bodyText1. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
get
body2
=>
bodyText1
;
TextStyle
?
get
body2
=>
bodyText1
;
/// Used for the default text style for [Material].
/// Used for the default text style for [Material].
///
///
...
@@ -339,7 +337,7 @@ class TextTheme with Diagnosticable {
...
@@ -339,7 +337,7 @@ class TextTheme with Diagnosticable {
'This is the term used in the 2014 version of material design. The modern term is bodyText2. '
'This is the term used in the 2014 version of material design. The modern term is bodyText2. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
get
body1
=>
bodyText2
;
TextStyle
?
get
body1
=>
bodyText2
;
/// Creates a copy of this text theme but with the given fields replaced with
/// Creates a copy of this text theme but with the given fields replaced with
...
@@ -383,69 +381,69 @@ class TextTheme with Diagnosticable {
...
@@ -383,69 +381,69 @@ class TextTheme with Diagnosticable {
/// * [merge] is used instead of [copyWith] when you want to merge all
/// * [merge] is used instead of [copyWith] when you want to merge all
/// of the fields of a TextTheme instead of individual fields.
/// of the fields of a TextTheme instead of individual fields.
TextTheme
copyWith
({
TextTheme
copyWith
({
TextStyle
headline1
,
TextStyle
?
headline1
,
TextStyle
headline2
,
TextStyle
?
headline2
,
TextStyle
headline3
,
TextStyle
?
headline3
,
TextStyle
headline4
,
TextStyle
?
headline4
,
TextStyle
headline5
,
TextStyle
?
headline5
,
TextStyle
headline6
,
TextStyle
?
headline6
,
TextStyle
subtitle1
,
TextStyle
?
subtitle1
,
TextStyle
subtitle2
,
TextStyle
?
subtitle2
,
TextStyle
bodyText1
,
TextStyle
?
bodyText1
,
TextStyle
bodyText2
,
TextStyle
?
bodyText2
,
TextStyle
caption
,
TextStyle
?
caption
,
TextStyle
button
,
TextStyle
?
button
,
TextStyle
overline
,
TextStyle
?
overline
,
@Deprecated
(
@Deprecated
(
'This is the term used in the 2014 version of material design. The modern term is headline1. '
'This is the term used in the 2014 version of material design. The modern term is headline1. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
display4
,
TextStyle
?
display4
,
@Deprecated
(
@Deprecated
(
'This is the term used in the 2014 version of material design. The modern term is headline2. '
'This is the term used in the 2014 version of material design. The modern term is headline2. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
display3
,
TextStyle
?
display3
,
@Deprecated
(
@Deprecated
(
'This is the term used in the 2014 version of material design. The modern term is headline3. '
'This is the term used in the 2014 version of material design. The modern term is headline3. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
display2
,
TextStyle
?
display2
,
@Deprecated
(
@Deprecated
(
'This is the term used in the 2014 version of material design. The modern term is headline4. '
'This is the term used in the 2014 version of material design. The modern term is headline4. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
display1
,
TextStyle
?
display1
,
@Deprecated
(
@Deprecated
(
'This is the term used in the 2014 version of material design. The modern term is headline5. '
'This is the term used in the 2014 version of material design. The modern term is headline5. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
headline
,
TextStyle
?
headline
,
@Deprecated
(
@Deprecated
(
'This is the term used in the 2014 version of material design. The modern term is headline6. '
'This is the term used in the 2014 version of material design. The modern term is headline6. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
title
,
TextStyle
?
title
,
@Deprecated
(
@Deprecated
(
'This is the term used in the 2014 version of material design. The modern term is subtitle1. '
'This is the term used in the 2014 version of material design. The modern term is subtitle1. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
subhead
,
TextStyle
?
subhead
,
@Deprecated
(
@Deprecated
(
'This is the term used in the 2014 version of material design. The modern term is subtitle2. '
'This is the term used in the 2014 version of material design. The modern term is subtitle2. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
subtitle
,
TextStyle
?
subtitle
,
@Deprecated
(
@Deprecated
(
'This is the term used in the 2014 version of material design. The modern term is bodyText1. '
'This is the term used in the 2014 version of material design. The modern term is bodyText1. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
body2
,
TextStyle
?
body2
,
@Deprecated
(
@Deprecated
(
'This is the term used in the 2014 version of material design. The modern term is bodyText2. '
'This is the term used in the 2014 version of material design. The modern term is bodyText2. '
'This feature was deprecated after v1.13.8.'
'This feature was deprecated after v1.13.8.'
)
)
TextStyle
body1
,
TextStyle
?
body1
,
})
{
})
{
assert
(
assert
(
(
headline1
==
null
&&
headline2
==
null
&&
headline3
==
null
&&
headline4
==
null
&&
headline5
==
null
&&
headline6
==
null
&&
(
headline1
==
null
&&
headline2
==
null
&&
headline3
==
null
&&
headline4
==
null
&&
headline5
==
null
&&
headline6
==
null
&&
...
@@ -522,7 +520,7 @@ class TextTheme with Diagnosticable {
...
@@ -522,7 +520,7 @@ class TextTheme with Diagnosticable {
/// * [copyWith] is used instead of [merge] when you wish to override
/// * [copyWith] is used instead of [merge] when you wish to override
/// individual fields in the [TextTheme] instead of merging all of the
/// individual fields in the [TextTheme] instead of merging all of the
/// fields of two [TextTheme]s.
/// fields of two [TextTheme]s.
TextTheme
merge
(
TextTheme
other
)
{
TextTheme
merge
(
TextTheme
?
other
)
{
if
(
other
==
null
)
if
(
other
==
null
)
return
this
;
return
this
;
return
copyWith
(
return
copyWith
(
...
@@ -553,14 +551,14 @@ class TextTheme with Diagnosticable {
...
@@ -553,14 +551,14 @@ class TextTheme with Diagnosticable {
/// the typography styles in the material design specification, as a starting
/// the typography styles in the material design specification, as a starting
/// point.
/// point.
TextTheme
apply
({
TextTheme
apply
({
String
fontFamily
,
String
?
fontFamily
,
double
fontSizeFactor
=
1.0
,
double
fontSizeFactor
=
1.0
,
double
fontSizeDelta
=
0.0
,
double
fontSizeDelta
=
0.0
,
Color
displayColor
,
Color
?
displayColor
,
Color
bodyColor
,
Color
?
bodyColor
,
TextDecoration
decoration
,
TextDecoration
?
decoration
,
Color
decorationColor
,
Color
?
decorationColor
,
TextDecorationStyle
decorationStyle
,
TextDecorationStyle
?
decorationStyle
,
})
{
})
{
return
TextTheme
(
return
TextTheme
(
headline1:
headline1
?.
apply
(
headline1:
headline1
?.
apply
(
...
@@ -686,7 +684,7 @@ class TextTheme with Diagnosticable {
...
@@ -686,7 +684,7 @@ class TextTheme with Diagnosticable {
/// Linearly interpolate between two text themes.
/// Linearly interpolate between two text themes.
///
///
/// {@macro dart.ui.shadow.lerp}
/// {@macro dart.ui.shadow.lerp}
static
TextTheme
lerp
(
TextTheme
a
,
TextTheme
b
,
double
t
)
{
static
TextTheme
lerp
(
TextTheme
?
a
,
TextTheme
?
b
,
double
t
)
{
assert
(
t
!=
null
);
assert
(
t
!=
null
);
return
TextTheme
(
return
TextTheme
(
headline1:
TextStyle
.
lerp
(
a
?.
headline1
,
b
?.
headline1
,
t
),
headline1:
TextStyle
.
lerp
(
a
?.
headline1
,
b
?.
headline1
,
t
),
...
...
packages/flutter/lib/src/material/toggleable.dart
View file @
a01113de
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter/animation.dart'
;
import
'package:flutter/animation.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/gestures.dart'
;
...
@@ -32,15 +30,15 @@ abstract class RenderToggleable extends RenderConstrainedBox {
...
@@ -32,15 +30,15 @@ abstract class RenderToggleable extends RenderConstrainedBox {
/// The [activeColor], and [inactiveColor] arguments must not be
/// The [activeColor], and [inactiveColor] arguments must not be
/// null. The [value] can only be null if tristate is true.
/// null. The [value] can only be null if tristate is true.
RenderToggleable
({
RenderToggleable
({
@required
bool
value
,
required
bool
?
value
,
bool
tristate
=
false
,
bool
tristate
=
false
,
@
required
Color
activeColor
,
required
Color
activeColor
,
@
required
Color
inactiveColor
,
required
Color
inactiveColor
,
Color
hoverColor
,
Color
?
hoverColor
,
Color
focusColor
,
Color
?
focusColor
,
ValueChanged
<
bool
>
onChanged
,
ValueChanged
<
bool
?>?
onChanged
,
BoxConstraints
additionalConstraints
,
required
BoxConstraints
additionalConstraints
,
@
required
TickerProvider
vsync
,
required
TickerProvider
vsync
,
bool
hasFocus
=
false
,
bool
hasFocus
=
false
,
bool
hovering
=
false
,
bool
hovering
=
false
,
})
:
assert
(
tristate
!=
null
),
})
:
assert
(
tristate
!=
null
),
...
@@ -110,7 +108,7 @@ abstract class RenderToggleable extends RenderConstrainedBox {
...
@@ -110,7 +108,7 @@ abstract class RenderToggleable extends RenderConstrainedBox {
/// animation reaches either 0.0 or 1.0.
/// animation reaches either 0.0 or 1.0.
@protected
@protected
AnimationController
get
positionController
=>
_positionController
;
AnimationController
get
positionController
=>
_positionController
;
AnimationController
_positionController
;
late
AnimationController
_positionController
;
/// The visual value of the control.
/// The visual value of the control.
///
///
...
@@ -121,7 +119,7 @@ abstract class RenderToggleable extends RenderConstrainedBox {
...
@@ -121,7 +119,7 @@ abstract class RenderToggleable extends RenderConstrainedBox {
/// to active (or vice versa), [value] is the target value and this animation
/// to active (or vice versa), [value] is the target value and this animation
/// gradually updates from 0.0 to 1.0 (or vice versa).
/// gradually updates from 0.0 to 1.0 (or vice versa).
CurvedAnimation
get
position
=>
_position
;
CurvedAnimation
get
position
=>
_position
;
CurvedAnimation
_position
;
late
CurvedAnimation
_position
;
/// Used by subclasses to control the radial reaction animation.
/// Used by subclasses to control the radial reaction animation.
///
///
...
@@ -132,8 +130,8 @@ abstract class RenderToggleable extends RenderConstrainedBox {
...
@@ -132,8 +130,8 @@ abstract class RenderToggleable extends RenderConstrainedBox {
/// reaction.
/// reaction.
@protected
@protected
AnimationController
get
reactionController
=>
_reactionController
;
AnimationController
get
reactionController
=>
_reactionController
;
AnimationController
_reactionController
;
late
AnimationController
_reactionController
;
Animation
<
double
>
_reaction
;
late
Animation
<
double
>
_reaction
;
/// Used by subclasses to control the radial reaction's opacity animation for
/// Used by subclasses to control the radial reaction's opacity animation for
/// [hasFocus] changes.
/// [hasFocus] changes.
...
@@ -146,8 +144,8 @@ abstract class RenderToggleable extends RenderConstrainedBox {
...
@@ -146,8 +144,8 @@ abstract class RenderToggleable extends RenderConstrainedBox {
/// reaction.
/// reaction.
@protected
@protected
AnimationController
get
reactionFocusFadeController
=>
_reactionFocusFadeController
;
AnimationController
get
reactionFocusFadeController
=>
_reactionFocusFadeController
;
AnimationController
_reactionFocusFadeController
;
late
AnimationController
_reactionFocusFadeController
;
Animation
<
double
>
_reactionFocusFade
;
late
Animation
<
double
>
_reactionFocusFade
;
/// Used by subclasses to control the radial reaction's opacity animation for
/// Used by subclasses to control the radial reaction's opacity animation for
/// [hovering] changes.
/// [hovering] changes.
...
@@ -160,8 +158,8 @@ abstract class RenderToggleable extends RenderConstrainedBox {
...
@@ -160,8 +158,8 @@ abstract class RenderToggleable extends RenderConstrainedBox {
/// reaction.
/// reaction.
@protected
@protected
AnimationController
get
reactionHoverFadeController
=>
_reactionHoverFadeController
;
AnimationController
get
reactionHoverFadeController
=>
_reactionHoverFadeController
;
AnimationController
_reactionHoverFadeController
;
late
AnimationController
_reactionHoverFadeController
;
Animation
<
double
>
_reactionHoverFade
;
late
Animation
<
double
>
_reactionHoverFade
;
/// True if this toggleable has the input focus.
/// True if this toggleable has the input focus.
bool
get
hasFocus
=>
_hasFocus
;
bool
get
hasFocus
=>
_hasFocus
;
...
@@ -216,9 +214,9 @@ abstract class RenderToggleable extends RenderConstrainedBox {
...
@@ -216,9 +214,9 @@ abstract class RenderToggleable extends RenderConstrainedBox {
/// When the value changes, this object starts the [positionController] and
/// When the value changes, this object starts the [positionController] and
/// [position] animations to animate the visual appearance of the control to
/// [position] animations to animate the visual appearance of the control to
/// the new value.
/// the new value.
bool
get
value
=>
_value
;
bool
?
get
value
=>
_value
;
bool
_value
;
bool
?
_value
;
set
value
(
bool
value
)
{
set
value
(
bool
?
value
)
{
assert
(
tristate
||
value
!=
null
);
assert
(
tristate
||
value
!=
null
);
if
(
value
==
_value
)
if
(
value
==
_value
)
return
;
return
;
...
@@ -323,9 +321,9 @@ abstract class RenderToggleable extends RenderConstrainedBox {
...
@@ -323,9 +321,9 @@ abstract class RenderToggleable extends RenderConstrainedBox {
/// that is displayed when the toggleable is toggled by a tap.
/// that is displayed when the toggleable is toggled by a tap.
///
///
/// Defaults to the [activeColor] at alpha [kRadialReactionAlpha].
/// Defaults to the [activeColor] at alpha [kRadialReactionAlpha].
Color
get
reactionColor
=>
_reactionColor
;
Color
?
get
reactionColor
=>
_reactionColor
;
Color
_reactionColor
;
Color
?
_reactionColor
;
set
reactionColor
(
Color
value
)
{
set
reactionColor
(
Color
?
value
)
{
assert
(
value
!=
null
);
assert
(
value
!=
null
);
if
(
value
==
_reactionColor
)
if
(
value
==
_reactionColor
)
return
;
return
;
...
@@ -342,9 +340,9 @@ abstract class RenderToggleable extends RenderConstrainedBox {
...
@@ -342,9 +340,9 @@ abstract class RenderToggleable extends RenderConstrainedBox {
/// callback is non-null. If the callback is null, then the control is
/// callback is non-null. If the callback is null, then the control is
/// disabled, and non-interactive. A disabled checkbox, for example, is
/// disabled, and non-interactive. A disabled checkbox, for example, is
/// displayed using a grey color and its value cannot be changed.
/// displayed using a grey color and its value cannot be changed.
ValueChanged
<
bool
>
get
onChanged
=>
_onChanged
;
ValueChanged
<
bool
?>?
get
onChanged
=>
_onChanged
;
ValueChanged
<
bool
>
_onChanged
;
ValueChanged
<
bool
?>?
_onChanged
;
set
onChanged
(
ValueChanged
<
bool
>
value
)
{
set
onChanged
(
ValueChanged
<
bool
?>?
value
)
{
if
(
value
==
_onChanged
)
if
(
value
==
_onChanged
)
return
;
return
;
final
bool
wasInteractive
=
isInteractive
;
final
bool
wasInteractive
=
isInteractive
;
...
@@ -363,8 +361,8 @@ abstract class RenderToggleable extends RenderConstrainedBox {
...
@@ -363,8 +361,8 @@ abstract class RenderToggleable extends RenderConstrainedBox {
/// grey color and its value cannot be changed.
/// grey color and its value cannot be changed.
bool
get
isInteractive
=>
onChanged
!=
null
;
bool
get
isInteractive
=>
onChanged
!=
null
;
TapGestureRecognizer
_tap
;
late
TapGestureRecognizer
_tap
;
Offset
_downPosition
;
Offset
?
_downPosition
;
@override
@override
void
attach
(
PipelineOwner
owner
)
{
void
attach
(
PipelineOwner
owner
)
{
...
@@ -410,13 +408,13 @@ abstract class RenderToggleable extends RenderConstrainedBox {
...
@@ -410,13 +408,13 @@ abstract class RenderToggleable extends RenderConstrainedBox {
return
;
return
;
switch
(
value
)
{
switch
(
value
)
{
case
false
:
case
false
:
onChanged
(
true
);
onChanged
!
(
true
);
break
;
break
;
case
true
:
case
true
:
onChanged
(
tristate
?
null
:
false
);
onChanged
!
(
tristate
?
null
:
false
);
break
;
break
;
default
:
//
case null:
case
null
:
onChanged
(
false
);
onChanged
!
(
false
);
break
;
break
;
}
}
sendSemanticsEvent
(
const
TapSemanticEvent
());
sendSemanticsEvent
(
const
TapSemanticEvent
());
...
@@ -457,8 +455,8 @@ abstract class RenderToggleable extends RenderConstrainedBox {
...
@@ -457,8 +455,8 @@ abstract class RenderToggleable extends RenderConstrainedBox {
Color
.
lerp
(
activeColor
.
withAlpha
(
kRadialReactionAlpha
),
hoverColor
,
_reactionHoverFade
.
value
),
Color
.
lerp
(
activeColor
.
withAlpha
(
kRadialReactionAlpha
),
hoverColor
,
_reactionHoverFade
.
value
),
focusColor
,
focusColor
,
_reactionFocusFade
.
value
,
_reactionFocusFade
.
value
,
);
)
!
;
final
Offset
center
=
Offset
.
lerp
(
_downPosition
??
origin
,
origin
,
_reaction
.
value
);
final
Offset
center
=
Offset
.
lerp
(
_downPosition
??
origin
,
origin
,
_reaction
.
value
)
!
;
final
double
reactionRadius
=
hasFocus
||
hovering
final
double
reactionRadius
=
hasFocus
||
hovering
?
kRadialReactionRadius
?
kRadialReactionRadius
:
_kRadialReactionRadiusTween
.
evaluate
(
_reaction
);
:
_kRadialReactionRadiusTween
.
evaluate
(
_reaction
);
...
...
packages/flutter/lib/src/material/typography.dart
View file @
a01113de
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/painting.dart'
;
import
'package:flutter/painting.dart'
;
...
@@ -117,12 +115,12 @@ class Typography with Diagnosticable {
...
@@ -117,12 +115,12 @@ class Typography with Diagnosticable {
/// The default values for [englishLike], [dense], and [tall] are
/// The default values for [englishLike], [dense], and [tall] are
/// [englishLike2014], [dense2014], and [tall2014].
/// [englishLike2014], [dense2014], and [tall2014].
factory
Typography
.
material2014
({
factory
Typography
.
material2014
({
TargetPlatform
platform
=
TargetPlatform
.
android
,
TargetPlatform
?
platform
=
TargetPlatform
.
android
,
TextTheme
black
,
TextTheme
?
black
,
TextTheme
white
,
TextTheme
?
white
,
TextTheme
englishLike
,
TextTheme
?
englishLike
,
TextTheme
dense
,
TextTheme
?
dense
,
TextTheme
tall
,
TextTheme
?
tall
,
})
{
})
{
assert
(
platform
!=
null
||
(
black
!=
null
&&
white
!=
null
));
assert
(
platform
!=
null
||
(
black
!=
null
&&
white
!=
null
));
return
Typography
.
_withPlatform
(
return
Typography
.
_withPlatform
(
...
@@ -145,12 +143,12 @@ class Typography with Diagnosticable {
...
@@ -145,12 +143,12 @@ class Typography with Diagnosticable {
/// The default values for [englishLike], [dense], and [tall] are
/// The default values for [englishLike], [dense], and [tall] are
/// [englishLike2018], [dense2018], and [tall2018].
/// [englishLike2018], [dense2018], and [tall2018].
factory
Typography
.
material2018
({
factory
Typography
.
material2018
({
TargetPlatform
platform
=
TargetPlatform
.
android
,
TargetPlatform
?
platform
=
TargetPlatform
.
android
,
TextTheme
black
,
TextTheme
?
black
,
TextTheme
white
,
TextTheme
?
white
,
TextTheme
englishLike
,
TextTheme
?
englishLike
,
TextTheme
dense
,
TextTheme
?
dense
,
TextTheme
tall
,
TextTheme
?
tall
,
})
{
})
{
assert
(
platform
!=
null
||
(
black
!=
null
&&
white
!=
null
));
assert
(
platform
!=
null
||
(
black
!=
null
&&
white
!=
null
));
return
Typography
.
_withPlatform
(
return
Typography
.
_withPlatform
(
...
@@ -163,9 +161,9 @@ class Typography with Diagnosticable {
...
@@ -163,9 +161,9 @@ class Typography with Diagnosticable {
}
}
factory
Typography
.
_withPlatform
(
factory
Typography
.
_withPlatform
(
TargetPlatform
platform
,
TargetPlatform
?
platform
,
TextTheme
black
,
TextTheme
?
black
,
TextTheme
white
,
TextTheme
?
white
,
TextTheme
englishLike
,
TextTheme
englishLike
,
TextTheme
dense
,
TextTheme
dense
,
TextTheme
tall
,
TextTheme
tall
,
...
@@ -193,8 +191,10 @@ class Typography with Diagnosticable {
...
@@ -193,8 +191,10 @@ class Typography with Diagnosticable {
black
??=
blackHelsinki
;
black
??=
blackHelsinki
;
white
??=
whiteHelsinki
;
white
??=
whiteHelsinki
;
break
;
break
;
case
null
:
break
;
}
}
return
Typography
.
_
(
black
,
white
,
englishLike
,
dense
,
tall
);
return
Typography
.
_
(
black
!,
white
!
,
englishLike
,
dense
,
tall
);
}
}
const
Typography
.
_
(
this
.
black
,
this
.
white
,
this
.
englishLike
,
this
.
dense
,
this
.
tall
)
const
Typography
.
_
(
this
.
black
,
this
.
white
,
this
.
englishLike
,
this
.
dense
,
this
.
tall
)
...
@@ -269,17 +269,16 @@ class Typography with Diagnosticable {
...
@@ -269,17 +269,16 @@ class Typography with Diagnosticable {
case
ScriptCategory
.
tall
:
case
ScriptCategory
.
tall
:
return
tall
;
return
tall
;
}
}
return
null
;
}
}
/// Creates a copy of this [Typography] with the given fields
/// Creates a copy of this [Typography] with the given fields
/// replaced by the non-null parameter values.
/// replaced by the non-null parameter values.
Typography
copyWith
({
Typography
copyWith
({
TextTheme
black
,
TextTheme
?
black
,
TextTheme
white
,
TextTheme
?
white
,
TextTheme
englishLike
,
TextTheme
?
englishLike
,
TextTheme
dense
,
TextTheme
?
dense
,
TextTheme
tall
,
TextTheme
?
tall
,
})
{
})
{
return
Typography
.
_
(
return
Typography
.
_
(
black
??
this
.
black
,
black
??
this
.
black
,
...
...
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