Reverts: flutter/flutter#145224 Initiated by: hellohuanlin Reason for reverting: breaks the tree Original PR Author: hellohuanlin Reviewed By: {gmackall, jmagman} This change reverts the following previous change: Reland https://github.com/flutter/flutter/pull/144745, which got reverted due to Android lockfile. Fixed by `dart dev/tools/bin/generate_gradle_lockfiles.dart` *List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.* Fixes https://github.com/flutter/flutter/issues/143534 Fixes https://github.com/flutter/flutter/issues/143257 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
This commit is contained in:
@@ -1,67 +0,0 @@
|
||||
// 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));
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user