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
9bc0e6a9
Unverified
Commit
9bc0e6a9
authored
Feb 10, 2020
by
Jonah Williams
Committed by
GitHub
Feb 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Reduced code duplication in ink_splash.dart, ink_ripple.dart (#49480)" (#50502)
This reverts commit
90206427
.
parent
c23d9cd4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
96 deletions
+46
-96
ink_ripple.dart
packages/flutter/lib/src/material/ink_ripple.dart
+23
-11
ink_splash.dart
packages/flutter/lib/src/material/ink_splash.dart
+23
-11
ink_well.dart
packages/flutter/lib/src/material/ink_well.dart
+0
-74
No files found.
packages/flutter/lib/src/material/ink_ripple.dart
View file @
9bc0e6a9
...
...
@@ -237,16 +237,28 @@ class InkRipple extends InteractiveInkFeature {
referenceBox
.
size
.
center
(
Offset
.
zero
),
Curves
.
ease
.
transform
(
_radiusController
.
value
),
);
paintInkCircle
(
canvas:
canvas
,
transform:
transform
,
paint:
paint
,
center:
center
,
textDirection:
_textDirection
,
radius:
_radius
.
value
,
customBorder:
_customBorder
,
borderRadius:
_borderRadius
,
clipCallback:
_clipCallback
,
);
final
Offset
originOffset
=
MatrixUtils
.
getAsTranslation
(
transform
);
canvas
.
save
();
if
(
originOffset
==
null
)
{
canvas
.
transform
(
transform
.
storage
);
}
else
{
canvas
.
translate
(
originOffset
.
dx
,
originOffset
.
dy
);
}
if
(
_clipCallback
!=
null
)
{
final
Rect
rect
=
_clipCallback
();
if
(
_customBorder
!=
null
)
{
canvas
.
clipPath
(
_customBorder
.
getOuterPath
(
rect
,
textDirection:
_textDirection
));
}
else
if
(
_borderRadius
!=
BorderRadius
.
zero
)
{
canvas
.
clipRRect
(
RRect
.
fromRectAndCorners
(
rect
,
topLeft:
_borderRadius
.
topLeft
,
topRight:
_borderRadius
.
topRight
,
bottomLeft:
_borderRadius
.
bottomLeft
,
bottomRight:
_borderRadius
.
bottomRight
,
));
}
else
{
canvas
.
clipRect
(
rect
);
}
}
canvas
.
drawCircle
(
center
,
_radius
.
value
,
paint
);
canvas
.
restore
();
}
}
packages/flutter/lib/src/material/ink_splash.dart
View file @
9bc0e6a9
...
...
@@ -202,16 +202,28 @@ class InkSplash extends InteractiveInkFeature {
Offset
center
=
_position
;
if
(
_repositionToReferenceBox
)
center
=
Offset
.
lerp
(
center
,
referenceBox
.
size
.
center
(
Offset
.
zero
),
_radiusController
.
value
);
paintInkCircle
(
canvas:
canvas
,
transform:
transform
,
paint:
paint
,
center:
center
,
textDirection:
_textDirection
,
radius:
_radius
.
value
,
customBorder:
_customBorder
,
borderRadius:
_borderRadius
,
clipCallback:
_clipCallback
,
);
final
Offset
originOffset
=
MatrixUtils
.
getAsTranslation
(
transform
);
canvas
.
save
();
if
(
originOffset
==
null
)
{
canvas
.
transform
(
transform
.
storage
);
}
else
{
canvas
.
translate
(
originOffset
.
dx
,
originOffset
.
dy
);
}
if
(
_clipCallback
!=
null
)
{
final
Rect
rect
=
_clipCallback
();
if
(
_customBorder
!=
null
)
{
canvas
.
clipPath
(
_customBorder
.
getOuterPath
(
rect
,
textDirection:
_textDirection
));
}
else
if
(
_borderRadius
!=
BorderRadius
.
zero
)
{
canvas
.
clipRRect
(
RRect
.
fromRectAndCorners
(
rect
,
topLeft:
_borderRadius
.
topLeft
,
topRight:
_borderRadius
.
topRight
,
bottomLeft:
_borderRadius
.
bottomLeft
,
bottomRight:
_borderRadius
.
bottomRight
,
));
}
else
{
canvas
.
clipRect
(
rect
);
}
}
canvas
.
drawCircle
(
center
,
_radius
.
value
,
paint
);
canvas
.
restore
();
}
}
packages/flutter/lib/src/material/ink_well.dart
View file @
9bc0e6a9
...
...
@@ -64,80 +64,6 @@ abstract class InteractiveInkFeature extends InkFeature {
_color
=
value
;
controller
.
markNeedsPaint
();
}
/// Draws an ink splash or ink ripple on the passed in [Canvas].
///
/// The [transform] argument is the [Matrix4] transform that typically
/// shifts the coordinate space of the canvas to the space in which
/// the ink circle is to be painted.
///
/// [center] is the [Offset] from origin of the canvas where the center
/// of the circle is drawn.
///
/// [paint] takes a [Paint] object that describes the styles used to draw the ink circle.
/// For example, [paint] can specify properties like color, strokewidth, colorFilter.
///
/// [radius] is the radius of ink circle to be drawn on canvas.
///
/// [clipCallback] is the callback used to obtain the [Rect] used for clipping the ink effect.
/// If [clipCallback] is null, no clipping is performed on the ink circle.
///
/// Clipping can happen in 3 different ways -
/// 1. If [customBorder] is provided, it is used to determine the path
/// for clipping.
/// 2. If [customBorder] is null, and [borderRadius] is provided, the canvas
/// is clipped by an [RRect] created from [clipCallback] and [borderRadius].
/// 3. If [borderRadius] is the default [BorderRadius.zero], then the [Rect] provided
/// by [clipCallback] is used for clipping.
///
/// [textDirection] is used by [customBorder] if it is non-null. This allows the [customBorder]'s path
/// to be properly defined if it was the path was expressed in terms of "start" and "end" instead of
/// "left" and "right".
///
/// For examples on how the function is used, see [InkSplash] and [InkRipple].
@protected
void
paintInkCircle
({
@required
Canvas
canvas
,
@required
Matrix4
transform
,
@required
Paint
paint
,
@required
Offset
center
,
@required
double
radius
,
TextDirection
textDirection
,
ShapeBorder
customBorder
,
BorderRadius
borderRadius
=
BorderRadius
.
zero
,
RectCallback
clipCallback
,
})
{
assert
(
canvas
!=
null
);
assert
(
transform
!=
null
);
assert
(
paint
!=
null
);
assert
(
center
!=
null
);
assert
(
radius
!=
null
);
assert
(
borderRadius
!=
null
);
final
Offset
originOffset
=
MatrixUtils
.
getAsTranslation
(
transform
);
canvas
.
save
();
if
(
originOffset
==
null
)
{
canvas
.
transform
(
transform
.
storage
);
}
else
{
canvas
.
translate
(
originOffset
.
dx
,
originOffset
.
dy
);
}
if
(
clipCallback
!=
null
)
{
final
Rect
rect
=
clipCallback
();
if
(
customBorder
!=
null
)
{
canvas
.
clipPath
(
customBorder
.
getOuterPath
(
rect
,
textDirection:
textDirection
));
}
else
if
(
borderRadius
!=
BorderRadius
.
zero
)
{
canvas
.
clipRRect
(
RRect
.
fromRectAndCorners
(
rect
,
topLeft:
borderRadius
.
topLeft
,
topRight:
borderRadius
.
topRight
,
bottomLeft:
borderRadius
.
bottomLeft
,
bottomRight:
borderRadius
.
bottomRight
,
));
}
else
{
canvas
.
clipRect
(
rect
);
}
}
canvas
.
drawCircle
(
center
,
radius
,
paint
);
canvas
.
restore
();
}
}
/// An encapsulation of an [InteractiveInkFeature] constructor used by
...
...
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