firebase_realtime_chat 0.0.3 copy "firebase_realtime_chat: ^0.0.3" to clipboard
firebase_realtime_chat: ^0.0.3 copied to clipboard

This Flutter package simplifies real-time chat integration using Firebase Firestore for private and community chat rooms with customizable UI options.

example/lib/main.dart

// ignore_for_file: must_be_immutable
import 'package:firebase_realtime_chat/firebase_realtime_chat.dart';

import 'firebase_options.dart';
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
  );
  runApp(MyApp());
}

UserModel user1 = UserModel(
  userId: "xyz",
  email: "xyz@gmail.com",
  name: "Mudassir",
  profile: "https://buffer.com/library/content/images/2023/10/free-images.jpg",
);
UserModel user2 = UserModel(
  userId: "asdf",
  email: "asdf@gmail.com",
  name: "Farhan",
  profile:
      "https://h5p.org/sites/default/files/h5p/content/1209180/images/file-6113d5f8845dc.jpeg",
);
UserModel otherUser = UserModel(
  userId: "abc",
  email: "abc@gmail.com",
  name: "Ali",
  profile: "https://www.industrialempathy.com/img/remote/ZiClJf-1920w.jpg",
);

class MyApp extends StatelessWidget {
  MyApp({super.key});
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      // home: CommunityChatRoomView(
      //   imageDownloadButton: true,
      //   // iconColor: Colors.green,
      //   // textFieldBorderColor: Colors.green,
      //   // ownerBubbleColor: const Color.fromARGB(255, 222, 197, 160),
      //   // otherBubbleColor: Color.fromARGB(255, 146, 202, 210),
      //   userData: user2,
      // ),
      // home: OpenChatRoomView(),
      home: ChatView(userData: otherUser),
    );
  }
}

class OpenChatRoomView extends StatefulWidget {
  const OpenChatRoomView({super.key});

  @override
  State<OpenChatRoomView> createState() => _OpenChatRoomViewState();
}

class _OpenChatRoomViewState extends State<OpenChatRoomView> {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: ElevatedButton(
            onPressed: () {
              Navigator.push(
                context,
                MaterialPageRoute(
                  builder: (context) => ChatRoomView(
                    imageDownloadButton: true,
                    senderMember: otherUser,
                    receiverMember: user1,
                  ),
                ),
              );
            },
            child: const Text("inbox open")),
      ),
    );
  }
}
12
likes
140
pub points
62%
popularity

Publisher

unverified uploader

This Flutter package simplifies real-time chat integration using Firebase Firestore for private and community chat rooms with customizable UI options.

Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

cloud_firestore, firebase_storage, flutter, fluttertoast, gallery_saver, http, image_picker, lottie, path_provider, permission_handler, photo_view, stacked

More

Packages that depend on firebase_realtime_chat