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
aa87ab6f
Commit
aa87ab6f
authored
Jan 14, 2016
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1238 from Hixie/material-tweaks
Tweaks near Material, BoxDecoration, implicit animations.
parents
4507a7fa
a54ee77b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
26 deletions
+60
-26
material.dart
packages/flutter/lib/src/material/material.dart
+9
-0
box_painter.dart
packages/flutter/lib/src/painting/box_painter.dart
+26
-26
implicit_animations.dart
packages/flutter/lib/src/widgets/implicit_animations.dart
+25
-0
No files found.
packages/flutter/lib/src/material/material.dart
View file @
aa87ab6f
...
...
@@ -84,6 +84,7 @@ class Material extends StatefulComponent {
this
.
color
,
this
.
textStyle
})
:
super
(
key:
key
)
{
assert
(
type
!=
null
);
assert
(
elevation
!=
null
);
}
...
...
@@ -100,6 +101,14 @@ class Material extends StatefulComponent {
}
_MaterialState
createState
()
=>
new
_MaterialState
();
void
debugFillDescription
(
List
<
String
>
description
)
{
super
.
debugFillDescription
(
description
);
description
.
add
(
'
$type
'
);
description
.
add
(
'elevation:
$elevation
'
);
if
(
color
!=
null
)
description
.
add
(
'color:
$color
'
);
}
}
class
_MaterialState
extends
State
<
Material
>
{
...
...
packages/flutter/lib/src/painting/box_painter.dart
View file @
aa87ab6f
...
...
@@ -726,32 +726,6 @@ class BoxDecoration extends Decoration {
);
}
double
getEffectiveBorderRadius
(
Rect
rect
)
{
double
shortestSide
=
rect
.
shortestSide
;
// In principle, we should use shortestSide / 2.0, but we don't want to
// run into floating point rounding errors. Instead, we just use
// shortestSide and let ui.Canvas do any remaining clamping.
return
borderRadius
>
shortestSide
?
shortestSide
:
borderRadius
;
}
bool
hitTest
(
Size
size
,
Point
position
)
{
assert
(
shape
!=
null
);
assert
((
Point
.
origin
&
size
).
contains
(
position
));
switch
(
shape
)
{
case
BoxShape
.
rectangle
:
if
(
borderRadius
!=
null
)
{
ui
.
RRect
bounds
=
new
ui
.
RRect
.
fromRectXY
(
Point
.
origin
&
size
,
borderRadius
,
borderRadius
);
return
bounds
.
contains
(
position
);
}
return
true
;
case
BoxShape
.
circle
:
// Circles are inscribed into our smallest dimension.
Point
center
=
size
.
center
(
Point
.
origin
);
double
distance
=
(
position
-
center
).
distance
;
return
distance
<=
math
.
min
(
size
.
width
,
size
.
height
)
/
2.0
;
}
}
/// Linearly interpolate between two box decorations.
///
/// Interpolates each parameter of the box decoration separately.
...
...
@@ -843,6 +817,32 @@ class BoxDecoration extends Decoration {
backgroundImage
?.
_removeChangeListener
(
listener
);
}
double
getEffectiveBorderRadius
(
Rect
rect
)
{
double
shortestSide
=
rect
.
shortestSide
;
// In principle, we should use shortestSide / 2.0, but we don't want to
// run into floating point rounding errors. Instead, we just use
// shortestSide and let ui.Canvas do any remaining clamping.
return
borderRadius
>
shortestSide
?
shortestSide
:
borderRadius
;
}
bool
hitTest
(
Size
size
,
Point
position
)
{
assert
(
shape
!=
null
);
assert
((
Point
.
origin
&
size
).
contains
(
position
));
switch
(
shape
)
{
case
BoxShape
.
rectangle
:
if
(
borderRadius
!=
null
)
{
ui
.
RRect
bounds
=
new
ui
.
RRect
.
fromRectXY
(
Point
.
origin
&
size
,
borderRadius
,
borderRadius
);
return
bounds
.
contains
(
position
);
}
return
true
;
case
BoxShape
.
circle
:
// Circles are inscribed into our smallest dimension.
Point
center
=
size
.
center
(
Point
.
origin
);
double
distance
=
(
position
-
center
).
distance
;
return
distance
<=
math
.
min
(
size
.
width
,
size
.
height
)
/
2.0
;
}
}
_BoxDecorationPainter
createBoxPainter
()
=>
new
_BoxDecorationPainter
(
this
);
}
...
...
packages/flutter/lib/src/widgets/implicit_animations.dart
View file @
aa87ab6f
...
...
@@ -75,6 +75,11 @@ abstract class AnimatedWidgetBase extends StatefulComponent {
final
Duration
duration
;
AnimatedWidgetBaseState
createState
();
void
debugFillDescription
(
List
<
String
>
description
)
{
super
.
debugFillDescription
(
description
);
description
.
add
(
'duration:
${duration.inMilliseconds}
ms'
);
}
}
typedef
AnimatedValue
<
T
>
VariableConstructor
<
T
>(
T
targetValue
);
...
...
@@ -232,6 +237,26 @@ class AnimatedContainer extends AnimatedWidgetBase {
final
double
height
;
_AnimatedContainerState
createState
()
=>
new
_AnimatedContainerState
();
void
debugFillDescription
(
List
<
String
>
description
)
{
super
.
debugFillDescription
(
description
);
if
(
constraints
!=
null
)
description
.
add
(
'
$constraints
'
);
if
(
decoration
!=
null
)
description
.
add
(
'has background'
);
if
(
foregroundDecoration
!=
null
)
description
.
add
(
'has foreground'
);
if
(
margin
!=
null
)
description
.
add
(
'margin:
$margin
'
);
if
(
padding
!=
null
)
description
.
add
(
'padding:
$padding
'
);
if
(
transform
!=
null
)
description
.
add
(
'has transform'
);
if
(
width
!=
null
)
description
.
add
(
'width:
$width
'
);
if
(
height
!=
null
)
description
.
add
(
'height:
$height
'
);
}
}
class
_AnimatedContainerState
extends
AnimatedWidgetBaseState
<
AnimatedContainer
>
{
...
...
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