Skip to content

Commit

Permalink
feat(flutter_desktop): colored column names in kanban board (AppFlowy…
Browse files Browse the repository at this point in the history
…-IO#6270)

* feat: colored column names in kanban board

* fix: rename group event

* chore: add comment for rough design

* chore: revert unintentional changes

* fix: use new colors and use new delete confirmation dialog
  • Loading branch information
richardshiue authored Sep 12, 2024
1 parent f597727 commit eea3004
Show file tree
Hide file tree
Showing 23 changed files with 471 additions and 572 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ class BoardBloc extends Bloc<BoardEvent, BoardState> {
final result = await groupBackendSvc.deleteGroup(groupId: groupId);
result.fold((_) {}, (err) => Log.error(err));
},
renameGroup: (groupId, name) async {
final result = await groupBackendSvc.updateGroup(
groupId: groupId,
name: name,
);
result.fold((_) {}, (err) => Log.error(err));
},
didReceiveError: (error) {
emit(BoardState.error(error: error));
},
Expand Down Expand Up @@ -207,7 +214,6 @@ class BoardBloc extends Bloc<BoardEvent, BoardState> {
final currentName = group.generateGroupName(databaseController);
if (currentName != groupName) {
await groupBackendSvc.updateGroup(
fieldId: groupControllers.values.first.group.fieldId,
groupId: groupId,
name: groupName,
);
Expand Down Expand Up @@ -282,7 +288,6 @@ class BoardBloc extends Bloc<BoardEvent, BoardState> {
);
} else {
await groupBackendSvc.updateGroup(
fieldId: groupControllers.values.first.group.fieldId,
groupId: group.groupId,
visible: isVisible,
);
Expand Down Expand Up @@ -550,6 +555,8 @@ class BoardEvent with _$BoardEvent {
) = _SetGroupVisibility;
const factory BoardEvent.toggleHiddenSectionVisibility(bool isVisible) =
_ToggleHiddenSectionVisibility;
const factory BoardEvent.renameGroup(String groupId, String name) =
_RenameGroup;
const factory BoardEvent.deleteGroup(String groupId) = _DeleteGroup;
const factory BoardEvent.reorderGroup(String fromGroupId, String toGroupId) =
_ReorderGroup;
Expand Down Expand Up @@ -718,7 +725,7 @@ class GroupControllerDelegateImpl extends GroupControllerDelegate {
}

class GroupData {
GroupData({
const GroupData({
required this.group,
required this.fieldInfo,
});
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'package:appflowy/mobile/presentation/database/board/mobile_board_page.da
import 'package:appflowy/plugins/database/application/database_controller.dart';
import 'package:appflowy/plugins/database/application/row/row_controller.dart';
import 'package:appflowy/plugins/database/board/application/board_actions_bloc.dart';
import 'package:appflowy/plugins/database/board/application/column_header_bloc.dart';
import 'package:appflowy/plugins/database/board/presentation/widgets/board_column_header.dart';
import 'package:appflowy/plugins/database/grid/presentation/grid_page.dart';
import 'package:appflowy/plugins/database/grid/presentation/widgets/header/field_type_extension.dart';
Expand Down Expand Up @@ -341,23 +340,10 @@ class _BoardContentState extends State<_BoardContent> {
false
? BoardTrailing(scrollController: scrollController)
: const HSpace(40),
headerBuilder: (_, groupData) => MultiBlocProvider(
providers: [
BlocProvider<BoardBloc>.value(
value: context.read<BoardBloc>(),
),
BlocProvider<ColumnHeaderBloc>(
create: (context) => ColumnHeaderBloc(
databaseController: databaseController,
fieldId: (groupData.customData as GroupData).fieldInfo.id,
group: context
.read<BoardBloc>()
.groupControllers[groupData.headerData.groupId]!
.group,
)..add(const ColumnHeaderEvent.initial()),
),
],
headerBuilder: (_, groupData) => BlocProvider.value(
value: context.read<BoardBloc>(),
child: BoardColumnHeader(
databaseController: databaseController,
groupData: groupData,
margin: config.groupHeaderPadding,
),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/plugins/database/application/database_controller.dart';
import 'package:appflowy/plugins/database/board/application/board_bloc.dart';
import 'package:appflowy/plugins/database/board/group_ext.dart';
import 'package:appflowy_board/appflowy_board.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart';

import 'board_column_header.dart';

class CheckboxColumnHeader extends StatelessWidget {
const CheckboxColumnHeader({
super.key,
required this.databaseController,
required this.groupData,
});

final DatabaseController databaseController;
final AppFlowyGroupData groupData;

@override
Widget build(BuildContext context) {
final customData = groupData.customData as GroupData;
return Row(
children: [
FlowySvg(
customData.asCheckboxGroup()!.isCheck
? FlowySvgs.check_filled_s
: FlowySvgs.uncheck_s,
blendMode: BlendMode.dst,
size: const Size.square(18),
),
const HSpace(6),
Expanded(
child: FlowyText.medium(
customData.group.generateGroupName(databaseController),
overflow: TextOverflow.ellipsis,
),
),
const HSpace(6),
GroupOptionsButton(
groupData: groupData,
),
const HSpace(4),
CreateCardFromTopButton(
groupId: groupData.id,
),
],
);
}
}
Loading

0 comments on commit eea3004

Please sign in to comment.