adn_flutter_offerwall 1.0.2 adn_flutter_offerwall: ^1.0.2 copied to clipboard
ADN Flutter Offerwall plugin project.
import 'dart:io' show Platform;
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:adn_flutter_offerwall/adn_flutter_offerwall_plugin.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
initOfferWall();
}
Future<void> initOfferWall() async {
final appKey = Platform.isAndroid
? "android Unit ID"
: Platform.isIOS
? "iOS Unit ID"
: throw Exception("Unsupported Platform");
OfferWall.init(appKey: appKey);
OfferWall.setUserId(userId: 'userId');
OfferWall.setGender(gender: 'F');
OfferWall.setBirthYear(birthYear: 1992);
}
Future<void> showOfferWall() async {
OfferWall.showOfferWall(title: "Get point");
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ElevatedButton(
child: Text("Show OfferWalls"),
onPressed: () {
showOfferWall();
},
),
],
),
),
),
);
}
}