diff --git a/lib/core/utils/extensions.dart b/lib/core/utils/extensions.dart index b2aea64..7e873e4 100644 --- a/lib/core/utils/extensions.dart +++ b/lib/core/utils/extensions.dart @@ -109,6 +109,15 @@ extension StringExtensions on String { if (cleaned.length < 10) return this; return '${cleaned.substring(0, 4)} ${cleaned.substring(4, 7)} ***'; } + + /// Remove leading "#" from string (e.g., "#SO-001" -> "SO-001") + /// Useful for backend IDs that start with "#" + String get withoutHash { + if (startsWith('#')) { + return substring(1); + } + return this; + } } // ============================================================================ diff --git a/lib/features/cart/presentation/pages/cart_page.dart b/lib/features/cart/presentation/pages/cart_page.dart index 2d1cac4..b0bbc81 100644 --- a/lib/features/cart/presentation/pages/cart_page.dart +++ b/lib/features/cart/presentation/pages/cart_page.dart @@ -50,7 +50,7 @@ class _CartPageState extends ConsumerState { _hasLoggedViewCart = true; AnalyticsService.logViewCart( - cartValue: cartState.totalPrice, + cartValue: cartState.selectedTotal, items: cartState.items.map((item) => AnalyticsEventItem( itemId: item.product.productId, itemName: item.product.name, diff --git a/lib/features/home/presentation/pages/home_page.dart b/lib/features/home/presentation/pages/home_page.dart index 42866e4..7adf4cc 100644 --- a/lib/features/home/presentation/pages/home_page.dart +++ b/lib/features/home/presentation/pages/home_page.dart @@ -198,7 +198,7 @@ class _HomePageState extends ConsumerState { actions: [ QuickAction( icon: FontAwesomeIcons.circlePlus, - label: 'Ghi nhận điểm', + label: 'Tham gia sự kiện', onTap: () => context.push(RouteNames.pointsRecords), ), QuickAction( @@ -216,7 +216,7 @@ class _HomePageState extends ConsumerState { // Sample Houses & News Section QuickActionSection( - title: 'Nhà mẫu, dự án & tin tức', + title: 'Nhà mẫu & Dự án', actions: [ QuickAction( icon: FontAwesomeIcons.houseCircleCheck, diff --git a/lib/features/invoices/presentation/pages/invoice_detail_page.dart b/lib/features/invoices/presentation/pages/invoice_detail_page.dart index cfc583e..1644afb 100644 --- a/lib/features/invoices/presentation/pages/invoice_detail_page.dart +++ b/lib/features/invoices/presentation/pages/invoice_detail_page.dart @@ -169,7 +169,7 @@ class InvoiceDetailPage extends ConsumerWidget { // Invoice Number Text( - '#${invoice.name}', + invoice.name, style: TextStyle( fontSize: 20, fontWeight: FontWeight.w600, @@ -192,7 +192,7 @@ class InvoiceDetailPage extends ConsumerWidget { _MetaItem(label: 'Ngày xuất:', value: invoice.formattedDate), if (invoice.orderId != null) ...[ const SizedBox(width: 32), - _MetaItem(label: 'Đơn hàng:', value: '#${invoice.orderId}'), + _MetaItem(label: 'Đơn hàng:', value: '${invoice.orderId}'), ], ], ), diff --git a/lib/features/invoices/presentation/pages/invoices_page.dart b/lib/features/invoices/presentation/pages/invoices_page.dart index 450b6e5..86dc11f 100644 --- a/lib/features/invoices/presentation/pages/invoices_page.dart +++ b/lib/features/invoices/presentation/pages/invoices_page.dart @@ -209,7 +209,7 @@ class _InvoiceCard extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - '#${invoice.name}', + invoice.name, style: TextStyle( fontSize: 16, fontWeight: FontWeight.w700, @@ -252,7 +252,7 @@ class _InvoiceCard extends StatelessWidget { if (invoice.orderId != null) _DetailRow( label: 'Đơn hàng:', - value: '#${invoice.orderId}', + value: '${invoice.orderId}', ), _DetailRow( label: 'Tổng tiền:', diff --git a/lib/features/loyalty/presentation/pages/points_history_page.dart b/lib/features/loyalty/presentation/pages/points_history_page.dart index af3e369..893d6f8 100644 --- a/lib/features/loyalty/presentation/pages/points_history_page.dart +++ b/lib/features/loyalty/presentation/pages/points_history_page.dart @@ -402,7 +402,7 @@ class PointsHistoryPage extends ConsumerWidget { ), const SizedBox(height: 4), Text( - 'Mã tham chiếu: #${entry.entryId}', + 'Mã tham chiếu: ${entry.entryId}', style: TextStyle( fontSize: 13, color: colorScheme.onSurfaceVariant, diff --git a/lib/features/loyalty/presentation/pages/points_records_page.dart b/lib/features/loyalty/presentation/pages/points_records_page.dart index 622baac..b1da367 100644 --- a/lib/features/loyalty/presentation/pages/points_records_page.dart +++ b/lib/features/loyalty/presentation/pages/points_records_page.dart @@ -295,7 +295,7 @@ class PointsRecordsPage extends ConsumerWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - '#${record.recordId}', + record.recordId, style: TextStyle( fontSize: 16, fontWeight: FontWeight.w700, diff --git a/lib/features/notifications/presentation/pages/notifications_page.dart b/lib/features/notifications/presentation/pages/notifications_page.dart index a32adb1..3502733 100644 --- a/lib/features/notifications/presentation/pages/notifications_page.dart +++ b/lib/features/notifications/presentation/pages/notifications_page.dart @@ -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('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), - ), - ), ); } diff --git a/lib/features/orders/presentation/pages/order_detail_page.dart b/lib/features/orders/presentation/pages/order_detail_page.dart index 773a05a..ea19440 100644 --- a/lib/features/orders/presentation/pages/order_detail_page.dart +++ b/lib/features/orders/presentation/pages/order_detail_page.dart @@ -205,7 +205,7 @@ class OrderDetailPage extends ConsumerWidget { children: [ // Order Number and Status Badge Text( - '#${order.name}', + order.name, style: TextStyle( fontSize: 20, fontWeight: FontWeight.w700, diff --git a/lib/features/orders/presentation/pages/payment_detail_page.dart b/lib/features/orders/presentation/pages/payment_detail_page.dart index e7e99e1..3859fad 100644 --- a/lib/features/orders/presentation/pages/payment_detail_page.dart +++ b/lib/features/orders/presentation/pages/payment_detail_page.dart @@ -248,7 +248,7 @@ class PaymentDetailPage extends ConsumerWidget { Column( children: [ Text( - '#$invoiceNumber', + '$invoiceNumber', style: TextStyle( fontSize: 24, fontWeight: FontWeight.w700, diff --git a/lib/features/orders/presentation/pages/payments_page.dart b/lib/features/orders/presentation/pages/payments_page.dart index 9722a7d..04f946f 100644 --- a/lib/features/orders/presentation/pages/payments_page.dart +++ b/lib/features/orders/presentation/pages/payments_page.dart @@ -227,7 +227,7 @@ class PaymentsPage extends ConsumerWidget { children: [ _DetailRow( label: 'Mã giao dịch:', - value: '#${payment.name}', + value: '${payment.name}', ), _DetailRow( label: 'Loại giao dịch:', @@ -325,7 +325,7 @@ class _TransactionCard extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - '#${payment.name}', + payment.name, style: TextStyle( fontSize: 15, fontWeight: FontWeight.w700, diff --git a/lib/features/orders/presentation/widgets/order_card.dart b/lib/features/orders/presentation/widgets/order_card.dart index 9a4a6a8..36a3ad5 100644 --- a/lib/features/orders/presentation/widgets/order_card.dart +++ b/lib/features/orders/presentation/widgets/order_card.dart @@ -48,7 +48,7 @@ class OrderCard extends StatelessWidget { children: [ // Order number Text( - '#${order.name}', + '${order.name}', style: TextStyle( fontSize: 16, fontWeight: FontWeight.w700, diff --git a/lib/features/quotes/presentation/pages/quotes_page.dart b/lib/features/quotes/presentation/pages/quotes_page.dart index 4ada751..b5491b4 100644 --- a/lib/features/quotes/presentation/pages/quotes_page.dart +++ b/lib/features/quotes/presentation/pages/quotes_page.dart @@ -222,7 +222,7 @@ class _QuotesPageState extends ConsumerState { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - '#${quote.quoteNumber}', + '${quote.quoteNumber}', style: const TextStyle( fontSize: 16, fontWeight: FontWeight.w700, diff --git a/lib/features/showrooms/presentation/pages/design_request_detail_page.dart b/lib/features/showrooms/presentation/pages/design_request_detail_page.dart index 2850ea3..6925ec5 100644 --- a/lib/features/showrooms/presentation/pages/design_request_detail_page.dart +++ b/lib/features/showrooms/presentation/pages/design_request_detail_page.dart @@ -230,7 +230,7 @@ class DesignRequestDetailPage extends ConsumerWidget { children: [ // Request ID Text( - '#${request.id}', + '${request.id}', style: TextStyle( fontSize: 24, fontWeight: FontWeight.w700, diff --git a/lib/features/showrooms/presentation/pages/model_houses_page.dart b/lib/features/showrooms/presentation/pages/model_houses_page.dart index 2af186e..4025150 100644 --- a/lib/features/showrooms/presentation/pages/model_houses_page.dart +++ b/lib/features/showrooms/presentation/pages/model_houses_page.dart @@ -509,40 +509,35 @@ class _RequestCard extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ // Header: Code and Status - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Text( - 'Mã yêu cầu: #${request.id}', - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w700, - color: colorScheme.onSurface, - ), - overflow: TextOverflow.ellipsis, - ), + + Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 6, + ), + decoration: BoxDecoration( + color: _getStatusBackgroundColor(), + borderRadius: BorderRadius.circular(20), + ), + child: Text( + request.statusText.toUpperCase(), + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: _getStatusColor(), ), - const SizedBox(width: 8), - Container( - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 6, - ), - decoration: BoxDecoration( - color: _getStatusBackgroundColor(), - borderRadius: BorderRadius.circular(20), - ), - child: Text( - request.statusText.toUpperCase(), - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - color: _getStatusColor(), - ), - ), - ), - ], + ), + ), + const SizedBox(height: 8), + + Text( + 'Mã yêu cầu: #${request.id}', + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w700, + color: colorScheme.onSurface, + ), + overflow: TextOverflow.ellipsis, ), const SizedBox(height: 8), @@ -566,16 +561,16 @@ class _RequestCard extends StatelessWidget { ), ), - if (request.plainDescription.isNotEmpty) ...[ - const SizedBox(height: 4), - // Description - Text( - request.plainDescription, - style: TextStyle(fontSize: 14, color: colorScheme.onSurfaceVariant), - maxLines: 2, - overflow: TextOverflow.ellipsis, - ), - ], + // if (request.plainDescription.isNotEmpty) ...[ + // const SizedBox(height: 4), + // // Description + // Text( + // request.plainDescription, + // style: TextStyle(fontSize: 14, color: colorScheme.onSurfaceVariant), + // maxLines: 2, + // overflow: TextOverflow.ellipsis, + // ), + // ], ], ), ),