ai_chat_kit 1.0.0 copy "ai_chat_kit: ^1.0.0" to clipboard
ai_chat_kit: ^1.0.0 copied to clipboard

A drop-in AI chat module for Flutter — LLM streaming, voice input, markdown, chat history, typing animation, prompt templates and multi-provider support (OpenAI, Gemini, Claude).

example/lib/main.dart

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

import 'assistant_picker.dart';
import 'launcher_demo.dart';
import 'support_demo.dart';
import 'templates_demo.dart';
import 'theming_demo.dart';
import 'widgets_demo.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  // Chat history is persisted with Hive; open it once at startup.
  await HiveChatStore.init();
  runApp(const ExampleApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'AI Chat Kit',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(colorSchemeSeed: const Color(0xFF2E7D32), useMaterial3: true),
      darkTheme: ThemeData(
        colorSchemeSeed: const Color(0xFF2E7D32),
        brightness: Brightness.dark,
        useMaterial3: true,
      ),
      home: const GalleryHome(),
    );
  }
}

/// One entry in the demo gallery.
class _Demo {
  const _Demo(this.title, this.subtitle, this.icon, this.builder);
  final String title;
  final String subtitle;
  final IconData icon;
  final WidgetBuilder builder;
}

final _demos = <_Demo>[
  _Demo('Build any assistant', 'Type a service type → role-driven chat',
      Icons.smart_toy_outlined, (_) => const AssistantPicker()),
  _Demo('Customer support (tools)', 'Live order lookup via function calling',
      Icons.support_agent, (_) => const SupportDemo()),
  _Demo('Prompt templates', 'Built-in roles from PromptLibrary',
      Icons.tune, (_) => const TemplatesDemo()),
  _Demo('Theming', 'Custom AiChatTheme presets',
      Icons.palette, (_) => const ThemingDemo()),
  _Demo('Launcher styles', 'Full-screen · bottom sheet · dialog · FAB',
      Icons.open_in_new, (_) => const LauncherDemo()),
  _Demo('Widgets showcase', 'Bubbles · markdown · typing · cursor (static)',
      Icons.view_agenda, (_) => const WidgetsDemo()),
];

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

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);
    return Scaffold(
      appBar: AppBar(title: const Text('AI Chat Kit — Demos')),
      body: ListView(
        padding: const EdgeInsets.all(16),
        children: [
          Row(
            children: [
              Icon(Icons.chat_rounded, color: theme.colorScheme.primary),
              const SizedBox(width: 8),
              Expanded(
                child: Text(
                  'Each demo shows one capability — tap to see how it works and '
                  'looks in an app.',
                  style: theme.textTheme.bodyMedium,
                ),
              ),
            ],
          ),
          const SizedBox(height: 12),
          for (final d in _demos)
            Card(
              clipBehavior: Clip.antiAlias,
              child: ListTile(
                leading: CircleAvatar(child: Icon(d.icon)),
                title: Text(d.title),
                subtitle: Text(d.subtitle),
                trailing: const Icon(Icons.chevron_right),
                onTap: () =>
                    Navigator.of(context).push(MaterialPageRoute<void>(builder: d.builder)),
              ),
            ),
        ],
      ),
    );
  }
}
1
likes
115
points
49
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A drop-in AI chat module for Flutter — LLM streaming, voice input, markdown, chat history, typing animation, prompt templates and multi-provider support (OpenAI, Gemini, Claude).

Repository (GitHub)
View/report issues

Topics

#ai #chat #llm #chatbot #openai

License

MIT (license)

Dependencies

flutter, gpt_markdown, hive, hive_flutter, http, path_provider, permission_handler, speech_to_text, url_launcher, uuid

More

Packages that depend on ai_chat_kit