update news

This commit is contained in:
Phuoc Nguyen
2025-11-10 15:37:55 +07:00
parent 36bdf6613b
commit 67fd5ed142
17 changed files with 1016 additions and 211 deletions

View File

@@ -735,16 +735,3 @@ class _NewsDetailPageState extends ConsumerState<NewsDetailPage> {
// );
}
}
/// Provider for getting article by ID
final newsArticleByIdProvider = FutureProvider.family<NewsArticle?, String>((
ref,
id,
) async {
final articles = await ref.watch(newsArticlesProvider.future);
try {
return articles.firstWhere((article) => article.id == id);
} catch (e) {
return null;
}
});

View File

@@ -86,44 +86,9 @@ class _NewsListPageState extends ConsumerState<NewsListPage> {
}
return SliverToBoxAdapter(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Section title "Nổi bật"
Padding(
padding: const EdgeInsets.symmetric(
horizontal: AppSpacing.md,
),
child: Row(
children: [
Icon(
Icons.star,
size: 18,
color: AppColors.primaryBlue,
),
const SizedBox(width: 8),
const Text(
'Nổi bật',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Color(0xFF1E293B),
),
),
],
),
),
const SizedBox(height: AppSpacing.md),
// Featured card
FeaturedNewsCard(
article: article,
onTap: () => _onArticleTap(context, article),
),
const SizedBox(height: 32),
],
child: FeaturedNewsCard(
article: article,
onTap: () => _onArticleTap(context, article),
),
);
},
@@ -137,10 +102,13 @@ class _NewsListPageState extends ConsumerState<NewsListPage> {
const SliverToBoxAdapter(child: SizedBox.shrink()),
),
const SliverToBoxAdapter(
child: SizedBox(height: AppSpacing.xl),
),
// Latest News Section
SliverToBoxAdapter(
const SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: AppSpacing.md),
padding: EdgeInsets.symmetric(horizontal: AppSpacing.md),
child: Row(
children: [
Icon(
@@ -148,8 +116,8 @@ class _NewsListPageState extends ConsumerState<NewsListPage> {
size: 18,
color: AppColors.primaryBlue,
),
const SizedBox(width: 8),
const Text(
SizedBox(width: 8),
Text(
'Mới nhất',
style: TextStyle(
fontSize: 18,