This commit is contained in:
Phuoc Nguyen
2025-12-11 16:55:25 +07:00
parent fc6a4f038e
commit 4546e7d8e8
15 changed files with 91 additions and 106 deletions

View File

@@ -27,6 +27,8 @@ class NotificationsPage extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final colorScheme = Theme.of(context).colorScheme;
// Use Flutter hooks for local state management
final selectedCategory = useState<String>('general');
final notificationsAsync = ref.watch(
@@ -34,59 +36,38 @@ class NotificationsPage extends HookConsumerWidget {
);
return Scaffold(
backgroundColor: const Color(0xFFF4F6F8),
body: SafeArea(
child: Column(
children: [
// Header
_buildHeader(),
// Tabs
_buildTabs(context, selectedCategory),
// Notifications List
Expanded(
child: notificationsAsync.when(
data: (notifications) => _buildNotificationsList(
context,
ref,
notifications,
selectedCategory,
),
loading: () => const CustomLoadingIndicator(),
error: (error, stack) =>
_buildErrorState(ref, selectedCategory),
),
),
],
backgroundColor: colorScheme.surfaceContainerLowest,
appBar: AppBar(
title: Text(
'Thông báo',
style: TextStyle(color: colorScheme.onSurface),
),
elevation: AppBarSpecs.elevation,
backgroundColor: colorScheme.surface,
foregroundColor: colorScheme.onSurface,
centerTitle: false,
),
);
}
body: Column(
children: [
// Tabs
_buildTabs(context, selectedCategory),
/// Build header
Widget _buildHeader() {
return Container(
width: double.infinity,
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.05),
blurRadius: 8,
offset: const Offset(0, 2),
// Notifications List
Expanded(
child: notificationsAsync.when(
data: (notifications) => _buildNotificationsList(
context,
ref,
notifications,
selectedCategory,
),
loading: () => const CustomLoadingIndicator(),
error: (error, stack) =>
_buildErrorState(ref, selectedCategory),
),
),
],
),
child: const Text(
'Thông báo',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Color(0xFF212121),
),
),
);
}