fix: integration test failed (grid row detail page: hide and show hidden fields) (#5781)

This commit is contained in:
Lucas.Xu 2024-07-22 16:51:58 +08:00 committed by GitHub
parent 620e027c3e
commit f66821715f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 23 additions and 30 deletions

View File

@ -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<FieldInfo>);
typedef OnReceiveFilters = void Function(List<FilterInfo>);
typedef OnReceiveSorts = void Function(List<SortInfo>);
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<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);
@ -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]);
}

View File

@ -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(

View File

@ -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,
),
),
),
);

View File

@ -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));
}
}