Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

refactor: rename files

appflowy467e0093b23f
diff --git a/frontend/app_flowy/lib/startup/deps_resolver.dart b/frontend/app_flowy/lib/startup/deps_resolver.dart
index 8bc5d4dd41..1f7f3524fa 100644
--- a/frontend/app_flowy/lib/startup/deps_resolver.dart
+++ b/frontend/app_flowy/lib/startup/deps_resolver.dart
@@ -170,8 +170,8 @@ void _resolveGridDeps(GetIt getIt) {
),
);
- getIt.registerFactoryParam<SelectionCellBloc, GridSelectOptionCellContext, void>(
- (context, _) => SelectionCellBloc(
+ getIt.registerFactoryParam<SelectOptionCellBloc, GridSelectOptionCellContext, void>(
+ (context, _) => SelectOptionCellBloc(
cellContext: context,
),
);
diff --git a/frontend/app_flowy/lib/workspace/application/grid/cell/selection_cell_bloc.dart b/frontend/app_flowy/lib/workspace/application/grid/cell/select_option_cell_bloc.dart
similarity index 69%
rename from frontend/app_flowy/lib/workspace/application/grid/cell/selection_cell_bloc.dart
rename to frontend/app_flowy/lib/workspace/application/grid/cell/select_option_cell_bloc.dart
index 794ccd3002..056b65e556 100644
--- a/frontend/app_flowy/lib/workspace/application/grid/cell/selection_cell_bloc.dart
+++ b/frontend/app_flowy/lib/workspace/application/grid/cell/select_option_cell_bloc.dart
@@ -4,16 +4,16 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:app_flowy/workspace/application/grid/cell/cell_service/cell_service.dart';
-part 'selection_cell_bloc.freezed.dart';
+part 'select_option_cell_bloc.freezed.dart';
-class SelectionCellBloc extends Bloc<SelectionCellEvent, SelectionCellState> {
+class SelectOptionCellBloc extends Bloc<SelectOptionCellEvent, SelectOptionCellState> {
final GridSelectOptionCellContext cellContext;
void Function()? _onCellChangedFn;
- SelectionCellBloc({
+ SelectOptionCellBloc({
required this.cellContext,
- }) : super(SelectionCellState.initial(cellContext)) {
- on<SelectionCellEvent>(
+ }) : super(SelectOptionCellState.initial(cellContext)) {
+ on<SelectOptionCellEvent>(
(event, emit) async {
await event.map(
initial: (_InitialCell value) async {
@@ -44,7 +44,7 @@ class SelectionCellBloc extends Bloc<SelectionCellEvent, SelectionCellState> {
_onCellChangedFn = cellContext.startListening(
onCellChanged: ((selectOptionContext) {
if (!isClosed) {
- add(SelectionCellEvent.didReceiveOptions(
+ add(SelectOptionCellEvent.didReceiveOptions(
selectOptionContext.options,
selectOptionContext.selectOptions,
));
@@ -55,25 +55,25 @@ class SelectionCellBloc extends Bloc<SelectionCellEvent, SelectionCellState> {
}
@freezed
-class SelectionCellEvent with _$SelectionCellEvent {
- const factory SelectionCellEvent.initial() = _InitialCell;
- const factory SelectionCellEvent.didReceiveOptions(
+class SelectOptionCellEvent with _$SelectOptionCellEvent {
+ const factory SelectOptionCellEvent.initial() = _InitialCell;
+ const factory SelectOptionCellEvent.didReceiveOptions(
List<SelectOption> options,
List<SelectOption> selectedOptions,
) = _DidReceiveOptions;
}
@freezed
-class SelectionCellState with _$SelectionCellState {
- const factory SelectionCellState({
+class SelectOptionCellState with _$SelectOptionCellState {
+ const factory SelectOptionCellState({
required List<SelectOption> options,
required List<SelectOption> selectedOptions,
- }) = _SelectionCellState;
+ }) = _SelectOptionCellState;
- factory SelectionCellState.initial(GridSelectOptionCellContext context) {
+ factory SelectOptionCellState.initial(GridSelectOptionCellContext context) {
final data = context.getCellData();
- return SelectionCellState(
+ return SelectOptionCellState(
options: data?.options ?? [],
selectedOptions: data?.selectOptions ?? [],
);
diff --git a/frontend/app_flowy/lib/workspace/application/grid/cell/selection_editor_bloc.dart b/frontend/app_flowy/lib/workspace/application/grid/cell/select_option_editor_bloc.dart
similarity index 97%
rename from frontend/app_flowy/lib/workspace/application/grid/cell/selection_editor_bloc.dart
rename to frontend/app_flowy/lib/workspace/application/grid/cell/select_option_editor_bloc.dart
index cc7af58531..2702e6006f 100644
--- a/frontend/app_flowy/lib/workspace/application/grid/cell/selection_editor_bloc.dart
+++ b/frontend/app_flowy/lib/workspace/application/grid/cell/select_option_editor_bloc.dart
@@ -7,14 +7,14 @@ import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:app_flowy/workspace/application/grid/cell/cell_service/cell_service.dart';
import 'select_option_service.dart';
-part 'selection_editor_bloc.freezed.dart';
+part 'select_option_editor_bloc.freezed.dart';
-class SelectOptionEditorBloc extends Bloc<SelectOptionEditorEvent, SelectOptionEditorState> {
+class SelectOptionCellEditorBloc extends Bloc<SelectOptionEditorEvent, SelectOptionEditorState> {
final SelectOptionService _selectOptionService;
final GridSelectOptionCellContext cellContext;
void Function()? _onCellChangedFn;
- SelectOptionEditorBloc({
+ SelectOptionCellEditorBloc({
required this.cellContext,
}) : _selectOptionService = SelectOptionService(gridCell: cellContext.gridCell),
super(SelectOptionEditorState.initial(cellContext)) {
diff --git a/frontend/app_flowy/lib/workspace/application/grid/prelude.dart b/frontend/app_flowy/lib/workspace/application/grid/prelude.dart
index e06f5d9da8..3a0ebc5112 100644
--- a/frontend/app_flowy/lib/workspace/application/grid/prelude.dart
+++ b/frontend/app_flowy/lib/workspace/application/grid/prelude.dart
@@ -18,7 +18,7 @@ export 'field/type_option/single_select_bloc.dart';
// Cell
export 'cell/text_cell_bloc.dart';
export 'cell/number_cell_bloc.dart';
-export 'cell/selection_cell_bloc.dart';
+export 'cell/select_option_cell_bloc.dart';
export 'cell/date_cell_bloc.dart';
export 'cell/checkbox_cell_bloc.dart';
export 'cell/cell_service/cell_service.dart';
diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/cell_builder.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/cell_builder.dart
index 7d21cb7e9a..eab2903857 100755
--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/cell_builder.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/cell_builder.dart
@@ -11,7 +11,7 @@ import 'package:styled_widget/styled_widget.dart';
import 'checkbox_cell.dart';
import 'date_cell/date_cell.dart';
import 'number_cell.dart';
-import 'selection_cell/selection_cell.dart';
+import 'select_option_cell/select_option_cell.dart';
import 'text_cell.dart';
GridCellWidget buildGridCellWidget(GridCell gridCell, GridCellCache cellCache, {GridCellStyle? style}) {
diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/date_cell/date_cell.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/date_cell/date_cell.dart
index d1d15ea4b3..5f0ccbc834 100644
--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/date_cell/date_cell.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/date_cell/date_cell.dart
@@ -5,7 +5,7 @@ import 'package:app_flowy/startup/startup.dart';
import 'package:app_flowy/workspace/application/grid/prelude.dart';
import '../cell_builder.dart';
-import 'calendar.dart';
+import 'date_editor.dart';
class DateCellStyle extends GridCellStyle {
Alignment alignment;
@@ -77,7 +77,7 @@ class _DateCellState extends State<DateCell> {
void _showCalendar(BuildContext context) {
final bloc = context.read<DateCellBloc>();
widget.onFocus.value = true;
- final calendar = CellCalendar(onDismissed: () => widget.onFocus.value = false);
+ final calendar = DateCellEditor(onDismissed: () => widget.onFocus.value = false);
calendar.show(
context,
cellContext: bloc.cellContext.clone(),
diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/date_cell/calendar.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/date_cell/date_editor.dart
similarity index 95%
rename from frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/date_cell/calendar.dart
rename to frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/date_cell/date_editor.dart
index c19e8c3001..abf8288c45 100644
--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/date_cell/calendar.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/date_cell/date_editor.dart
@@ -22,10 +22,10 @@ final kFirstDay = DateTime(kToday.year, kToday.month - 3, kToday.day);
final kLastDay = DateTime(kToday.year, kToday.month + 3, kToday.day);
const kMargin = EdgeInsets.symmetric(horizontal: 6, vertical: 10);
-class CellCalendar with FlowyOverlayDelegate {
+class DateCellEditor with FlowyOverlayDelegate {
final VoidCallback onDismissed;
- const CellCalendar({
+ const DateCellEditor({
required this.onDismissed,
});
@@ -33,23 +33,14 @@ class CellCalendar with FlowyOverlayDelegate {
BuildContext context, {
required GridDateCellContext cellContext,
}) async {
- CellCalendar.remove(context);
+ DateCellEditor.remove(context);
final result = await cellContext.getTypeOptionData();
result.fold(
(data) {
- final typeOptionData = DateTypeOption.fromBuffer(data);
- // DateTime? selectedDay;
- // final cellData = cellContext.getCellData();
-
- // if (cellData != null) {
- // final timestamp = $fixnum.Int64.parseInt(cellData).toInt();
- // selectedDay = DateTime.fromMillisecondsSinceEpoch(timestamp * 1000);
- // }
-
final calendar = _CellCalendarWidget(
cellContext: cellContext,
- dateTypeOption: typeOptionData,
+ dateTypeOption: DateTypeOption.fromBuffer(data),
);
FlowyOverlay.of(context).insertWithAnchor(
@@ -57,7 +48,7 @@ class CellCalendar with FlowyOverlayDelegate {
child: calendar,
constraints: BoxConstraints.loose(const Size(320, 500)),
),
- identifier: CellCalendar.identifier(),
+ identifier: DateCellEditor.identifier(),
anchorContext: context,
anchorDirection: AnchorDirection.leftWithCenterAligned,
style: FlowyOverlayStyle(blur: false),
@@ -73,7 +64,7 @@ class CellCalendar with FlowyOverlayDelegate {
}
static String identifier() {
- return (CellCalendar).toString();
+ return (DateCellEditor).toString();
}
@override
diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/prelude.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/prelude.dart
index 3c7e43ecc0..792e58810f 100644
--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/prelude.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/prelude.dart
@@ -3,4 +3,4 @@ export 'text_cell.dart';
export 'number_cell.dart';
export 'date_cell/date_cell.dart';
export 'checkbox_cell.dart';
-export 'selection_cell/selection_cell.dart';
+export 'select_option_cell/select_option_cell.dart';
diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/selection_cell/extension.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/extension.dart
similarity index 100%
rename from frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/selection_cell/extension.dart
rename to frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/extension.dart
diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/selection_cell/selection_cell.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/select_option_cell.dart
similarity index 90%
rename from frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/selection_cell/selection_cell.dart
rename to frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/select_option_cell.dart
index 0c754b0297..12415c816d 100644
--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/selection_cell/selection_cell.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/select_option_cell.dart
@@ -10,7 +10,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'extension.dart';
-import 'selection_editor.dart';
+import 'select_option_editor.dart';
class SelectOptionCellStyle extends GridCellStyle {
String placeholder;
@@ -41,12 +41,12 @@ class SingleSelectCell extends GridCellWidget {
}
class _SingleSelectCellState extends State<SingleSelectCell> {
- late SelectionCellBloc _cellBloc;
+ late SelectOptionCellBloc _cellBloc;
@override
void initState() {
final cellContext = widget.cellContextBuilder.build() as GridSelectOptionCellContext;
- _cellBloc = getIt<SelectionCellBloc>(param1: cellContext)..add(const SelectionCellEvent.initial());
+ _cellBloc = getIt<SelectOptionCellBloc>(param1: cellContext)..add(const SelectOptionCellEvent.initial());
super.initState();
}
@@ -54,7 +54,7 @@ class _SingleSelectCellState extends State<SingleSelectCell> {
Widget build(BuildContext context) {
return BlocProvider.value(
value: _cellBloc,
- child: BlocBuilder<SelectionCellBloc, SelectionCellState>(
+ child: BlocBuilder<SelectOptionCellBloc, SelectOptionCellState>(
builder: (context, state) {
return _SelectOptionCell(
selectOptions: state.selectedOptions,
@@ -95,12 +95,12 @@ class MultiSelectCell extends GridCellWidget {
}
class _MultiSelectCellState extends State<MultiSelectCell> {
- late SelectionCellBloc _cellBloc;
+ late SelectOptionCellBloc _cellBloc;
@override
void initState() {
final cellContext = widget.cellContextBuilder.build() as GridSelectOptionCellContext;
- _cellBloc = getIt<SelectionCellBloc>(param1: cellContext)..add(const SelectionCellEvent.initial());
+ _cellBloc = getIt<SelectOptionCellBloc>(param1: cellContext)..add(const SelectOptionCellEvent.initial());
super.initState();
}
@@ -108,7 +108,7 @@ class _MultiSelectCellState extends State<MultiSelectCell> {
Widget build(BuildContext context) {
return BlocProvider.value(
value: _cellBloc,
- child: BlocBuilder<SelectionCellBloc, SelectionCellState>(
+ child: BlocBuilder<SelectOptionCellBloc, SelectOptionCellState>(
builder: (context, state) {
return _SelectOptionCell(
selectOptions: state.selectedOptions,
diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/selection_cell/selection_editor.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/select_option_editor.dart
similarity index 89%
rename from frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/selection_cell/selection_editor.dart
rename to frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/select_option_editor.dart
index 6e96fccbfb..2effe120c2 100644
--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/selection_cell/selection_editor.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/select_option_editor.dart
@@ -1,8 +1,8 @@
import 'dart:collection';
import 'package:app_flowy/workspace/application/grid/cell/cell_service/cell_service.dart';
-import 'package:app_flowy/workspace/application/grid/cell/selection_editor_bloc.dart';
+import 'package:app_flowy/workspace/application/grid/cell/select_option_editor_bloc.dart';
import 'package:app_flowy/workspace/presentation/plugins/grid/src/layout/sizes.dart';
-import 'package:app_flowy/workspace/presentation/plugins/grid/src/widgets/header/type_option/edit_option_pannel.dart';
+import 'package:app_flowy/workspace/presentation/plugins/grid/src/widgets/header/type_option/select_option_editor.dart';
import 'package:app_flowy/workspace/presentation/plugins/grid/src/widgets/common/text_field.dart';
import 'package:flowy_infra/image.dart';
import 'package:flowy_infra/theme.dart';
@@ -37,10 +37,10 @@ class SelectOptionCellEditor extends StatelessWidget with FlowyOverlayDelegate {
@override
Widget build(BuildContext context) {
return BlocProvider(
- create: (context) => SelectOptionEditorBloc(
+ create: (context) => SelectOptionCellEditorBloc(
cellContext: cellContext,
)..add(const SelectOptionEditorEvent.initial()),
- child: BlocBuilder<SelectOptionEditorBloc, SelectOptionEditorState>(
+ child: BlocBuilder<SelectOptionCellEditorBloc, SelectOptionEditorState>(
builder: (context, state) {
return CustomScrollView(
shrinkWrap: true,
@@ -102,7 +102,7 @@ class _OptionList extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return BlocBuilder<SelectOptionEditorBloc, SelectOptionEditorState>(
+ return BlocBuilder<SelectOptionCellEditorBloc, SelectOptionEditorState>(
builder: (context, state) {
List<Widget> cells = [];
cells.addAll(state.options.map((option) {
@@ -145,7 +145,7 @@ class _TextField extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return BlocBuilder<SelectOptionEditorBloc, SelectOptionEditorState>(
+ return BlocBuilder<SelectOptionCellEditorBloc, SelectOptionEditorState>(
builder: (context, state) {
final optionMap = LinkedHashMap<String, SelectOption>.fromIterable(state.selectedOptions,
key: (option) => option.name, value: (option) => option);
@@ -158,10 +158,10 @@ class _TextField extends StatelessWidget {
distanceToText: _editorPannelWidth * 0.7,
tagController: _tagController,
newText: (text) {
- context.read<SelectOptionEditorBloc>().add(SelectOptionEditorEvent.filterOption(text));
+ context.read<SelectOptionCellEditorBloc>().add(SelectOptionEditorEvent.filterOption(text));
},
onNewTag: (tagName) {
- context.read<SelectOptionEditorBloc>().add(SelectOptionEditorEvent.newOption(tagName));
+ context.read<SelectOptionCellEditorBloc>().add(SelectOptionEditorEvent.newOption(tagName));
},
),
);
@@ -230,7 +230,7 @@ class _SelectOptionCell extends StatelessWidget {
_body(theme, context),
InkWell(
onTap: () {
- context.read<SelectOptionEditorBloc>().add(SelectOptionEditorEvent.selectOption(option.id));
+ context.read<SelectOptionCellEditorBloc>().add(SelectOptionEditorEvent.selectOption(option.id));
},
),
],
@@ -270,17 +270,17 @@ class _SelectOptionCell extends StatelessWidget {
}
void _showEditPannel(BuildContext context) {
- final pannel = EditSelectOptionPannel(
+ final pannel = SelectOptionTypeOptionEditor(
option: option,
onDeleted: () {
- context.read<SelectOptionEditorBloc>().add(SelectOptionEditorEvent.deleteOption(option));
+ context.read<SelectOptionCellEditorBloc>().add(SelectOptionEditorEvent.deleteOption(option));
},
onUpdated: (updatedOption) {
- context.read<SelectOptionEditorBloc>().add(SelectOptionEditorEvent.updateOption(updatedOption));
+ context.read<SelectOptionCellEditorBloc>().add(SelectOptionEditorEvent.updateOption(updatedOption));
},
key: ValueKey(option.id), // Use ValueKey to refresh the UI, otherwise, it will remain the old value.
);
- final overlayIdentifier = (EditSelectOptionPannel).toString();
+ final overlayIdentifier = (SelectOptionTypeOptionEditor).toString();
FlowyOverlay.of(context).remove(overlayIdentifier);
FlowyOverlay.of(context).insertWithAnchor(
diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/selection_cell/text_field.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/text_field.dart
similarity index 100%
rename from frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/selection_cell/text_field.dart
rename to frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/text_field.dart
diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/multi_select.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/multi_select.dart
index b5b3ece1a8..397c5e054d 100644
--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/multi_select.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/multi_select.dart
@@ -4,7 +4,7 @@ import 'package:app_flowy/workspace/presentation/plugins/grid/src/widgets/header
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
-import 'field_option_pannel.dart';
+import 'select_option.dart';
class MultiSelectTypeOptionBuilder extends TypeOptionBuilder {
final MultiSelectTypeOptionWidget _widget;
@@ -43,18 +43,18 @@ class MultiSelectTypeOptionWidget extends TypeOptionWidget {
dataDelegate.didUpdateTypeOptionData(state.typeOption.writeToBuffer());
},
builder: (context, state) {
- return FieldSelectOptionPannel(
+ return SelectOptionTypeOptionWidget(
options: state.typeOption.options,
beginEdit: () {
overlayDelegate.hideOverlay(context);
},
- createOptionCallback: (name) {
+ createSelectOptionCallback: (name) {
context.read<MultiSelectTypeOptionBloc>().add(MultiSelectTypeOptionEvent.createOption(name));
},
- updateOptionCallback: (updateOption) {
+ updateSelectOptionCallback: (updateOption) {
context.read<MultiSelectTypeOptionBloc>().add(MultiSelectTypeOptionEvent.updateOption(updateOption));
},
- deleteOptionCallback: (deleteOption) {
+ deleteSelectOptionCallback: (deleteOption) {
context.read<MultiSelectTypeOptionBloc>().add(MultiSelectTypeOptionEvent.deleteOption(deleteOption));
},
overlayDelegate: overlayDelegate,
diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/field_option_pannel.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/select_option.dart
similarity index 82%
rename from frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/field_option_pannel.dart
rename to frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/select_option.dart
index ce6c69d2cd..c00a473b38 100644
--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/field_option_pannel.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/select_option.dart
@@ -13,22 +13,22 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:app_flowy/generated/locale_keys.g.dart';
-import 'edit_option_pannel.dart';
+import 'select_option_editor.dart';
-class FieldSelectOptionPannel extends StatelessWidget {
+class SelectOptionTypeOptionWidget extends StatelessWidget {
final List<SelectOption> options;
final VoidCallback beginEdit;
- final Function(String optionName) createOptionCallback;
- final Function(SelectOption) updateOptionCallback;
- final Function(SelectOption) deleteOptionCallback;
+ final Function(String optionName) createSelectOptionCallback;
+ final Function(SelectOption) updateSelectOptionCallback;
+ final Function(SelectOption) deleteSelectOptionCallback;
final TypeOptionOverlayDelegate overlayDelegate;
- const FieldSelectOptionPannel({
+ const SelectOptionTypeOptionWidget({
required this.options,
required this.beginEdit,
- required this.createOptionCallback,
- required this.updateOptionCallback,
- required this.deleteOptionCallback,
+ required this.createSelectOptionCallback,
+ required this.updateSelectOptionCallback,
+ required this.deleteSelectOptionCallback,
required this.overlayDelegate,
Key? key,
}) : super(key: key);
@@ -44,17 +44,17 @@ class FieldSelectOptionPannel extends StatelessWidget {
}
state.newOptionName.fold(
() => null,
- (optionName) => createOptionCallback(optionName),
+ (optionName) => createSelectOptionCallback(optionName),
);
state.updateOption.fold(
() => null,
- (updateOption) => updateOptionCallback(updateOption),
+ (updateOption) => updateSelectOptionCallback(updateOption),
);
state.deleteOption.fold(
() => null,
- (deleteOption) => deleteOptionCallback(deleteOption),
+ (deleteOption) => deleteSelectOptionCallback(deleteOption),
);
},
builder: (context, state) {
@@ -86,30 +86,12 @@ class OptionTitle extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final theme = context.watch<AppTheme>();
-
return BlocBuilder<FieldOptionPannelBloc, FieldOptionPannelState>(
builder: (context, state) {
List<Widget> children = [FlowyText.medium(LocaleKeys.grid_field_optionTitle.tr(), fontSize: 12)];
if (state.options.isNotEmpty) {
children.add(const Spacer());
- children.add(
- SizedBox(
- width: 100,
- height: 26,
- child: FlowyButton(
- text: FlowyText.medium(
- LocaleKeys.grid_field_addOption.tr(),
- fontSize: 12,
- textAlign: TextAlign.center,
- ),
- hoverColor: theme.hover,
- onTap: () {
- context.read<FieldOptionPannelBloc>().add(const FieldOptionPannelEvent.beginAddingOption());
- },
- ),
- ),
- );
+ children.add(const _OptionTitleAddOptionButton());
}
return SizedBox(
@@ -121,6 +103,30 @@ class OptionTitle extends StatelessWidget {
}
}
+class _OptionTitleAddOptionButton extends StatelessWidget {
+ const _OptionTitleAddOptionButton({Key? key}) : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ final theme = context.watch<AppTheme>();
+ return SizedBox(
+ width: 100,
+ height: 26,
+ child: FlowyButton(
+ text: FlowyText.medium(
+ LocaleKeys.grid_field_addOption.tr(),
+ fontSize: 12,
+ textAlign: TextAlign.center,
+ ),
+ hoverColor: theme.hover,
+ onTap: () {
+ context.read<FieldOptionPannelBloc>().add(const FieldOptionPannelEvent.beginAddingOption());
+ },
+ ),
+ );
+ }
+}
+
class _OptionList extends StatelessWidget {
final TypeOptionOverlayDelegate delegate;
const _OptionList(this.delegate, {Key? key}) : super(key: key);
@@ -155,7 +161,7 @@ class _OptionList extends StatelessWidget {
return _OptionCell(
option: option,
onEdited: (option) {
- final pannel = EditSelectOptionPannel(
+ final pannel = SelectOptionTypeOptionEditor(
option: option,
onDeleted: () {
delegate.hideOverlay(context);
diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/edit_option_pannel.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/select_option_editor.dart
similarity index 97%
rename from frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/edit_option_pannel.dart
rename to frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/select_option_editor.dart
index 62c4eca7e5..dada59b41c 100644
--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/edit_option_pannel.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/select_option_editor.dart
@@ -1,6 +1,6 @@
import 'package:app_flowy/workspace/application/grid/field/type_option/edit_select_option_bloc.dart';
import 'package:app_flowy/workspace/presentation/plugins/grid/src/layout/sizes.dart';
-import 'package:app_flowy/workspace/presentation/plugins/grid/src/widgets/cell/selection_cell/extension.dart';
+import 'package:app_flowy/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/extension.dart';
import 'package:app_flowy/workspace/presentation/plugins/grid/src/widgets/common/text_field.dart';
import 'package:flowy_infra/image.dart';
import 'package:flowy_infra/theme.dart';
@@ -14,11 +14,11 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:app_flowy/generated/locale_keys.g.dart';
-class EditSelectOptionPannel extends StatelessWidget {
+class SelectOptionTypeOptionEditor extends StatelessWidget {
final SelectOption option;
final VoidCallback onDeleted;
final Function(SelectOption) onUpdated;
- const EditSelectOptionPannel({
+ const SelectOptionTypeOptionEditor({
required this.option,
required this.onDeleted,
required this.onUpdated,
diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/single_select.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/single_select.dart
index f8cc2293f6..3b84eec495 100644
--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/single_select.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/single_select.dart
@@ -3,7 +3,7 @@ import 'package:app_flowy/workspace/application/grid/field/type_option/type_opti
import 'package:app_flowy/workspace/presentation/plugins/grid/src/widgets/header/field_editor_pannel.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
-import 'field_option_pannel.dart';
+import 'select_option.dart';
class SingleSelectTypeOptionBuilder extends TypeOptionBuilder {
final SingleSelectTypeOptionWidget _widget;
@@ -42,18 +42,18 @@ class SingleSelectTypeOptionWidget extends TypeOptionWidget {
dataDelegate.didUpdateTypeOptionData(state.typeOption.writeToBuffer());
},
builder: (context, state) {
- return FieldSelectOptionPannel(
+ return SelectOptionTypeOptionWidget(
options: state.typeOption.options,
beginEdit: () {
overlayDelegate.hideOverlay(context);
},
- createOptionCallback: (name) {
+ createSelectOptionCallback: (name) {
context.read<SingleSelectTypeOptionBloc>().add(SingleSelectTypeOptionEvent.createOption(name));
},
- updateOptionCallback: (updateOption) {
+ updateSelectOptionCallback: (updateOption) {
context.read<SingleSelectTypeOptionBloc>().add(SingleSelectTypeOptionEvent.updateOption(updateOption));
},
- deleteOptionCallback: (deleteOption) {
+ deleteSelectOptionCallback: (deleteOption) {
context.read<SingleSelectTypeOptionBloc>().add(SingleSelectTypeOptionEvent.deleteOption(deleteOption));
},
overlayDelegate: overlayDelegate,