Skip to content

Instantly share code, notes, and snippets.

@anmolseth06
Created May 19, 2020 05:47
Show Gist options
  • Select an option

  • Save anmolseth06/7bd9fde3b8bfb13b71e0bdb3d35650b1 to your computer and use it in GitHub Desktop.

Select an option

Save anmolseth06/7bd9fde3b8bfb13b71e0bdb3d35650b1 to your computer and use it in GitHub Desktop.
import 'dart:math';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:netflixclone/dummyData.dart';
class InfoScreen extends StatelessWidget {
int index;
String imageUrl;
InfoScreen({@required this.imageUrl, @required this.index});
@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
return Theme(
data: ThemeData.dark(),
child: Scaffold(
body: SafeArea(
child: ListView(
children: <Widget>[
Stack(
children: <Widget>[
Container(
height: size.height * 0.35,
width: size.width,
child: Image.asset(
imageUrl,
fit: BoxFit.fitWidth,
),
),
Positioned(
child: Icon(
Icons.play_arrow,
size: 70,
),
left: size.width * 0.45,
top: size.width * 0.16,
),
Positioned(
child: IconButton(
onPressed: () {
Navigator.of(context).pop();
},
icon: Icon(
Icons.arrow_back,
),
),
left: 20,
top: 10),
Positioned(
child: Container(
height: size.height * 0.35,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Colors.grey[850],
Colors.transparent,
Colors.transparent,
Colors.transparent,
Colors.transparent,
Colors.transparent,
Colors.transparent,
Colors.grey[850]
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter)),
),
),
Positioned(
top: size.height * 0.27,
left: 15,
child: Text(
DUMMY_DATA[index].title,
style: GoogleFonts.lato(
textStyle: TextStyle(
fontSize: 27, fontWeight: FontWeight.w900)),
),
),
],
),
Container(
width: size.width * 0.6,
padding: EdgeInsets.only(left: 15, right: 50),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
"91% Match",
style: GoogleFonts.baloo(
textStyle: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w900,
color: Colors.greenAccent)),
),
Text(
DUMMY_DATA[index].year.toString(),
style: TextStyle(color: Colors.grey),
),
Text(
"${DUMMY_DATA[index].ageGroup.toString()}+",
style: TextStyle(color: Colors.grey),
),
Text(
"${DUMMY_DATA[index].totalSeason.toString()} Season",
style: TextStyle(color: Colors.grey),
)
],
),
),
Container(
padding: EdgeInsets.only(left: 15, right: 15),
child: Text(
DUMMY_DATA[index].about,
style: GoogleFonts.lato(
textStyle: TextStyle(
fontWeight: FontWeight.bold, wordSpacing: 2)),
),
),
Container(
padding: EdgeInsets.only(left: 15, right: 15, top: 15),
child: Text(
"Starring: ${DUMMY_DATA[index].starring}",
style: GoogleFonts.lato(),
),
),
Container(
padding:
EdgeInsets.only(left: 40, right: 40, top: 20, bottom: 20),
width: size.width,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
_widget(Icons.add, "My List"),
_widget(Icons.thumb_up, "Rate"),
_widget(Icons.share, "Share"),
_widget(Icons.file_download, "Download")
],
),
),
Divider(
height: 1,
thickness: 1.5,
color: Colors.black,
),
Padding(
padding: const EdgeInsets.only(left: 15, top: 20, bottom: 25),
child: Text(
"MORE LIKE THIS",
style: GoogleFonts.lato(
textStyle:
TextStyle(fontSize: 15, fontWeight: FontWeight.w700)),
),
),
Container(
height: 700,
child: GridView(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, childAspectRatio: 3 / 5),
children: makeContainers(context),
),
)
],
),
),
),
);
}
}
Random random = Random();
List<Container> movieList = [];
BuildContext context;
List<Widget> makeContainers(BuildContext context) {
for (int i = 0; i < 12; i++) {
int a = random.nextInt(18);
movieList.add(new Container(
padding: EdgeInsets.all(5),
height: 300,
width: 150,
child: InkWell(
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => InfoScreen(
index: a,
imageUrl: "assets/" + a.toString() + ".jpg",
)),
);
},
child: Image(
fit: BoxFit.cover,
image: AssetImage("assets/" + a.toString() + ".jpg"),
),
),
));
}
return movieList;
}
Widget _widget(IconData iconData, String string) {
return Column(
children: <Widget>[
Icon(iconData),
Text(
string,
style: GoogleFonts.lato(),
),
],
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment