Skip to content

Instantly share code, notes, and snippets.

@arpit
Created February 24, 2020 03:22
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 arpit/434222d57365b62ad25243502cc4d862 to your computer and use it in GitHub Desktop.
Save arpit/434222d57365b62ad25243502cc4d862 to your computer and use it in GitHub Desktop.
Creates a linear gradient in Flutter
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