NotificationsScreen: match Thread screen AppBar (back, title, home/chat actions, tab bar)
This commit is contained in:
parent
858d57b5b2
commit
b8bd45c0f9
|
|
@ -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,25 +359,29 @@ 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 {
|
||||||
|
context.go('/home');
|
||||||
|
}
|
||||||
|
},
|
||||||
icon: Icon(Icons.arrow_back, color: AppTheme.navyBlue),
|
icon: Icon(Icons.arrow_back, color: AppTheme.navyBlue),
|
||||||
onPressed: () => context.go('/home'),
|
|
||||||
),
|
),
|
||||||
Text(
|
title: Text(
|
||||||
'Activity',
|
'Activity',
|
||||||
style: AppTheme.textTheme.headlineSmall?.copyWith(
|
style: GoogleFonts.inter(
|
||||||
fontWeight: FontWeight.bold,
|
color: AppTheme.textPrimary,
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
actions: [
|
||||||
if (canArchiveAll)
|
if (canArchiveAll)
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: _archiveAllNotifications,
|
onPressed: _archiveAllNotifications,
|
||||||
|
|
@ -386,11 +393,32 @@ class _NotificationsScreenState extends ConsumerState<NotificationsScreen> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => context.go('/home'),
|
||||||
|
icon: Icon(Icons.home_outlined, color: AppTheme.navyBlue),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => Navigator.of(context, rootNavigator: true).push(
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (_) => const SecureChatFullScreen(),
|
||||||
|
fullscreenDialog: true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
icon: Consumer(
|
||||||
|
builder: (context, ref, child) {
|
||||||
|
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(
|
||||||
),
|
|
||||||
// Filter tabs
|
|
||||||
TabBar(
|
|
||||||
onTap: (index) {
|
onTap: (index) {
|
||||||
if (index != _activeTabIndex) {
|
if (index != _activeTabIndex) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|
@ -407,9 +435,8 @@ class _NotificationsScreenState extends ConsumerState<NotificationsScreen> {
|
||||||
Tab(text: 'Archived'),
|
Tab(text: 'Archived'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
// Content
|
),
|
||||||
Expanded(
|
body: _error != null
|
||||||
child: _error != null
|
|
||||||
? _ErrorState(
|
? _ErrorState(
|
||||||
message: _error!,
|
message: _error!,
|
||||||
onRetry: () => _loadNotifications(refresh: true),
|
onRetry: () => _loadNotifications(refresh: true),
|
||||||
|
|
@ -484,10 +511,6 @@ class _NotificationsScreenState extends ConsumerState<NotificationsScreen> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue