PageBloc constructor
Implementation
PageBloc(this.max, this.min) : super(PageInitial()) {
on<Next>((event, emit) {
index++;
if (index < max) {
emit(Moving(index));
} else {
index = max;
emit(NoChange());
}
});
on<Previous>((event, emit) {
index--;
if (index > min) {
emit(Moving(index));
} else {
index = min;
emit(NoChange());
}
});
on<Move>((event, emit) {
index = event.index;
emit(Moving(index));
});
}