- Fix gamification endpoints to use Node.js server (app.eventifyplus.com) - Replace 6 mock gamification methods with real API calls (dashboard, leaderboard, shop, redeem, submit) - Add booking models, service, payment service (Razorpay), checkout provider - Add 3-step CheckoutScreen with Razorpay native modal integration - Add Google OAuth login (Flutter + Django backend) - Add full notifications system (Django model + 3 endpoints + Flutter UI) - Register CheckoutProvider, NotificationProvider in main.dart MultiProvider - Wire notification bell in HomeScreen app bar - Add razorpay_flutter ^1.3.7 and google_sign_in ^6.2.2 packages
62 lines
2.1 KiB
Dart
62 lines
2.1 KiB
Dart
// lib/features/notifications/widgets/notification_bell.dart
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import '../providers/notification_provider.dart';
|
|
import 'notification_panel.dart';
|
|
|
|
class NotificationBell extends StatelessWidget {
|
|
const NotificationBell({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Consumer<NotificationProvider>(
|
|
builder: (context, provider, _) {
|
|
return GestureDetector(
|
|
onTap: () => _showPanel(context),
|
|
child: Stack(
|
|
clipBehavior: Clip.none,
|
|
children: [
|
|
const Padding(
|
|
padding: EdgeInsets.all(8.0),
|
|
child: Icon(Icons.notifications_outlined, size: 26, color: Colors.black87),
|
|
),
|
|
if (provider.unreadCount > 0)
|
|
Positioned(
|
|
right: 4,
|
|
top: 4,
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 2),
|
|
decoration: BoxDecoration(
|
|
color: Colors.red,
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
constraints: const BoxConstraints(minWidth: 18, minHeight: 18),
|
|
child: Text(
|
|
provider.unreadCount > 99 ? '99+' : '${provider.unreadCount}',
|
|
style: const TextStyle(color: Colors.white, fontSize: 10, fontWeight: FontWeight.w600),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
void _showPanel(BuildContext context) {
|
|
context.read<NotificationProvider>().loadNotifications();
|
|
showModalBottomSheet(
|
|
context: context,
|
|
isScrollControlled: true,
|
|
backgroundColor: Colors.transparent,
|
|
builder: (_) => ChangeNotifierProvider.value(
|
|
value: context.read<NotificationProvider>(),
|
|
child: const NotificationPanel(),
|
|
),
|
|
);
|
|
}
|
|
}
|