fix: kanban card icon not displaying (#5181)

This commit is contained in:
Richard Shiue 2024-04-29 09:30:51 +08:00 committed by GitHub
parent 044dad1d3e
commit 0b94e2b25d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 9 deletions

View File

@ -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<DesktopBoardContent> {
context: context,
databaseController: databaseController,
groupId: groupData.group.groupId,
rowMeta: rowMeta,
rowMeta: context.read<CardBloc>().state.rowMeta,
),
styleConfiguration: RowCardStyleConfiguration(
cellStyleMap: desktopBoardCardCellStyleMap(context),

View File

@ -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<TextCardCell> {
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<TextCardCell> {
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