Skip to content

Commit

Permalink
winter2020 done
Browse files Browse the repository at this point in the history
  • Loading branch information
febryardiansyah committed Apr 16, 2020
1 parent 44732b1 commit b8a87c0
Show file tree
Hide file tree
Showing 11 changed files with 395 additions and 152 deletions.
11 changes: 8 additions & 3 deletions lib/components/bottom_navbar.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import 'package:animku/environments/colors.dart';
import 'package:animku/environments/dictionary.dart';
import 'package:animku/environments/end_point_path.dart';
import 'package:animku/providers/current_season_provider.dart';
import 'package:animku/ui/current_season_screen.dart';
import 'package:animku/providers/days_provider.dart';
import 'package:animku/ui/spring_season_screen.dart';
import 'package:animku/ui/currentSeason/current_season_screen.dart';
import 'package:bottom_navy_bar/bottom_navy_bar.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
Expand All @@ -17,13 +20,15 @@ class BottomNavBar extends StatefulWidget {
class _BottomNavBarState extends State<BottomNavBar> {
int currentIndex = 0;
List<Widget>_children = [
CurrentSeasonScreen(),
SpringSeasonScreen(),
SpringSeasonScreen(),
];

@override
void initState() {
// TODO: implement initState
Provider.of<CurrentSeasonProvider>(context,listen: false).getCurrentSeason();
Provider.of<CurrentSeasonProvider>(context,listen: false).getWinter();
Provider.of<DaysProvider>(context,listen: false).getDays();
super.initState();
}
@override
Expand Down
256 changes: 152 additions & 104 deletions lib/components/my_list.dart
Original file line number Diff line number Diff line change
@@ -1,134 +1,185 @@
import 'package:animku/environments/colors.dart';
import 'package:animku/environments/my_fonts.dart';
import 'package:animku/providers/current_season_provider.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:provider/provider.dart';

class MyList extends StatefulWidget {
final String image, title, genre, score, type;
final image, title, genre, score, eps,itemCount;

const MyList(
{Key key, this.image, this.title, this.genre, this.score, this.type})
{Key key, this.image, this.title, this.genre, this.score, this.eps,this.itemCount})
: super(key: key);

@override
_MyListState createState() => _MyListState();
}

class _MyListState extends State<MyList> {
bool isLoading = false;

@override
Widget build(BuildContext context) {
ScreenUtil.init(context);
return ListView(
shrinkWrap: true,
physics: ClampingScrollPhysics(),
children: <Widget>[
Center(
child: Stack(
overflow: Overflow.visible,
children: <Widget>[
Container(
height: 600.h,
),
_background(),
_animePic(),
],
),
)
],
var _getData =
Provider.of<CurrentSeasonProvider>(context, listen: false).getWinter();
return FutureBuilder(
future: _getData,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return SpinKitWave(
color: BaseColor.lightPurple,
);
}
return Consumer<CurrentSeasonProvider>(
builder: (context, data, _) => ListView.builder(
scrollDirection: Axis.vertical,
itemCount: data.winter2020.length,
shrinkWrap: true,
physics: ClampingScrollPhysics(),
itemBuilder: (context, i) {
List genLst = new List();
data.winter2020[i].animeList[i].genreList.forEach((item) {
genLst.add(item.name);
});
if (i == data.winter2020.length) {
return _buildProgress();
}
return Container(
child: Stack(
children: <Widget>[
Container(
height: 600.h,
),
_background(
title: data.winter2020[i].animeList[i].title,
genre: genLst,
episodes: data.winter2020[i].animeList[i].episodes,
score: data.winter2020[i].animeList[i].score,
),
_animePic(
imageUrl: data.winter2020[i].animeList[i].imageUrl),
],
),
);
},
),
);
});
}

Widget _buildProgress() {
return new Padding(
padding: const EdgeInsets.all(8.0),
child: new Center(
child: new CircularProgressIndicator(),
),
);
}
}

