Last active
December 14, 2018 09:36
-
-
Save yumi0629/07b1bb00bd154e3809990f9a5804f6af to your computer and use it in GitHub Desktop.
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
final Shader linearGradient = LinearGradient( | |
colors: <Color>[Colors.pink, Colors.green], | |
).createShader(Rect.fromLTWH(0.0, 0.0, 200.0, 70.0)); | |
Text('Hello Gradients!', | |
style: new TextStyle( | |
fontSize: 60.0, | |
fontWeight: FontWeight.bold, | |
foreground: Paint()..shader = linearGradient), | |
) | |
Shader getTextGradient(RenderBox renderBox) { | |
if (renderBox == null) return null; | |
return LinearGradient( | |
colors: <Color>[Colors.deepOrange, Colors.lightGreenAccent], | |
).createShader(Rect.fromLTWH( | |
renderBox.localToGlobal(Offset.zero).dx, | |
renderBox.localToGlobal(Offset.zero).dy, | |
renderBox.size.width, | |
renderBox.size.height)); | |
} |
Author
yumi0629
commented
Dec 14, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment