Created
June 15, 2020 12:18
-
-
Save guilhermecarvalhocarneiro/b5bd21ee6dc3167cc8100b3fe7653881 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
_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