Skip to content

Commit 6b8d9bd

Browse files
authored
Merge pull request #28 from hillelcoren/master
Support setting IconSlideAction foregroundColor
2 parents 89c56f6 + 9fda4d5 commit 6b8d9bd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/src/widgets/slide_action.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ class IconSlideAction extends ClosableSlideAction {
104104
@required this.icon,
105105
this.caption,
106106
Color color,
107+
this.foregroundColor,
107108
VoidCallback onTap,
108109
bool closeOnTap = _kCloseOnTap,
109110
}) : color = color ?? Colors.white,
@@ -122,9 +123,11 @@ class IconSlideAction extends ClosableSlideAction {
122123
/// Defaults to true.
123124
final Color color;
124125

126+
final Color foregroundColor;
127+
125128
@override
126129
Widget buildAction(BuildContext context) {
127-
final Color foregroundColor =
130+
final Color estimatedColor =
128131
ThemeData.estimateBrightnessForColor(color) == Brightness.light
129132
? Colors.black
130133
: Colors.white;
@@ -134,7 +137,7 @@ class IconSlideAction extends ClosableSlideAction {
134137
style: Theme.of(context)
135138
.primaryTextTheme
136139
.caption
137-
.copyWith(color: foregroundColor),
140+
.copyWith(color: foregroundColor ?? estimatedColor),
138141
);
139142
return Container(
140143
color: color,
@@ -145,7 +148,7 @@ class IconSlideAction extends ClosableSlideAction {
145148
new Flexible(
146149
child: new Icon(
147150
icon,
148-
color: foregroundColor,
151+
color: foregroundColor ?? estimatedColor,
149152
),
150153
),
151154
new Flexible(child: textWidget),

0 commit comments

Comments
 (0)