risecx_chat_client 1.2.3+1
risecx_chat_client: ^1.2.3+1 copied to clipboard

Risecx Company Chat Client

example/lib/main.dart

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

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  dynamic loggedUser = {
    "_id": "5d604bac3a3dff3702ee82c2",
    "id": "8f3a6fb3-525f-4ea0-98cc-726836d52440",
    "lastName": "Domingues",
    "firstName": "Crístofer",
    "email": "cristofer@risecx.com",
    "gender": "male",
    "birthDate": "1984-10-21"
  };
  dynamic config = {
    "urlApi": "https://develop.carespace.ai/api/admin/",
    "botName": "Amanda",
    "wsUrl": "wss://develop.carespace.ai/api/bot/web",
  };

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        body: RisecxChatClient(
          user: loggedUser,
          options: config,
          disableHistory: true,
          initConversationTrigger: {
            'text': "Covid Test",
            "key":
                "5e740e128e2e96da6f97364e&conversation=5e740fbb8e2e96da6f973697&block=5e740e128e2e96da6f97364d",
            "type": "payload"
          },
        ));
  }
}