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
b6c2335d
Unverified
Commit
b6c2335d
authored
Aug 26, 2022
by
Taha Tesser
Committed by
GitHub
Aug 26, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace `_lerpProperties` with `MaterialStateProperty.lerp` in `button_style.dart` (#110323)
parent
0d2776fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
36 deletions
+12
-36
button_style.dart
packages/flutter/lib/src/material/button_style.dart
+12
-36
No files found.
packages/flutter/lib/src/material/button_style.dart
View file @
b6c2335d
...
...
@@ -485,18 +485,18 @@ class ButtonStyle with Diagnosticable {
return
null
;
}
return
ButtonStyle
(
textStyle:
_lerpProperties
<
TextStyle
?>(
a
?.
textStyle
,
b
?.
textStyle
,
t
,
TextStyle
.
lerp
),
backgroundColor:
_lerpProperties
<
Color
?>(
a
?.
backgroundColor
,
b
?.
backgroundColor
,
t
,
Color
.
lerp
),
foregroundColor:
_lerpProperties
<
Color
?>(
a
?.
foregroundColor
,
b
?.
foregroundColor
,
t
,
Color
.
lerp
),
overlayColor:
_lerpProperties
<
Color
?>(
a
?.
overlayColor
,
b
?.
overlayColor
,
t
,
Color
.
lerp
),
shadowColor:
_lerpProperties
<
Color
?>(
a
?.
shadowColor
,
b
?.
shadowColor
,
t
,
Color
.
lerp
),
surfaceTintColor:
_lerpProperties
<
Color
?>(
a
?.
surfaceTintColor
,
b
?.
surfaceTintColor
,
t
,
Color
.
lerp
),
elevation:
_lerpProperties
<
double
?>(
a
?.
elevation
,
b
?.
elevation
,
t
,
lerpDouble
),
padding:
_lerpProperties
<
EdgeInsetsGeometry
?>(
a
?.
padding
,
b
?.
padding
,
t
,
EdgeInsetsGeometry
.
lerp
),
minimumSize:
_lerpProperties
<
Size
?>(
a
?.
minimumSize
,
b
?.
minimumSize
,
t
,
Size
.
lerp
),
fixedSize:
_lerpProperties
<
Size
?>(
a
?.
fixedSize
,
b
?.
fixedSize
,
t
,
Size
.
lerp
),
maximumSize:
_lerpProperties
<
Size
?>(
a
?.
maximumSize
,
b
?.
maximumSize
,
t
,
Size
.
lerp
),
iconSize:
_lerpProperties
<
double
?>(
a
?.
iconSize
,
b
?.
iconSize
,
t
,
lerpDouble
),
textStyle:
MaterialStateProperty
.
lerp
<
TextStyle
?>(
a
?.
textStyle
,
b
?.
textStyle
,
t
,
TextStyle
.
lerp
),
backgroundColor:
MaterialStateProperty
.
lerp
<
Color
?>(
a
?.
backgroundColor
,
b
?.
backgroundColor
,
t
,
Color
.
lerp
),
foregroundColor:
MaterialStateProperty
.
lerp
<
Color
?>(
a
?.
foregroundColor
,
b
?.
foregroundColor
,
t
,
Color
.
lerp
),
overlayColor:
MaterialStateProperty
.
lerp
<
Color
?>(
a
?.
overlayColor
,
b
?.
overlayColor
,
t
,
Color
.
lerp
),
shadowColor:
MaterialStateProperty
.
lerp
<
Color
?>(
a
?.
shadowColor
,
b
?.
shadowColor
,
t
,
Color
.
lerp
),
surfaceTintColor:
MaterialStateProperty
.
lerp
<
Color
?>(
a
?.
surfaceTintColor
,
b
?.
surfaceTintColor
,
t
,
Color
.
lerp
),
elevation:
MaterialStateProperty
.
lerp
<
double
?>(
a
?.
elevation
,
b
?.
elevation
,
t
,
lerpDouble
),
padding:
MaterialStateProperty
.
lerp
<
EdgeInsetsGeometry
?>(
a
?.
padding
,
b
?.
padding
,
t
,
EdgeInsetsGeometry
.
lerp
),
minimumSize:
MaterialStateProperty
.
lerp
<
Size
?>(
a
?.
minimumSize
,
b
?.
minimumSize
,
t
,
Size
.
lerp
),
fixedSize:
MaterialStateProperty
.
lerp
<
Size
?>(
a
?.
fixedSize
,
b
?.
fixedSize
,
t
,
Size
.
lerp
),
maximumSize:
MaterialStateProperty
.
lerp
<
Size
?>(
a
?.
maximumSize
,
b
?.
maximumSize
,
t
,
Size
.
lerp
),
iconSize:
MaterialStateProperty
.
lerp
<
double
?>(
a
?.
iconSize
,
b
?.
iconSize
,
t
,
lerpDouble
),
side:
_lerpSides
(
a
?.
side
,
b
?.
side
,
t
),
shape:
MaterialStateProperty
.
lerp
<
OutlinedBorder
?>(
a
?.
shape
,
b
?.
shape
,
t
,
OutlinedBorder
.
lerp
),
mouseCursor:
t
<
0.5
?
a
?.
mouseCursor
:
b
?.
mouseCursor
,
...
...
@@ -509,14 +509,6 @@ class ButtonStyle with Diagnosticable {
);
}
static
MaterialStateProperty
<
T
?>?
_lerpProperties
<
T
>(
MaterialStateProperty
<
T
>?
a
,
MaterialStateProperty
<
T
>?
b
,
double
t
,
T
?
Function
(
T
?,
T
?,
double
)
lerpFunction
)
{
// Avoid creating a _LerpProperties object for a common case.
if
(
a
==
null
&&
b
==
null
)
{
return
null
;
}
return
_LerpProperties
<
T
>(
a
,
b
,
t
,
lerpFunction
);
}
// Special case because BorderSide.lerp() doesn't support null arguments
static
MaterialStateProperty
<
BorderSide
?>?
_lerpSides
(
MaterialStateProperty
<
BorderSide
?>?
a
,
MaterialStateProperty
<
BorderSide
?>?
b
,
double
t
)
{
if
(
a
==
null
&&
b
==
null
)
{
...
...
@@ -526,22 +518,6 @@ class ButtonStyle with Diagnosticable {
}
}
class
_LerpProperties
<
T
>
implements
MaterialStateProperty
<
T
?>
{
const
_LerpProperties
(
this
.
a
,
this
.
b
,
this
.
t
,
this
.
lerpFunction
);
final
MaterialStateProperty
<
T
>?
a
;
final
MaterialStateProperty
<
T
>?
b
;
final
double
t
;
final
T
?
Function
(
T
?,
T
?,
double
)
lerpFunction
;
@override
T
?
resolve
(
Set
<
MaterialState
>
states
)
{
final
T
?
resolvedA
=
a
?.
resolve
(
states
);
final
T
?
resolvedB
=
b
?.
resolve
(
states
);
return
lerpFunction
(
resolvedA
,
resolvedB
,
t
);
}
}
class
_LerpSides
implements
MaterialStateProperty
<
BorderSide
?>
{
const
_LerpSides
(
this
.
a
,
this
.
b
,
this
.
t
);
...
...
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