From 0b94e2b25dfd434f47976cabf429ef8acb68f478 Mon Sep 17 00:00:00 2001 From: Richard Shiue <71320345+richardshiue@users.noreply.github.com> Date: Mon, 29 Apr 2024 09:30:51 +0800 Subject: [PATCH] fix: kanban card icon not displaying (#5181) --- .../board/presentation/board_page.dart | 3 +- .../card_cell_skeleton/text_card_cell.dart | 36 ++++++++++++++----- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/frontend/appflowy_flutter/lib/plugins/database/board/presentation/board_page.dart b/frontend/appflowy_flutter/lib/plugins/database/board/presentation/board_page.dart index f74416b42d..b72b4b083c 100644 --- a/frontend/appflowy_flutter/lib/plugins/database/board/presentation/board_page.dart +++ b/frontend/appflowy_flutter/lib/plugins/database/board/presentation/board_page.dart @@ -12,6 +12,7 @@ import 'package:appflowy/plugins/database/grid/presentation/grid_page.dart'; import 'package:appflowy/plugins/database/grid/presentation/widgets/header/field_type_extension.dart'; import 'package:appflowy/plugins/database/tab_bar/desktop/setting_menu.dart'; import 'package:appflowy/plugins/database/tab_bar/tab_bar_view.dart'; +import 'package:appflowy/plugins/database/widgets/card/card_bloc.dart'; import 'package:appflowy/plugins/database/widgets/cell/card_cell_style_maps/desktop_board_card_cell_style.dart'; import 'package:appflowy/plugins/database/widgets/row/row_detail.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/row_entities.pb.dart'; @@ -278,7 +279,7 @@ class _DesktopBoardContentState extends State { context: context, databaseController: databaseController, groupId: groupData.group.groupId, - rowMeta: rowMeta, + rowMeta: context.read().state.rowMeta, ), styleConfiguration: RowCardStyleConfiguration( cellStyleMap: desktopBoardCardCellStyleMap(context), diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/text_card_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/text_card_cell.dart index a36d539bb1..421cf3b761 100644 --- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/text_card_cell.dart +++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/text_card_cell.dart @@ -5,6 +5,7 @@ import 'package:appflowy/plugins/database/application/cell/cell_controller_build import 'package:appflowy/plugins/database/application/database_controller.dart'; import 'package:appflowy/plugins/database/application/cell/bloc/text_cell_bloc.dart'; import 'package:easy_localization/easy_localization.dart'; +import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flowy_infra_ui/widget/flowy_tooltip.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; @@ -128,20 +129,17 @@ class _TextCellState extends State { return const SizedBox.shrink(); } + final icon = _buildIcon(state, isTitle); final child = state.enableEdit || focusWhenInit ? _buildTextField() : _buildText(state, isTitle); return Row( children: [ - if (isTitle && widget.showNotes) - FlowyTooltip( - message: LocaleKeys.board_notesTooltip.tr(), - child: FlowySvg( - FlowySvgs.notes_s, - color: Theme.of(context).hintColor, - ), - ), + if (icon != null) ...[ + icon, + const HSpace(4.0), + ], Expanded(child: child), ], ); @@ -158,6 +156,28 @@ class _TextCellState extends State { super.dispose(); } + Widget? _buildIcon(TextCellState state, bool isTitle) { + if (!isTitle) { + return null; + } + if (state.emoji.isNotEmpty) { + return Text( + state.emoji, + style: widget.style.titleTextStyle, + ); + } + if (widget.showNotes) { + return FlowyTooltip( + message: LocaleKeys.board_notesTooltip.tr(), + child: FlowySvg( + FlowySvgs.notes_s, + color: Theme.of(context).hintColor, + ), + ); + } + return null; + } + Widget _buildText(TextCellState state, bool isTitle) { final text = state.content.isEmpty ? isTitle