ekghanti_livechat 0.0.4
ekghanti_livechat: ^0.0.4 copied to clipboard
A Flutter package that provides a simple and easy-to-integrate live chat component for Flutter applications.
EkGhanti LiveChat #
A Flutter package that provides a simple and easy-to-integrate live chat component for Flutter applications. This package enables you to implement EkGhanti's live chat functionality for both Android and iOS platforms.
Features #
- 🚀 Easy integration with just a few lines of code
- 💬 Fully-featured live chat functionality
- 🎨 Customizable chat interface
- 📱 Support for both Android and iOS platforms
- 🔌 Real-time communication via socket connections
- 📎 Image upload functionality
- 💾 Chat history persistence
Installation #
To use this package, add ekghanti_livechat as a dependency in your pubspec.yaml file:
dependencies:
ekghanti_livechat: ^0.0.4
Then run:
flutter pub get
Platform-Specific Setup #
Android #
Update your AndroidManifest.xml file by adding the following permissions:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
iOS #
Update your Info.plist file by adding the following keys:
<key>NSCameraUsageDescription</key>
<string>This app needs access to the camera for live chat image uploads</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app needs access to the photo library for live chat image uploads</string>
Usage #
Import the package in your Dart file:
import 'package:ekghanti_livechat/widgets/ekghanti_livechat.dart';
Adding the Floating Chat Widget #
To add the floating chat button to your app, use the EkghantiChatWidget component:
Scaffold(
body: Stack(
children: [
// Your app content here
// Add the floating chat widget
Positioned(
bottom: 40,
right: 40,
child: EkghantiChatWidget(
channelId: 'YOUR_CHANNEL_ID',
btnSize: 70,
),
),
],
),
)
Required Parameters #
| Parameter | Type | Description |
|---|---|---|
| channelId | String | Your unique EkGhanti LiveChat channel ID |
| btnSize | double | Size of the floating button in logical pixels |
Optional Parameters #
| Parameter | Type | Default | Description |
|---|---|---|---|
| btnColor | Color | Blue | Background color of the floating button |
| iconColor | Color | White | Color of the chat icon |
| badgeColor | Color | Red | Color of the unread message badge |
| badgeTextColor | Color | White | Color of the text in the unread message badge |
| onOpen | Function | null | Callback function when chat is opened |
| onClose | Function | null | Callback function when chat is closed |
| onMessageReceived | Function | null | Callback when a new message is received |
Advanced Usage #
Obtaining Your Channel ID #
Each EkGhanti LiveChat installation requires a unique channelId. To obtain your channel ID:
- Register/Login to your EkGhanti account at https://ekghanti.com
- Navigate to the LiveChat section
- Create a new channel or select an existing one
- Copy the channel ID from your channel settings
Customization #
Theme Customization #
You can customize the appearance of the chat interface by providing a ChatTheme object:
EkghantiChatWidget(
channelId: 'YOUR_CHANNEL_ID',
btnSize: 70,
chatTheme: ChatTheme(
primaryColor: Colors.purple,
secondaryColor: Colors.purpleAccent,
backgroundColor: Colors.white,
userMessageColor: Colors.purple.shade100,
agentMessageColor: Colors.grey.shade200,
fontFamily: 'Roboto',
),
),
Troubleshooting #
Common Issues #
-
Socket Connection Issues
- Ensure your app has proper internet permissions
- Check if your device/emulator has an active internet connection
-
Image Upload Issues
- Verify that you've added the necessary permissions in AndroidManifest.xml and Info.plist
- Ensure the user has granted the permissions at runtime
-
Chat Not Loading
- Verify your channelId is correct
- Ensure your EkGhanti account is active and properly configured
Support #
For any issues, feature requests, or questions, please create an issue on the GitLab repository.
Contributing #
Contributions are welcome! Please feel free to submit a Pull Request.
License #
This project is licensed under the MIT License - see the LICENSE file for details.