|  | @@ -1,18 +1,15 @@
 | 
											
												
													
														|  |  import 'package:app_flowy/startup/startup.dart';
 |  |  import 'package:app_flowy/startup/startup.dart';
 | 
											
												
													
														|  |  import 'package:app_flowy/workspace/application/grid/field/field_editor_bloc.dart';
 |  |  import 'package:app_flowy/workspace/application/grid/field/field_editor_bloc.dart';
 | 
											
												
													
														|  |  import 'package:app_flowy/workspace/application/grid/field/field_service.dart';
 |  |  import 'package:app_flowy/workspace/application/grid/field/field_service.dart';
 | 
											
												
													
														|  | -import 'package:app_flowy/workspace/application/grid/field/field_switch_bloc.dart';
 |  | 
 | 
											
												
													
														|  |  import 'package:easy_localization/easy_localization.dart';
 |  |  import 'package:easy_localization/easy_localization.dart';
 | 
											
												
													
														|  |  import 'package:flowy_infra_ui/flowy_infra_ui.dart';
 |  |  import 'package:flowy_infra_ui/flowy_infra_ui.dart';
 | 
											
												
													
														|  |  import 'package:flowy_infra_ui/style_widget/text.dart';
 |  |  import 'package:flowy_infra_ui/style_widget/text.dart';
 | 
											
												
													
														|  |  import 'package:flowy_infra_ui/widget/spacing.dart';
 |  |  import 'package:flowy_infra_ui/widget/spacing.dart';
 | 
											
												
													
														|  | -import 'package:flowy_sdk/log.dart';
 |  | 
 | 
											
												
													
														|  | -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart' show Field;
 |  | 
 | 
											
												
													
														|  |  import 'package:flutter/material.dart';
 |  |  import 'package:flutter/material.dart';
 | 
											
												
													
														|  |  import 'package:flutter_bloc/flutter_bloc.dart';
 |  |  import 'package:flutter_bloc/flutter_bloc.dart';
 | 
											
												
													
														|  |  import 'package:app_flowy/generated/locale_keys.g.dart';
 |  |  import 'package:app_flowy/generated/locale_keys.g.dart';
 | 
											
												
													
														|  |  import 'field_name_input.dart';
 |  |  import 'field_name_input.dart';
 | 
											
												
													
														|  | -import 'field_switcher.dart';
 |  | 
 | 
											
												
													
														|  | 
 |  | +import 'field_editor_pannel.dart';
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  class FieldEditor extends FlowyOverlayDelegate {
 |  |  class FieldEditor extends FlowyOverlayDelegate {
 | 
											
												
													
														|  |    final String gridId;
 |  |    final String gridId;
 | 
											
										
											
												
													
														|  | @@ -30,7 +27,6 @@ class FieldEditor extends FlowyOverlayDelegate {
 | 
											
												
													
														|  |      BuildContext context, {
 |  |      BuildContext context, {
 | 
											
												
													
														|  |      AnchorDirection anchorDirection = AnchorDirection.bottomWithLeftAligned,
 |  |      AnchorDirection anchorDirection = AnchorDirection.bottomWithLeftAligned,
 | 
											
												
													
														|  |    }) {
 |  |    }) {
 | 
											
												
													
														|  | -    Log.trace("Show $identifier()");
 |  | 
 | 
											
												
													
														|  |      FlowyOverlay.of(context).remove(identifier());
 |  |      FlowyOverlay.of(context).remove(identifier());
 | 
											
												
													
														|  |      FlowyOverlay.of(context).insertWithAnchor(
 |  |      FlowyOverlay.of(context).insertWithAnchor(
 | 
											
												
													
														|  |        widget: OverlayContainer(
 |  |        widget: OverlayContainer(
 | 
											
										
											
												
													
														|  | @@ -69,16 +65,24 @@ class _FieldEditorWidget extends StatelessWidget {
 | 
											
												
													
														|  |        value: editorBloc,
 |  |        value: editorBloc,
 | 
											
												
													
														|  |        child: BlocBuilder<FieldEditorBloc, FieldEditorState>(
 |  |        child: BlocBuilder<FieldEditorBloc, FieldEditorState>(
 | 
											
												
													
														|  |          builder: (context, state) {
 |  |          builder: (context, state) {
 | 
											
												
													
														|  | -          return state.field.fold(
 |  | 
 | 
											
												
													
														|  | 
 |  | +          return state.editFieldContext.fold(
 | 
											
												
													
														|  |              () => const SizedBox(),
 |  |              () => const SizedBox(),
 | 
											
												
													
														|  | -            (field) => ListView(
 |  | 
 | 
											
												
													
														|  | 
 |  | +            (editFieldContext) => ListView(
 | 
											
												
													
														|  |                shrinkWrap: true,
 |  |                shrinkWrap: true,
 | 
											
												
													
														|  |                children: [
 |  |                children: [
 | 
											
												
													
														|  |                  FlowyText.medium(LocaleKeys.grid_field_editProperty.tr(), fontSize: 12),
 |  |                  FlowyText.medium(LocaleKeys.grid_field_editProperty.tr(), fontSize: 12),
 | 
											
												
													
														|  |                  const VSpace(10),
 |  |                  const VSpace(10),
 | 
											
												
													
														|  |                  const _FieldNameTextField(),
 |  |                  const _FieldNameTextField(),
 | 
											
												
													
														|  |                  const VSpace(10),
 |  |                  const VSpace(10),
 | 
											
												
													
														|  | -                _renderSwitchButton(context, field, state),
 |  | 
 | 
											
												
													
														|  | 
 |  | +                FieldEditorPannel(
 | 
											
												
													
														|  | 
 |  | +                  editFieldContext: editFieldContext,
 | 
											
												
													
														|  | 
 |  | +                  onSwitchToField: (fieldId, fieldType) {
 | 
											
												
													
														|  | 
 |  | +                    return fieldContextLoader.switchToField(fieldId, fieldType);
 | 
											
												
													
														|  | 
 |  | +                  },
 | 
											
												
													
														|  | 
 |  | +                  onUpdated: (field, typeOptionData) {
 | 
											
												
													
														|  | 
 |  | +                    context.read<FieldEditorBloc>().add(FieldEditorEvent.updateField(field, typeOptionData));
 | 
											
												
													
														|  | 
 |  | +                  },
 | 
											
												
													
														|  | 
 |  | +                ),
 | 
											
												
													
														|  |                ],
 |  |                ],
 | 
											
												
													
														|  |              ),
 |  |              ),
 | 
											
												
													
														|  |            );
 |  |            );
 | 
											
										
											
												
													
														|  | @@ -86,18 +90,6 @@ class _FieldEditorWidget extends StatelessWidget {
 | 
											
												
													
														|  |        ),
 |  |        ),
 | 
											
												
													
														|  |      );
 |  |      );
 | 
											
												
													
														|  |    }
 |  |    }
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -  Widget _renderSwitchButton(BuildContext context, Field field, FieldEditorState state) {
 |  | 
 | 
											
												
													
														|  | -    return FieldSwitcher(
 |  | 
 | 
											
												
													
														|  | -      switchContext: SwitchFieldContext(state.gridId, field, state.typeOptionData),
 |  | 
 | 
											
												
													
														|  | -      onSwitchToField: (fieldId, fieldType) {
 |  | 
 | 
											
												
													
														|  | -        return fieldContextLoader.switchToField(fieldId, fieldType);
 |  | 
 | 
											
												
													
														|  | -      },
 |  | 
 | 
											
												
													
														|  | -      onUpdated: (field, typeOptionData) {
 |  | 
 | 
											
												
													
														|  | -        context.read<FieldEditorBloc>().add(FieldEditorEvent.switchField(field, typeOptionData));
 |  | 
 | 
											
												
													
														|  | -      },
 |  | 
 | 
											
												
													
														|  | -    );
 |  | 
 | 
											
												
													
														|  | -  }
 |  | 
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  class _FieldNameTextField extends StatelessWidget {
 |  |  class _FieldNameTextField extends StatelessWidget {
 | 
											
										
											
												
													
														|  | @@ -105,11 +97,16 @@ class _FieldNameTextField extends StatelessWidget {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |    @override
 |  |    @override
 | 
											
												
													
														|  |    Widget build(BuildContext context) {
 |  |    Widget build(BuildContext context) {
 | 
											
												
													
														|  | -    return BlocBuilder<FieldEditorBloc, FieldEditorState>(
 |  | 
 | 
											
												
													
														|  | -      buildWhen: (previous, current) => previous.fieldName != current.fieldName,
 |  | 
 | 
											
												
													
														|  | -      builder: (context, state) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +    return BlocSelector<FieldEditorBloc, FieldEditorState, String>(
 | 
											
												
													
														|  | 
 |  | +      selector: (state) {
 | 
											
												
													
														|  | 
 |  | +        return state.editFieldContext.fold(
 | 
											
												
													
														|  | 
 |  | +          () => "",
 | 
											
												
													
														|  | 
 |  | +          (editFieldContext) => editFieldContext.gridField.name,
 | 
											
												
													
														|  | 
 |  | +        );
 | 
											
												
													
														|  | 
 |  | +      },
 | 
											
												
													
														|  | 
 |  | +      builder: (context, name) {
 | 
											
												
													
														|  |          return FieldNameTextField(
 |  |          return FieldNameTextField(
 | 
											
												
													
														|  | -          name: state.fieldName,
 |  | 
 | 
											
												
													
														|  | 
 |  | +          name: name,
 | 
											
												
													
														|  |            errorText: context.read<FieldEditorBloc>().state.errorText,
 |  |            errorText: context.read<FieldEditorBloc>().state.errorText,
 | 
											
												
													
														|  |            onNameChanged: (newName) {
 |  |            onNameChanged: (newName) {
 | 
											
												
													
														|  |              context.read<FieldEditorBloc>().add(FieldEditorEvent.updateName(newName));
 |  |              context.read<FieldEditorBloc>().add(FieldEditorEvent.updateName(newName));
 |