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.

fix(flutter_desktop): fix calendar event bugs (#6446)

Richard Shiue092aefdd71c9
diff --git a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_card.dart b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_card.dart
index ad6124cd19..634dca5ce2 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_card.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_card.dart
@@ -1,3 +1,5 @@
+import 'package:appflowy/plugins/database/application/row/row_controller.dart';
+import 'package:appflowy/plugins/database/widgets/row/row_detail.dart';
import 'package:flutter/material.dart';
import 'package:appflowy/mobile/presentation/database/card/card_detail/mobile_card_detail_screen.dart';
@@ -168,6 +170,22 @@ class _EventCardState extends State<EventCard> {
databaseController: widget.databaseController,
rowMeta: widget.event.event.rowMeta,
layoutSettings: settings,
+ onExpand: () {
+ final rowController = RowController(
+ rowMeta: widget.event.event.rowMeta,
+ viewId: widget.databaseController.viewId,
+ rowCache: widget.databaseController.rowCache,
+ );
+
+ FlowyOverlay.show(
+ context: context,
+ builder: (_) => RowDetailPage(
+ databaseController: widget.databaseController,
+ rowController: rowController,
+ userProfile: context.read<CalendarBloc>().userProfile,
+ ),
+ );
+ },
),
);
},
diff --git a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_editor.dart b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_editor.dart
index 2bfdb4313a..da461b93fe 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_editor.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_editor.dart
@@ -12,8 +12,6 @@ import 'package:appflowy/plugins/database/widgets/cell/editable_cell_builder.dar
import 'package:appflowy/plugins/database/widgets/cell/editable_cell_skeleton/text.dart';
import 'package:appflowy/plugins/database/widgets/row/accessory/cell_accessory.dart';
import 'package:appflowy/plugins/database/widgets/row/cells/cell_container.dart';
-import 'package:appflowy/plugins/database/widgets/row/row_detail.dart';
-import 'package:appflowy/workspace/application/view/view_bloc.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
import 'package:appflowy_popover/appflowy_popover.dart';
import 'package:collection/collection.dart';
@@ -28,6 +26,7 @@ class CalendarEventEditor extends StatelessWidget {
required RowMetaPB rowMeta,
required this.layoutSettings,
required this.databaseController,
+ required this.onExpand,
}) : rowController = RowController(
rowMeta: rowMeta,
viewId: databaseController.viewId,
@@ -40,6 +39,7 @@ class CalendarEventEditor extends StatelessWidget {
final DatabaseController databaseController;
final RowController rowController;
final EditableCellBuilder cellBuilder;
+ final VoidCallback onExpand;
@override
Widget build(BuildContext context) {
@@ -55,6 +55,7 @@ class CalendarEventEditor extends StatelessWidget {
EventEditorControls(
rowController: rowController,
databaseController: databaseController,
+ onExpand: onExpand,
),
Flexible(
child: EventPropertyList(
@@ -74,10 +75,12 @@ class EventEditorControls extends StatelessWidget {
super.key,
required this.rowController,
required this.databaseController,
+ required this.onExpand,
});
final RowController rowController;
final DatabaseController databaseController;
+ final VoidCallback onExpand;
@override
Widget build(BuildContext context) {
@@ -122,17 +125,7 @@ class EventEditorControls extends StatelessWidget {
iconColorOnHover: Theme.of(context).colorScheme.onSecondary,
onPressed: () {
PopoverContainer.of(context).close();
- FlowyOverlay.show(
- context: context,
- builder: (_) => BlocProvider.value(
- value: context.read<ViewBloc>(),
- child: RowDetailPage(
- databaseController: databaseController,
- rowController: rowController,
- userProfile: context.read<CalendarBloc>().userProfile,
- ),
- ),
- );
+ onExpand.call();
},
),
],
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/card/container/accessory.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/card/container/accessory.dart
index 56045d57d6..7078685845 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/card/container/accessory.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/card/container/accessory.dart
@@ -24,6 +24,10 @@ class CardAccessoryContainer extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ if (accessories.isEmpty) {
+ return const SizedBox.shrink();
+ }
+
final children = accessories.map<Widget>((accessory) {
return GestureDetector(
behavior: HitTestBehavior.opaque,