flutter_bot 0.0.1
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.