feat: Added load data to controllers
This commit is contained in:
@@ -168,6 +168,17 @@ class _ChannelListViewCoreState extends State<ChannelListViewCore>
|
||||
return widget.errorBuilder(snapshot.error);
|
||||
}
|
||||
|
||||
void loadData() {
|
||||
final channelsBloc = ChannelsBloc.of(context);
|
||||
|
||||
channelsBloc.queryChannels(
|
||||
filter: widget.filter,
|
||||
sortOptions: widget.sort,
|
||||
paginationParams: widget.pagination,
|
||||
options: widget.options,
|
||||
);
|
||||
}
|
||||
|
||||
void paginateData() {
|
||||
final channelsBloc = ChannelsBloc.of(context);
|
||||
|
||||
@@ -216,6 +227,7 @@ class _ChannelListViewCoreState extends State<ChannelListViewCore>
|
||||
});
|
||||
|
||||
if (widget.channelListController != null) {
|
||||
widget.channelListController.loadData = loadData;
|
||||
widget.channelListController.paginateData = paginateData;
|
||||
}
|
||||
}
|
||||
@@ -249,5 +261,6 @@ class _ChannelListViewCoreState extends State<ChannelListViewCore>
|
||||
|
||||
/// Controller used for paginating data in [ChannelListViewCore]
|
||||
class ChannelListController {
|
||||
VoidCallback loadData;
|
||||
VoidCallback paginateData;
|
||||
}
|
||||
|
||||
@@ -115,6 +115,7 @@ class _MessageSearchListViewCoreState extends State<MessageSearchListViewCore> {
|
||||
);
|
||||
|
||||
if (widget.messageSearchListController != null) {
|
||||
widget.messageSearchListController.loadData = loadData;
|
||||
widget.messageSearchListController.paginateData = paginateData;
|
||||
}
|
||||
}
|
||||
@@ -152,6 +153,18 @@ class _MessageSearchListViewCoreState extends State<MessageSearchListViewCore> {
|
||||
);
|
||||
}
|
||||
|
||||
void loadData() {
|
||||
final messageSearchBloc = MessageSearchBloc.of(context);
|
||||
|
||||
messageSearchBloc.search(
|
||||
filter: widget.filters,
|
||||
sort: widget.sortOptions,
|
||||
query: widget.messageQuery,
|
||||
pagination: widget.paginationParams,
|
||||
messageFilter: widget.messageFilters,
|
||||
);
|
||||
}
|
||||
|
||||
void paginateData() {
|
||||
final messageSearchBloc = MessageSearchBloc.of(context);
|
||||
|
||||
@@ -190,5 +203,6 @@ class _MessageSearchListViewCoreState extends State<MessageSearchListViewCore> {
|
||||
|
||||
/// Controller used for paginating data in [ChannelListView]
|
||||
class MessageSearchListController {
|
||||
VoidCallback loadData;
|
||||
VoidCallback paginateData;
|
||||
}
|
||||
|
||||
@@ -115,6 +115,7 @@ class _UserListViewCoreState extends State<UserListViewCore>
|
||||
);
|
||||
|
||||
if (widget.userListController != null) {
|
||||
widget.userListController.loadData = loadData;
|
||||
widget.userListController.paginateData = paginateData;
|
||||
}
|
||||
}
|
||||
@@ -203,6 +204,17 @@ class _UserListViewCoreState extends State<UserListViewCore>
|
||||
);
|
||||
}
|
||||
|
||||
void loadData() {
|
||||
final usersBloc = UsersBloc.of(context);
|
||||
|
||||
usersBloc.queryUsers(
|
||||
filter: widget.filter,
|
||||
sort: widget.sort,
|
||||
pagination: widget.pagination,
|
||||
options: widget.options,
|
||||
);
|
||||
}
|
||||
|
||||
void paginateData() {
|
||||
final usersBloc = UsersBloc.of(context);
|
||||
|
||||
@@ -276,5 +288,6 @@ class ListUserItem extends ListItem {
|
||||
|
||||
/// Controller used for paginating data in [ChannelListView]
|
||||
class UserListController {
|
||||
VoidCallback loadData;
|
||||
VoidCallback paginateData;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user