Widget _background() {
return Positioned(
top: 25.h,
child: Container(
alignment: Alignment.center,
height: 500.h,
width: 1000.w,
decoration: BoxDecoration(
color: BaseColor.lightPurple,
borderRadius: BorderRadius.all(Radius.circular(10))),
child: Padding(
padding: EdgeInsets.only(left: 380.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Anime Name',
Widget _background({
title,
genre,
score,
episodes,
}) {
return Positioned(
top: 25.h,
child: Container(
alignment: Alignment.center,
height: 500.h,
width: 1000.w,
decoration: BoxDecoration(
color: BaseColor.lightPurple,
borderRadius: BorderRadius.all(Radius.circular(10))),
child: Padding(
padding: EdgeInsets.only(left: 380.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Flexible(
child: Text(
'${title}',
style: TextStyle(
fontFamily: MyFonts.baloo,
color: BaseColor.white,
fontSize: 25),
),
Text(
'comedy, romance',
style: TextStyle(color: Color(0xffF0F0F0), fontSize: 14),
),
SizedBox(
height: 10,
fontSize: 20),
),
Row(
children: <Widget>[
Icon(
Icons.star,
color: BaseColor.orange,
size: 30,
),
SizedBox(
width: 10,
),
Container(
height: 30,
width: 30,
decoration: BoxDecoration(
color: BaseColor.white,
borderRadius: BorderRadius.all(Radius.circular(8)),
),
child: Center(
child: Text(
'9.1',
style: TextStyle(
fontFamily: MyFonts.baloo,
fontSize: 18,
color: BaseColor.orange),
)),
),
],
),
SizedBox(height: 10,),
Row(
children: <Widget>[
Icon(
Icons.tv,
color: BaseColor.red,
size: 30,
),
SizedBox(
width: 10,
),
Text(
'${genre}',
style: TextStyle(color: Color(0xffF0F0F0), fontSize: 14),
),
SizedBox(
height: 10,
),
Row(
children: <Widget>[
Icon(
Icons.star,
color: BaseColor.orange,
size: 30,
),
SizedBox(
width: 10,
),
Container(
height: 35,
width: 35,
decoration: BoxDecoration(
color: BaseColor.white,
borderRadius: BorderRadius.all(Radius.circular(8)),
),
Text(
'TV',
child: Center(
child: Text(
'${score}',
style: TextStyle(
fontFamily: MyFonts.baloo,
fontSize: 18,
color: BaseColor.red),
),
],
),
],
),
color: BaseColor.orange),
)),
),
],
),
SizedBox(
height: 10,
),
Row(
children: <Widget>[
Icon(
Icons.confirmation_number,
color: BaseColor.red,
size: 30,
),
SizedBox(
width: 10,
),
Text(
'${episodes} eps',
style: TextStyle(
fontFamily: MyFonts.baloo,
fontSize: 18,
color: BaseColor.red),
),
],
),
],
),
),
);
}
),
);
}

Widget _animePic() {
return Container(
margin: EdgeInsets.only(left: 10),
width: 320.w,
height: 540.h,
decoration: BoxDecoration(
Widget _animePic({imageUrl}) {
return Container(
margin: EdgeInsets.only(left: 10),
width: 320.w,
height: 540.h,
decoration: BoxDecoration(
color: BaseColor.white,
borderRadius: BorderRadius.all(Radius.circular(8)),
boxShadow: [
Expand All @@ -138,10 +189,7 @@ class _MyListState extends State<MyList> {
),
BoxShadow(offset: Offset(-5, -5), color: Colors.black12)
],
// image: DecorationImage(
// image: AssetImage(widget.image),fit: BoxFit.fill
// )
),
);
}
image:
DecorationImage(image: NetworkImage(imageUrl), fit: BoxFit.fill)),
);
}
5 changes: 4 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:animku/components/bottom_navbar.dart';
import 'package:animku/providers/current_season_provider.dart';
import 'package:animku/providers/days_provider.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

Expand All @@ -11,10 +12,12 @@ class MyApp extends StatelessWidget {
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (_)=> CurrentSeasonProvider()),
ChangeNotifierProvider(create: (_)=>DaysProvider(),)
],
child: MaterialApp(
debugShowCheckedModeBanner: false,
home: BottomNavBar(),
home: Scaffold(
body: BottomNavBar()),
),
);
}
Expand Down
17 changes: 15 additions & 2 deletions lib/models/current_season_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ class CurrentSeasonModel{
int seasonYear;
List<AnimeList> animeList;

@override
String toString() {
return 'CurrentSeasonModel{seasonName: $seasonName, seasonYear: $seasonYear, animeList: $animeList}';
}
CurrentSeasonModel({this.seasonName, this.seasonYear, this.animeList});

factory CurrentSeasonModel.fromMap(Map<String, dynamic>json){
Expand All @@ -22,7 +26,8 @@ class CurrentSeasonModel{
class AnimeList{
String title,imageUrl,synopsis,type,
airingStart,source;
int members,score,episodes;
int members,episodes;
var score;
List<GenreList> genreList;
List<Producers> producers;

Expand All @@ -35,6 +40,7 @@ class AnimeList{
imageUrl: json['image_url'],
synopsis: json['synopsis'],
type: json['type'],
score: json['score'],
airingStart: json['airing_start'],
episodes: json['episodes'],
members: json['members'],
Expand All @@ -47,12 +53,19 @@ class AnimeList{

class GenreList{
String name;
String type;

GenreList({this.name,this.type});

GenreList({this.name});
@override
String toString() {
return 'GenreList{name: $name, type: $type}';
}

factory GenreList.fromMap(Map<String,dynamic>json){
return GenreList(
name: json['name'],
type: json['type'],
);
}
}
Expand Down
Loading

0 comments on commit b8a87c0

Please sign in to comment.