-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
217 additions
and
68 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
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']) | ||
); |
This file contains 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
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)),)), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains 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