Last active
May 23, 2020 19:30
-
-
Save freedive-cebu30/c36d52ee4de145319cdffafbeec9100e to your computer and use it in GitHub Desktop.
admob_3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'package:cloud_firestore/cloud_firestore.dart'; | |
import 'package:firebase_admob/firebase_admob.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter_localizations/flutter_localizations.dart'; | |
import 'package:google_maps_flutter/google_maps_flutter.dart'; | |
import 'package:location/location.dart'; | |
import 'package:phexchangestore/models/store.dart'; | |
import 'package:phexchangestore/models/store_data.dart'; | |
import 'i18n.dart'; | |
import 'i18n_delegate.dart'; | |
final _firestore = Firestore.instance; | |
Completer<GoogleMapController> _controller = Completer(); | |
void main() { | |
runApp( | |
ExchangeShop(), | |
); | |
} | |
class ExchangeShop extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
localizationsDelegates: [ | |
const I18nDelegate(), | |
GlobalMaterialLocalizations.delegate, | |
GlobalWidgetsLocalizations.delegate, | |
GlobalCupertinoLocalizations.delegate, | |
], | |
supportedLocales: [ | |
const Locale("en", "US"), | |
const Locale("ja", "JP"), | |
], | |
home: ExchangeShopApp(), | |
); | |
} | |
} | |
class ExchangeShopApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Center(child: Text(I18n.of(context).title)), | |
), | |
body: MapCebu(), | |
); | |
} | |
} | |
class MapCebu extends StatefulWidget { | |
@override | |
State<MapCebu> createState() => MapCebuState(); | |
} | |
class MapCebuState extends State<MapCebu> { | |
LocationData currentLocation; | |
Location _locationService = Location(); | |
String error; | |
BitmapDescriptor pinLocationIcon; | |
StoreData storeData = StoreData(); | |
@override | |
void initState() { | |
super.initState(); | |
// テスト用の広告IDです | |
FirebaseAdMob.instance.initialize(appId: FirebaseAdMob.testAppId); | |
BannerAd _bannerAd = _createBannerAd(); | |
_bannerAd | |
..load() | |
..show( | |
anchorOffset: 20.0, | |
); | |
} | |
@override | |
Widget build(BuildContext context) { | |
Locale _locale = Localizations.localeOf(context); | |
return new Scaffold( | |
); | |
} | |
BannerAd _createBannerAd() { | |
return new BannerAd( | |
// テスト用の広告ユニットです | |
adUnitId: BannerAd.testAdUnitId, | |
size: AdSize.banner, | |
targetingInfo: _targetingInfo, | |
listener: (MobileAdEvent event) { | |
print("BannerAd event $event"); | |
}, | |
); | |
} | |
MobileAdTargetingInfo _targetingInfo = new MobileAdTargetingInfo( | |
keywords: <String>['travel'], | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment