Skip to content

Commit

Permalink
[table]:解决空数据图片无法显示问题
Browse files Browse the repository at this point in the history
  • Loading branch information
ccXxx1aoBai committed Jan 10, 2025
1 parent b7b06da commit a2d4ddc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tdesign-component/lib/src/components/table/td_table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,8 @@ class TDTableState extends State<TDTable> {
padding: const EdgeInsets.only(top: 16, bottom: 38),
child: TDEmpty(
image: Visibility(
visible: false,
child: TDImage(assetUrl: widget.empty?.assetUrl ?? ''),
visible: widget.empty?.assetUrl != null,
child: _getEmptyImage(),
),
emptyText: widget.empty?.text ?? defaultText,
),
Expand All @@ -526,6 +526,14 @@ class TDTableState extends State<TDTable> {
);
}

TDImage _getEmptyImage() {
var url = widget.empty?.assetUrl ?? '';
if (url.startsWith('http')) {
return TDImage(imgUrl: url);
}
return TDImage(assetUrl: url);
}

/// 竖向生成单元格
List<Widget> _getVerticalCell(
List<TDTableCol> cols, List<List<String>> titles, double cellWidth) {
Expand Down

0 comments on commit a2d4ddc

Please sign in to comment.