fix design request
This commit is contained in:
@@ -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,
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
@@ -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),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user