flutter_bl_umpush 0.0.8

Flutter Android iOS

A new flutter plugin project.

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:flutter_bl_umpush/flutter_bl_umpush.dart';

void main() => runApp(MyApp());

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

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

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String platformVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      platformVersion = await FlutterBlUmpushPlugin.platformVersion;
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }

    bool isInit = await FlutterBlUmpushPlugin.initWithAppkey(
        '5de487310cafb221820010c2', "0a4c23cee3d2d6f692341b14429044ed", 'app store');

    bool isScenarioType = await FlutterBlUmpushPlugin.setScenarioType();

    bool isLogin = await FlutterBlUmpushPlugin.umengSignIn('1111');


    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;
    });
  }

  void startPage() async {
    bool isStart = await FlutterBlUmpushPlugin.umengOutViewWithName('start page test...');
  }

  void endPage() async {
    bool isEnd = await FlutterBlUmpushPlugin.umengEnterViewWithName('启动统计');
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('测试app'),
        ),
        body: Column(
          children: <Widget>[
            Center(
              child: Text('Running on: $_platformVersion\n'),
            ),
            GestureDetector(
              onTap: () {
                endPage();
                print('start Page .............................');
              },
              child: Container(
                color: Colors.lightBlueAccent,
                padding: const EdgeInsets.only(top: 20, bottom: 20),
                child: Center(
                  child: Text('页面统计进入'),
                ),
              ),
            ),
            GestureDetector(
              onTap: () {
                startPage();
                print('end Page .............................');
              },
              child: Container(
                color: Colors.lightBlueAccent,
                margin: const EdgeInsets.only(top: 10),
                padding: const EdgeInsets.only(top: 20, bottom: 20),
                child: Center(
                  child: Text('页面统计退出'),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
1
likes
80
pub points
14%
popularity

A new flutter plugin project.

Homepage

Documentation

API reference

Uploader

wgpvincent@gmail.com

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_bl_umpush