adgydeplugin 4.1.8 adgydeplugin: ^4.1.8 copied to clipboard
AdGyde Flutter plugin is used for integration of AdGyde SDk in Android and Ios.
import 'dart:collection';
import 'package:flutter/material.dart';
import 'dart:async';
//import 'package:flutter/services.dart';
import 'package:adgydeplugin/adgydeplugin.dart';
import 'package:adgydeplugin_example/countingevent.dart';
import 'package:adgydeplugin_example/uniqueevent.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.red,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
Adgydeplugin adgydesinstance= new Adgydeplugin();
@override
void initState() {
adgydesinstance.init("H74674687834738","Organic");
adgydesinstance.setCurrentScreen("HomePage");
print("initDart");
super.initState();
}
@override
Widget build(BuildContext context) {
int number=0;
return new Scaffold(
appBar: new AppBar(
title: new Text("AdGyde Sdk Example"),
),
body:
new Center(
child: new Column(
children: <Widget>[
new RaisedButton(
textColor: Colors.white,
color: Colors.blue,
onPressed: _simpleButtonClick,
child: new Text("AddScreen1"),
),
new RaisedButton(
textColor: Colors.white,
color: Colors.blue,
//padding: const EdgeInsets.all(8.0),
onPressed:(){Navigator.push(context, MaterialPageRoute(builder: (context) => CountingEvent()),);
print("onPressCounting");},
child: new Text("CountingEvent"),
),
new RaisedButton(
textColor: Colors.white,
color: Colors.blue,
//padding: const EdgeInsets.all(8.0),
onPressed:_computingButtonClick,
child: new Text("AddScreen2"),
),
new RaisedButton(
textColor: Colors.white,
color: Colors.blue,
//padding: const EdgeInsets.all(8.0),
onPressed:() {Navigator.push(context, MaterialPageRoute(builder: (context) => UniqueEvent()),);
print("onPressUnique");},
child: new Text("Unique Event"),
),
new RaisedButton(
textColor: Colors.white,
color: Colors.blue,
onPressed:_revenueButtonClick,
child: new Text("removeScreen1"),
),
new RaisedButton(
textColor: Colors.white,
color: Colors.blue,
onPressed:_removeScreen,
child: new Text("removeScreen2"),
)
],
)
)
);
}
void _simpleButtonClick(){
// adgydesinstance.simpleEvent("registration");
adgydesinstance.setCurrentScreen("AddScreen1");
}
void _computingButtonClick(){
/*HashMap map = HashMap<String, String>();
// First parameter is event name and second is value name which will be accumulated.
map={"offerlist":"50%Off"} as HashMap;
// Second parameter is the value for its value name. Value must be integer type.
map={"50%off":"1000rs"} as HashMap;
// Trigger event where first parameter is event_id
adgydesinstance.computingEvent("computing", map);*/
adgydesinstance.removeCurrentScreen("AddScreen1");
}
void _revenueButtonClick(){
//adgydesinstance.revenueEvent(70);
adgydesinstance.setCurrentScreen("AddScreen1");
}
void _removeScreen(){
//adgydesinstance.revenueEvent(70);
adgydesinstance.setCurrentScreen("AddScreen2");
}
}