Skip to content

Commit

Permalink
CharactersPage
Browse files Browse the repository at this point in the history
  • Loading branch information
Yashank18 committed Apr 3, 2020
1 parent 3bddaf6 commit 8fb71c9
Show file tree
Hide file tree
Showing 4 changed files with 217 additions and 68 deletions.
123 changes: 64 additions & 59 deletions rickandmorty/lib/characterofTheDay.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,69 +67,74 @@ class _CHaracterOfTheDayState extends State<CHaracterOfTheDay> {
double screenHeight=MediaQuery.of(context).size.height;
double screenWidth=MediaQuery.of(context).size.width;
return SafeArea(
child: Scaffold(
appBar: new AppBar(
backgroundColor:Color.fromRGBO(45, 62, 80, 1),
leading: Icon(Icons.arrow_back_ios,color:Colors.red),
title: Text("Character Of the Day",style: GoogleFonts.varelaRound(textStyle:TextStyle(color:Colors.red)),),
),
body: Container(
height: screenHeight,
width: screenWidth,
color:Color.fromRGBO(45, 62, 80, 1),
child: FutureBuilder<Shape>(
future: futureAlbum,
builder: (context,snapshot){
if(snapshot.hasData){
return Column(
child: WillPopScope(
onWillPop: (){
Navigator.pop(context);
},
child: Scaffold(
appBar: new AppBar(
backgroundColor:Color.fromRGBO(45, 62, 80, 1),
leading: InkWell(onTap: (){Navigator.pop(context);},child: Icon(Icons.arrow_back_ios,color:Colors.red)),
title: Text("Character Of the Day",style: GoogleFonts.varelaRound(textStyle:TextStyle(color:Colors.red)),),
),
body: Container(
height: screenHeight,
width: screenWidth,
color:Color.fromRGBO(45, 62, 80, 1),
child: FutureBuilder<Shape>(
future: futureAlbum,
builder: (context,snapshot){
if(snapshot.hasData){
return Column(

children: <Widget>[

SizedBox(height: screenHeight*0.03,),
Image.network('${snapshot.data.image}',height: screenHeight*0.4,width: screenWidth*0.7,),
SizedBox(height: screenHeight*0.03,),
Text("${snapshot.data.name}",style: GoogleFonts.specialElite(textStyle:TextStyle(fontSize: 35,color:Colors.red))),
SizedBox(height: screenHeight*0.07,),
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(

child: Text("Gender - ${snapshot.data.gender}",style: GoogleFonts.specialElite(textStyle:TextStyle(fontSize: 20,color:Colors.red))),
),
SizedBox(height: screenHeight*0.02,),
Container(

child: Text("Species - ${snapshot.data.species}",style: GoogleFonts.specialElite(textStyle:TextStyle(fontSize: 20,color:Colors.red))),
),
],
),
SizedBox(height: screenHeight*0.07,),
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(

child: Text("Status - ${snapshot.data.status}",style: GoogleFonts.specialElite(textStyle:TextStyle(fontSize: 20,color:Colors.red))),
),
SizedBox(height: screenHeight*0.02,),
Container(

child: Text("Created - ${snapshot.data.created}",style: GoogleFonts.specialElite(textStyle:TextStyle(fontSize: 18,color:Colors.red))),
),
],
)
children: <Widget>[
SizedBox(height: screenHeight*0.03,),
Image.network('${snapshot.data.image}',height: screenHeight*0.4,width: screenWidth*0.7,),
SizedBox(height: screenHeight*0.03,),
Text("${snapshot.data.name}",style: GoogleFonts.specialElite(textStyle:TextStyle(fontSize: 35,color:Colors.red))),
SizedBox(height: screenHeight*0.07,),
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
child: Text("Gender - ${snapshot.data.gender}",style: GoogleFonts.specialElite(textStyle:TextStyle(fontSize: 20,color:Colors.red))),
),
SizedBox(height: screenHeight*0.02,),
Container(
child: Text("Species - ${snapshot.data.species}",style: GoogleFonts.specialElite(textStyle:TextStyle(fontSize: 20,color:Colors.red))),
),
],
),
SizedBox(height: screenHeight*0.07,),
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
child: Text("Status - ${snapshot.data.status}",style: GoogleFonts.specialElite(textStyle:TextStyle(fontSize: 20,color:Colors.red))),
),
SizedBox(height: screenHeight*0.02,),
Container(
child: Text("Created - ${snapshot.data.created}",style: GoogleFonts.specialElite(textStyle:TextStyle(fontSize: 18,color:Colors.red))),
),
],
)

],
);
}
else {
return CircularProgressIndicator();
}
},
],
);
}
else {
return CircularProgressIndicator();
}
},
),
),
),
),
),
);
}
}
65 changes: 65 additions & 0 deletions rickandmorty/lib/characters.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:http/http.dart' as http;

class characters extends StatefulWidget {
characters({Key key}) : super(key: key);

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


class _charactersState extends State<characters> {

List data;

// Function to get the JSON data
Future<String> getJSONData() async {
var response = await http.get(
// Encode the url
Uri.encodeFull("https://rickandmortyapi.com/api/character/"),

);

setState(() {
// Get the JSON data
data = json.decode(response.body)['results'];
});

return "Successfull";
}
@override
Widget build(BuildContext context) {
double screenHeight=MediaQuery.of(context).size.height;
double screenWidth=MediaQuery.of(context).size.width;
return SafeArea(
child: WillPopScope(
onWillPop: (){Navigator.pop(context);},
child: Scaffold(
appBar: new AppBar(
backgroundColor:Color.fromRGBO(45, 62, 80, 1),
leading: InkWell(onTap: (){Navigator.pop(context);},child: Icon(Icons.arrow_back_ios,color:Colors.red)),
title: Text("Characters",style: GoogleFonts.varelaRound(textStyle:TextStyle(color:Colors.red)),),
),
body: Container(
color:Color.fromRGBO(45, 62, 80, 1),
child: ListView.builder(
itemCount: data == null ? 0 : data.length,
itemBuilder: (context, index) {
return _build(data[index],screenHeight);
// return _buildRow(data[index]);
}
),

),
),
),
);
}
}
Widget _build(dynamic item,double screenh)=> Card(
child:Text(item['name'])
);
73 changes: 73 additions & 0 deletions rickandmorty/lib/cookedBook.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:rickandmorty/characters.dart';

class cookedBook extends StatefulWidget {
cookedBook({Key key}) : super(key: key);

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

class _cookedBookState extends State<cookedBook> {

@override
Widget build(BuildContext context) {
double screenHeight=MediaQuery.of(context).size.height;
double screenWidth=MediaQuery.of(context).size.width;
return SafeArea(
child: WillPopScope(
onWillPop: (){Navigator.pop(context);},
child: Scaffold(
appBar: new AppBar(
backgroundColor:Color.fromRGBO(45, 62, 80, 1),
leading: InkWell(onTap: (){Navigator.pop(context);},child: Icon(Icons.arrow_back_ios,color:Colors.red)),
title: Text("Cooked Book",style: GoogleFonts.varelaRound(textStyle:TextStyle(color:Colors.red)),),
),
body: Container(
height: screenHeight,
width: screenWidth,
color:Color.fromRGBO(45, 62, 80, 1),
child:Column(

children: <Widget>[
SizedBox(height: screenHeight*0.05,),
Image.network("https://www.cartoongoodies.com/wp-content/uploads/2019/11/Rick-and-Mortimer-running.png"),
SizedBox(height: screenHeight*0.15,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
InkWell(
onTap: (){
Navigator.push(context, new MaterialPageRoute(builder: (__) => new characters()));
},
child: Container(
height: screenHeight*0.15,
width: screenWidth*0.4,
color: Colors.blue.shade100.withOpacity(0.1),
child: Center(child:Text("Characters",style: GoogleFonts.varelaRound(textStyle:TextStyle(color: Colors.red,fontSize: 25)),)),
),
),
Container(
height: screenHeight*0.15,
width: screenWidth*0.4,
color: Colors.blue.shade100.withOpacity(0.1),
child: Center(child:Text("Locations",style: GoogleFonts.varelaRound(textStyle:TextStyle(color: Colors.red,fontSize: 25)),)),
),
],
),
SizedBox(height: screenHeight*0.04,),
Container(
height: screenHeight*0.15,
width: screenWidth*0.9,
color: Colors.blue.shade100.withOpacity(0.1),
child: Center(child:Text("Episodes",style: GoogleFonts.varelaRound(textStyle:TextStyle(color: Colors.red,fontSize: 25)),)),
),
],
),
),
),
),
);
}
}
24 changes: 15 additions & 9 deletions rickandmorty/lib/homescreen.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:rickandmorty/characterofTheDay.dart';
import 'package:rickandmorty/cookedBook.dart';

class homescreen extends StatefulWidget {
homescreen({Key key}) : super(key: key);
Expand Down Expand Up @@ -73,16 +74,21 @@ with SingleTickerProviderStateMixin {
),
AnimatedBuilder(
animation: animationController,
child: Container(

height: screenHeight*0.2,
width: screenWidth*0.35,
decoration: BoxDecoration(
color: Color.fromRGBO(45, 62, 80, 1),
image: DecorationImage(image: AssetImage("Images/bg.png",),fit: BoxFit.cover,),
border: Border.all(color: Color.fromRGBO(45, 62, 80, 1),width: 0),
child: InkWell(
onTap: (){
Navigator.push(context, new MaterialPageRoute(builder: (__) => new cookedBook()));
},
child: Container(

height: screenHeight*0.2,
width: screenWidth*0.35,
decoration: BoxDecoration(
color: Color.fromRGBO(45, 62, 80, 1),
image: DecorationImage(image: AssetImage("Images/bg.png",),fit: BoxFit.cover,),
border: Border.all(color: Color.fromRGBO(45, 62, 80, 1),width: 0),
),
child: Center(child: Text("Cooked Book",textAlign: TextAlign.center,style: GoogleFonts.russoOne(textStyle:TextStyle(fontSize: 20.0)),),),
),
child: Center(child: Text("Cooked Book",textAlign: TextAlign.center,style: GoogleFonts.russoOne(textStyle:TextStyle(fontSize: 20.0)),),),
),
builder: (BuildContext context, Widget _widget) {
return new Transform.rotate(
Expand Down

0 comments on commit 8fb71c9

Please sign in to comment.