Skip to content

Instantly share code, notes, and snippets.

@mrmitew
Created October 5, 2018 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrmitew/124e09636137d9b4d840b09a0d1ebf68 to your computer and use it in GitHub Desktop.
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
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