Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save guilhermecarvalhocarneiro/e4f8850a1aa84f7eefe74c115412a93c to your computer and use it in GitHub Desktop.
Save guilhermecarvalhocarneiro/e4f8850a1aa84f7eefe74c115412a93c to your computer and use it in GitHub Desktop.
return Observer(
builder: (context) {
if (_feedController.processing == true) {
return customCupertinoActivity(context);
} else if (_feedController.errorMessage.isNotEmpty) {
return Center(
child: Text(_feedController.errorMessage),
);
} else {
if (_feedController.list != null) {
if (_feedController.list.length == 0) {
return EmptyData(
context: context,
titleMessage: "",
bodyMessage: AppLocalizations.of(context).translate("label_feed_em_branco"),
);
} else {
// Testando para saber se a listview deve ser movida para o início.
if (_feedController.scrollListViewToTop != null &&
_feedController.scrollListViewToTop == true &&
scrollController.hasClients) {
_moveScrollListViewPositionTop();
}
return Stack(
children: [
Container(
color: Color(vestterCustomGray),
child: RefreshIndicator(
onRefresh: _reloadData,
child: ListView.builder(
// addAutomaticKeepAlives: true,
controller: scrollController,
itemCount: _feedController.list.length,
itemBuilder: (BuildContext context, int index) {
List<PostModel> items = _feedController.list;
return FeedCardView(
context,
post: items[index],
user: _user,
offsetListViewPosition: offsetPositionListView,
);
},
),
),
),
Visibility(
visible: _loading,
child: customCupertinoActivity(context),
),
],
);
}
} else {
return customCupertinoActivity(context);
}
}
},
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment