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(); } }