Commit c52b4d25 authored by Leon Tappe's avatar Leon Tappe 🔥
Browse files

add external limit setting to user journal

parent 179c34d4
...@@ -75,7 +75,7 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> { ...@@ -75,7 +75,7 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> {
on<GetJournal>((GetJournal event, Emitter<UsersState> emit) async { on<GetJournal>((GetJournal event, Emitter<UsersState> emit) async {
try { try {
await _getJournal(event.userId); await _getJournal(event.userId, limit: event.limit);
emit(UsersState.result(_users)); emit(UsersState.result(_users));
} on NetworkException catch (e) { } on NetworkException catch (e) {
emit(UsersState.exception(e)); emit(UsersState.exception(e));
...@@ -151,7 +151,7 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> { ...@@ -151,7 +151,7 @@ class UsersBloc extends Bloc<UsersEvent, UsersState> {
void onGetCredit(int userId) => add(GetCredit(userId)); void onGetCredit(int userId) => add(GetCredit(userId));
void onGetJournal(int userId) => add(GetJournal(userId)); void onGetJournal(int userId, {int limit = 1000}) => add(GetJournal(userId, limit));
void onRefresh() => add(RefreshUsers()); void onRefresh() => add(RefreshUsers());
......
...@@ -56,10 +56,11 @@ class GetCredit extends UsersEvent { ...@@ -56,10 +56,11 @@ class GetCredit extends UsersEvent {
class GetJournal extends UsersEvent { class GetJournal extends UsersEvent {
final int userId; final int userId;
final int limit;
GetJournal(this.userId); GetJournal(this.userId, this.limit);
Map<String, dynamic> get toMap => {'userId': userId}; Map<String, dynamic> get toMap => {'userId': userId, 'limit': limit};
@override @override
String toString() => '[GetJournal $toMap]'; String toString() => '[GetJournal $toMap]';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment