flutter_chat_ui_kit 3.0.3-pluto.beta.1 copy "flutter_chat_ui_kit: ^3.0.3-pluto.beta.1" to clipboard
flutter_chat_ui_kit: ^3.0.3-pluto.beta.1 copied to clipboard

discontinuedreplaced by: cometchat_chat_uikit

CometChat Flutter UI Kit is a collection of custom UI Components designed to build text , chat features in your application. The UI Kit is developed to keep developers in mind and aims to reduce deve [...]

example/example.dart

import 'package:flutter/material.dart';
import 'package:flutter_chat_ui_kit/flutter_chat_ui_kit.dart';
import 'package:flutter_localizations/flutter_localizations.dart';

void main() {
  runApp(const MyApp());
}

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      localizationsDelegates: [
        Translations.delegate,
        GlobalMaterialLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate
      ],
      supportedLocales: [
        Locale('en', ''),
        Locale('hi', ''),
        Locale('ar', ''),
        Locale('de', ''),
        Locale('es', ''),
        Locale('fr', ''),
        Locale('ms', ''),
        Locale('pt', ''),
        Locale('ru', ''),
        Locale('sv', ''),
        Locale('zh', ''),
      ],
      title: 'Flutter Demo',
      home: Home(),
    );
  }
}

class Home extends StatefulWidget {
  const Home({Key? key}) : super(key: key);

  @override
  _HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {
  final String appId = "APP_ID"; //Replace with your app id
  static const String authKey = "AUTH_KEY"; //Replace with your auth key";
  static const String region = "us"; ////Replace with your Region code ";

  bool isLoading = true;

  @override
  void initState() {
    super.initState();

    initializeCometChat();
  }

  initializeCometChat() async {
    //CometChat SDk should be initialized at the start of application. No need to initialize it again
    AppSettings appSettings = (AppSettingsBuilder()
          ..subscriptionType = CometChatSubscriptionType.allUsers
          ..region = region
          ..autoEstablishSocketConnection = true)
        .build();

    CometChat.init(appId, appSettings, onSuccess: (String successMessage) {
      login();
    }, onError: (CometChatException excep) {
      // "Initialization failed with exception: ${excep.message}";
    });
  }

  login() async {
    String userId = "superhero1";
    await CometChat.login(userId, authKey, onSuccess: (User loggedInUser) {
      debugPrint("Login Successful : $loggedInUser");
      Navigator.push(
          context,
          MaterialPageRoute(
              builder: (context) =>
                  const CometChatConversationsWithMessages()));
    }, onError: (CometChatException e) {
      debugPrint("Login failed with exception:  ${e.message}");
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: CircularProgressIndicator(),
      ),
    );
  }
}
13
likes
0
pub points
12%
popularity

Publisher

verified publishercometchat.com

CometChat Flutter UI Kit is a collection of custom UI Components designed to build text , chat features in your application. The UI Kit is developed to keep developers in mind and aims to reduce development efforts significantly

Homepage

License

unknown (LICENSE)

Dependencies

chewie, cometchat, file_picker, flutter, flutter_image, flutter_localizations, http, image_picker, intl, path_provider, share_plus, url_launcher, video_player, webview_flutter

More

Packages that depend on flutter_chat_ui_kit