chat support
This commit is contained in:
@@ -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],
|
||||
|
||||
Reference in New Issue
Block a user