trsurveys 1.0.3 copy "trsurveys: ^1.0.3" to clipboard
trsurveys: ^1.0.3 copied to clipboard

unlistedoutdated

A plugin for TheoremReach Surveys SDK for both Android & iOS

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:trsurveys/trsurveys.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    TheoremReach.instance
        .init(apiToken: 'yourapitoken', userId: 'userId');
    TheoremReach.instance.setTheoremReachOnRewardListener(onTheoremReachReward);
    TheoremReach.instance
        .setTheoremReachRewardCenterClosed(onTheoremReachRewardCenterClosed);
    TheoremReach.instance
        .setTheoremReachRewardCenterOpened(onTheoremReachRewardCenterOpened);
    TheoremReach.instance
        .setTheoremReachSurveyAvaiableListener(onTheoremReachSurveyAvailable);
    super.initState();
  }

  void onTheoremReachReward(int quantity) {
    print('TR: $quantity');
  }

  void onTheoremReachSurveyAvailable(int survey) {
    print('TR: $survey');
  }

  void onTheoremReachRewardCenterClosed() {
    print('TR: closed');
  }

  void onTheoremReachRewardCenterOpened() {
    print('TR: opened');
  }

  @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>[
              RaisedButton(
                child: Text("Launch TheoremReach"),
                onPressed: () => TheoremReach.instance.show(),
              ),
              RaisedButton(
                child: Text("Launch TheoremReach Placement"),
                onPressed: () => TheoremReach.instance.show(placementID: 'yourplacement'),
              )
            ],
          )
        ),
      ),
    );
  }
}
2
likes
0
pub points
0%
popularity

Publisher

verified publisheranavrinapps.com

A plugin for TheoremReach Surveys SDK for both Android & iOS

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on trsurveys