Skip to content

Instantly share code, notes, and snippets.

@sansal54
Forked from tusharhow/gradient.dart
Created March 6, 2024 11:39
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 sansal54/7ce3bbcfec440251a67453e27734d3ed to your computer and use it in GitHub Desktop.
Save sansal54/7ce3bbcfec440251a67453e27734d3ed to your computer and use it in GitHub Desktop.
Did you know that in Flutter, bringing gradient colors to your text is a breeze? πŸš€πŸ’» Just sprinkle a bit of code magic:
Text(
"Gradient Text Example",
style: TextStyle(
fontSize: 50.0,
fontWeight: FontWeight.bold,
foreground: Paint()
..shader = const LinearGradient(
colors: <Color>[
Colors.red,
Colors.blue,
],
).createShader(
const Rect.fromLTWH(0.0, 0.0, 200.0, 70.0),
),
),
textAlign: TextAlign.center,
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment