Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save guilhermecarvalhocarneiro/b5bd21ee6dc3167cc8100b3fe7653881 to your computer and use it in GitHub Desktop.
Save guilhermecarvalhocarneiro/b5bd21ee6dc3167cc8100b3fe7653881 to your computer and use it in GitHub Desktop.
_buildFriendsList() {
return Observer(
builder: (_) {
if (_grupoController.processingFriends == true) {
return Center(
child: Container(
child: CircularProgressIndicator(),
));
} else if (_grupoController.errorMessage.isNotEmpty) {
return Center(
child: Text(_grupoController.errorMessage),
);
} else {
return Container(
child: RefreshIndicator(
onRefresh: _reloadData,
child: ListView.builder(
shrinkWrap: true,
controller: _scrollControllerFriends,
itemCount: _grupoController.friends.length,
itemBuilder: (BuildContext context, int index) {
List<UsuarioModel> itens = _grupoController.friends;
UsuarioModel _friend = itens[index];
return Padding(
padding: const EdgeInsets.all(8.0),
child: InkWell(
onTap: () {},
child: _buildCardUserItem(_friend),
),
);
}),
),
);
}
},
);
}
Future<void> _reloadData() async {
await Future.delayed(Duration(seconds: 2), () {
// Carregando os dados do amigos
_grupoController.fetchFriends(
_grupoController.model.id, _usuarioController.model.token);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment