ai_chatview 0.1.2
ai_chatview: ^0.1.2 copied to clipboard
A customizable AI chat interface for Flutter with markdown and typing animation support.
AI Chatview #
AI Chatview a customizable Flutter chat UI for AI-driven conversations with markdown and typing effects. This package is designed exclusively for creating elegant, modern AI chat interfaces in Flutter.
π§© Features #
-
π§ Supports full Markdown rendering
Including bold, italic, ,inline code, links, and even complex widgets like lists and tables. -
β¨οΈ Typewriter Animation
Just like how an AI chatbot gradually types its responses β thanks to the built-inTypewriterAnimatedConfiguration. -
π§ AI-Focused Design β Built for chatbots, assistants, and conversational UIs.
π§ͺ Demos #
π‘ Example Usage #
class Home extends StatefulWidget {
const Home({super.key});
@override
State<Home> createState() => _HomeState();
}
class _HomeState extends State<Home> {
late final AIChatviewController chatController;
@override
void initState() {
super.initState();
chatController = AIChatviewController(
typewriterAnimatedConfiguration: TypewriterAnimatedConfiguration(
typingSpeed: Duration(milliseconds: 2),
),
textFieldDecoration: TextFieldDecoration(
minLines: 2,
maxLines: 4,
textFieldDarkModeBackgroundColor: Colors.white,
textFieldLightModeBackgroundColor: Colors.grey.shade300,
),
);
}
@override
void dispose() {
chatController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('AI Chatview Package Demo')),
body: AIChatView(
aIChatViewController: chatController,
onSendTap: onSend,
emptyState: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Hi, Dear how are you doing?',
style: Theme.of(context).textTheme.titleLarge,
),
Text(
'This is AI Chatview Demo. Type something to get started.',
style: Theme.of(context).textTheme.bodyMedium,
),
],
),
),
textFieldOtherWidget: IconButton(
onPressed: () => showSnackBar("Implement your mic functinality here"),
icon: Icon(Icons.mic),
),
leftPanelWidget: InkWell(
borderRadius: BorderRadius.circular(22),
onTap: () => showSnackBar("Implement any other functinality here"),
child: CircleAvatar(
radius: 22,
child: Icon(Icons.auto_awesome), //bubble_chart_rounded
),
),
),
);
}
showSnackBar(String mssg) =>
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(mssg)));
onSend() async {
await Future.delayed(Duration(seconds: 2));
chatController.addMessage(
ChatModel(isUser: false, message: mockAIgeneratedText),
);
}
}
Some important parameters #
-
[AIChatviewController]β Must be initialized. This controller manages and updates the chat view UI.
-
[emptyState]β The widget displayed when the chat view has no messages.
-
[textFieldOtherWidget]β A widget that adds extra functionality (e.g., microphone, attachments) on the right of the text input field.
-
[leftPanelWidget]β An optional widget positioned on the left side for additional features when needed.
-
[aiWidget]β A widget displayed below each AI-generated message for extra interactions such as thumbs up, report, etc.
-
[aiTypingWidget]β The widget to customize when the AI is βthinkingβ or generating a response.
-
[TypewriterAnimatedConfiguration]β Controls the AI typing animation speed and behavior.
Note: #
- All parameters are optional except AIChatviewController, which must be initialized.
- Remember to dispose the controller properly to avoid memory leaks.
π Version 0.1.1 β Initial Release #
Version 1.0.0 marks the first official release of this package! Thereβs still plenty of room for improvement and community-driven enhancement β and your contributions are highly appreciated.
π€ Contributing #
I welcome all forms of contribution β from small fixes to major feature additions. Every contribution helps make this project more robust and valuable for the Flutter community.
Upcoming #
- π· Ability to send images and other files to the AI
- π¨ Enhanced UI aesthetics
- π§Ύ Improved documentation
β Donβt forget to star the repo if you find it useful. Happy Coding! π