Created
February 24, 2020 03:22
-
-
Save arpit/434222d57365b62ad25243502cc4d862 to your computer and use it in GitHub Desktop.
Creates a linear gradient in Flutter
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
static LinearGradient getGradient(Color color, double ratio, double sign) { | |
return LinearGradient( | |
colors: [ | |
color.withOpacity(ratio * 1.0), | |
color.withOpacity(ratio * 0.30), | |
color.withOpacity(ratio * 0.10), | |
], | |
stops: [ | |
0.012, | |
0.012, | |
1.0, | |
], | |
begin: Alignment(sign, 0.0), | |
end: Alignment(-sign * ratio, 0.0), | |
); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment