Skip to content

Instantly share code, notes, and snippets.

@shyjuzz
Created November 30, 2018 10:32
Show Gist options
  • Save shyjuzz/3696709bdc0fe2018f8994d58c03542b to your computer and use it in GitHub Desktop.
Save shyjuzz/3696709bdc0fe2018f8994d58c03542b to your computer and use it in GitHub Desktop.
class GradientText extends StatelessWidget {
final Shader linearGradient = LinearGradient(
colors: <Color>[Color(0xffDA44bb), Color(0xff8921aa)],
).createShader(Rect.fromLTWH(0.0, 0.0, 200.0, 70.0));
@override
Widget build(BuildContext context) {
return Center(child: Text(
'Hello World',
style: new TextStyle(
fontSize: 50.0,
fontWeight: FontWeight.bold,
foreground: Paint()..shader = linearGradient),
),);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment