Skip to content

Instantly share code, notes, and snippets.

@yaizudamashii
Created August 11, 2021 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yaizudamashii/8083467b4be0b5be17619902f8b44d82 to your computer and use it in GitHub Desktop.
Save yaizudamashii/8083467b4be0b5be17619902f8b44d82 to your computer and use it in GitHub Desktop.
roomsTileViewModelStream.when(
data: (List<RoomTileViewModel> items) {
return items.isEmpty ? Container() : ListView.builder(
itemCount: items.length,
itemBuilder: (context, index) {
RoomTileViewModel item = items[index];
return RoomTile(
model: item,
onPressed: () {
Navigator.pushNamed(
context,
AppRoutes.roomDetail,
arguments: { 'room': item.room },
);
},
);
},
);
},
loading: () {
return Center(child: CircularProgressIndicator());
},
error: (error, stackTrace) {
return const EmptyFeed(
title: 'Something went wrong',
message: 'Can\'t load items right now',
);
}
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment