qiyu_flutter 0.0.1 copy "qiyu_flutter: ^0.0.1" to clipboard
qiyu_flutter: ^0.0.1 copied to clipboard

A qiyu plugin for flutter. qiyu is a customer service system of netease. www.qiyukf.com to get more infomation.

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:qiyu/qiyu.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();
    Qiyu().register('be719789c7111ff8e81109f90a2f54f9', 'test_app');
  }

  // 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 Qiyu().platformVersion;
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }

    // 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;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: IconButton(icon: Icon(Icons.add), onPressed: _onPressed),
        ),
      ),
    );
  }

  _onPressed() {
    var _defaultSessionConfig = {
      'sessionTitle': 'QiYuDemoForFlutter',
      'groupId': 0,
      'staffId': 0,
      'robotId': 0,
      'vipLevel': 0,
      'openRobotInShuntMode': false,
      'commonQuestionTemplateId': 0,
      'source': {
        'title':'网易七鱼Flutter',
        'urlString':'http://www.qiyukf.com',
        'customInfo':'我是来自自定义的信息'
      },

      'commodityInfo': {
        'title':'Flutter商品',
        'desc':'这是来自网易七鱼Flutter的商品描述',
        'pictureUrlString':'https://qiyukf.nosdn.127.net/main/res/img/online/qy-web-cp-zxkf-kh-3.1.1-icon@2x_86ec48d3e30b8fe5d6c1d5099d370019.png',
        'urlString':'http://www.qiyukf.com',
        'note':'¥1888',
        'show':true,
        'tagsArray': [
          {
            'label': '1',
            'url': 'http://www.qiyukf.com',
            'focusIframe': '2',
            'data': '3'
          },
        ],
        'tagsString': 'tagsString',
        'isCustom': true,
        'sendByUser': false,
        'actionText': 'actionText',
        'actionTextColor': '#FFFFFF',
        'ext': '123456'
      },
      'buttonInfoArray': [
        {
          'buttonId': '123',
          'title': 'buttonInfoArray',
          'userData': 'userData'
        }
      ],
      'showCloseSessionEntry':true,
      'showQuitQueue':true
    };
    Qiyu().openServiceWindow(_defaultSessionConfig);
    Qiyu().setCustomUIConfig({"navBackgroundColor":"#CC00FF"});
  }
}
0
likes
20
pub points
0%
popularity

Publisher

unverified uploader

A qiyu plugin for flutter. qiyu is a customer service system of netease. www.qiyukf.com to get more infomation.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on qiyu_flutter