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

@@ -5,6 +5,9 @@ import 'order_screen.dart';
import 'invoice_screen.dart';
import 'chat_screen.dart';
import 'settings_screen.dart';
import 'package:provider/provider.dart';
import '../providers/chat_unread_provider.dart';
class MainBottomNav extends StatefulWidget {
const MainBottomNav({super.key});
@@ -20,7 +23,7 @@ class MainBottomNavState extends State<MainBottomNav> {
setState(() => _currentIndex = index);
}
final List<Widget> _screens = const [
final List<Widget> _screens = [
DashboardScreen(),
OrdersScreen(),
InvoiceScreen(),
@@ -161,11 +164,54 @@ class MainBottomNavState extends State<MainBottomNav> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
index == 3
? Consumer<ChatUnreadProvider>(
builder: (_, chat, __) {
return Stack(
clipBehavior: Clip.none,
children: [
Icon(
_icons[index],
size: 22 * scale,
color: Colors.black87,
),
if (chat.unreadCount > 0)
Positioned(
right: -6,
top: -6,
child: Container(
padding: const EdgeInsets.all(4),
decoration: const BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
),
constraints: const BoxConstraints(
minWidth: 20,
minHeight: 20,
),
child: Center(
child: Text(
chat.unreadCount.toString(),
style: const TextStyle(
color: Colors.white,
fontSize: 10,
fontWeight: FontWeight.bold,
),
),
),
),
),
],
);
},
)
: Icon(
_icons[index],
size: 22 * scale,
color: Colors.black87,
),
SizedBox(height: 4 * scale),
Text(
_labels[index],