-
-
Save kharitonovAL/154fba650a0eb3057f2471dfdf7ca52f to your computer and use it in GitHub Desktop.
This file contains 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
BlocBuilder<HouseMessagesCubit, HouseMessagesState>( | |
builder: (context, state) { | |
if (state is HouseMessagesLoading) { | |
return const Center( | |
child: CircularProgressIndicator(), | |
); | |
} else if (state is HouseMessagesLoaded) { | |
if (state.list.isEmpty) { | |
return const Center( | |
child: Text( | |
AppString.houseNoMessages, | |
), | |
); | |
} else { | |
return Scrollbar( | |
controller: _messagesScrollController, | |
child: ListView.builder( | |
controller: _messagesScrollController, | |
itemCount: state.list.length, | |
shrinkWrap: true, | |
itemBuilder: (context, index) => | |
HouseMessageListItem( | |
message: state.list[index], | |
), | |
), | |
); | |
} | |
} else if (state is HouseMessagesLoadFailed) { | |
return Center( | |
child: Text( | |
state.error.toString(), | |
), | |
); | |
} | |
return const Center( | |
child: CircularProgressIndicator(), | |
); | |
}, | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment