-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba8bae4
commit 7408b3b
Showing
14 changed files
with
367 additions
and
72 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import 'package:animku/models/current_season_model.dart'; | ||
import 'package:animku/repository/season_later_repo.dart'; | ||
import 'package:equatable/equatable.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
|
||
abstract class SeasonLaterEvent extends Equatable{} | ||
|
||
class FetchSeasonLaterEvent extends SeasonLaterEvent{ | ||
@override | ||
// TODO: implement props | ||
List<Object> get props => null; | ||
} | ||
|
||
abstract class SeasonLaterState extends Equatable{} | ||
|
||
class SeasonLaterInitialState extends SeasonLaterState{ | ||
@override | ||
// TODO: implement props | ||
List<Object> get props => []; | ||
} | ||
class SeasonLaterLoadedState extends SeasonLaterState{ | ||
List<AnimeList>animeList; | ||
|
||
SeasonLaterLoadedState({this.animeList}); | ||
|
||
@override | ||
// TODO: implement props | ||
List<Object> get props => [animeList]; | ||
} | ||
class SeasonLaterErrorState extends SeasonLaterState{ | ||
String message; | ||
|
||
SeasonLaterErrorState({this.message}); | ||
|
||
@override | ||
// TODO: implement props | ||
List<Object> get props => [message]; | ||
} | ||
|
||
class SeasonLaterBloc extends Bloc<SeasonLaterEvent,SeasonLaterState>{ | ||
SeasonLaterRepository seasonLaterRepository; | ||
|
||
SeasonLaterBloc({this.seasonLaterRepository}); | ||
|
||
@override | ||
// TODO: implement initialState | ||
SeasonLaterState get initialState => SeasonLaterInitialState(); | ||
|
||
@override | ||
Stream<SeasonLaterState> mapEventToState(SeasonLaterEvent event) async*{ | ||
if(event is FetchSeasonLaterEvent){ | ||
yield SeasonLaterInitialState(); | ||
try{ | ||
List<AnimeList> animeList = await seasonLaterRepository.fetchSeasonLater(); | ||
yield SeasonLaterLoadedState(animeList: animeList); | ||
}catch(e){ | ||
yield SeasonLaterErrorState(message: e.toString()); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
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/season_later_screen.dart'; | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; | ||
|
||
class MyDrawer extends StatelessWidget { | ||
final bool selected; | ||
|
||
const MyDrawer({Key key, this.selected}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return SafeArea( | ||
child: Drawer( | ||
child: ListView( | ||
children: <Widget>[ | ||
_header(), | ||
_drawerItems( | ||
leading: Icon(FontAwesomeIcons.calendarCheck), | ||
text: Text('This Season'), | ||
trailing: Icon(Icons.arrow_forward_ios), | ||
onTapTabbed: (){ | ||
Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) => CurrentSeasonScreen()), | ||
(Route<dynamic> route) => false); | ||
} | ||
), | ||
_drawerItems( | ||
leading: Icon(FontAwesomeIcons.calendarAlt), | ||
text: Text('Season Later'), | ||
trailing: Icon(Icons.arrow_forward_ios), | ||
onTapTabbed: (){ | ||
Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) => SeasonLaterScreen()), | ||
(Route<dynamic> route) => false); | ||
} | ||
), | ||
_drawerItems( | ||
leading: Icon(Icons.date_range), | ||
text: Text('Schedule'), | ||
trailing: Icon(Icons.arrow_forward_ios), | ||
onTapTabbed: (){} | ||
), | ||
_drawerItems( | ||
leading: Icon(FontAwesomeIcons.search), | ||
text: Text('Search Anime'), | ||
trailing: Icon(Icons.arrow_forward_ios), | ||
onTapTabbed: (){} | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
|
||
Widget _header() { | ||
return DrawerHeader( | ||
margin: EdgeInsets.zero, | ||
padding: EdgeInsets.zero, | ||
decoration: BoxDecoration( | ||
image: DecorationImage( | ||
image: AssetImage(Dictionary.tenkinokowp), | ||
fit: BoxFit.cover | ||
) | ||
), | ||
child: Stack( | ||
children: <Widget>[ | ||
Positioned( | ||
bottom: 12.0, | ||
left: 16.0, | ||
child: Text("ANIMKU", | ||
style: TextStyle( | ||
fontFamily: MyFonts.horizon, | ||
color: Colors.white, | ||
fontSize: 20.0, | ||
fontWeight: FontWeight.w500))), | ||
])); | ||
} | ||
Widget _drawerItems({leading,trailing,text,onTapTabbed}){ | ||
return ListTile( | ||
leading: leading, | ||
title: text, | ||
trailing: trailing, | ||
onTap: onTapTabbed, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.