About

SDK com exclisividade de uso particular da fintalk.

Features

SDK destinado a integração de acesso ao chat com utilização dos seguintes itens: camera, microfone e reconhecimento de voz, envio e captura de imagens e documentos.

Usage

Adicione a referência do sdk no seu projeto. No projeto de destino adicione as seguintes permissões no Android Manifest:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_FRAME_BUFFER"/>
<uses-permission android:name="android.permission.MEDIA_CONTENT_CONTROL"/>
<uses-permission android:name="android.permission.CAPTURE_AUDIO_OUTPUT"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.webkit.resource.AUDIO_CAPTURE"/>

Adicione a chamada ao componente utilizando o fintalk_sdk_services, e a rota para tela do chat, segundo ao exemplo abaixo:

import 'package:falazap_integracao/sdk/fintalk_sdk_services.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Falazap!',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: const MyHomePage(title: 'Falazap - Integração'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});
  final String title;
  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final param = {
    "nome": "J'Dark",
    "email": "jdark@gmail.com",
    "cpf": "466.054.330-76"
  };
  final url = "https://agent0054-dev.web.fintalk.io/";

  final chatService = FintalkSdkServices();

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

  @override
  Widget build(BuildContext context) {
    chatService.initialize(context);

    return Scaffold(
      extendBody: true,
      floatingActionButtonAnimator: FloatingActionButtonAnimator.scaling,
      appBar: AppBar(
        title: Text(widget.title),
        actions: [
          IconButton(
            icon: const Icon(Icons.chat),
            onPressed: () {
              chatService.openChat(context,
                  url: url,
                  userName: param['nome'] ?? '',
                  userEmail: param['email'] ?? '',
                  userId: param['cpf'] ?? '',
                  avatarUrl: '');
            },
          )
        ],
      ),
      body: const HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(child:  Center(child: Text('Bem Vindo',style:
    TextStyle(fontFamily: AutofillHints.familyName,fontSize: 24),)),);
  }
}