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
6dc18ef7
Unverified
Commit
6dc18ef7
authored
Aug 24, 2021
by
Deepak Penaganti
Committed by
GitHub
Aug 24, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Blurstyle for boxshadow v2 (#88697)
parent
c8e30bf4
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
311 additions
and
5 deletions
+311
-5
box_shadow.dart
packages/flutter/lib/src/painting/box_shadow.dart
+13
-4
box_painter_test.dart
packages/flutter/test/painting/box_painter_test.dart
+298
-1
No files found.
packages/flutter/lib/src/painting/box_shadow.dart
View file @
6dc18ef7
...
...
@@ -36,11 +36,17 @@ class BoxShadow extends ui.Shadow {
Offset
offset
=
Offset
.
zero
,
double
blurRadius
=
0.0
,
this
.
spreadRadius
=
0.0
,
this
.
blurStyle
=
BlurStyle
.
normal
,
})
:
super
(
color:
color
,
offset:
offset
,
blurRadius:
blurRadius
);
/// The amount the box should be inflated prior to applying the blur.
final
double
spreadRadius
;
/// The [BlurStyle] to use for this shadow.
///
/// Defaults to [BlurStyle.normal].
final
BlurStyle
blurStyle
;
/// Create the [Paint] object that corresponds to this shadow description.
///
/// The [offset] and [spreadRadius] are not represented in the [Paint] object.
...
...
@@ -51,7 +57,7 @@ class BoxShadow extends ui.Shadow {
Paint
toPaint
()
{
final
Paint
result
=
Paint
()
..
color
=
color
..
maskFilter
=
MaskFilter
.
blur
(
BlurStyle
.
normal
,
blurSigma
);
..
maskFilter
=
MaskFilter
.
blur
(
blurStyle
,
blurSigma
);
assert
(()
{
if
(
debugDisableShadows
)
result
.
maskFilter
=
null
;
...
...
@@ -68,6 +74,7 @@ class BoxShadow extends ui.Shadow {
offset:
offset
*
factor
,
blurRadius:
blurRadius
*
factor
,
spreadRadius:
spreadRadius
*
factor
,
blurStyle:
blurStyle
,
);
}
...
...
@@ -91,6 +98,7 @@ class BoxShadow extends ui.Shadow {
offset:
Offset
.
lerp
(
a
.
offset
,
b
.
offset
,
t
)!,
blurRadius:
ui
.
lerpDouble
(
a
.
blurRadius
,
b
.
blurRadius
,
t
)!,
spreadRadius:
ui
.
lerpDouble
(
a
.
spreadRadius
,
b
.
spreadRadius
,
t
)!,
blurStyle:
a
.
blurStyle
==
BlurStyle
.
normal
?
b
.
blurStyle
:
a
.
blurStyle
,
);
}
...
...
@@ -123,12 +131,13 @@ class BoxShadow extends ui.Shadow {
&&
other
.
color
==
color
&&
other
.
offset
==
offset
&&
other
.
blurRadius
==
blurRadius
&&
other
.
spreadRadius
==
spreadRadius
;
&&
other
.
spreadRadius
==
spreadRadius
&&
other
.
blurStyle
==
blurStyle
;
}
@override
int
get
hashCode
=>
hashValues
(
color
,
offset
,
blurRadius
,
spreadRadius
);
int
get
hashCode
=>
hashValues
(
color
,
offset
,
blurRadius
,
spreadRadius
,
blurStyle
);
@override
String
toString
()
=>
'BoxShadow(
$color
,
$offset
,
${debugFormatDouble(blurRadius)}
,
${debugFormatDouble(spreadRadius)}
)'
;
String
toString
()
=>
'BoxShadow(
$color
,
$offset
,
${debugFormatDouble(blurRadius)}
,
${debugFormatDouble(spreadRadius)}
)
,
$blurStyle
'
;
}
packages/flutter/test/painting/box_painter_test.dart
View file @
6dc18ef7
This diff is collapsed.
Click to expand it.
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