Commit 4399fea1 authored by Adam Barth's avatar Adam Barth

Icons in material buttons should match text color (#3551)

Fixes #3186
parent c6942c99
...@@ -7,6 +7,8 @@ import 'package:flutter/widgets.dart'; ...@@ -7,6 +7,8 @@ import 'package:flutter/widgets.dart';
import 'colors.dart'; import 'colors.dart';
import 'constants.dart'; import 'constants.dart';
import 'debug.dart'; import 'debug.dart';
import 'icon_theme_data.dart';
import 'icon_theme.dart';
import 'ink_well.dart'; import 'ink_well.dart';
import 'material.dart'; import 'material.dart';
import 'theme.dart'; import 'theme.dart';
...@@ -168,24 +170,30 @@ abstract class MaterialButtonState<T extends MaterialButton> extends State<T> { ...@@ -168,24 +170,30 @@ abstract class MaterialButtonState<T extends MaterialButton> extends State<T> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
assert(debugCheckHasMaterial(context)); assert(debugCheckHasMaterial(context));
Widget contents = new InkWell( final Color textColor = _getTextColor(context);
onTap: config.onPressed, Widget contents = new IconTheme(
onHighlightChanged: _handleHighlightChanged, data: new IconThemeData(
child: new Container( color: textColor
padding: new EdgeInsets.symmetric(horizontal: 8.0), ),
child: new Center( child: new InkWell(
widthFactor: 1.0, onTap: config.onPressed,
child: config.child onHighlightChanged: _handleHighlightChanged,
child: new Container(
padding: new EdgeInsets.symmetric(horizontal: 8.0),
child: new Center(
widthFactor: 1.0,
child: config.child
)
) )
) )
); );
TextStyle style = Theme.of(context).textTheme.button.copyWith(color: _getTextColor(context)); final TextStyle style = Theme.of(context).textTheme.button.copyWith(color: textColor);
int elevation = this.elevation; final int elevation = this.elevation;
Color color = getColor(context); final Color color = getColor(context);
if (elevation > 0 || color != null) { if (elevation > 0 || color != null) {
contents = new Material( contents = new Material(
type: MaterialType.button, type: MaterialType.button,
color: getColor(context), color: color,
elevation: elevation, elevation: elevation,
textStyle: style, textStyle: style,
child: contents child: contents
......
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