flutter_turbolink_attribution 1.0.2 copy "flutter_turbolink_attribution: ^1.0.2" to clipboard
flutter_turbolink_attribution: ^1.0.2 copied to clipboard

retracted

TurboLink's official Flutter SDK for App Attribution & Campaign.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_turbolink_attribution/flutter_turbolink_attribution.dart';
import 'package:flutter_turbolink_attribution/turbolink_custom_properties.dart';
import 'package:flutter_turbolink_attribution_example/login.dart';

final navigatorKey = GlobalKey<NavigatorState>();

void main() {
  print("main");
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';

  @override
  void initState() {
    print("initState");
    super.initState();
    initTurbolinkSDK();

  }

  void initTurbolinkSDK() async {
    TurbolinkSdk.enableLogger();

    // TurbolinkSdk.setAppUser("jeff", "");
    TurbolinkSdk.setLang('zh');

    TurbolinkSdk.withCampaignCreateCallback((result) {
      print("TurboLinkSDK, withCampaignCreateCallback:" + result);
    });

    TurbolinkSdk.withLoginListenerCallback(() {
      print("TurboLinkSDK, withLoginListenerCallback:");
      navigatorKey.currentState?.push(MaterialPageRoute(builder: (context) => LoginWidget()));
    });
    TurbolinkSdk.withEventListenerCallback((args) {
      print("TurboLinkSDK, withEventListenerCallback:${args.arguments}:${args.scheme}:${args.campaignUrl}:${args.additionalParam}");
      TurbolinkSdk.closeCampaignPage();
    });
    TurbolinkSdk.withEventCallback((args) {
      print("TurboLinkSDK, withEventCallback:${args.linkHashId}:${args.blackBox}:${args.deviceStatus}:${args.linkData}");
    });
    TurbolinkSdk.setLaunchCampaignDelay(-1);
    TurbolinkSdk.autoInstance('coae59progtocgji0vug', '6fbbbdewbe1f68712212c895522d66c241e', '6f3c7c7c24d2ba6f0d53256968e56ea4b7b4bee8');
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      navigatorKey: navigatorKey,
      debugShowCheckedModeBanner: false,
      // home: MainWidget(_platformVersion),
      home: Builder(
        builder: (context) => Scaffold(
            appBar: AppBar(
              title: const Text('Plugin example app'),
            ),
            body: Column(
              children: [
                Container(
                  child: Text('Running on: $_platformVersion\n'),
                ),
                Container(
                  child: TextButton(
                    onPressed: (){
                      print("onPressed");
                      TurbolinkSdk.loadUrl("https://jeffapp.c.allapp.link/c?l=cpgm03progtr9q5t33j0&c=tB");
                      // Navigator.push(context,MaterialPageRoute(builder: (context) => LoginWidget()));
                    },
                    child: Text("活动"),
                  ),
                ),
                TextButton(
                  onPressed: () {
                    Navigator.push(context,MaterialPageRoute(builder: (context) => LoginWidget()));
                  },
                  child: Text("Login Widget"),
                ),
                TextButton(
                  onPressed: () {
                    TurbolinkSdk.logout();
                  },
                  child: Text("Logout"),
                ),
                TextButton(
                  onPressed: () {
                    TurboLinkCustomProperties customData = TurboLinkCustomProperties()
                        .addKeyValue("name", "ben")
                        .addKeyValue("age", "22");
                    TurbolinkSdk.customEvent("pay", customData);
                  },
                  child: Text("自定义事件"),
                ),
                TextButton(
                  onPressed: () {
                    TurbolinkSdk.register("jeff");
                  },
                  child: Text("register"),
                ),
                TextButton(
                  onPressed: () {
                    TurbolinkSdk.codeSearch("143.42¥8QJXKXOTv2¥");
                  },
                  child: Text("codeSearch"),
                ),
              ],
            )
        ),
      )
    );
  }
}
2
likes
0
pub points
65%
popularity

Publisher

unverified uploader

TurboLink's official Flutter SDK for App Attribution & Campaign.

Homepage

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flutter_turbolink_attribution