add news detail page
This commit is contained in:
@@ -22,6 +22,7 @@ import 'package:worker/features/promotions/presentation/pages/promotion_detail_p
|
||||
import 'package:worker/features/quotes/presentation/pages/quotes_page.dart';
|
||||
import 'package:worker/features/price_policy/price_policy.dart';
|
||||
import 'package:worker/features/news/presentation/pages/news_list_page.dart';
|
||||
import 'package:worker/features/news/presentation/pages/news_detail_page.dart';
|
||||
|
||||
/// App Router
|
||||
///
|
||||
@@ -43,20 +44,16 @@ class AppRouter {
|
||||
GoRoute(
|
||||
path: RouteNames.home,
|
||||
name: RouteNames.home,
|
||||
pageBuilder: (context, state) => MaterialPage(
|
||||
key: state.pageKey,
|
||||
child: const MainScaffold(),
|
||||
),
|
||||
pageBuilder: (context, state) =>
|
||||
MaterialPage(key: state.pageKey, child: const MainScaffold()),
|
||||
),
|
||||
|
||||
// Products Route (full screen, no bottom nav)
|
||||
GoRoute(
|
||||
path: RouteNames.products,
|
||||
name: RouteNames.products,
|
||||
pageBuilder: (context, state) => MaterialPage(
|
||||
key: state.pageKey,
|
||||
child: const ProductsPage(),
|
||||
),
|
||||
pageBuilder: (context, state) =>
|
||||
MaterialPage(key: state.pageKey, child: const ProductsPage()),
|
||||
),
|
||||
|
||||
// Product Detail Route
|
||||
@@ -89,60 +86,48 @@ class AppRouter {
|
||||
GoRoute(
|
||||
path: RouteNames.cart,
|
||||
name: RouteNames.cart,
|
||||
pageBuilder: (context, state) => MaterialPage(
|
||||
key: state.pageKey,
|
||||
child: const CartPage(),
|
||||
),
|
||||
pageBuilder: (context, state) =>
|
||||
MaterialPage(key: state.pageKey, child: const CartPage()),
|
||||
),
|
||||
|
||||
// Favorites Route
|
||||
GoRoute(
|
||||
path: RouteNames.favorites,
|
||||
name: RouteNames.favorites,
|
||||
pageBuilder: (context, state) => MaterialPage(
|
||||
key: state.pageKey,
|
||||
child: const FavoritesPage(),
|
||||
),
|
||||
pageBuilder: (context, state) =>
|
||||
MaterialPage(key: state.pageKey, child: const FavoritesPage()),
|
||||
),
|
||||
|
||||
// Loyalty Route
|
||||
GoRoute(
|
||||
path: RouteNames.loyalty,
|
||||
name: RouteNames.loyalty,
|
||||
pageBuilder: (context, state) => MaterialPage(
|
||||
key: state.pageKey,
|
||||
child: const LoyaltyPage(),
|
||||
),
|
||||
pageBuilder: (context, state) =>
|
||||
MaterialPage(key: state.pageKey, child: const LoyaltyPage()),
|
||||
),
|
||||
|
||||
// Loyalty Rewards Route
|
||||
GoRoute(
|
||||
path: '/loyalty/rewards',
|
||||
name: 'loyalty_rewards',
|
||||
pageBuilder: (context, state) => MaterialPage(
|
||||
key: state.pageKey,
|
||||
child: const RewardsPage(),
|
||||
),
|
||||
pageBuilder: (context, state) =>
|
||||
MaterialPage(key: state.pageKey, child: const RewardsPage()),
|
||||
),
|
||||
|
||||
// Points History Route
|
||||
GoRoute(
|
||||
path: RouteNames.pointsHistory,
|
||||
name: 'loyalty_points_history',
|
||||
pageBuilder: (context, state) => MaterialPage(
|
||||
key: state.pageKey,
|
||||
child: const PointsHistoryPage(),
|
||||
),
|
||||
pageBuilder: (context, state) =>
|
||||
MaterialPage(key: state.pageKey, child: const PointsHistoryPage()),
|
||||
),
|
||||
|
||||
// Orders Route
|
||||
GoRoute(
|
||||
path: RouteNames.orders,
|
||||
name: RouteNames.orders,
|
||||
pageBuilder: (context, state) => MaterialPage(
|
||||
key: state.pageKey,
|
||||
child: const OrdersPage(),
|
||||
),
|
||||
pageBuilder: (context, state) =>
|
||||
MaterialPage(key: state.pageKey, child: const OrdersPage()),
|
||||
),
|
||||
|
||||
// Order Detail Route
|
||||
@@ -162,10 +147,8 @@ class AppRouter {
|
||||
GoRoute(
|
||||
path: RouteNames.payments,
|
||||
name: RouteNames.payments,
|
||||
pageBuilder: (context, state) => MaterialPage(
|
||||
key: state.pageKey,
|
||||
child: const PaymentsPage(),
|
||||
),
|
||||
pageBuilder: (context, state) =>
|
||||
MaterialPage(key: state.pageKey, child: const PaymentsPage()),
|
||||
),
|
||||
|
||||
// Payment Detail Route
|
||||
@@ -185,30 +168,37 @@ class AppRouter {
|
||||
GoRoute(
|
||||
path: RouteNames.quotes,
|
||||
name: RouteNames.quotes,
|
||||
pageBuilder: (context, state) => MaterialPage(
|
||||
key: state.pageKey,
|
||||
child: const QuotesPage(),
|
||||
),
|
||||
pageBuilder: (context, state) =>
|
||||
MaterialPage(key: state.pageKey, child: const QuotesPage()),
|
||||
),
|
||||
|
||||
// Price Policy Route
|
||||
GoRoute(
|
||||
path: RouteNames.pricePolicy,
|
||||
name: RouteNames.pricePolicy,
|
||||
pageBuilder: (context, state) => MaterialPage(
|
||||
key: state.pageKey,
|
||||
child: const PricePolicyPage(),
|
||||
),
|
||||
pageBuilder: (context, state) =>
|
||||
MaterialPage(key: state.pageKey, child: const PricePolicyPage()),
|
||||
),
|
||||
|
||||
// News Route
|
||||
GoRoute(
|
||||
path: RouteNames.news,
|
||||
name: RouteNames.news,
|
||||
pageBuilder: (context, state) => MaterialPage(
|
||||
key: state.pageKey,
|
||||
child: const NewsListPage(),
|
||||
),
|
||||
pageBuilder: (context, state) =>
|
||||
MaterialPage(key: state.pageKey, child: const NewsListPage()),
|
||||
),
|
||||
|
||||
// News Detail Route
|
||||
GoRoute(
|
||||
path: RouteNames.newsDetail,
|
||||
name: RouteNames.newsDetail,
|
||||
pageBuilder: (context, state) {
|
||||
final articleId = state.pathParameters['id'];
|
||||
return MaterialPage(
|
||||
key: state.pageKey,
|
||||
child: NewsDetailPage(articleId: articleId ?? ''),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
// TODO: Add more routes as features are implemented
|
||||
@@ -218,18 +208,12 @@ class AppRouter {
|
||||
errorPageBuilder: (context, state) => MaterialPage(
|
||||
key: state.pageKey,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Không tìm thấy trang'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('Không tìm thấy trang')),
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.error_outline,
|
||||
size: 64,
|
||||
color: Colors.red,
|
||||
),
|
||||
const Icon(Icons.error_outline, size: 64, color: Colors.red),
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
'Trang không tồn tại',
|
||||
|
||||
Reference in New Issue
Block a user