From 2a14f82b724ce3f316e9196537494eddcf80d53d Mon Sep 17 00:00:00 2001 From: Phuoc Nguyen Date: Wed, 3 Dec 2025 17:12:21 +0700 Subject: [PATCH] fix design request --- ios/Runner/AppDelegate.swift | 10 +-- .../pages/design_request_detail_page.dart | 6 +- .../widgets/description_item.dart | 66 ++++++++++++++----- 3 files changed, 57 insertions(+), 25 deletions(-) diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index a3d6710..625cdfd 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -7,11 +7,11 @@ import UIKit _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { - #if DEBUG - var args = ProcessInfo.processInfo.arguments - args.append("-FIRDebugEnabled") - ProcessInfo.processInfo.setValue(args, forKey: "arguments") - #endif +// #if DEBUG +// var args = ProcessInfo.processInfo.arguments +// args.append("-FIRDebugEnabled") +// ProcessInfo.processInfo.setValue(args, forKey: "arguments") +// #endif GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } 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 2d7e805..2850ea3 100644 --- a/lib/features/showrooms/presentation/pages/design_request_detail_page.dart +++ b/lib/features/showrooms/presentation/pages/design_request_detail_page.dart @@ -305,12 +305,14 @@ class DesignRequestDetailPage extends ConsumerWidget { value: request.subject, ), - if (request.plainDescription.isNotEmpty) ...[ + if (request.description != null && + request.description!.isNotEmpty) ...[ const SizedBox(height: 12), DescriptionItem( label: 'Mô tả chi tiết:', - value: request.plainDescription, + value: request.description!, isMultiLine: true, + isHtml: true, ), ], ], diff --git a/lib/features/showrooms/presentation/widgets/description_item.dart b/lib/features/showrooms/presentation/widgets/description_item.dart index 0022562..69dd469 100644 --- a/lib/features/showrooms/presentation/widgets/description_item.dart +++ b/lib/features/showrooms/presentation/widgets/description_item.dart @@ -4,12 +4,14 @@ library; import 'package:flutter/material.dart'; +import 'package:flutter_html/flutter_html.dart'; /// Description Item Widget /// /// Shows a label and value pair with: /// - Inline layout (label: value) for single line /// - Stacked layout for multi-line values +/// - HTML rendering support for rich text content /// - Theme-aware colors class DescriptionItem extends StatelessWidget { const DescriptionItem({ @@ -17,11 +19,55 @@ class DescriptionItem extends StatelessWidget { required this.label, required this.value, this.isMultiLine = false, + this.isHtml = false, }); final String label; final String value; final bool isMultiLine; + final bool isHtml; + + Widget _buildValueWidget(BuildContext context) { + final colorScheme = Theme.of(context).colorScheme; + + if (isHtml) { + return Html( + data: value, + style: { + 'body': Style( + fontSize: FontSize(15), + color: colorScheme.onSurface, + fontWeight: FontWeight.w500, + lineHeight: const LineHeight(1.6), + margin: Margins.zero, + padding: HtmlPaddings.zero, + ), + 'p': Style( + margin: Margins.only(bottom: 8), + ), + 'ul': Style( + margin: Margins.only(left: 16, bottom: 8), + ), + 'ol': Style( + margin: Margins.only(left: 16, bottom: 8), + ), + 'li': Style( + margin: Margins.only(bottom: 4), + ), + }, + ); + } + + return Text( + value, + style: TextStyle( + fontSize: 15, + color: colorScheme.onSurface, + fontWeight: FontWeight.w500, + height: 1.6, + ), + ); + } @override Widget build(BuildContext context) { @@ -40,15 +86,7 @@ class DescriptionItem extends StatelessWidget { ), ), const SizedBox(height: 4), - Text( - value, - style: TextStyle( - fontSize: 15, - color: colorScheme.onSurface, - fontWeight: FontWeight.w500, - height: 1.6, - ), - ), + _buildValueWidget(context), ], ); } @@ -75,15 +113,7 @@ class DescriptionItem extends StatelessWidget { ), ), Expanded( - child: Text( - value, - style: TextStyle( - fontSize: 15, - color: colorScheme.onSurface, - fontWeight: FontWeight.w500, - height: 1.6, - ), - ), + child: _buildValueWidget(context), ), ], ),