Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

chore: fix card animation issue

appflowyd3c13d325ee8
diff --git a/frontend/app_flowy/lib/plugins/board/presentation/card/board_checkbox_cell.dart b/frontend/app_flowy/lib/plugins/board/presentation/card/board_checkbox_cell.dart
index ab78a46765..f832d3749d 100644
--- a/frontend/app_flowy/lib/plugins/board/presentation/card/board_checkbox_cell.dart
+++ b/frontend/app_flowy/lib/plugins/board/presentation/card/board_checkbox_cell.dart
@@ -36,19 +36,18 @@ class _BoardCheckboxCellState extends State<BoardCheckboxCell> {
return BlocProvider.value(
value: _cellBloc,
child: BlocBuilder<BoardCheckboxCellBloc, BoardCheckboxCellState>(
+ buildWhen: (previous, current) =>
+ previous.isSelected != current.isSelected,
builder: (context, state) {
final icon = state.isSelected
? svgWidget('editor/editor_check')
: svgWidget('editor/editor_uncheck');
- return Padding(
- padding: EdgeInsets.zero,
- child: Align(
- alignment: Alignment.centerLeft,
- child: FlowyIconButton(
- iconPadding: EdgeInsets.zero,
- icon: icon,
- width: 20,
- ),
+ return Align(
+ alignment: Alignment.centerLeft,
+ child: FlowyIconButton(
+ iconPadding: EdgeInsets.zero,
+ icon: icon,
+ width: 20,
),
);
},
diff --git a/frontend/app_flowy/lib/plugins/board/presentation/card/board_date_cell.dart b/frontend/app_flowy/lib/plugins/board/presentation/card/board_date_cell.dart
index dd6fe621df..47472a0f9f 100644
--- a/frontend/app_flowy/lib/plugins/board/presentation/card/board_date_cell.dart
+++ b/frontend/app_flowy/lib/plugins/board/presentation/card/board_date_cell.dart
@@ -5,8 +5,6 @@ import 'package:flowy_infra_ui/style_widget/text.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
-import 'define.dart';
-
class BoardDateCell extends StatefulWidget {
final String groupId;
final GridCellControllerBuilder cellControllerBuilder;
@@ -39,21 +37,17 @@ class _BoardDateCellState extends State<BoardDateCell> {
return BlocProvider.value(
value: _cellBloc,
child: BlocBuilder<BoardDateCellBloc, BoardDateCellState>(
+ buildWhen: (previous, current) => previous.dateStr != current.dateStr,
builder: (context, state) {
if (state.dateStr.isEmpty) {
return const SizedBox();
} else {
return Align(
alignment: Alignment.centerLeft,
- child: Padding(
- padding: EdgeInsets.symmetric(
- vertical: BoardSizes.cardCellVPadding,
- ),
- child: FlowyText.regular(
- state.dateStr,
- fontSize: 13,
- color: context.read<AppTheme>().shader3,
- ),
+ child: FlowyText.regular(
+ state.dateStr,
+ fontSize: 13,
+ color: context.read<AppTheme>().shader3,
),
);
}
diff --git a/frontend/app_flowy/lib/plugins/board/presentation/card/board_number_cell.dart b/frontend/app_flowy/lib/plugins/board/presentation/card/board_number_cell.dart
index a651f9f3aa..0f4aca6b61 100644
--- a/frontend/app_flowy/lib/plugins/board/presentation/card/board_number_cell.dart
+++ b/frontend/app_flowy/lib/plugins/board/presentation/card/board_number_cell.dart
@@ -4,8 +4,6 @@ import 'package:flowy_infra_ui/style_widget/text.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
-import 'define.dart';
-
class BoardNumberCell extends StatefulWidget {
final String groupId;
final GridCellControllerBuilder cellControllerBuilder;
@@ -38,19 +36,16 @@ class _BoardNumberCellState extends State<BoardNumberCell> {
return BlocProvider.value(
value: _cellBloc,
child: BlocBuilder<BoardNumberCellBloc, BoardNumberCellState>(
+ buildWhen: (previous, current) => previous.content != current.content,
builder: (context, state) {
if (state.content.isEmpty) {
return const SizedBox();
} else {
- return Padding(
- padding:
- EdgeInsets.symmetric(vertical: BoardSizes.cardCellVPadding),
- child: Align(
- alignment: Alignment.centerLeft,
- child: FlowyText.medium(
- state.content,
- fontSize: 14,
- ),
+ return Align(
+ alignment: Alignment.centerLeft,
+ child: FlowyText.medium(
+ state.content,
+ fontSize: 14,
),
);
}
diff --git a/frontend/app_flowy/lib/plugins/board/presentation/card/board_select_option_cell.dart b/frontend/app_flowy/lib/plugins/board/presentation/card/board_select_option_cell.dart
index faed598d09..f75de47651 100644
--- a/frontend/app_flowy/lib/plugins/board/presentation/card/board_select_option_cell.dart
+++ b/frontend/app_flowy/lib/plugins/board/presentation/card/board_select_option_cell.dart
@@ -4,8 +4,6 @@ import 'package:app_flowy/plugins/grid/presentation/widgets/cell/select_option_c
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
-import 'define.dart';
-
class BoardSelectOptionCell extends StatefulWidget {
final String groupId;
final GridCellControllerBuilder cellControllerBuilder;
@@ -37,9 +35,8 @@ class _BoardSelectOptionCellState extends State<BoardSelectOptionCell> {
return BlocProvider.value(
value: _cellBloc,
child: BlocBuilder<BoardSelectOptionCellBloc, BoardSelectOptionCellState>(
- // buildWhen: (previous, current) {
- // return previous.selectedOptions != current.selectedOptions;
- // },
+ buildWhen: (previous, current) =>
+ previous.selectedOptions != current.selectedOptions,
builder: (context, state) {
if (state.selectedOptions
.where((element) => element.id == widget.groupId)
@@ -54,13 +51,10 @@ class _BoardSelectOptionCellState extends State<BoardSelectOptionCell> {
),
)
.toList();
- return Padding(
- padding: EdgeInsets.only(top: BoardSizes.cardCellVPadding),
- child: Align(
- alignment: Alignment.centerLeft,
- child: AbsorbPointer(
- child: Wrap(children: children, spacing: 4, runSpacing: 2),
- ),
+ return Align(
+ alignment: Alignment.centerLeft,
+ child: AbsorbPointer(
+ child: Wrap(children: children, spacing: 4, runSpacing: 2),
),
);
}
diff --git a/frontend/app_flowy/lib/plugins/board/presentation/card/board_text_cell.dart b/frontend/app_flowy/lib/plugins/board/presentation/card/board_text_cell.dart
index d7c4e67bc1..deea60e793 100644
--- a/frontend/app_flowy/lib/plugins/board/presentation/card/board_text_cell.dart
+++ b/frontend/app_flowy/lib/plugins/board/presentation/card/board_text_cell.dart
@@ -4,8 +4,6 @@ import 'package:flowy_infra_ui/style_widget/text.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
-import 'define.dart';
-
class BoardTextCell extends StatefulWidget {
final String groupId;
final GridCellControllerBuilder cellControllerBuilder;
@@ -37,20 +35,16 @@ class _BoardTextCellState extends State<BoardTextCell> {
return BlocProvider.value(
value: _cellBloc,
child: BlocBuilder<BoardTextCellBloc, BoardTextCellState>(
+ buildWhen: (previous, current) => previous.content != current.content,
builder: (context, state) {
if (state.content.isEmpty) {
return const SizedBox();
} else {
return Align(
alignment: Alignment.centerLeft,
- child: Padding(
- padding: EdgeInsets.symmetric(
- vertical: BoardSizes.cardCellVPadding,
- ),
- child: ConstrainedBox(
- constraints: const BoxConstraints(maxHeight: 120),
- child: FlowyText.medium(state.content, fontSize: 14),
- ),
+ child: ConstrainedBox(
+ constraints: const BoxConstraints(maxHeight: 120),
+ child: FlowyText.medium(state.content, fontSize: 14),
),
);
}
diff --git a/frontend/app_flowy/lib/plugins/board/presentation/card/board_url_cell.dart b/frontend/app_flowy/lib/plugins/board/presentation/card/board_url_cell.dart
index a70414baf4..40cdec7c2f 100644
--- a/frontend/app_flowy/lib/plugins/board/presentation/card/board_url_cell.dart
+++ b/frontend/app_flowy/lib/plugins/board/presentation/card/board_url_cell.dart
@@ -4,8 +4,6 @@ import 'package:flowy_infra/theme.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
-import 'define.dart';
-
class BoardUrlCell extends StatefulWidget {
final String groupId;
final GridCellControllerBuilder cellControllerBuilder;
@@ -38,24 +36,21 @@ class _BoardUrlCellState extends State<BoardUrlCell> {
return BlocProvider.value(
value: _cellBloc,
child: BlocBuilder<BoardURLCellBloc, BoardURLCellState>(
+ buildWhen: (previous, current) => previous.content != current.content,
builder: (context, state) {
if (state.content.isEmpty) {
return const SizedBox();
} else {
- return Padding(
- padding:
- EdgeInsets.symmetric(vertical: BoardSizes.cardCellVPadding),
- child: Align(
- alignment: Alignment.centerLeft,
- child: RichText(
- textAlign: TextAlign.left,
- text: TextSpan(
- text: state.content,
- style: TextStyle(
- color: theme.main2,
- fontSize: 14,
- decoration: TextDecoration.underline,
- ),
+ return Align(
+ alignment: Alignment.centerLeft,
+ child: RichText(
+ textAlign: TextAlign.left,
+ text: TextSpan(
+ text: state.content,
+ style: TextStyle(
+ color: theme.main2,
+ fontSize: 14,
+ decoration: TextDecoration.underline,
),
),
),
diff --git a/frontend/app_flowy/lib/plugins/board/presentation/card/card.dart b/frontend/app_flowy/lib/plugins/board/presentation/card/card.dart
index 0fcce45fa9..65c7d3dade 100644
--- a/frontend/app_flowy/lib/plugins/board/presentation/card/card.dart
+++ b/frontend/app_flowy/lib/plugins/board/presentation/card/card.dart
@@ -75,7 +75,7 @@ class _BoardCardState extends State<BoardCard> {
(cellId) {
final child = widget.cellBuilder.buildCell(widget.groupId, cellId);
return Padding(
- padding: const EdgeInsets.symmetric(horizontal: 6),
+ padding: const EdgeInsets.only(left: 4, right: 4, top: 6),
child: child,
);
},