flutter_chat_bot


Getting started

Using flutter run:

flutter pub add flutter_chat_bot

Usage

Add LiveChat widget at the top of the app.

A simple usage example:

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

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

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: Scaffold(
        resizeToAvoidBottomInset: true,
        appBar: AppBar(
          backgroundColor: Theme
              .of(context)
              .colorScheme
              .inversePrimary,
          title: const Text('Home'),
        ),
        body: LiveChat(
          apiUrl: "",
          websocketUrl: "",
          email: '',
          threshold: 0.4,
          temperature: 0,
          maxToken: 800,
          sysPrompt:
          "Bạn là một trợ lí AI hữu ích. Hãy trả lời người dùng một cách chính xác.",
          userType: '0' | '1',
          isOutsidePage: false,
          child: Container(),
        ),
      ),
    );
  }
}