Commit 4c3fd804 authored by Leon Tappe's avatar Leon Tappe 🔥
Browse files

improve journal bloc for external chunkSizes

parent 67b3d961
......@@ -37,7 +37,7 @@ class JournalBloc extends Bloc<JournalEvent, JournalState> {
on<RefreshJournal>((RefreshJournal event, Emitter<JournalState> emit) async {
try {
await _getJournal(limit: chunkSize, offset: chunkOffset);
await _getJournal(limit: event.chunkSize, offset: event.chunkOffset);
emit(JournalState.result(_journal));
} on NetworkException catch (e) {
emit(JournalState.exception(e));
......@@ -96,7 +96,8 @@ class JournalBloc extends Bloc<JournalEvent, JournalState> {
void onFuzzyFilterJournal(String filter) => add(FuzzyFilterJournal(filter));
void onRefresh() => add(RefreshJournal());
void onRefresh({int size, int offset}) =>
add(RefreshJournal(size ?? chunkSize, offset ?? chunkOffset));
void onStart(String token) => add(InitJournal(token));
......
......@@ -57,7 +57,17 @@ class InitJournal extends JournalEvent {
abstract class JournalEvent {}
class RefreshJournal extends JournalEvent {}
class RefreshJournal extends JournalEvent {
final int chunkSize;
final int chunkOffset;
RefreshJournal(this.chunkSize, this.chunkOffset);
Map<String, dynamic> get toMap => {'chunkSize': chunkSize, 'chunkOffset': chunkOffset};
@override
String toString() => '[RefreshJournal $toMap]';
}
class SortJournal extends JournalEvent {
final JournalSortParam param;
......
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