From baaa2e67f8b70ff72a6236dfb3c99a11e3e12ee5 Mon Sep 17 00:00:00 2001 From: Luke Date: Thu, 2 Mar 2017 23:28:55 -0800 Subject: [PATCH] adds highlightColor and splashColor to InkResponse and InkWell (#8551) --- .../flutter/lib/src/material/ink_well.dart | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/flutter/lib/src/material/ink_well.dart b/packages/flutter/lib/src/material/ink_well.dart index eda3d5b591..845f45929c 100644 --- a/packages/flutter/lib/src/material/ink_well.dart +++ b/packages/flutter/lib/src/material/ink_well.dart @@ -41,6 +41,8 @@ class InkResponse extends StatefulWidget { this.containedInkWell: false, this.highlightShape: BoxShape.circle, this.radius, + this.highlightColor, + this.splashColor, }) : super(key: key); /// The widget below this widget in the tree. @@ -71,6 +73,14 @@ class InkResponse extends StatefulWidget { /// The radius of the ink splash. 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 splash effects if [containedInkWell] is true. /// @@ -116,7 +126,7 @@ class _InkResponseState extends State { _lastHighlight = new InkHighlight( controller: Material.of(context), referenceBox: referenceBox, - color: Theme.of(context).highlightColor, + color: config.highlightColor ?? Theme.of(context).highlightColor, shape: config.highlightShape, rectCallback: config.getRectCallback(referenceBox), onRemoved: () { @@ -143,7 +153,7 @@ class _InkResponseState extends State { controller: Material.of(context), referenceBox: referenceBox, position: referenceBox.globalToLocal(details.globalPosition), - color: Theme.of(context).splashColor, + color: config.splashColor ?? Theme.of(context).splashColor, containedInkWell: config.containedInkWell, rectCallback: config.containedInkWell ? rectCallback : null, radius: config.radius, @@ -241,7 +251,9 @@ class InkWell extends InkResponse { GestureTapCallback onTap, GestureTapCallback onDoubleTap, GestureLongPressCallback onLongPress, - ValueChanged onHighlightChanged + ValueChanged onHighlightChanged, + Color highlightColor, + Color splashColor, }) : super( key: key, child: child, @@ -250,6 +262,8 @@ class InkWell extends InkResponse { onLongPress: onLongPress, onHighlightChanged: onHighlightChanged, containedInkWell: true, - highlightShape: BoxShape.rectangle + highlightShape: BoxShape.rectangle, + highlightColor: highlightColor, + splashColor: splashColor, ); }