Skip to content

Commit baaa2e6

Browse files
lukefabarth
authored andcommitted
adds highlightColor and splashColor to InkResponse and InkWell (flutter#8551)
1 parent 0403ed4 commit baaa2e6

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

packages/flutter/lib/src/material/ink_well.dart

+18-4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ class InkResponse extends StatefulWidget {
4141
this.containedInkWell: false,
4242
this.highlightShape: BoxShape.circle,
4343
this.radius,
44+
this.highlightColor,
45+
this.splashColor,
4446
}) : super(key: key);
4547

4648
/// The widget below this widget in the tree.
@@ -71,6 +73,14 @@ class InkResponse extends StatefulWidget {
7173
/// The radius of the ink splash.
7274
final double radius;
7375

76+
/// The highlight color of the ink response. If this property is null then the
77+
/// highlight color of the theme will be used.
78+
final Color highlightColor;
79+
80+
/// The splash color of the ink response. If this property is null then the
81+
/// splash color of the theme will be used.
82+
final Color splashColor;
83+
7484
/// The rectangle to use for the highlight effect and for clipping
7585
/// the splash effects if [containedInkWell] is true.
7686
///
@@ -116,7 +126,7 @@ class _InkResponseState<T extends InkResponse> extends State<T> {
116126
_lastHighlight = new InkHighlight(
117127
controller: Material.of(context),
118128
referenceBox: referenceBox,
119-
color: Theme.of(context).highlightColor,
129+
color: config.highlightColor ?? Theme.of(context).highlightColor,
120130
shape: config.highlightShape,
121131
rectCallback: config.getRectCallback(referenceBox),
122132
onRemoved: () {
@@ -143,7 +153,7 @@ class _InkResponseState<T extends InkResponse> extends State<T> {
143153
controller: Material.of(context),
144154
referenceBox: referenceBox,
145155
position: referenceBox.globalToLocal(details.globalPosition),
146-
color: Theme.of(context).splashColor,
156+
color: config.splashColor ?? Theme.of(context).splashColor,
147157
containedInkWell: config.containedInkWell,
148158
rectCallback: config.containedInkWell ? rectCallback : null,
149159
radius: config.radius,
@@ -241,7 +251,9 @@ class InkWell extends InkResponse {
241251
GestureTapCallback onTap,
242252
GestureTapCallback onDoubleTap,
243253
GestureLongPressCallback onLongPress,
244-
ValueChanged<bool> onHighlightChanged
254+
ValueChanged<bool> onHighlightChanged,
255+
Color highlightColor,
256+
Color splashColor,
245257
}) : super(
246258
key: key,
247259
child: child,
@@ -250,6 +262,8 @@ class InkWell extends InkResponse {
250262
onLongPress: onLongPress,
251263
onHighlightChanged: onHighlightChanged,
252264
containedInkWell: true,
253-
highlightShape: BoxShape.rectangle
265+
highlightShape: BoxShape.rectangle,
266+
highlightColor: highlightColor,
267+
splashColor: splashColor,
254268
);
255269
}

0 commit comments

Comments
 (0)