Skip to content

Instantly share code, notes, and snippets.

@timsneath
Created April 5, 2018 00:55
Show Gist options
  • Save timsneath/f2ac261c33d2af24851dc59b71266da4 to your computer and use it in GitHub Desktop.
Save timsneath/f2ac261c33d2af24851dc59b71266da4 to your computer and use it in GitHub Desktop.
Adding support for dismissible jokes
_refreshAction() {
setState(() {
_response = http.read(dadJokeApi, headers: httpHeaders);
});
}
...
if (decoded['status'] == 200) {
_displayedJoke = decoded['joke'];
return new Padding(
padding: const EdgeInsets.all(16.0),
child: new Dismissible(
key: new Key("joke"),
direction: DismissDirection.horizontal,
onDismissed: (direction) {
_refreshAction();
},
child: new Text(_displayedJoke, style: jokeTextStyle),
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment