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: dragging the Unsplash cover triggers an assertion error (#5404)

Lucas.Xucb44a885a17f
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/page_style/_page_style_cover_image.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/page_style/_page_style_cover_image.dart
index 84d8c751f4..fd0aa86fa7 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/page_style/_page_style_cover_image.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/page_style/_page_style_cover_image.dart
@@ -20,13 +20,13 @@ import 'package:appflowy_backend/log.dart';
import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart';
import 'package:appflowy_result/appflowy_result.dart';
import 'package:easy_localization/easy_localization.dart';
+import 'package:flowy_infra/theme_extension.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flowy_infra_ui/style_widget/snap_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:image_picker/image_picker.dart';
-import 'package:flowy_infra/theme_extension.dart';
class PageStyleCoverImage extends StatelessWidget {
PageStyleCoverImage({
@@ -257,6 +257,9 @@ class PageStyleCoverImage extends StatelessWidget {
void _showUnsplash(BuildContext context) {
final pageStyleBloc = context.read<DocumentPageStyleBloc>();
+ final backgroundColor = AFThemeExtension.of(context).background;
+ final maxHeight = MediaQuery.of(context).size.height * 0.6;
+
context.pop();
showMobileBottomSheet(
@@ -267,7 +270,7 @@ class PageStyleCoverImage extends StatelessWidget {
showHeader: true,
showRemoveButton: true,
title: LocaleKeys.pageStyle_unsplash.tr(),
- backgroundColor: AFThemeExtension.of(context).background,
+ backgroundColor: backgroundColor,
onRemove: () {
pageStyleBloc.add(
DocumentPageStyleEvent.updateCoverImage(
@@ -278,11 +281,11 @@ class PageStyleCoverImage extends StatelessWidget {
builder: (_) {
return ConstrainedBox(
constraints: BoxConstraints(
- maxHeight: MediaQuery.of(context).size.height * 0.6,
+ maxHeight: maxHeight,
minHeight: 80,
),
child: BlocProvider.value(
- value: context.read<DocumentPageStyleBloc>(),
+ value: pageStyleBloc,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: UnsplashImageWidget(