Skip to content

Commit

Permalink
fix: integration test failed (grid row detail page: hide and show hid…
Browse files Browse the repository at this point in the history
…den fields) (#5781)
  • Loading branch information
LucasXu0 authored Jul 22, 2024
1 parent 620e027 commit f668217
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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 {
Expand Down Expand Up @@ -76,7 +74,6 @@ typedef OnReceiveFields = void Function(List<FieldInfo>);
typedef OnReceiveFilters = void Function(List<FilterInfo>);
typedef OnReceiveSorts = void Function(List<SortInfo>);


class FieldController {
FieldController({required this.viewId})
: _fieldListener = FieldsListener(viewId: viewId),
Expand Down Expand Up @@ -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<FieldInfo> newFields = fieldInfos;
FieldInfo updatedField = newFields[0];
var updatedField = newFields.firstOrNull;

if (updatedField == null) {
return null;
}

final index = newFields
.indexWhere((field) => field.id == updatedFieldSettings.fieldId);
Expand All @@ -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]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,4 @@ extension FlowyAsyncResultExtension<S, F extends Object>
FlowyAsyncResult<S, F> onFailure(void Function(F failure) onFailure) {
return then((result) => result..onFailure(onFailure));
}

FlowyAsyncResult<S, F> onSuccess(void Function(S success) onSuccess) {
return then((result) => result..onSuccess(onSuccess));
}
}

0 comments on commit f668217

Please sign in to comment.