Skip to content

Instantly share code, notes, and snippets.

@felixblaschke
Last active April 22, 2019 10:02
Show Gist options
  • Save felixblaschke/13eae534c721c2635e1f455903db2726 to your computer and use it in GitHub Desktop.
Save felixblaschke/13eae534c721c2635e1f455903db2726 to your computer and use it in GitHub Desktop.
load-stuff-1.dart
class LoadStuffButton extends StatefulWidget {
@override
_LoadStuffButtonState createState() => _LoadStuffButtonState();
}
class _LoadStuffButtonState extends State<LoadStuffButton> {
bool _startedLoading = false;
bool _firstAnimationFinished = false;
bool _dataAvailable = false;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: _clickLoadStuff,
child: Container(), // TODO implement
);
}
// TODO use somewhere
void _listenToAnimationFinished(status) {
if (status == AnimationStatus.completed) {
setState(() {
_firstAnimationFinished = true;
});
}
}
void _clickLoadStuff() {
setState(() {
_startedLoading = true;
});
Future.delayed(Duration(milliseconds: 2000)).then((_) {
setState(() {
_dataAvailable = true;
});
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment