chatty_client_app 0.0.2 copy "chatty_client_app: ^0.0.2" to clipboard
chatty_client_app: ^0.0.2 copied to clipboard

A Flutter package for building responsive chat applications with AI conversation API integration.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:chatty_client_app/chatty_client_app.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // Initialize the package (loads .env file if available)
  await ChattyClientApp.initialize();

  if (kIsWeb) {
    // For web: Initialize from URL parameters
    final initialized = await ChattyClientApp.initializeFromUrl();
    final integrationKey = await ChattyClientApp.getIntegrationKey();
    final customerId = await ChattyClientApp.getPartnerCustomerId();
    if (!initialized) {
      await ChattyClientApp.configure(
        integrationKey: integrationKey ?? '',
        partnerCustomerId: customerId ?? '',
      );
    }
  } else {
    // For mobile/desktop: Use hardcoded configuration
    await ChattyClientApp.configure(
      integrationKey: '1ee',
      partnerCustomerId: '1ee',
      baseUrl: "http://192.168.100.83:3000"
    );
  }

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Chatty Client Example',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
        useMaterial3: true,
      ),
      home: const ChatScreen(),
    );
  }
}

class ChatScreen extends StatelessWidget {
  const ChatScreen({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const ChatWidget(
      title: 'Elevate AI Support',
      primaryColor: Colors.blue,
      userMessageColor: Colors.blue,
      // maxWidth: 800, // Remove or set to null for full-width responsive design
    );
  }
}
0
likes
120
points
34
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter package for building responsive chat applications with AI conversation API integration.

Homepage
Repository (GitHub)

License

MIT (license)

Dependencies

dio, flutter, flutter_dotenv, flutter_web_plugins, freezed_annotation, json_annotation, pretty_dio_logger, shared_preferences

More

Packages that depend on chatty_client_app