-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Platform view devicelab ad banner scroll list real ads #145239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 21 commits
da55c70
a34b4ef
03348d1
5ac97bb
4f8de1b
a50f665
7e3418c
be377eb
fd34fd6
8403248
06a0244
a9b0bae
46f468e
768eed0
615eab9
4f2f089
18e5f20
dd357fb
1280553
4487b75
1f78af1
3c2ab41
413bde1
1203ccd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,5 +20,9 @@ found in the LICENSE file. --> | |
| </intent-filter> | ||
| </activity> | ||
| <meta-data android:name="flutterEmbedding" android:value="2"/> | ||
| <!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 --> | ||
| <meta-data | ||
| android:name="com.google.android.gms.ads.APPLICATION_ID" | ||
| android:value="ca-app-pub-3940256099942544~3347511713" /> | ||
|
Comment on lines
+23
to
+26
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the only change on top of #145224 |
||
| </application> | ||
| </manifest> | ||
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" | ||
| #include "Generated.xcconfig" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" | ||
| #include "Generated.xcconfig" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # Uncomment this line to define a global platform for your project | ||
| # platform :ios, '12.0' | ||
|
|
||
| # CocoaPods analytics sends network stats synchronously affecting flutter build latency. | ||
| ENV['COCOAPODS_DISABLE_STATS'] = 'true' | ||
|
|
||
| project 'Runner', { | ||
| 'Debug' => :debug, | ||
| 'Profile' => :release, | ||
| 'Release' => :release, | ||
| } | ||
|
|
||
| def flutter_root | ||
| generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) | ||
| unless File.exist?(generated_xcode_build_settings_path) | ||
| raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" | ||
| end | ||
|
|
||
| File.foreach(generated_xcode_build_settings_path) do |line| | ||
| matches = line.match(/FLUTTER_ROOT\=(.*)/) | ||
| return matches[1].strip if matches | ||
| end | ||
| raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" | ||
| end | ||
|
|
||
| require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) | ||
|
|
||
| flutter_ios_podfile_setup | ||
|
|
||
| target 'Runner' do | ||
| flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) | ||
| end | ||
|
|
||
| post_install do |installer| | ||
| installer.pods_project.targets.each do |target| | ||
| flutter_additional_ios_build_settings(target) | ||
| end | ||
| end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| // Copyright 2014 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| import 'dart:io'; | ||
|
|
||
| import 'package:flutter/material.dart'; | ||
| import 'package:google_mobile_ads/google_mobile_ads.dart'; | ||
|
|
||
| void main() { | ||
| runApp( | ||
| const PlatformViewApp() | ||
| ); | ||
| } | ||
|
|
||
| class PlatformViewApp extends StatefulWidget { | ||
| const PlatformViewApp({ | ||
| super.key, | ||
| }); | ||
|
|
||
| @override | ||
| PlatformViewAppState createState() => PlatformViewAppState(); | ||
| } | ||
|
|
||
| class PlatformViewAppState extends State<PlatformViewApp> { | ||
|
|
||
| AdWidget _getBannerWidget() { | ||
| // Test IDs from Admob: | ||
| // https://developers.google.com/admob/ios/test-ads | ||
| // https://developers.google.com/admob/android/test-ads | ||
| final String bannerId = Platform.isAndroid | ||
| ? 'ca-app-pub-3940256099942544/6300978111' | ||
| : 'ca-app-pub-3940256099942544/2934735716'; | ||
| final BannerAd bannerAd = BannerAd( | ||
| adUnitId: bannerId, | ||
| request: const AdRequest(), | ||
| size: AdSize.banner, | ||
| listener: const BannerAdListener(), | ||
| ); | ||
| bannerAd.load(); | ||
| return AdWidget(ad: bannerAd); | ||
| } | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return MaterialApp( | ||
| theme: ThemeData.light(), | ||
| title: 'Advanced Layout', | ||
| home: Scaffold( | ||
| appBar: AppBar(title: const Text('Platform View Ad Banners')), | ||
| body: ListView.builder( | ||
| key: const Key('platform-views-scroll'), // This key is used by the driver test. | ||
| itemCount: 250, | ||
| itemBuilder: (BuildContext context, int index) { | ||
| return index.isEven | ||
| // Use 320x50 Admob standard banner size. | ||
| ? SizedBox(width: 320, height: 50, child: _getBannerWidget()) | ||
| // Adjust the height to control number of platform views on screen. | ||
| // TODO(hellohuanlin): Having more than 5 banners on screen causes an unknown crash. | ||
| // See: https://github.com/flutter/flutter/issues/144339 | ||
| : const SizedBox(height: 150, child: ColoredBox(color: Colors.yellow)); | ||
| }, | ||
| ), | ||
| ), | ||
| ); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I won't land the
presubmit: falsechanges, I want to validate in presubmit.