ask_bubble_ai 1.1.0
ask_bubble_ai: ^1.1.0 copied to clipboard
A customizable floating AI chat bubble widget for Flutter. Powered by Gemini, with built-in navigation shortcuts, styling, and active session context.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:ask_bubble_ai/ask_bubble_ai.dart';
/// The entry point of the example application.
void main() {
runApp(const MyApp());
}
/// The root widget of the example application.
class MyApp extends StatelessWidget {
/// Creates a new [MyApp] instance.
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Ask Bubble AI Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(),
);
}
}
/// The home page widget containing the [AskBubbleAi] floating chat assistant.
class MyHomePage extends StatelessWidget {
/// Creates a new [MyHomePage] instance.
const MyHomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Ask Bubble AI Example')),
body: Stack(
children: [
const Center(child: Text('Your App Content Here')),
Positioned(
right: 16,
bottom: 16,
child: AskBubbleAi(
apiKey: 'YOUR_GEMINI_API_KEY', // Put your API Key here
provider: AskAiProvider.gemini, // Can also use openAi or claude
modelName: 'gemini-2.5-flash', // Specify custom model identifier
assistantName: 'AI Assistant',
welcomeTitle: 'Welcome!',
welcomeSubtitle: 'How can I assist you today?',
brainDocument: '''
App FAQ & Knowledge Base:
- Support hours are Monday to Friday, 9 AM - 5 PM.
- To change password, go to Settings screen.
- Refund queries can be directed to support.
''',
userDetails: const {
'User Name': 'John Doe',
'Status': 'Premium Member',
},
suggestions: const [
'How can you help me?',
'What are support hours?',
],
navigationRoutes: const [
{
'route': '/settings',
'description':
'Configure user settings and password management',
},
],
onNavigate: (routePath) {
// Handle in-app navigation routes here
debugPrint('User clicked navigation route: $routePath');
},
),
),
],
),
);
}
}