Created
May 18, 2020 08:13
-
-
Save anmolseth06/9643d32c8fbecacedef4d1808cbe346a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import 'dart:math'; | |
import 'package:flutter/material.dart'; | |
import 'package:google_fonts/google_fonts.dart'; | |
import 'infoScreen.dart'; | |
class NetflixTabBar extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return DefaultTabController( | |
length: 5, | |
child: Theme( | |
data: ThemeData(brightness: Brightness.dark), | |
child: Scaffold( | |
bottomNavigationBar: TabBar( | |
labelStyle: | |
GoogleFonts.lato(textStyle: TextStyle(fontSize: 10)), | |
tabs: [ | |
Tab( | |
icon: Icon( | |
Icons.home, | |
), | |
text: "Home", | |
), | |
Tab( | |
icon: Icon(Icons.search), | |
text: "Search", | |
), | |
Tab(icon: Icon(Icons.personal_video), text: "Coming Soon"), | |
Tab(icon: Icon(Icons.file_download), text: "Downloads"), | |
Tab(icon: Icon(Icons.list), text: "More"), | |
], | |
unselectedLabelColor: Color(0xff999999), | |
labelColor: Colors.white, | |
indicatorColor: Colors.transparent), | |
body: TabBarView( | |
children: [ | |
HomePage(), | |
Center(child: Text("Page 2")), | |
Center( | |
child: Text("Page 3"), | |
), | |
Center( | |
child: Text("Page 3"), | |
), | |
Center(child: Text("Page 4")), | |
], | |
), | |
), | |
)); | |
} | |
} | |
class HomePage extends StatelessWidget { | |
final TextStyle topMenuStyle = GoogleFonts.lato( | |
textStyle: TextStyle( | |
fontSize: 15, color: Colors.white, fontWeight: FontWeight.w600)); | |
final TextStyle buttonInfoStyle = GoogleFonts.lato( | |
textStyle: new TextStyle( | |
fontSize: 10, color: Colors.white, fontWeight: FontWeight.w600)); | |
@override | |
Widget build(BuildContext context) { | |
return new Material( | |
child: Container( | |
child: Center( | |
child: ListView( | |
children: <Widget>[ | |
Stack( | |
children: <Widget>[ | |
Container( | |
height: 500, | |
decoration: new BoxDecoration( | |
image: new DecorationImage( | |
image: new AssetImage("assets/money_heist.jpg"), | |
fit: BoxFit.fitHeight), | |
), | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: <Widget>[ | |
Container( | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | |
children: <Widget>[ | |
Container( | |
height: 50, | |
width: 50, | |
child: Image( | |
image: AssetImage("assets/netflix_icon.png"), | |
)), | |
FlatButton( | |
child: Text( | |
'TV Shows', | |
style: topMenuStyle, | |
), | |
onPressed: () {}, | |
), | |
FlatButton( | |
child: Text( | |
'Movies', | |
style: topMenuStyle, | |
), | |
onPressed: () {}, | |
), | |
FlatButton( | |
child: Text( | |
'My List', | |
style: topMenuStyle, | |
), | |
onPressed: () {}, | |
), | |
], | |
), | |
), | |
], | |
), | |
), | |
Container( | |
height: 500, | |
decoration: BoxDecoration( | |
gradient: LinearGradient(colors: [ | |
Colors.transparent, | |
Colors.transparent, | |
Colors.black54 | |
], begin: Alignment.topCenter, end: Alignment.bottomCenter)), | |
), | |
Positioned( | |
top: 420, | |
child: Container( | |
width: MediaQuery.of(context).size.width, | |
padding: EdgeInsets.only(top: 20, bottom: 20), | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | |
children: <Widget>[ | |
FlatButton( | |
child: Column( | |
children: <Widget>[ | |
Icon(Icons.add, color: Colors.white, size: 30), | |
Text( | |
'My List', | |
style: buttonInfoStyle, | |
) | |
], | |
), | |
onPressed: () {}, | |
), | |
FlatButton( | |
color: Colors.white, | |
child: Row( | |
children: <Widget>[ | |
Icon( | |
Icons.play_arrow, | |
color: Colors.black, | |
), | |
Text( | |
"Play", | |
style: TextStyle(color: Colors.black), | |
) | |
], | |
), | |
onPressed: () {}, | |
), | |
FlatButton( | |
child: Column( | |
children: <Widget>[ | |
Icon( | |
Icons.info_outline, | |
color: Colors.white, | |
size: 30, | |
), | |
Text( | |
'Info', | |
style: buttonInfoStyle, | |
) | |
], | |
), | |
onPressed: () {}, | |
) | |
], | |
), | |
), | |
) | |
], | |
), | |
makeCircleWidget("Previews"), | |
makePopularWidget("TV Comedies"), | |
makePopularWidget("Trending Now"), | |
bannerMovie(context), | |
makePopularWidget("US TV Showes"), | |
makePopularWidget("Crime TV Shows"), | |
makePopularWidget("TV Drames"), | |
makePopularWidget("TV Comedies"), | |
makePopularWidget("Popular in Netflix"), | |
makePopularWidget("Top 10 in India Today"), | |
makeNetflixOrig('NETFLIX ORIGINALS >'), | |
makePopularWidget("Rommantic Movies"), | |
makePopularWidget("New Releases"), | |
makePopularWidget("TV Thillers"), | |
makePopularWidget("Exciting Movies"), | |
makePopularWidget("Documentaries"), | |
makePopularWidget("Romantic Drama"), | |
makePopularWidget("Recently Added"), | |
], | |
), | |
)), | |
); | |
} | |
Widget bannerMovie(BuildContext context) { | |
return new Container( | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: <Widget>[ | |
Padding( | |
padding: const EdgeInsets.all(10), | |
child: Text( | |
'Avalable Now:Season 1', | |
style: GoogleFonts.lato( | |
textStyle: TextStyle( | |
fontSize: 23, | |
color: Colors.white, | |
fontWeight: FontWeight.w600)), | |
), | |
), | |
InkWell( | |
onTap: () { | |
Navigator.of(context).push( | |
MaterialPageRoute( | |
builder: (_) => InfoScreen( | |
imageUrl: "assets/Sacred_games.webp", | |
)), | |
); | |
}, | |
child: Container( | |
child: Image( | |
image: new AssetImage("assets/Sacred_games.webp"), | |
), | |
), | |
), | |
Container( | |
padding: EdgeInsets.only(top: 4, bottom: 4), | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | |
children: <Widget>[ | |
FlatButton( | |
child: Container( | |
padding: EdgeInsets.only(top: 8, bottom: 8), | |
width: 160, | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Icon( | |
Icons.play_arrow, | |
color: Colors.black, | |
), | |
Text( | |
'Play', | |
style: GoogleFonts.lato( | |
textStyle: | |
TextStyle(color: Colors.black, fontSize: 15)), | |
) | |
], | |
), | |
), | |
color: Colors.white, | |
onPressed: () {}, | |
), | |
FlatButton( | |
child: Container( | |
padding: EdgeInsets.only(top: 8, bottom: 8), | |
width: 160, | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Icon( | |
Icons.add, | |
color: Colors.white, | |
), | |
Text( | |
'My List', | |
style: GoogleFonts.lato( | |
textStyle: | |
TextStyle(color: Colors.white, fontSize: 15)), | |
) | |
], | |
), | |
), | |
color: Color(0xff4f4f4f), | |
onPressed: () {}, | |
) | |
], | |
), | |
) | |
], | |
), | |
); | |
} | |
Widget makeNetflixOrig(String title) { | |
return new Container( | |
padding: EdgeInsets.only(top: 30, left: 10), | |
height: 400, | |
child: Column( | |
children: <Widget>[ | |
Expanded( | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.start, | |
children: <Widget>[ | |
Text(title, | |
style: GoogleFonts.lato( | |
textStyle: TextStyle( | |
fontSize: 20, | |
fontWeight: FontWeight.w900, | |
))), | |
]), | |
), | |
Container( | |
height: 350, | |
child: ListView( | |
padding: EdgeInsets.only(right: 6), | |
scrollDirection: Axis.horizontal, | |
//shrinkWrap: true, | |
children: makeOriginals(context)), | |
) | |
], | |
), | |
); | |
} | |
List<Widget> makeOriginals(BuildContext context) { | |
List<Container> movieList = []; | |
for (int i = 0; i < 6; i++) { | |
int a = random.nextInt(18); | |
movieList.add(new Container( | |
margin: EdgeInsets.only(right: 10, top: 10), | |
width: 200, | |
child: InkWell( | |
child: Image.asset("assets/" + a.toString() + ".jpg"), | |
onTap: () { | |
Navigator.of(context).push( | |
MaterialPageRoute( | |
builder: (_) => InfoScreen( | |
imageUrl: "assets/" + a.toString() + ".jpg", | |
)), | |
); | |
}, | |
), | |
)); | |
} | |
return movieList; | |
} | |
Widget makePopularWidget(String title) { | |
return new Container( | |
padding: EdgeInsets.only(left: 10, right: 5, top: 5), | |
height: 250, | |
width: 150, | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: <Widget>[ | |
Text( | |
title, | |
style: GoogleFonts.lato( | |
fontSize: 20, | |
wordSpacing: 2, | |
fontWeight: FontWeight.w900, | |
), | |
), | |
Container( | |
height: 200, | |
child: ListView( | |
scrollDirection: Axis.horizontal, | |
children: makeContainers(context)), | |
) | |
], | |
), | |
); | |
} | |
Widget makeCircleWidget(String title) { | |
return new Container( | |
padding: EdgeInsets.only(left: 10, right: 5, top: 5), | |
height: 200, | |
width: 150, | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: <Widget>[ | |
Text( | |
title, | |
style: GoogleFonts.lato( | |
fontSize: 20, | |
wordSpacing: 2, | |
fontWeight: FontWeight.w900, | |
), | |
), | |
Container( | |
height: 150, | |
child: ListView( | |
scrollDirection: Axis.horizontal, | |
children: makeCircleContainers(context)), | |
) | |
], | |
), | |
); | |
} | |
Random random = Random(); | |
BuildContext context; | |
List<Widget> makeContainers(BuildContext context) { | |
List<Container> movieList = []; | |
for (int i = 0; i < 6; i++) { | |
int a = random.nextInt(18); | |
movieList.add(new Container( | |
padding: EdgeInsets.all(5), | |
height: 200, | |
width: 150, | |
child: InkWell( | |
onTap: () { | |
Navigator.of(context).push( | |
MaterialPageRoute( | |
builder: (_) => InfoScreen( | |
imageUrl: "assets/" + a.toString() + ".jpg", | |
)), | |
); | |
}, | |
child: Image( | |
fit: BoxFit.cover, | |
image: AssetImage("assets/" + a.toString() + ".jpg"), | |
), | |
), | |
)); | |
} | |
return movieList; | |
} | |
List<Widget> makeCircleContainers(BuildContext context) { | |
List<Container> movieList = []; | |
for (int i = 0; i < 6; i++) { | |
int a = random.nextInt(18); | |
movieList.add(new Container( | |
padding: EdgeInsets.all(5), | |
height: 80, | |
width: 150, | |
child: InkWell( | |
onTap: () { | |
Navigator.of(context).push( | |
MaterialPageRoute( | |
builder: (_) => InfoScreen( | |
imageUrl: "assets/" + a.toString() + ".jpg", | |
)), | |
); | |
}, | |
child: ClipRRect( | |
borderRadius: BorderRadius.circular(120), | |
child: Image( | |
fit: BoxFit.cover, | |
image: AssetImage("assets/" + a.toString() + ".jpg"), | |
), | |
), | |
), | |
)); | |
} | |
return movieList; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment