Skip to content

Commit

Permalink
current season almost done
Browse files Browse the repository at this point in the history
  • Loading branch information
febryardiansyah committed Apr 26, 2020
1 parent 9050c50 commit 6b4b357
Show file tree
Hide file tree
Showing 3 changed files with 183 additions and 88 deletions.
26 changes: 25 additions & 1 deletion lib/components/my_grid.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:animku/components/season_title.dart';
import 'package:animku/environments/colors.dart';
import 'package:animku/environments/my_fonts.dart';
import 'package:animku/environments/my_variable.dart';
import 'package:animku/models/current_season_model.dart';
import 'package:animku/ui/detailscreen/details_screen.dart';
import 'package:flutter/cupertino.dart';
Expand Down Expand Up @@ -40,12 +41,35 @@ class _MyGridState extends State<MyGrid> {
shrinkWrap: true,
physics: ClampingScrollPhysics(),
itemBuilder: (context, i) {
List<String> genList = new List();
List<String> studioList = new List();
widget.animeList[i].genreList.forEach((v) {
genList.add(v.name);
});
widget.animeList[i].producers.forEach((f) {
studioList.add(f.name);
});
return ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(8)),
child: GestureDetector(
onTap: () {
setState(() {
MyVariable.isList = false;
});
Navigator.push(context, MaterialPageRoute(
builder: (context) => DetailsScreen(title: widget.animeList[i].title,)
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(
Expand Down
30 changes: 25 additions & 5 deletions lib/components/my_list.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:animku/environments/colors.dart';
import 'package:animku/environments/my_fonts.dart';
import 'package:animku/environments/my_variable.dart';
import 'package:animku/models/current_season_model.dart';
import 'package:animku/ui/detailscreen/details_screen.dart';
import 'package:flutter/material.dart';
Expand All @@ -16,21 +17,37 @@ class MyList extends StatefulWidget {
}

class _MyListState extends State<MyList> {
ScrollController scrollController = new ScrollController();

bool showFAB = true;
ScrollController toTopScrollCtrl = new ScrollController();
@override
void initState() {
// TODO: implement initState
super.initState();
toTopScrollCtrl = ScrollController();
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
toTopScrollCtrl.dispose();
}

@override
Widget build(BuildContext context) {
ScreenUtil.init(context);
return Scaffold(
floatingActionButton: showFAB?FloatingActionButton(
child: Icon(Icons.keyboard_arrow_up),
backgroundColor: BaseColor.baseColor,
onPressed: (){
toTopScrollCtrl.animateTo(toTopScrollCtrl.position.minScrollExtent, duration: Duration(
microseconds: 1000
), curve: Curves.easeIn);
},
):Container(),
backgroundColor: BaseColor.baseColor,
body: Scrollbar(
child: SingleChildScrollView(
controller: toTopScrollCtrl,
child: Padding(
padding: EdgeInsets.only(top: 10),
child: Column(
Expand All @@ -54,6 +71,9 @@ class _MyListState extends State<MyList> {
});
return GestureDetector(
onTap: () {
setState(() {
MyVariable.isList = true;
});
Navigator.push(
context,
MaterialPageRoute(
Expand Down Expand Up @@ -182,7 +202,7 @@ class _MyListState extends State<MyList> {
),
child: Center(
child: Text(
'${score}',
'${score == null? '0':score}',
style: TextStyle(
fontFamily: MyFonts.baloo,
fontSize: 18,
Expand All @@ -205,7 +225,7 @@ class _MyListState extends State<MyList> {
width: 10,
),
Text(
'${episodes} eps',
'${episodes == null?'0':episodes} eps',
style: TextStyle(
fontFamily: MyFonts.baloo,
fontSize: 18,
Expand Down
215 changes: 133 additions & 82 deletions lib/ui/detailscreen/details_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class _DetailsScreenState extends State<DetailsScreen> {
expandableCard: ExpandableCard(
minHeight: 1300.h,
maxHeight: 1700.h,
backgroundColor: Colors.white,
backgroundColor: BaseColor.white,
hasShadow: true,
hasHandle: false,
hasRoundedCorners: true,
Expand All @@ -67,53 +67,70 @@ class _DetailsScreenState extends State<DetailsScreen> {
}
Widget _background() {
ScreenUtil.init(context);
return Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(widget.imageUrl),
fit: BoxFit.cover,
),
),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 2, sigmaY: 2),
child: Container(
alignment: Alignment.center,
color: Colors.grey.withOpacity(0.1),
),
),
);
}
Widget _details() {
ScreenUtil.init(context);
return Align(
alignment: Alignment.bottomCenter,
child: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30), topRight: Radius.circular(30)),
child: Container(
alignment: Alignment.bottomCenter,
height: 1300.h,
decoration: BoxDecoration(color: BaseColor.white, boxShadow: [
BoxShadow(
color: Colors.black, offset: Offset(-10, -10), blurRadius: 8),
]),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
_title(),
_genre(),
],
return Stack(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(widget.imageUrl),
fit: BoxFit.cover,
),
),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 2, sigmaY: 2),
child: Container(
alignment: Alignment.center,
color: Colors.grey.withOpacity(0.1),
),
),
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 25,horizontal: 10),
child: RaisedButton(
color: BaseColor.baseColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15)
),
child: Icon(Icons.arrow_back_ios,color: BaseColor.white,),
onPressed: (){
Navigator.pop(context);
},
),
)
],
);
}
// Widget _details() {
// ScreenUtil.init(context);
// return Align(
// alignment: Alignment.bottomCenter,
// child: ClipRRect(
// borderRadius: BorderRadius.only(
// topLeft: Radius.circular(30), topRight: Radius.circular(30)),
// child: Container(
// alignment: Alignment.bottomCenter,
// height: 1300.h,
// decoration: BoxDecoration(color: BaseColor.white, boxShadow: [
// BoxShadow(
// color: Colors.black, offset: Offset(-10, -10), blurRadius: 8),
// ]),
// child: Padding(
// padding: const EdgeInsets.all(8.0),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
// children: <Widget>[
// _title(),
// _genre(),
// ],
// ),
// ),
// ),
// ),
// );
// }
Widget _title() {
return Flexible(
child: Text(
Expand All @@ -126,27 +143,29 @@ class _DetailsScreenState extends State<DetailsScreen> {
}
Widget _genre() {
return Flexible(
child: ListView.builder(
physics: ClampingScrollPhysics(),
shrinkWrap: true,
itemCount: widget.genre.length,
scrollDirection: Axis.horizontal,
itemBuilder: (context, i) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Card(
color: Color(0xffF25959),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
widget.genre[i].toString() + ' ',
style: TextStyle(color: BaseColor.white),
),
)),
],
);
},
child: Scrollbar(
child: ListView.builder(
physics: ClampingScrollPhysics(),
shrinkWrap: true,
itemCount: widget.genre.length,
scrollDirection: Axis.horizontal,
itemBuilder: (context, i) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Card(
color: Color(0xffF25959),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
widget.genre[i].toString() + ' ',
style: TextStyle(color: BaseColor.white),
),
)),
],
);
},
),
),
);
}
Expand Down Expand Up @@ -191,7 +210,7 @@ class _DetailsScreenState extends State<DetailsScreen> {
size: 25,
),
Text(
widget.score.toString(),
widget.score ==null?'0':widget.score.toString(),
style: TextStyle(
fontSize: 30,
color: BaseColor.white,
Expand Down Expand Up @@ -234,7 +253,7 @@ class _DetailsScreenState extends State<DetailsScreen> {
color: BaseColor.white),
),
Text(
widget.episodes.toString(),
widget.episodes == null?'0':widget.episodes.toString(),
style: TextStyle(
fontSize: 25,
color: BaseColor.orange,
Expand Down Expand Up @@ -267,32 +286,64 @@ class _DetailsScreenState extends State<DetailsScreen> {
}
Widget _box2() {
var formatNumber = new NumberFormat('#,###');
String studio;
for(int i=0;i<widget.studio.length;i++){
studio = widget.studio[i];
}
return Card(
elevation: 8,
color: BaseColor.baseColor,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
child: Container(
height: 1000.h,
width: double.infinity,
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.all(8),
child: Row(
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
Stack(
children: <Widget>[
_detailItems(title: widget.airing.substring(0,10),icon: Icons.date_range),
// Flexible(
// child: ListView.builder(
// scrollDirection: Axis.horizontal,
// physics: ClampingScrollPhysics(),
// shrinkWrap: true,
// itemCount: widget.studio.length,
// itemBuilder: (context,i){
// return _detailItems(title: widget.studio.toString(),icon: FontAwesomeIcons.building);
// },
// ),
// ),
_detailItems(title: '${formatNumber.format(widget.members)}',icon: Icons.people)
Container(
height: MediaQuery.of(context).size.height,
width: 970.w,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
_detailItems(title: widget.airing == null?'Unknown':widget.airing.substring(0,10),icon: Icons.date_range),
_detailItems(title: studio == null?'':studio,icon: FontAwesomeIcons.building),
_detailItems(title: '${widget.members == null?'':formatNumber.format(widget.members)}',icon: Icons.people)
],
),
Positioned(
left: 600.w,
child: Row(
children: <Widget>[
Container(
height: 600.h,
width: 370.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
offset: Offset(10,10),
color: Colors.black12,
blurRadius: 10
),
BoxShadow(
offset: Offset(-10,-10),
color: Colors.black12,
blurRadius: 10
)
],
image: DecorationImage(
image: NetworkImage(widget.imageUrl),
fit: BoxFit.cover
)
),
)
],
),
),
],
)
],
Expand Down

0 comments on commit 6b4b357

Please sign in to comment.