Fakultas Ilmu Komputer UI

Commit 6395db57 authored by Tsamara Esperanti Erwin's avatar Tsamara Esperanti Erwin 🦄
Browse files

Pbi 7 progress program

parent ab7d0abe
...@@ -46,6 +46,13 @@ class ProgramBloc extends Bloc<ProgramEvent, ProgramState> { ...@@ -46,6 +46,13 @@ class ProgramBloc extends Bloc<ProgramEvent, ProgramState> {
page: currentState.page + 1); page: currentState.page + 1);
return; return;
} }
if (currentState is ListProgramsSortedLoaded) {
yield ListProgramsLoaded(
programs: currentState.programs,
hasReachedMax: programs.next == null,
page: 0);
return;
}
} on DioError catch (e) { } on DioError catch (e) {
yield ListProgramsError(error: e.response.data.toString()); yield ListProgramsError(error: e.response.data.toString());
} catch (e) { } catch (e) {
......
...@@ -10,10 +10,3 @@ class FetchProgram extends ProgramEvent { ...@@ -10,10 +10,3 @@ class FetchProgram extends ProgramEvent {
@override @override
List<Object> get props => []; List<Object> get props => [];
} }
class FetchProgramByStatus extends ProgramEvent {
const FetchProgramByStatus();
@override
List<Object> get props => [];
}
...@@ -135,6 +135,10 @@ class __ListProgramState extends State<_ListProgram> { ...@@ -135,6 +135,10 @@ class __ListProgramState extends State<_ListProgram> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocBuilder<ProgramBloc, ProgramState>( return BlocBuilder<ProgramBloc, ProgramState>(
bloc: ProgramBloc(
programRepository:
RepositoryProvider.of<ProgramRepository>(context))
..add(const FetchProgram()),
builder: (BuildContext context, ProgramState state) { builder: (BuildContext context, ProgramState state) {
if (state is InitialListProgramState) { if (state is InitialListProgramState) {
return const Center( return const Center(
......
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