Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 31k
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
da55c70a34b4ef03348d15ac97bb4f8de1ba50f6657e3418cbe377ebfd34fd6840324806a0244a9b0bae46f468e768eed0615eab94f2f08918e5f20dd357fb12805534487b751f78af13c2ab41413bde11203ccdFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
| 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.
Uh oh!
There was an error while loading. Please reload this page.
| 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)); | ||
| }, | ||
| ), | ||
| ), | ||
| ); | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.
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.
This is the only change on top of #145224