Skip to content

Instantly share code, notes, and snippets.

@theacodes
Created November 27, 2019 19:24
Show Gist options
  • Save theacodes/98255cd57845731449582e12b132ed6d to your computer and use it in GitHub Desktop.
Save theacodes/98255cd57845731449582e12b132ed6d to your computer and use it in GitHub Desktop.
AnimatedContainer with FutureBuilder
FutureBuilder(
future: future,
builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
double width;
switch(snapshot.connectionState) {
case ConnectionState.none:
case ConnectionState.waiting:
case ConnectionState.active:
width = 0;
break;
case ConnectionState.done:
width = 500;
break;
}
return AnimatedContainer(
width: width,
child: Image.asset('assets/star.png'),
duration: Duration(seconds: 1),
);
}
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment