Created
October 5, 2018 13:41
-
-
Save mrmitew/124e09636137d9b4d840b09a0d1ebf68 to your computer and use it in GitHub Desktop.
Override accent color of a given child by wrapping it into a AccentColorOverride widget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AccentColorOverride extends StatelessWidget { | |
const AccentColorOverride({Key key, this.color, this.child}) | |
: super(key: key); | |
final Color color; | |
final Widget child; | |
@override | |
Widget build(BuildContext context) { | |
return Theme( | |
child: child, | |
data: Theme.of(context).copyWith(accentColor: color), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment