diff --git a/.gitignore b/.gitignore
index 7a3667b..0d94d3c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,3 +23,8 @@ build/
/android/misc/api-8857670977859340350-9644-c1e382e20443.json
.flutter-plugins-dependencies
.dart_tool/
+/android/app/flutter_playground.jks
+/upload_certificate.pem
+/lib/ads/ad_helper.dart
+/android/app/release/
+/ios/Flutter/flutter_export_environment.sh
diff --git a/android/.gitignore b/android/.gitignore
index ae0cff2..f03a9f3 100644
--- a/android/.gitignore
+++ b/android/.gitignore
@@ -9,4 +9,5 @@
/captures
GeneratedPluginRegistrant.java
/misc/flutterplayground.jks
-/key.properties
\ No newline at end of file
+/key.properties
+/app/src/main/res/values/strings.xml
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 403444f..19d5ed5 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -46,7 +46,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.ibhavikmakwana.flutterplayground"
- minSdkVersion 20
+ minSdkVersion 21
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index e36a723..587e634 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -7,6 +7,21 @@
-->
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
diff --git a/android/app/src/main/res/values/test_strings.xml b/android/app/src/main/res/values/test_strings.xml
new file mode 100644
index 0000000..545bddf
--- /dev/null
+++ b/android/app/src/main/res/values/test_strings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/assets/images/ic_github.svg b/assets/images/ic_github.svg
new file mode 100644
index 0000000..be8bd55
--- /dev/null
+++ b/assets/images/ic_github.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/lib/ads/test_ad_helper.dart b/lib/ads/test_ad_helper.dart
new file mode 100644
index 0000000..064fe37
--- /dev/null
+++ b/lib/ads/test_ad_helper.dart
@@ -0,0 +1,11 @@
+import 'dart:io';
+
+class AdHelper {
+ static String get bannerAdUnitId {
+ if (Platform.isAndroid) {
+ return "ca-app-pub-3940256099942544/6300978111";
+ } else {
+ throw new UnsupportedError("Unsupported platform");
+ }
+ }
+}
diff --git a/lib/main.dart b/lib/main.dart
index cbb5657..4721a8b 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -4,11 +4,10 @@
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
-import 'package:flutter_playground/store/theme_store.dart';
-import 'package:provider/provider.dart';
-
import 'package:flutter_playground/my_app.dart';
+import 'package:flutter_playground/store/theme_store.dart';
import 'package:flutter_playground/values/imports.dart';
+import 'package:provider/provider.dart';
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
diff --git a/lib/ui/staggeredanimation/StaggerDemo.dart b/lib/ui/staggeredanimation/StaggerDemo.dart
index cceac24..2a792ad 100644
--- a/lib/ui/staggeredanimation/StaggerDemo.dart
+++ b/lib/ui/staggeredanimation/StaggerDemo.dart
@@ -101,7 +101,7 @@ class StaggerAnimation extends StatelessWidget {
final Animation width;
final Animation height;
final Animation padding;
- final Animation borderRadius;
+ final Animation borderRadius;
final Animation color;
// This function is called each time the controller "ticks" a frame.
diff --git a/lib/ui_ux/home_page/my_home_page.dart b/lib/ui_ux/home_page/my_home_page.dart
index 002841f..69674c3 100644
--- a/lib/ui_ux/home_page/my_home_page.dart
+++ b/lib/ui_ux/home_page/my_home_page.dart
@@ -1,14 +1,18 @@
+import 'dart:developer';
+
import 'package:flutter/material.dart';
+import 'package:flutter_playground/ads/ad_helper.dart';
import 'package:flutter_playground/store/theme_store.dart';
+import 'package:flutter_playground/ui_ux/home_page/my_home_page_store.dart';
import 'package:flutter_playground/ui_ux/open_source_licenses.dart';
import 'package:flutter_playground/ui_ux/search_widget.dart';
import 'package:flutter_playground/values/assets.dart';
import 'package:flutter_playground/values/imports.dart';
+import 'package:flutter_svg/flutter_svg.dart';
+import 'package:google_mobile_ads/google_mobile_ads.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
-import 'package:flutter_playground/ui_ux/home_page/my_home_page_store.dart';
-
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@@ -19,12 +23,37 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State {
MyHomePageStore? store;
+ late BannerAd _ad;
+ bool _isAdLoaded = false;
@override
void initState() {
super.initState();
+ _initGoogleMobileAds();
+ _ad = BannerAd(
+ adUnitId: AdHelper.bannerAdUnitId,
+ size: AdSize.banner,
+ request: const AdRequest(),
+ listener: BannerAdListener(
+ onAdLoaded: (_) {
+ setState(() {
+ _isAdLoaded = true;
+ });
+ },
+ onAdFailedToLoad: (ad, error) {
+ // Releases an ad resource when it fails to load
+ ad.dispose();
+
+ log('Ad load failed (code=${error.code} message=${error.message})');
+ },
+ ),
+ );
+ _ad.load();
}
+ Future _initGoogleMobileAds() =>
+ MobileAds.instance.initialize();
+
@override
void didChangeDependencies() {
store ??= Provider.of(context);
@@ -33,6 +62,7 @@ class _MyHomePageState extends State {
@override
void dispose() {
+ _ad.dispose();
super.dispose();
}
@@ -72,9 +102,23 @@ class _MyHomePageState extends State {
SafeArea(
child: Container(
margin: const EdgeInsets.all(16),
- child: Text(
- widget.title,
- style: Theme.of(context).textTheme.headline6,
+ child: Row(
+ children: [
+ Expanded(
+ child: Text(
+ widget.title,
+ style: Theme.of(context).textTheme.headline6,
+ ),
+ ),
+ IconButton(
+ onPressed: () {
+ _launchURL(
+ 'https://github.com/ibhavikmakwana/FlutterPlayground',
+ );
+ },
+ icon: SvgPicture.asset(Assets.icGithub),
+ ),
+ ],
),
),
),
@@ -92,6 +136,15 @@ class _MyHomePageState extends State {
),
),
),
+ if (_isAdLoaded)
+ Center(
+ child: Container(
+ width: _ad.size.width.toDouble(),
+ height: 72.0,
+ alignment: Alignment.center,
+ child: AdWidget(ad: _ad),
+ ),
+ ),
Flexible(
child: _buildExampleItemsWidget(),
),
@@ -141,7 +194,9 @@ class _MyHomePageState extends State {
const Divider(),
ListTile(
title: const Text('Privacy Policy'),
- onTap: _launchURL,
+ onTap: () => _launchURL(
+ 'https://flutter-playground.flycricket.io/privacy.html',
+ ),
),
],
),
@@ -163,8 +218,7 @@ class _MyHomePageState extends State {
);
}
- Future _launchURL() async {
- const url = 'https://flutter-playground.flycricket.io/privacy.html';
+ Future _launchURL(String url) async {
if (await canLaunch(url)) {
await launch(url);
} else {
diff --git a/lib/values/assets.dart b/lib/values/assets.dart
index 1cb169c..fb2fc14 100644
--- a/lib/values/assets.dart
+++ b/lib/values/assets.dart
@@ -1,4 +1,5 @@
class Assets {
static const String featureGraphic = 'assets/images/feature-graphic.png';
static const String appIcon = 'assets/images/ic_launcher.png';
+ static const String icGithub = 'assets/images/ic_github.svg';
}
diff --git a/pubspec.yaml b/pubspec.yaml
index 783ce57..ff41028 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -11,7 +11,7 @@ description: A Flutter application contains a list of Flutter Examples.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
-version: 1.2.7+10
+version: 1.2.9+170
environment:
sdk: ">=2.12.0 <3.0.0"
@@ -35,6 +35,7 @@ dependencies:
webview_flutter: ^2.0.4
firebase_analytics: ^8.0.4
firebase_core: ^1.1.1
+ flutter_svg:
dev_dependencies:
flutter_test:
@@ -42,6 +43,7 @@ dev_dependencies:
build_runner: ^2.0.3
mobx_codegen: ^2.0.1+3
lint: ^1.5.3
+ google_mobile_ads: ^0.13.4
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec