Skip to content

Instantly share code, notes, and snippets.

@defensive-wizard
Created September 22, 2021 12:23
Show Gist options
  • Save defensive-wizard/7cf66ea0f78f74a32066a16e953c7c72 to your computer and use it in GitHub Desktop.
Save defensive-wizard/7cf66ea0f78f74a32066a16e953c7c72 to your computer and use it in GitHub Desktop.
final repo= FetchColorsFromImage();
// i have used networkImage you can use any ImageProvider class for it
var image=NetworkImage(<imageurl>);
Color backgroundColor =Colors.black;
void initState(){
getColors();
super.initState();
}
getColors() async {
setState((){
backgroundColor=await repo.getColor(image);
});
}
.....
return Scaffold(
backgroundColor:backgroundColor,
....
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment