Skip to content

Commit

Permalink
Pokedex with Flutter
Browse files Browse the repository at this point in the history
  • Loading branch information
imayush-chauhan committed Dec 9, 2021
1 parent f59aff2 commit 05d4273
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 48 deletions.
1 change: 0 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,5 @@ flutter {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation platform('com.google.firebase:firebase-bom:29.0.0')
implementation 'com.google.android.gms:play-services-ads:20.5.0'
implementation 'com.google.firebase:firebase-analytics-ktx'
}
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package="com.blackhole.pokidexayu.pokidexayu">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:label="pokidexayu"
android:label="InfoDex"
android:icon="@mipmap/ic_launcher">
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.4.32'
ext.kotlin_version = '1.5.31'
repositories {
google()
jcenter()
Expand Down
1 change: 1 addition & 0 deletions lib/data/data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Data {
static bool isIntro = false;
static bool isSignIn = false;
static User? user;
static int isInAds = 0;

static String n = "Loading...";
static int inx = 0;
Expand Down
12 changes: 6 additions & 6 deletions lib/pokemon/infoScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ class _InfoScreenState extends State<InfoScreen> {
ad: _ad!,
),
),
height: 50,
width: 320,
height: _ad!.size.height.toDouble(),
width: _ad!.size.width.toDouble(),
alignment: Alignment.center,
);
}else{
Expand Down Expand Up @@ -206,7 +206,7 @@ class _InfoScreenState extends State<InfoScreen> {
thickColor = Colors.grey.shade400;
}
totalPoints();
Future.delayed(Duration(milliseconds: 300), () {
Future.delayed(Duration(milliseconds: 400), () {
calculator();
});
bannerAds();
Expand Down Expand Up @@ -463,7 +463,7 @@ class _InfoScreenState extends State<InfoScreen> {
GestureDetector(
onTap: () {
isType == false ?
Future.delayed(Duration(milliseconds: 500), () {
Future.delayed(Duration(milliseconds: 800), () {
setState(() {
click =
Data.poke["pokemon"][widget
Expand Down Expand Up @@ -511,7 +511,7 @@ class _InfoScreenState extends State<InfoScreen> {
GestureDetector(
onTap: () {
isType == false ?
Future.delayed(Duration(milliseconds: 500), () {
Future.delayed(Duration(milliseconds: 800), () {
setState(() {
click =
Data.poke["pokemon"][widget
Expand Down Expand Up @@ -1294,7 +1294,7 @@ class _InfoScreenState extends State<InfoScreen> {
return GestureDetector(
onTap: () {
isType == false ?
Future.delayed(Duration(milliseconds: 500), () {
Future.delayed(Duration(milliseconds: 800), () {
setState(() {
click =
Data.poke["pokemon"][widget
Expand Down
120 changes: 82 additions & 38 deletions lib/pokemon/pokemon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
import 'package:http/http.dart' as http;
import 'package:page_transition/page_transition.dart';
import 'package:pokidexayu/data/data.dart';
Expand Down Expand Up @@ -108,11 +109,46 @@ class _PokemonState extends State<Pokemon> with SingleTickerProviderStateMixin {
_controller.addListener(_scrollListener);
getFav();
getData();
loadInAd();
print(">>>>>>>>>>>>>>>>>>>>>>>>");
controller = AnimationController(
vsync: this,
duration: Duration(milliseconds: 600),
);
}

InterstitialAd? _in;
bool isLoadedIn = false;

loadInAd(){
if(Data.showAds == true){
_in = InterstitialAd(
// adUnitId: "ca-app-pub-3028010056599796/1200794278",
adUnitId: InterstitialAd.testAdUnitId,
request: AdRequest(
keywords: ["amazon", "games", "land", "collage","toys","learn","coding","food"],
),
listener: AdListener(
onAdLoaded: (_){
setState(() {
isLoadedIn = true;
print("hmm true >>>>>>>>");
});
},
onAdFailedToLoad: (_ad,error){
print("Ad failed to load on Error: $error");
}
),
);
_in!.load();
}
}

showInAd(){
if(isLoadedIn == true){
_in!.show();
}
}

final fireStore = Firebase.initializeApp();
String url = "";
Expand Down Expand Up @@ -235,7 +271,15 @@ class _PokemonState extends State<Pokemon> with SingleTickerProviderStateMixin {
setState(() {
isCollapsed = false;
iconAnimation();
if(Data.isInAds != 5){
Data.isInAds++;
}else{
Data.isInAds = 0;
}
});
if(Data.isInAds == 5){
showInAd();
}
Future.delayed(Duration(milliseconds: 150), () {
Navigator.push(context, PageTransition(
child: InfoScreen(
Expand Down Expand Up @@ -955,44 +999,7 @@ class _PokemonState extends State<Pokemon> with SingleTickerProviderStateMixin {
),
Padding(
padding: const EdgeInsets.only(left: 15),
child: Text("Help",
style: GoogleFonts.roboto(
fontSize: 20,
fontWeight: FontWeight.w600,
color: Colors.black.withOpacity(0.9),
)),
),
],
),
),
),
GestureDetector(
onTap: () {
FirebaseAuth.instance.signOut();
},
child: Container(
height: 55,
width: MediaQuery
.of(context)
.size
.width * 0.6,
alignment: Alignment.centerLeft,
color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(left: 20),
child: Icon(Icons.logout),
// child: Icon(Icons.hel,
// color: Colors.black.withOpacity(0.9),
// size: 20,
// ),
),
Padding(
padding: const EdgeInsets.only(left: 15),
child: Text("Logout",
child: Text("About",
style: GoogleFonts.roboto(
fontSize: 20,
fontWeight: FontWeight.w600,
Expand All @@ -1003,6 +1010,43 @@ class _PokemonState extends State<Pokemon> with SingleTickerProviderStateMixin {
),
),
),
// GestureDetector(
// onTap: () {
// FirebaseAuth.instance.signOut();
// },
// child: Container(
// height: 55,
// width: MediaQuery
// .of(context)
// .size
// .width * 0.6,
// alignment: Alignment.centerLeft,
// color: Colors.white,
// child: Row(
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Padding(
// padding: const EdgeInsets.only(left: 20),
// child: Icon(Icons.logout),
// // child: Icon(Icons.hel,
// // color: Colors.black.withOpacity(0.9),
// // size: 20,
// // ),
// ),
// Padding(
// padding: const EdgeInsets.only(left: 15),
// child: Text("Logout",
// style: GoogleFonts.roboto(
// fontSize: 20,
// fontWeight: FontWeight.w600,
// color: Colors.black.withOpacity(0.9),
// )),
// ),
// ],
// ),
// ),
// ),
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies:
cloud_firestore:
firebase_auth:
firebase_storage:
google_mobile_ads: ^0.12.1+1
google_mobile_ads:
cached_network_image: ^3.0.0
url_launcher:
http:
Expand Down

0 comments on commit 05d4273

Please sign in to comment.