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
d3022132
Commit
d3022132
authored
Apr 04, 2017
by
Jason Simmons
Committed by
GitHub
Apr 04, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gate the PhysicalModel shadows behind a flag (#9198)
Fixes
https://github.com/flutter/flutter/issues/9186
parent
3000c8bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
18 deletions
+37
-18
material.dart
packages/flutter/lib/src/material/material.dart
+35
-18
ink_paint_test.dart
packages/flutter/test/material/ink_paint_test.dart
+2
-0
No files found.
packages/flutter/lib/src/material/material.dart
View file @
d3022132
...
...
@@ -7,6 +7,7 @@ import 'package:flutter/rendering.dart';
import
'package:flutter/widgets.dart'
;
import
'constants.dart'
;
import
'shadows.dart'
;
import
'theme.dart'
;
/// Signature for the callback used by ink effects to obtain the rectangle for the effect.
...
...
@@ -187,6 +188,9 @@ class Material extends StatefulWidget {
/// The default radius of an ink splash in logical pixels.
static
const
double
defaultSplashRadius
=
35.0
;
// Temporary flag used to enable the PhysicalModel shadow implementation.
static
bool
debugEnablePhysicalModel
=
false
;
}
class
_MaterialState
extends
State
<
Material
>
with
TickerProviderStateMixin
{
...
...
@@ -232,30 +236,41 @@ class _MaterialState extends State<Material> with TickerProviderStateMixin {
)
);
if
(
config
.
type
==
MaterialType
.
circle
)
{
contents
=
new
PhysicalModel
(
shape:
BoxShape
.
circle
,
elevation:
config
.
elevation
,
color:
backgroundColor
,
child:
contents
,
);
}
else
if
(
config
.
type
==
MaterialType
.
transparency
)
{
if
(
radius
==
null
)
{
contents
=
new
ClipRect
(
child:
contents
);
if
(
Material
.
debugEnablePhysicalModel
)
{
if
(
config
.
type
==
MaterialType
.
circle
)
{
contents
=
new
PhysicalModel
(
shape:
BoxShape
.
circle
,
elevation:
config
.
elevation
,
color:
backgroundColor
,
child:
contents
,
);
}
else
if
(
config
.
type
==
MaterialType
.
transparency
)
{
if
(
radius
==
null
)
{
contents
=
new
ClipRect
(
child:
contents
);
}
else
{
contents
=
new
ClipRRect
(
borderRadius:
radius
,
child:
contents
);
}
}
else
{
contents
=
new
PhysicalModel
(
shape:
BoxShape
.
rectangle
,
borderRadius:
radius
??
BorderRadius
.
zero
,
elevation:
config
.
elevation
,
color:
backgroundColor
,
child:
contents
,
);
}
}
else
{
if
(
config
.
type
==
MaterialType
.
circle
)
{
contents
=
new
ClipOval
(
child:
contents
);
}
else
if
(
kMaterialEdges
[
config
.
type
]
!=
null
)
{
contents
=
new
ClipRRect
(
borderRadius:
radius
,
child:
contents
);
}
}
else
{
contents
=
new
PhysicalModel
(
shape:
BoxShape
.
rectangle
,
borderRadius:
radius
??
BorderRadius
.
zero
,
elevation:
config
.
elevation
,
color:
backgroundColor
,
child:
contents
,
);
}
if
(
config
.
type
!=
MaterialType
.
transparency
)
{
...
...
@@ -264,6 +279,8 @@ class _MaterialState extends State<Material> with TickerProviderStateMixin {
duration:
kThemeChangeDuration
,
decoration:
new
BoxDecoration
(
borderRadius:
radius
,
boxShadow:
config
.
elevation
==
0
||
Material
.
debugEnablePhysicalModel
?
null
:
kElevationToShadow
[
config
.
elevation
],
shape:
config
.
type
==
MaterialType
.
circle
?
BoxShape
.
circle
:
BoxShape
.
rectangle
),
child:
new
Container
(
...
...
packages/flutter/test/material/ink_paint_test.dart
View file @
d3022132
...
...
@@ -9,6 +9,8 @@ import 'package:flutter_test/flutter_test.dart';
import
'../rendering/mock_canvas.dart'
;
void
main
(
)
{
Material
.
debugEnablePhysicalModel
=
true
;
testWidgets
(
'Does the ink widget render a border radius'
,
(
WidgetTester
tester
)
async
{
final
Color
highlightColor
=
new
Color
(
0xAAFF0000
);
final
Color
splashColor
=
new
Color
(
0xAA0000FF
);
...
...
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