|
|
|
@@ -23,7 +23,8 @@ class PlotBloc extends Bloc<PlotEvent, PlotState> { |
|
|
|
try { |
|
|
|
if (state is PlotInitial) { |
|
|
|
yield PlotLoading(); |
|
|
|
final response = await repository.getPlots(page: 0, size: pageSize); |
|
|
|
final response = await repository.getPlots( |
|
|
|
page: 0, size: pageSize, searchString: ""); |
|
|
|
yield PlotSuccess( |
|
|
|
items: response, |
|
|
|
page: 0, |
|
|
|
@@ -32,8 +33,8 @@ class PlotBloc extends Bloc<PlotEvent, PlotState> { |
|
|
|
if (state is PlotSuccess) { |
|
|
|
final currentState = state as PlotSuccess; |
|
|
|
int page = currentState.page + 1; |
|
|
|
final response = |
|
|
|
await repository.getPlots(page: page, size: pageSize); |
|
|
|
final response = await repository.getPlots( |
|
|
|
page: page, size: pageSize, searchString: ""); |
|
|
|
yield response.isEmpty |
|
|
|
? currentState.copyWith(hasReachedMax: true) |
|
|
|
: PlotSuccess( |
|
|
|
@@ -49,7 +50,8 @@ class PlotBloc extends Bloc<PlotEvent, PlotState> { |
|
|
|
if (event is OnRefresh) { |
|
|
|
try { |
|
|
|
yield PlotLoading(); |
|
|
|
final response = await repository.getPlots(page: 0, size: pageSize); |
|
|
|
final response = await repository.getPlots( |
|
|
|
page: 0, size: pageSize, searchString: ""); |
|
|
|
yield PlotSuccess( |
|
|
|
items: response, |
|
|
|
page: 0, |