Skip to content

Commit

Permalink
details screen
Browse files Browse the repository at this point in the history
  • Loading branch information
febryardiansyah committed Apr 26, 2020
1 parent 9f07c45 commit 9050c50
Show file tree
Hide file tree
Showing 10 changed files with 398 additions and 46 deletions.
9 changes: 7 additions & 2 deletions lib/components/my_grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:animku/components/season_title.dart';
import 'package:animku/environments/colors.dart';
import 'package:animku/environments/my_fonts.dart';
import 'package:animku/models/current_season_model.dart';
import 'package:animku/ui/detailscreen/details_screen.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
Expand Down Expand Up @@ -41,8 +42,12 @@ class _MyGridState extends State<MyGrid> {
itemBuilder: (context, i) {
return ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(8)),
child: InkWell(
onTap: () {},
child: GestureDetector(
onTap: () {
Navigator.push(context, MaterialPageRoute(
builder: (context) => DetailsScreen(title: widget.animeList[i].title,)
));
},
child: Container(
decoration: BoxDecoration(
color: BaseColor.white,
Expand Down
74 changes: 54 additions & 20 deletions lib/components/my_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class MyList extends StatefulWidget {
final List<AnimeList> animeList;
final seasonTitle;

const MyList({Key key, this.animeList,this.seasonTitle}) : super(key: key);
const MyList({Key key, this.animeList, this.seasonTitle}) : super(key: key);

@override
_MyListState createState() => _MyListState();
Expand All @@ -23,6 +23,7 @@ class _MyListState extends State<MyList> {
// TODO: implement initState
super.initState();
}

@override
Widget build(BuildContext context) {
ScreenUtil.init(context);
Expand All @@ -35,9 +36,7 @@ class _MyListState extends State<MyList> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
_seasonTitle(
judul: widget.seasonTitle
),
_seasonTitle(judul: widget.seasonTitle),
Padding(
padding: EdgeInsets.symmetric(horizontal: 15, vertical: 15),
child: ListView.builder(
Expand All @@ -46,15 +45,31 @@ class _MyListState extends State<MyList> {
itemCount: widget.animeList.length,
itemBuilder: (context, i) {
List<String> genList = new List();
widget.animeList[i].genreList.forEach((v){
List<String> studioList = new List();
widget.animeList[i].genreList.forEach((v) {
genList.add(v.name);
});
return InkWell(
splashColor: BaseColor.transparent,
onTap: (){
Navigator.push(context, MaterialPageRoute(
builder: (context) => DetailsScreen(title: widget.animeList[i].title,)
));
widget.animeList[i].producers.forEach((f) {
studioList.add(f.name);
});
return GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => DetailsScreen(
title: widget.animeList[i].title,
imageUrl: widget.animeList[i].imageUrl,
genre: genList,
episodes: widget.animeList[i].episodes,
score: widget.animeList[i].score,
members: widget.animeList[i].members,
airing: widget.animeList[i].airingStart,
source: widget.animeList[i].source,
studio: studioList,
synopsis: widget.animeList[i].synopsis,
type: widget.animeList[i].type,
)));
},
child: Container(
child: Stack(
Expand Down Expand Up @@ -82,20 +97,26 @@ class _MyListState extends State<MyList> {
),
);
}
Widget _seasonTitle({String judul}){

Widget _seasonTitle({String judul}) {
ScreenUtil.init(context);
return Container(
height: 200.h,
width: 700.w,
color: BaseColor.greyPurple,
child: Center(
child: Text(judul,style: TextStyle(fontFamily: MyFonts.baloo,fontSize: 40,color: BaseColor.white),),
child: Text(
judul,
style: TextStyle(
fontFamily: MyFonts.baloo, fontSize: 40, color: BaseColor.white),
),
),
);
}

Widget _background({
title,
List<String>genre,
List<String> genre,
score,
episodes,
}) {
Expand All @@ -122,12 +143,25 @@ class _MyListState extends State<MyList> {
fontSize: 20),
),
),
Text(
'${genre}',
style: TextStyle(color: Color(0xffF0F0F0), fontSize: 14),
),
SizedBox(
height: 10,
Expanded(
child: ListView.builder(
itemCount: genre.length,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
physics: ClampingScrollPhysics(),
itemBuilder: (context, i) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
genre[i].toString() + ' ',
style:
TextStyle(color: Color(0xffF0F0F0), fontSize: 14),
),
],
);
},
),
),
Row(
children: <Widget>[
Expand Down
5 changes: 2 additions & 3 deletions lib/ui/currentScreen/fall_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,17 @@ class FallScreen extends StatefulWidget {

class _FallScreenState extends State<FallScreen> {
FallBloc fallBloc;

@override
void initState() {
// TODO: implement initState
super.initState();
fallBloc = BlocProvider.of<FallBloc>(context);
fallBloc.add(FetchCurrentEvent());

}
@override
Widget build(BuildContext context) {
return MyAppbar(
onRefresh: (){
fallBloc = BlocProvider.of<FallBloc>(context);
fallBloc.add(FetchCurrentEvent());
},
isList: MyVariable.isList,
Expand Down
8 changes: 1 addition & 7 deletions lib/ui/currentScreen/spring_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,11 @@ class SpringScreen extends StatefulWidget {
class _SpringScreenState extends State<SpringScreen> {
SpringBloc springBloc;

@override
void initState() {
// TODO: implement initState
super.initState();
springBloc = BlocProvider.of<SpringBloc>(context);
springBloc.add(FetchCurrentEvent());
}
@override
Widget build(BuildContext context) {
return MyAppbar(
onRefresh: (){
springBloc = BlocProvider.of<SpringBloc>(context);
springBloc.add(FetchCurrentEvent());
},
isList: MyVariable.isList,
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/currentScreen/summer_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ class _SummerScreenState extends State<SummerScreen> {
void initState() {
// TODO: implement initState
super.initState();
summerBloc = BlocProvider.of<SummerBloc>(context);
summerBloc.add(FetchCurrentEvent());

}
@override
Widget build(BuildContext context) {
return MyAppbar(
onRefresh: (){
summerBloc = BlocProvider.of<SummerBloc>(context);
summerBloc.add(FetchCurrentEvent());
},
isList: MyVariable.isList,
Expand Down
8 changes: 1 addition & 7 deletions lib/ui/currentScreen/winter_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ class WinterScreen extends StatefulWidget {
class _WinterScreenState extends State<WinterScreen> {
WinterBloc winterBloc;

@override
void initState() {
// TODO: implement initState
super.initState();
winterBloc = BlocProvider.of<WinterBloc>(context);
winterBloc.add(FetchCurrentEvent());
}
@override
Widget build(BuildContext context) {
return BlocListener<WinterBloc,CurrentBlocState>(
Expand All @@ -40,6 +33,7 @@ class _WinterScreenState extends State<WinterScreen> {
},
child: MyAppbar(
onRefresh: (){
winterBloc = BlocProvider.of<WinterBloc>(context);
winterBloc.add(FetchCurrentEvent());
},
isList: MyVariable.isList,
Expand Down
Loading

0 comments on commit 9050c50

Please sign in to comment.