buzz_booster 0.1.0 buzz_booster: ^0.1.0 copied to clipboard
BuzzBooster SDK
import 'package:flutter/material.dart';
import 'package:buzz_booster/buzz_booster.dart';
final buzzBooster = BuzzBooster();
void main() async {
runApp(const MyApp());
await buzzBooster.init(
androidAppKey: "307117684877774",
iosAppKey: "279753136766115",
);
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final userIdTextController = TextEditingController();
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
children: [
const Text("This is BuzzBooster Flutter App"),
TextField(
controller: userIdTextController,
decoration: const InputDecoration(
border: OutlineInputBorder(),
labelText: 'UserId',
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
OutlinedButton(
onPressed: () async {
String userId = userIdTextController.text;
await buzzBooster.setUserId(userId);
await buzzBooster.showInAppMessage();
},
child: const Text("Login"),
),
OutlinedButton(
onPressed: () async {
userIdTextController.clear();
await buzzBooster.setUserId(null);
},
child: const Text("Logout"),
),
],
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: () async {
await buzzBooster.showCampaign();
},
backgroundColor: Colors.deepPurple,
child: const Icon(Icons.gif_box),
),
),
);
}
}