NotificationsScreen: match Thread screen AppBar (back, title, home/chat actions, tab bar)

This commit is contained in:
Patrick Britton 2026-02-06 16:03:50 -06:00
parent 858d57b5b2
commit b8bd45c0f9

View file

@ -10,7 +10,10 @@ import '../../widgets/media/signed_media_image.dart';
import '../profile/viewable_profile_screen.dart'; import '../profile/viewable_profile_screen.dart';
import '../post/post_detail_screen.dart'; import '../post/post_detail_screen.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:google_fonts/google_fonts.dart';
import '../../services/notification_service.dart'; import '../../services/notification_service.dart';
import '../../providers/notification_provider.dart';
import '../secure_chat/secure_chat_full_screen.dart';
/// Notifications screen showing user activity /// Notifications screen showing user activity
class NotificationsScreen extends ConsumerStatefulWidget { class NotificationsScreen extends ConsumerStatefulWidget {
@ -356,60 +359,84 @@ class _NotificationsScreenState extends ConsumerState<NotificationsScreen> {
length: 2, length: 2,
child: Scaffold( child: Scaffold(
backgroundColor: AppTheme.scaffoldBg, backgroundColor: AppTheme.scaffoldBg,
body: SafeArea( appBar: AppBar(
child: Column( backgroundColor: AppTheme.scaffoldBg,
children: [ elevation: 0,
// Threads-style top bar surfaceTintColor: Colors.transparent,
Padding( leading: IconButton(
padding: const EdgeInsets.only(left: 4, right: 8, top: 4), onPressed: () {
child: Row( if (Navigator.of(context).canPop()) {
children: [ Navigator.of(context).pop();
IconButton( } else {
icon: Icon(Icons.arrow_back, color: AppTheme.navyBlue), context.go('/home');
onPressed: () => context.go('/home'), }
), },
Text( icon: Icon(Icons.arrow_back, color: AppTheme.navyBlue),
'Activity', ),
style: AppTheme.textTheme.headlineSmall?.copyWith( title: Text(
fontWeight: FontWeight.bold, 'Activity',
), style: GoogleFonts.inter(
), color: AppTheme.textPrimary,
const Spacer(), fontSize: 18,
if (canArchiveAll) fontWeight: FontWeight.w700,
TextButton( ),
onPressed: _archiveAllNotifications, ),
child: Text( actions: [
'Archive All', if (canArchiveAll)
style: AppTheme.textTheme.labelMedium?.copyWith( TextButton(
color: AppTheme.egyptianBlue, onPressed: _archiveAllNotifications,
fontWeight: FontWeight.w600, child: Text(
), 'Archive All',
), style: AppTheme.textTheme.labelMedium?.copyWith(
), color: AppTheme.egyptianBlue,
], fontWeight: FontWeight.w600,
),
), ),
), ),
// Filter tabs IconButton(
TabBar( onPressed: () => context.go('/home'),
onTap: (index) { icon: Icon(Icons.home_outlined, color: AppTheme.navyBlue),
if (index != _activeTabIndex) { ),
setState(() { IconButton(
_activeTabIndex = index; onPressed: () => Navigator.of(context, rootNavigator: true).push(
}); MaterialPageRoute(
_loadNotifications(refresh: true); builder: (_) => const SecureChatFullScreen(),
} fullscreenDialog: true,
}, ),
indicatorColor: AppTheme.egyptianBlue,
labelColor: AppTheme.egyptianBlue,
unselectedLabelColor: AppTheme.egyptianBlue.withOpacity(0.5),
tabs: const [
Tab(text: 'Active'),
Tab(text: 'Archived'),
],
), ),
// Content icon: Consumer(
Expanded( builder: (context, ref, child) {
child: _error != null final badge = ref.watch(currentBadgeProvider);
return Badge(
label: Text(badge.messageCount.toString()),
isLabelVisible: badge.messageCount > 0,
backgroundColor: AppTheme.brightNavy,
child: Icon(Icons.chat_bubble_outline, color: AppTheme.navyBlue),
);
},
),
),
const SizedBox(width: 8),
],
bottom: TabBar(
onTap: (index) {
if (index != _activeTabIndex) {
setState(() {
_activeTabIndex = index;
});
_loadNotifications(refresh: true);
}
},
indicatorColor: AppTheme.egyptianBlue,
labelColor: AppTheme.egyptianBlue,
unselectedLabelColor: AppTheme.egyptianBlue.withOpacity(0.5),
tabs: const [
Tab(text: 'Active'),
Tab(text: 'Archived'),
],
),
),
body: _error != null
? _ErrorState( ? _ErrorState(
message: _error!, message: _error!,
onRetry: () => _loadNotifications(refresh: true), onRetry: () => _loadNotifications(refresh: true),
@ -483,10 +510,6 @@ class _NotificationsScreenState extends ConsumerState<NotificationsScreen> {
}, },
), ),
), ),
),
],
),
),
), ),
); );
} }