Skip to content

Instantly share code, notes, and snippets.

@nucklearproject
Last active Nov 23, 2019
Embed
What would you like to do?
Prueba test Flutter positioned into Stack
import 'package:firebase_admob/firebase_admob.dart';
import '../services/globals.dart';
class Ads {
InterstitialAd myInterstitial;
MobileAdTargetingInfo targetingInfo = new MobileAdTargetingInfo(
testDevices: TEST_DEVICES,
/* keywords: <String>[
"tarot",
"horoscopo gratis",
"horoscopo diario",
"tarot gratis",
"videntes buenas",
"free tarot reading",
"voyance",
"free voyance",
"free Horoscope"
],
contentUrl: "https://tarotgratishd.com/",
childDirected: false,
designedForFamilies: true,
gender: MobileAdGender.unknown,
*/
);
InterstitialAd createBannerInter() {
return new InterstitialAd(
adUnitId: AD_MOB_INTERSITIAL_ID, //InterstitialAd.testAdUnitId,
targetingInfo: targetingInfo,
listener: (MobileAdEvent event) {
print("BannerAd event is $event");
if (event == MobileAdEvent.closed) {}
},
);
}
void showInter() {
FirebaseAdMob.instance.initialize(appId: AD_MOB_APP_ID);
myInterstitial = createBannerInter()
..load()
..show();
}
void showPub() {
print("no hace nada por ahora");
}
//**********************************************
//la idea es hacer algo asi para poder llamarlo desde otras pantallas, el load al cargar la pantalla y
// el show en cualquier evento que yo quiera. Ads().loadInter(); y Ads().showInter()
showInter(){
myInterstitial..show();
}
loadInter(){
FirebaseAdMob.instance.initialize(appId: AD_MOB_APP_ID);
myInterstitial = createBannerInter()
..load();
}
}
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can
// be found in the LICENSE file.
// Demonstrates a basic shared element (Hero) animation.
import 'package:flutter/material.dart';
import '../comunes/recursos.dart' as _recursos;
class Pruebas extends StatelessWidget {
Widget build(BuildContext context) {
var arregloListaCartas = [
'm0',
'm1',
'm2',
'm3',
'm4',
'm5',
'm6',
'm7',
'm8',
'm9',
'm10',
'm11',
'm12',
'm13',
'm14',
'm15',
'm16',
'm17',
'm18',
'm19',
'm20',
'm21'
];
var randomItem = (arregloListaCartas..shuffle());
aleatorio(int _id) {
print(randomItem[_id]);
}
Widget _stacker() {
return Container(
height: 196.0,
margin: const EdgeInsets.only(top: 40.0),
child: new ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
new Stack(
children: new List.generate(22, (int index) {
return GestureDetector(
onTap: () {
aleatorio(index);
},
child: new Container(
// padding: const EdgeInsets.all(4.0),
// margin: const EdgeInsets.only(left: 20.0),
margin: const EdgeInsets.only(right: 5.0),
width: 110.0,
height: 196.0,
child: new Image(
image: new AssetImage('assets/bgcard-a.jpg'),
fit: BoxFit.cover)));
}))
],
));
}
return Scaffold(
appBar: AppBar(
title: const Text('Prueba test'),
),
body: new Stack(
children: <Widget>[
new Container(
decoration: _recursos.backgroundImageComun(),
),
_stacker()
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment