firebase_chat_services 0.0.1
firebase_chat_services: ^0.0.1 copied to clipboard
A powerful and easy-to-use Firebase Chat Services plugin for Flutter. It automatically handles all core chat functionalities including sending Supports text, image, video, and location messages out o [...]
example/lib/main.dart
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:custom_styles_package/custom_styles_package.dart';
import 'package:custom_styles_package/navigation/custom_navigation_services.dart';
import 'package:custom_styles_package/theme/sized_box.dart';
import 'package:custom_styles_package/widgets/custom_appbar.dart';
import 'package:custom_styles_package/widgets/custom_scaffold.dart';
import 'package:firebase_chat_services/chat_services/chat_user_modal.dart';
import 'package:firebase_chat_services_example/chat_page/chat_list_screen.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
var firestoreInstance = FirebaseFirestore.instanceFor(
app: Firebase.app(), databaseId: databaseID);
String databaseID = 'agreesplit-live';
void main() async{
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
firestoreInstance.settings = const Settings(persistenceEnabled: true,ignoreUndefinedProperties: true);
CustomStylesConfig.init(primary: Color(0xFF050A4B));
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
Map<String, ChatUserModal> allusers = {
'abcd': ChatUserModal(userId: 'abcd',
name: 'Manish',
profileImage: 'https://skdfj',
fullData: {},
deviceTokens: []),
'raju': ChatUserModal(userId: 'raju',
name: 'Raju',
profileImage: 'https://skdfj',
fullData: {},
deviceTokens: []),
};
class _MyAppState extends State<MyApp> {
// final _firebaseChatServicesPlugin = FirebaseChatServices();
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return CustomScreenUtil(
designSize: const Size(390, 850),
child: MaterialApp(
home: HomePage(),
),
);
}
}
class HomePage extends StatelessWidget {
const HomePage({super.key});
@override
Widget build(BuildContext context) {
return CustomScaffold(
appBar: CustomAppBar(titleText: 'Hello world'),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// CustomButton(
// text: 'Enter as Manish',
// onTap: (){
//
//
// // CustomNavigation.push(context, screen: ChatScreen(currentUser: allusers['abcd']!,allUsers: allusers,));
// },
// ),
// vSizedBox2,
// CustomButton(
// text: 'Enter as Raju',
// onTap: (){
//
// CustomNavigation.push(context, screen: ChatScreen(currentUser: allusers['raju']!,allUsers: allusers,));
// },
// ),
// vSizedBox2,
CustomButton(
text: 'Enter ChatList Screen as Manish',
onTap: (){
CustomNavigation.push(context, screen: ChatListScreenPage(currentUser: allusers['abcd']!,allUsers: allusers,));
},
),
vSizedBox2,
CustomButton(
text: 'Enter ChatList Screen as Raju',
onTap: (){
CustomNavigation.push(context, screen: ChatListScreenPage(currentUser: allusers['raju']!,allUsers: allusers,));
},
),
],
),
),
);
}
}