feat: Implement Firebase push notifications with support for flavor-specific configurations.
This commit is contained in:
@@ -1,14 +1,34 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:real_estate_mobile/core/services/push_notification_service.dart';
|
||||
import 'package:real_estate_mobile/core/widgets/app_bottom_nav_bar.dart';
|
||||
import 'package:real_estate_mobile/features/home/presentation/widgets/home_header.dart';
|
||||
|
||||
/// Root shell that provides the persistent header and bottom nav bar.
|
||||
/// Only the content area (child) swaps when navigating between tabs.
|
||||
class AppShell extends StatelessWidget {
|
||||
class AppShell extends StatefulWidget {
|
||||
final Widget child;
|
||||
|
||||
const AppShell({super.key, required this.child});
|
||||
|
||||
@override
|
||||
State<AppShell> createState() => _AppShellState();
|
||||
}
|
||||
|
||||
class _AppShellState extends State<AppShell> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// Wire push notification taps to GoRouter navigation
|
||||
PushNotificationService().onNotificationTap = (actionUrl) {
|
||||
if (mounted && actionUrl != null && actionUrl.isNotEmpty) {
|
||||
context.go(actionUrl);
|
||||
} else if (mounted) {
|
||||
context.go('/notifications');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -31,8 +51,8 @@ class AppShell extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
child: KeyedSubtree(
|
||||
key: ValueKey(child.runtimeType),
|
||||
child: child,
|
||||
key: ValueKey(widget.child.runtimeType),
|
||||
child: widget.child,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user