ai_chat_box 0.5.0 copy "ai_chat_box: ^0.5.0" to clipboard
ai_chat_box: ^0.5.0 copied to clipboard

A generic, customizable chat widget for Flutter that supports dynamic AI-like conversations with user-defined callback responses.

example/main.dart

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

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

Stream<String> _mockChatCallback(List<Map<String, String>> messages) async* {
  await Future.delayed(const Duration(seconds: 5));
  final lastUserMessage = messages.last['user'] ?? '';
  yield lastUserMessage;
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'AI Chat Box Example',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: Scaffold(
        appBar: AppBar(
          title: const Text('AI Chat Box Example'),
        ),
        body: AiChatBox(
          initialMessages: [
            {"bot": "Hi! I'm a bot. Ask me anything!"},
          ],
          onSend: _mockChatCallback,
        ),
      ),
    );
  }
}
0
likes
160
points
112
downloads

Publisher

unverified uploader

Weekly Downloads

A generic, customizable chat widget for Flutter that supports dynamic AI-like conversations with user-defined callback responses.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

cupertino_icons, flutter, gpt_markdown

More

Packages that depend on ai_chat_box