diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/field/field_controller.dart b/frontend/appflowy_flutter/lib/plugins/database/application/field/field_controller.dart index ad0d1b4653..3b9ff53853 100644 --- a/frontend/appflowy_flutter/lib/plugins/database/application/field/field_controller.dart +++ b/frontend/appflowy_flutter/lib/plugins/database/application/field/field_controller.dart @@ -1,7 +1,5 @@ import 'dart:collection'; -import 'package:flutter/foundation.dart'; - import 'package:appflowy/plugins/database/application/row/row_cache.dart'; import 'package:appflowy/plugins/database/application/setting/setting_listener.dart'; import 'package:appflowy/plugins/database/domain/database_view_service.dart'; @@ -19,9 +17,9 @@ import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; import 'package:appflowy_result/appflowy_result.dart'; import 'package:collection/collection.dart'; +import 'package:flutter/foundation.dart'; import '../setting/setting_service.dart'; - import 'field_info.dart'; class _GridFieldNotifier extends ChangeNotifier { @@ -76,7 +74,6 @@ typedef OnReceiveFields = void Function(List); typedef OnReceiveFilters = void Function(List); typedef OnReceiveSorts = void Function(List); - class FieldController { FieldController({required this.viewId}) : _fieldListener = FieldsListener(viewId: viewId), @@ -446,9 +443,13 @@ class FieldController { /// Listen for field setting changes in the backend. void _listenOnFieldSettingsChanged() { - FieldInfo updateFieldSettings(FieldSettingsPB updatedFieldSettings) { + FieldInfo? updateFieldSettings(FieldSettingsPB updatedFieldSettings) { final List newFields = fieldInfos; - FieldInfo updatedField = newFields[0]; + var updatedField = newFields.firstOrNull; + + if (updatedField == null) { + return null; + } final index = newFields .indexWhere((field) => field.id == updatedFieldSettings.fieldId); @@ -470,6 +471,10 @@ class FieldController { result.fold( (fieldSettings) { final updatedFieldInfo = updateFieldSettings(fieldSettings); + if (updatedFieldInfo == null) { + return; + } + for (final listener in _updatedFieldCallbacks.values) { listener([updatedFieldInfo]); } diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar.dart index 92022daa60..136516253e 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar.dart @@ -349,12 +349,7 @@ class _SidebarState extends State<_Sidebar> { ), const VSpace(8), - Column( - children: [ - // ai pay button - _renderUpgradeSpaceButton(menuHorizontalInset), - ], - ), + _renderUpgradeSpaceButton(menuHorizontalInset), const VSpace(8), Padding( diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_item.dart b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_item.dart index 7076e6037e..fed0bf4390 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_item.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_item.dart @@ -238,22 +238,19 @@ class _NotificationContent extends StatelessWidget { padding: EdgeInsets.zero, ); - return ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 200), - child: Transform.scale( - scale: .9, - alignment: Alignment.centerLeft, - child: AppFlowyEditor( + return Transform.scale( + scale: .9, + alignment: Alignment.centerLeft, + child: AppFlowyEditor( + editorState: editorState, + editorStyle: styleCustomizer.style(), + editable: false, + shrinkWrap: true, + blockComponentBuilders: getEditorBuilderMap( + context: context, editorState: editorState, - editorStyle: styleCustomizer.style(), + styleCustomizer: styleCustomizer, editable: false, - shrinkWrap: true, - blockComponentBuilders: getEditorBuilderMap( - context: context, - editorState: editorState, - styleCustomizer: styleCustomizer, - editable: false, - ), ), ), ); diff --git a/frontend/appflowy_flutter/packages/appflowy_result/lib/src/async_result.dart b/frontend/appflowy_flutter/packages/appflowy_result/lib/src/async_result.dart index e8396d8019..94cd9a68a6 100644 --- a/frontend/appflowy_flutter/packages/appflowy_result/lib/src/async_result.dart +++ b/frontend/appflowy_flutter/packages/appflowy_result/lib/src/async_result.dart @@ -34,8 +34,4 @@ extension FlowyAsyncResultExtension FlowyAsyncResult onFailure(void Function(F failure) onFailure) { return then((result) => result..onFailure(onFailure)); } - - FlowyAsyncResult onSuccess(void Function(S success) onSuccess) { - return then((result) => result..onSuccess(onSuccess)); - } }