Created
September 22, 2021 12:23
-
-
Save defensive-wizard/7cf66ea0f78f74a32066a16e953c7c72 to your computer and use it in GitHub Desktop.
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
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