chat support

This commit is contained in:
Abhishek Mali
2025-12-15 11:10:52 +05:30
parent 9faf983b95
commit bb81269140
12 changed files with 612 additions and 22 deletions

View File

@@ -0,0 +1,34 @@
import 'package:flutter/material.dart';
class ChatUnreadProvider extends ChangeNotifier {
int _unreadCount = 0;
bool _chatOpen = false;
int get unreadCount => _unreadCount;
bool get isChatOpen => _chatOpen;
/// 📩 Called when ADMIN sends message
void increment() {
if (!_chatOpen) {
_unreadCount++;
notifyListeners();
}
}
/// 👁 Called when chat screen is opened
void setChatOpen(bool open) {
_chatOpen = open;
if (open) {
_unreadCount = 0; // reset badge when user opens chat
}
notifyListeners();
}
/// 🔁 Manual reset (optional)
void reset() {
_unreadCount = 0;
notifyListeners();
}
}