flutter_qy_plugin 0.9.0 copy "flutter_qy_plugin: ^0.9.0" to clipboard
flutter_qy_plugin: ^0.9.0 copied to clipboard

outdated

A new Flutter plugin.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_qy_plugin/flutter_qiyu.dart';
import 'package:qiyu/qiyu.dart';

// import 'flutter_qiyu.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  QiYu.registerApp(
    appKey: '063da122b2c0a592a70556647540efd5',
    appName: '波尔世界',
  );

  runApp(MyApp());
}

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

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            children: <Widget>[
              TextButton(
                child: Text('联系客服'),
                onPressed: () {
                  QYUserInfoParams userInfoParams = QYUserInfoParams.fromJson({
                    'userId': 'uid10101010',
                    'data':
                        '[{\"key\":\"real_name\", \"value\":\"土豪\"},{\"key\":\"mobile_phone\", \"hidden\":true},{\"key\":\"email\", \"value\":\"13800000000@163.com\"},{\"index\":0, \"key\":\"account\", \"label\":\"账号\", \"value\":\"zhangsan\", \"href\":\"http://example.domain/user/zhangsan\"},{\"index\":1, \"key\":\"sex\", \"label\":\"性别\", \"value\":\"先生\"},{\"index\":5, \"key\":\"reg_date\", \"label\":\"注册日期\", \"value\":\"2015-11-16\"},{\"index\":6, \"key\":\"last_login\", \"label\":\"上次登录时间\", \"value\":\"2015-12-22 15:38:54\"}]'
                  });
                  QiYu.setUserInfo(userInfoParams);

                  QYServiceWindowParams serviceWindowParams =
                      QYServiceWindowParams.fromJson({
                    'source': {
                      'sourceTitle': '网易七鱼Flutter',
                      'sourceUrl': 'http://www.qiyukf.com',
                      'sourceCustomInfo': '我是来自自定义的信息'
                    },
                    'commodityInfo': {
                      'commodityInfoTitle': 'Flutter商品',
                      'commodityInfoDesc': '这是来自网易七鱼Flutter的商品描述',
                      'pictureUrl':
                          'http://qiyukf.com/res/img/companyLogo/blmn.png',
                      'commodityInfoUrl': 'http://www.qiyukf.com',
                      'note': '¥1000',
                      'show': true
                    },
                    'sessionTitle': '网易七鱼123',
                    'groupId': 0,
                    'staffId': 0,
                    'robotId': 0,
                    'robotFirst': false,
                    'faqTemplateId': 0,
                    'vipLevel': 0,
                    'showQuitQueue': true,
                    'showCloseSessionEntry': true
                  });
                  QiYu.openServiceWindow(serviceWindowParams);
                },
              ),
              TextButton(
                child: Text('版本'),
                onPressed: () {
                  QiYu.getVersion()
                      .then((value) => {print("version = " + value)});
                },
              )
            ],
          ),
        ),
      ),
    );
  }
}
1
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A new Flutter plugin.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on flutter_qy_plugin