Commit baaa2e67 authored by Luke's avatar Luke Committed by Adam Barth

adds highlightColor and splashColor to InkResponse and InkWell (#8551)

parent 0403ed46
...@@ -41,6 +41,8 @@ class InkResponse extends StatefulWidget { ...@@ -41,6 +41,8 @@ class InkResponse extends StatefulWidget {
this.containedInkWell: false, this.containedInkWell: false,
this.highlightShape: BoxShape.circle, this.highlightShape: BoxShape.circle,
this.radius, this.radius,
this.highlightColor,
this.splashColor,
}) : super(key: key); }) : super(key: key);
/// The widget below this widget in the tree. /// The widget below this widget in the tree.
...@@ -71,6 +73,14 @@ class InkResponse extends StatefulWidget { ...@@ -71,6 +73,14 @@ class InkResponse extends StatefulWidget {
/// The radius of the ink splash. /// The radius of the ink splash.
final double radius; final double radius;
/// The highlight color of the ink response. If this property is null then the
/// highlight color of the theme will be used.
final Color highlightColor;
/// The splash color of the ink response. If this property is null then the
/// splash color of the theme will be used.
final Color splashColor;
/// The rectangle to use for the highlight effect and for clipping /// The rectangle to use for the highlight effect and for clipping
/// the splash effects if [containedInkWell] is true. /// the splash effects if [containedInkWell] is true.
/// ///
...@@ -116,7 +126,7 @@ class _InkResponseState<T extends InkResponse> extends State<T> { ...@@ -116,7 +126,7 @@ class _InkResponseState<T extends InkResponse> extends State<T> {
_lastHighlight = new InkHighlight( _lastHighlight = new InkHighlight(
controller: Material.of(context), controller: Material.of(context),
referenceBox: referenceBox, referenceBox: referenceBox,
color: Theme.of(context).highlightColor, color: config.highlightColor ?? Theme.of(context).highlightColor,
shape: config.highlightShape, shape: config.highlightShape,
rectCallback: config.getRectCallback(referenceBox), rectCallback: config.getRectCallback(referenceBox),
onRemoved: () { onRemoved: () {
...@@ -143,7 +153,7 @@ class _InkResponseState<T extends InkResponse> extends State<T> { ...@@ -143,7 +153,7 @@ class _InkResponseState<T extends InkResponse> extends State<T> {
controller: Material.of(context), controller: Material.of(context),
referenceBox: referenceBox, referenceBox: referenceBox,
position: referenceBox.globalToLocal(details.globalPosition), position: referenceBox.globalToLocal(details.globalPosition),
color: Theme.of(context).splashColor, color: config.splashColor ?? Theme.of(context).splashColor,
containedInkWell: config.containedInkWell, containedInkWell: config.containedInkWell,
rectCallback: config.containedInkWell ? rectCallback : null, rectCallback: config.containedInkWell ? rectCallback : null,
radius: config.radius, radius: config.radius,
...@@ -241,7 +251,9 @@ class InkWell extends InkResponse { ...@@ -241,7 +251,9 @@ class InkWell extends InkResponse {
GestureTapCallback onTap, GestureTapCallback onTap,
GestureTapCallback onDoubleTap, GestureTapCallback onDoubleTap,
GestureLongPressCallback onLongPress, GestureLongPressCallback onLongPress,
ValueChanged<bool> onHighlightChanged ValueChanged<bool> onHighlightChanged,
Color highlightColor,
Color splashColor,
}) : super( }) : super(
key: key, key: key,
child: child, child: child,
...@@ -250,6 +262,8 @@ class InkWell extends InkResponse { ...@@ -250,6 +262,8 @@ class InkWell extends InkResponse {
onLongPress: onLongPress, onLongPress: onLongPress,
onHighlightChanged: onHighlightChanged, onHighlightChanged: onHighlightChanged,
containedInkWell: true, containedInkWell: true,
highlightShape: BoxShape.rectangle highlightShape: BoxShape.rectangle,
highlightColor: highlightColor,
splashColor: splashColor,
); );
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment