Skip to content

Commit

Permalink
schedule done
Browse files Browse the repository at this point in the history
  • Loading branch information
febryardiansyah committed May 12, 2020
1 parent 7408b3b commit 64e743e
Show file tree
Hide file tree
Showing 26 changed files with 855 additions and 138 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# animku

A new Flutter application.
Animku is unofficial myanimelist.com app that will be available on ios and android.

## Getting Started
if you want to contribute on this project, you can fork this project and pull request.

This project is a starting point for a Flutter application.
#TODO

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
- [x] current season screen
- [x] drawer and items
- [x] anime detail
- [x] schedule
- [] search anime
- [] top anime
- [] splash screen
- [] icon launcher
28 changes: 28 additions & 0 deletions lib/bloc/schedule_bloc/friday_bloc.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'package:animku/bloc/schedule_bloc/shedule_event_state.dart';
import 'package:animku/models/current_season_model.dart';
import 'package:animku/repository/schedule_repo.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class FridayBloc extends Bloc<ScheduleEvent,ScheduleState>{
ScheduleRepository scheduleRepository;

FridayBloc(this.scheduleRepository);

@override
// TODO: implement initialState
ScheduleState get initialState => ScheduleInitialState();

@override
Stream<ScheduleState> mapEventToState(ScheduleEvent event) async*{
if(event is FetchSchedule){
yield ScheduleInitialState();
try{
List<AnimeList> list = await scheduleRepository.getFriday();
yield ScheduleLoadedState(animeList: list);
}catch(e){
yield ScheduleErrorState(message: e.toString());
}
}
}

}
28 changes: 28 additions & 0 deletions lib/bloc/schedule_bloc/monday_bloc.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'package:animku/bloc/schedule_bloc/shedule_event_state.dart';
import 'package:animku/models/current_season_model.dart';
import 'package:animku/models/days_model.dart';
import 'package:animku/repository/schedule_repo.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class MondayBloc extends Bloc<ScheduleEvent,ScheduleState>{
ScheduleRepository scheduleRepository;

MondayBloc(this.scheduleRepository);

@override
// TODO: implement initialState
ScheduleState get initialState => ScheduleInitialState();

@override
Stream<ScheduleState> mapEventToState(ScheduleEvent event) async* {
if(event is FetchSchedule){
yield ScheduleInitialState();
try{
List<AnimeList> list = await scheduleRepository.getMonday();
yield ScheduleLoadedState(animeList: list);
}catch(e){
yield ScheduleErrorState(message: e.toString());
}
}
}
}
28 changes: 28 additions & 0 deletions lib/bloc/schedule_bloc/saturday_bloc.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'package:animku/bloc/schedule_bloc/shedule_event_state.dart';
import 'package:animku/models/current_season_model.dart';
import 'package:animku/repository/schedule_repo.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class SaturdayBloc extends Bloc<ScheduleEvent,ScheduleState>{
ScheduleRepository scheduleRepository;

SaturdayBloc(this.scheduleRepository);

@override
// TODO: implement initialState
ScheduleState get initialState => ScheduleInitialState();

@override
Stream<ScheduleState> mapEventToState(ScheduleEvent event) async*{
if(event is FetchSchedule){
yield ScheduleInitialState();
try{
List<AnimeList> list = await scheduleRepository.getSaturday();
yield ScheduleLoadedState(animeList: list);
}catch(e){
yield ScheduleErrorState(message: e.toString());
}
}
}

}
38 changes: 38 additions & 0 deletions lib/bloc/schedule_bloc/shedule_event_state.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import 'package:animku/models/current_season_model.dart';
import 'package:equatable/equatable.dart';

//fetch event
abstract class ScheduleEvent extends Equatable{}

class FetchSchedule extends ScheduleEvent{
@override
// TODO: implement props
List<Object> get props => [];
}

//state
abstract class ScheduleState extends Equatable{}

class ScheduleInitialState extends ScheduleState{
@override
// TODO: implement props
List<Object> get props => [];
}
class ScheduleLoadedState extends ScheduleState{
List<AnimeList> animeList;

ScheduleLoadedState({this.animeList});

@override
// TODO: implement props
List<Object> get props => [animeList];
}
class ScheduleErrorState extends ScheduleState{
String message;

ScheduleErrorState({this.message});

@override
// TODO: implement props
List<Object> get props => [message];
}
28 changes: 28 additions & 0 deletions lib/bloc/schedule_bloc/sunday_bloc.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'package:animku/bloc/schedule_bloc/shedule_event_state.dart';
import 'package:animku/models/current_season_model.dart';
import 'package:animku/models/days_model.dart';
import 'package:animku/repository/schedule_repo.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class SundayBloc extends Bloc<ScheduleEvent,ScheduleState>{
ScheduleRepository scheduleRepository;

SundayBloc(this.scheduleRepository);

@override
// TODO: implement initialState
ScheduleState get initialState => ScheduleInitialState();

@override
Stream<ScheduleState> mapEventToState(ScheduleEvent event) async*{
if(event is FetchSchedule){
yield ScheduleInitialState();
try{
List<AnimeList> data = await scheduleRepository.getSunday();
yield ScheduleLoadedState(animeList: data);
}catch(e){
yield ScheduleErrorState(message: e.toString());
}
}
}
}
27 changes: 27 additions & 0 deletions lib/bloc/schedule_bloc/thursday_bloc.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import 'package:animku/bloc/schedule_bloc/shedule_event_state.dart';
import 'package:animku/models/current_season_model.dart';
import 'package:animku/repository/schedule_repo.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class ThursdayBloc extends Bloc<ScheduleEvent,ScheduleState>{
ScheduleRepository scheduleRepository;

ThursdayBloc(this.scheduleRepository);

@override
// TODO: implement initialState
ScheduleState get initialState => ScheduleInitialState();

@override
Stream<ScheduleState> mapEventToState(ScheduleEvent event) async*{
if(event is FetchSchedule){
yield ScheduleInitialState();
try{
List<AnimeList> list = await scheduleRepository.getThursday();
yield ScheduleLoadedState(animeList: list);
}catch(e){
yield ScheduleErrorState(message: e.toString());
}
}
}
}
28 changes: 28 additions & 0 deletions lib/bloc/schedule_bloc/tuesday_bloc.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'package:animku/bloc/schedule_bloc/shedule_event_state.dart';
import 'package:animku/models/current_season_model.dart';
import 'package:animku/repository/schedule_repo.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class TuesDayBloc extends Bloc<ScheduleEvent,ScheduleState>{
ScheduleRepository scheduleRepository;

TuesDayBloc(this.scheduleRepository);

@override
// TODO: implement initialState
ScheduleState get initialState => ScheduleInitialState();

@override
Stream<ScheduleState> mapEventToState(ScheduleEvent event) async*{
if(event is FetchSchedule){
yield ScheduleInitialState();
try{
List<AnimeList>list = await scheduleRepository.getTuesday();
yield ScheduleLoadedState(animeList: list);
}catch(e){
yield ScheduleErrorState(message: e.toString());
}
}
}

}
28 changes: 28 additions & 0 deletions lib/bloc/schedule_bloc/wednesday_bloc.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'package:animku/bloc/schedule_bloc/shedule_event_state.dart';
import 'package:animku/models/current_season_model.dart';
import 'package:animku/repository/schedule_repo.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class WednesdayBloc extends Bloc<ScheduleEvent,ScheduleState>{
ScheduleRepository scheduleRepository;

WednesdayBloc(this.scheduleRepository);

@override
// TODO: implement initialState
ScheduleState get initialState => ScheduleInitialState();

@override
Stream<ScheduleState> mapEventToState(ScheduleEvent event) async*{
if(event is FetchSchedule){
yield ScheduleInitialState();
try{
List<AnimeList> list = await scheduleRepository.getWednesday();
yield ScheduleLoadedState(animeList: list);
}catch(e){
yield ScheduleErrorState(message: e.toString());
}
}
}

}
2 changes: 1 addition & 1 deletion lib/bloc/seasonLaterBloc/season_later_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ abstract class SeasonLaterEvent extends Equatable{}
class FetchSeasonLaterEvent extends SeasonLaterEvent{
@override
// TODO: implement props
List<Object> get props => null;
List<Object> get props => [];
}

abstract class SeasonLaterState extends Equatable{}
Expand Down
7 changes: 6 additions & 1 deletion lib/components/my_drawer.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import 'package:animku/environments/dictionary.dart';
import 'package:animku/environments/my_fonts.dart';
import 'package:animku/ui/drawerList/current_season_screen.dart';
import 'package:animku/ui/drawerList/schedule_screen.dart';
import 'package:animku/ui/drawerList/season_later_screen.dart';
import 'package:animku/ui/scheduleScreen/sunday_screen.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
Expand Down Expand Up @@ -40,7 +42,10 @@ class MyDrawer extends StatelessWidget {
leading: Icon(Icons.date_range),
text: Text('Schedule'),
trailing: Icon(Icons.arrow_forward_ios),
onTapTabbed: (){}
onTapTabbed: (){
Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) => ScheduleScreen()),
(Route<dynamic> route) => false);
}
),
_drawerItems(
leading: Icon(FontAwesomeIcons.search),
Expand Down
1 change: 1 addition & 0 deletions lib/environments/end_point_path.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ class EndPointPath{
static String sunday = '/schedule/sunday';

static String seasonLater = '/season/later';
static String schedule = '/schedule';

}
32 changes: 31 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,18 @@ import 'package:animku/bloc/current_season_bloc/fall_bloc.dart';
import 'package:animku/bloc/current_season_bloc/spring_bloc.dart';
import 'package:animku/bloc/current_season_bloc/summer_bloc.dart';
import 'package:animku/bloc/current_season_bloc/winter_bloc.dart';
import 'package:animku/bloc/schedule_bloc/friday_bloc.dart';
import 'package:animku/bloc/schedule_bloc/monday_bloc.dart';
import 'package:animku/bloc/schedule_bloc/saturday_bloc.dart';
import 'package:animku/bloc/schedule_bloc/shedule_event_state.dart';
import 'package:animku/bloc/schedule_bloc/sunday_bloc.dart';
import 'package:animku/bloc/schedule_bloc/thursday_bloc.dart';
import 'package:animku/bloc/schedule_bloc/tuesday_bloc.dart';
import 'package:animku/bloc/schedule_bloc/wednesday_bloc.dart';
import 'package:animku/bloc/simple_bloc_delegate.dart';
import 'package:animku/components/bottom_navbar.dart';
import 'package:animku/repository/current_season_repo.dart';
import 'package:animku/repository/schedule_repo.dart';
import 'package:animku/repository/season_later_repo.dart';
import 'package:animku/ui/drawerList/current_season_screen.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -39,7 +48,28 @@ class MyApp extends StatelessWidget {
),
BlocProvider(
create: (context) => SeasonLaterBloc(seasonLaterRepository: SeasonLaterImplements()),
)
),
BlocProvider(
create: (context) => SundayBloc(ScheduleRepoImplement()),
),
BlocProvider(
create: (context) => MondayBloc(ScheduleRepoImplement()),
),
BlocProvider(
create: (context) => TuesDayBloc(ScheduleRepoImplement()),
),
BlocProvider(
create: (context) => WednesdayBloc(ScheduleRepoImplement()),
),
BlocProvider(
create: (context) => ThursdayBloc(ScheduleRepoImplement()),
),
BlocProvider(
create: (context) => FridayBloc(ScheduleRepoImplement()),
),
BlocProvider(
create: (context) => SaturdayBloc(ScheduleRepoImplement()),
),
],
child: MaterialApp(
debugShowCheckedModeBanner: false,
Expand Down
Loading

0 comments on commit 64e743e

Please sign in to comment.