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 'dart:collection';
import 'package:flutter/foundation.dart';
import 'package:appflowy/plugins/database/application/row/row_cache.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/application/setting/setting_listener.dart';
import 'package:appflowy/plugins/database/domain/database_view_service.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_backend/protobuf/flowy-error/errors.pb.dart';
import 'package:appflowy_result/appflowy_result.dart'; import 'package:appflowy_result/appflowy_result.dart';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:flutter/foundation.dart';
import '../setting/setting_service.dart'; import '../setting/setting_service.dart';
import 'field_info.dart'; import 'field_info.dart';
class _GridFieldNotifier extends ChangeNotifier { class _GridFieldNotifier extends ChangeNotifier {
@ -76,7 +74,6 @@ typedef OnReceiveFields = void Function(List<FieldInfo>);
typedef OnReceiveFilters = void Function(List<FilterInfo>); typedef OnReceiveFilters = void Function(List<FilterInfo>);
typedef OnReceiveSorts = void Function(List<SortInfo>); typedef OnReceiveSorts = void Function(List<SortInfo>);
class FieldController { class FieldController {
FieldController({required this.viewId}) FieldController({required this.viewId})
: _fieldListener = FieldsListener(viewId: viewId), : _fieldListener = FieldsListener(viewId: viewId),
@ -446,9 +443,13 @@ class FieldController {
/// Listen for field setting changes in the backend. /// Listen for field setting changes in the backend.
void _listenOnFieldSettingsChanged() { void _listenOnFieldSettingsChanged() {
FieldInfo updateFieldSettings(FieldSettingsPB updatedFieldSettings) { FieldInfo? updateFieldSettings(FieldSettingsPB updatedFieldSettings) {
final List<FieldInfo> newFields = fieldInfos; final List<FieldInfo> newFields = fieldInfos;
FieldInfo updatedField = newFields[0]; var updatedField = newFields.firstOrNull;
if (updatedField == null) {
return null;
}
final index = newFields final index = newFields
.indexWhere((field) => field.id == updatedFieldSettings.fieldId); .indexWhere((field) => field.id == updatedFieldSettings.fieldId);
@ -470,6 +471,10 @@ class FieldController {
result.fold( result.fold(
(fieldSettings) { (fieldSettings) {
final updatedFieldInfo = updateFieldSettings(fieldSettings); final updatedFieldInfo = updateFieldSettings(fieldSettings);
if (updatedFieldInfo == null) {
return;
}
for (final listener in _updatedFieldCallbacks.values) { for (final listener in _updatedFieldCallbacks.values) {
listener([updatedFieldInfo]); listener([updatedFieldInfo]);
} }

View File

@ -349,12 +349,7 @@ class _SidebarState extends State<_Sidebar> {
), ),
const VSpace(8), const VSpace(8),
Column(
children: [
// ai pay button
_renderUpgradeSpaceButton(menuHorizontalInset), _renderUpgradeSpaceButton(menuHorizontalInset),
],
),
const VSpace(8), const VSpace(8),
Padding( Padding(

View File

@ -238,9 +238,7 @@ class _NotificationContent extends StatelessWidget {
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
); );
return ConstrainedBox( return Transform.scale(
constraints: const BoxConstraints(maxWidth: 200),
child: Transform.scale(
scale: .9, scale: .9,
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: AppFlowyEditor( child: AppFlowyEditor(
@ -255,7 +253,6 @@ class _NotificationContent extends StatelessWidget {
editable: false, editable: false,
), ),
), ),
),
); );
}, },
); );

View File

@ -34,8 +34,4 @@ extension FlowyAsyncResultExtension<S, F extends Object>
FlowyAsyncResult<S, F> onFailure(void Function(F failure) onFailure) { FlowyAsyncResult<S, F> onFailure(void Function(F failure) onFailure) {
return then((result) => result..onFailure(onFailure)); return then((result) => result..onFailure(onFailure));
} }
FlowyAsyncResult<S, F> onSuccess(void Function(S success) onSuccess) {
return then((result) => result..onSuccess(onSuccess));
}
} }