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

A Flutter chatbot widget

AI Chatbot SDK for Flutter #

A beautiful, customizable AI chatbot widget that can be easily integrated into any Flutter app. Perfect for B2B companies wanting to add intelligent customer support to their mobile applications.

Features #

  • 🎨 Beautiful UI: Modern, customizable design with smooth animations
  • πŸš€ Easy Integration: Single widget integration with minimal setup
  • πŸ”’ Secure: Token-based authentication, no API keys in client code
  • πŸ“± Responsive: Works perfectly on all screen sizes
  • ⚑ Fast: Optimized performance with lazy loading
  • 🎭 Customizable: Themes, colors, and behavior can be customized
  • πŸ”„ Real-time: Live typing indicators and instant responses

Quick Start #

1. Add dependency #

dependencies:
  ai_chatbot_sdk: ^1.0.0

2. Import the package #

import 'package:ai_chatbot_sdk/ai_chatbot_sdk.dart';

3. Configure the service #

void main() {
  // Configure your API credentials
  ChatService().configure(
    apiKey: 'your-api-key',
    baseUrl: 'https://your-api.com',
  );
  
  runApp(MyApp());
}

4. Add the chatbot to your app #

class MyHomePage extends StatefulWidget {
  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> 
    with TickerProviderStateMixin {
  bool _showChat = false;
  late ChatAnimations _animations;

  @override
  void initState() {
    super.initState();
    _animations = ChatAnimations(this);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: [
          // Your app content here
          YourMainContent(),
          
          // Add the chatbot overlay
          if (_showChat)
            SlideTransition(
              position: _animations.chatSlideAnimation,
              child: FadeTransition(
                opacity: _animations.chatFadeAnimation,
                child: ChatScreen(
                  onClose: () => setState(() => _showChat = false),
                  typingController: _animations.typingController,
                ),
              ),
            ),
        ],
      ),
      floatingActionButton: AnimatedFab(
        onPressed: () => setState(() => _showChat = !_showChat),
        animation: _animations.fabAnimation,
      ),
    );
  }
}

Customization #

Theme Customization #

// Use the built-in theme
MaterialApp(
  theme: AppTheme.lightTheme,
  // your app
)

// Or customize colors
class MyCustomTheme {
  static ThemeData get customTheme {
    return AppTheme.lightTheme.copyWith(
      primaryColor: Colors.blue,
      // customize as needed
    );
  }
}

Chat Configuration #

ChatService().configure(
  apiKey: 'your-api-key',
  baseUrl: 'https://your-api.com',
  // Add custom headers, timeouts, etc.
);

API Integration #

The SDK expects your backend to provide these endpoints:

POST /api/chat #

{
  "message": "User message",
  "conversation_id": "optional-conversation-id",
  "user_id": "optional-user-id"
}

Response:

{
  "response": "AI response message",
  "conversation_id": "conversation-id",
  "timestamp": "2024-01-01T12:00:00Z"
}

Security #

The SDK is designed with security in mind:

  • βœ… No API keys stored in client code
  • βœ… Token-based authentication
  • βœ… HTTPS only communication
  • βœ… Request/response validation
  • βœ… Rate limiting support

Examples #

Check out the /example folder for a complete implementation showing:

  • Basic integration
  • Custom theming
  • Error handling
  • Authentication flow

Support #

For support, email support@your-company.com or create an issue on GitHub.

License #

This project is licensed under the MIT License - see the LICENSE file for details.