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.

fix: desktop grid launch review (#4840)

Richard Shiue2a65c193c250
diff --git a/frontend/.vscode/tasks.json b/frontend/.vscode/tasks.json
index 8bce9eb24b..4253215e27 100644
--- a/frontend/.vscode/tasks.json
+++ b/frontend/.vscode/tasks.json
@@ -257,7 +257,7 @@
"label": "AF: Tauri UI Dev",
"type": "shell",
"isBackground": true,
- "command": "pnpm run tauri:dev",
+ "command": "pnpm run sync:i18n && pnpm run dev",
"options": {
"cwd": "${workspaceFolder}/appflowy_tauri"
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/calculations/calculation_selector.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/calculations/calculation_selector.dart
index 09ea5c76c5..b95295818c 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/calculations/calculation_selector.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/calculations/calculation_selector.dart
@@ -32,7 +32,7 @@ class _CalculationSelectorState extends State<CalculationSelector> {
onEnter: (_) => _setHovering(true),
onExit: (_) => _setHovering(false),
child: AnimatedOpacity(
- duration: const Duration(milliseconds: 200),
+ duration: const Duration(milliseconds: 100),
opacity: widget.isSelected || _isHovering ? 1 : 0,
child: FlowyButton(
radius: BorderRadius.zero,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/field_editor.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/field_editor.dart
index 1456f15996..0cd22a7a29 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/field_editor.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/field_editor.dart
@@ -370,9 +370,6 @@ class _FieldDetailsEditorState extends State<FieldDetailsEditor> {
Widget _addDeleteFieldButton() {
return BlocBuilder<FieldEditorBloc, FieldEditorState>(
builder: (context, state) {
- if (state.field.isPrimary) {
- return const SizedBox.shrink();
- }
return Padding(
padding: const EdgeInsets.fromLTRB(8.0, 4.0, 8.0, 0),
child: FieldActionCell(
@@ -389,9 +386,6 @@ class _FieldDetailsEditorState extends State<FieldDetailsEditor> {
Widget _addDuplicateFieldButton() {
return BlocBuilder<FieldEditorBloc, FieldEditorState>(
builder: (context, state) {
- if (state.field.isPrimary) {
- return const SizedBox.shrink();
- }
return Padding(
padding: const EdgeInsets.fromLTRB(8.0, 4.0, 8.0, 0),
child: FieldActionCell(
@@ -533,41 +527,52 @@ class _SwitchFieldButtonState extends State<SwitchFieldButton> {
@override
Widget build(BuildContext context) {
- return SizedBox(
- height: GridSize.popoverItemHeight,
- child: AppFlowyPopover(
- constraints: BoxConstraints.loose(const Size(460, 540)),
- triggerActions: PopoverTriggerFlags.hover,
- mutex: widget.popoverMutex,
- controller: _popoverController,
- offset: const Offset(8, 0),
- margin: const EdgeInsets.all(8),
- popupBuilder: (BuildContext popoverContext) {
- return FieldTypeList(
- onSelectField: (newFieldType) {
- context
- .read<FieldEditorBloc>()
- .add(FieldEditorEvent.switchFieldType(newFieldType));
+ return BlocBuilder<FieldEditorBloc, FieldEditorState>(
+ builder: (context, state) {
+ final bool isPrimary = state.field.isPrimary;
+ return SizedBox(
+ height: GridSize.popoverItemHeight,
+ child: AppFlowyPopover(
+ constraints: BoxConstraints.loose(const Size(460, 540)),
+ triggerActions: isPrimary ? 0 : PopoverTriggerFlags.hover,
+ mutex: widget.popoverMutex,
+ controller: _popoverController,
+ offset: const Offset(8, 0),
+ margin: const EdgeInsets.all(8),
+ popupBuilder: (BuildContext popoverContext) {
+ return FieldTypeList(
+ onSelectField: (newFieldType) {
+ context
+ .read<FieldEditorBloc>()
+ .add(FieldEditorEvent.switchFieldType(newFieldType));
+ },
+ );
},
- );
- },
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 8.0),
- child: _buildMoreButton(context),
- ),
- ),
- );
- }
-
- Widget _buildMoreButton(BuildContext context) {
- final bloc = context.read<FieldEditorBloc>();
- return FlowyButton(
- onTap: () => _popoverController.show(),
- text: FlowyText.medium(
- bloc.state.field.fieldType.i18n,
- ),
- leftIcon: FlowySvg(bloc.state.field.fieldType.svgData),
- rightIcon: const FlowySvg(FlowySvgs.more_s),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 8.0),
+ child: FlowyButton(
+ onTap: () {
+ if (!isPrimary) {
+ _popoverController.show();
+ }
+ },
+ text: FlowyText.medium(
+ state.field.fieldType.i18n,
+ color: isPrimary ? Theme.of(context).disabledColor : null,
+ ),
+ leftIcon: FlowySvg(
+ state.field.fieldType.svgData,
+ color: isPrimary ? Theme.of(context).disabledColor : null,
+ ),
+ rightIcon: FlowySvg(
+ FlowySvgs.more_s,
+ color: isPrimary ? Theme.of(context).disabledColor : null,
+ ),
+ ),
+ ),
+ ),
+ );
+ },
);
}
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell_editor/checklist_cell_editor.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell_editor/checklist_cell_editor.dart
index 9299545f13..d32725c166 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell_editor/checklist_cell_editor.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell_editor/checklist_cell_editor.dart
@@ -191,7 +191,9 @@ class _ChecklistItemState extends State<ChecklistItem> {
void didUpdateWidget(ChecklistItem oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.task.data.name != oldWidget.task.data.name) {
+ final selection = _textController.selection;
_textController.text = widget.task.data.name;
+ _textController.selection = selection;
}
}
@@ -236,6 +238,10 @@ class _ChecklistItemState extends State<ChecklistItem> {
else
const SingleActivator(LogicalKeyboardKey.enter, control: true):
const _SelectTaskIntent(),
+ const SingleActivator(LogicalKeyboardKey.arrowUp):
+ const PreviousFocusIntent(),
+ const SingleActivator(LogicalKeyboardKey.arrowDown):
+ const NextFocusIntent(),
},
descendantsAreTraversable: false,
child: Container(
@@ -263,15 +269,24 @@ class _ChecklistItemState extends State<ChecklistItem> {
),
Expanded(
child: Shortcuts(
- shortcuts: const {
- SingleActivator(LogicalKeyboardKey.space):
- DoNothingAndStopPropagationIntent(),
- SingleActivator(LogicalKeyboardKey.delete):
- DoNothingAndStopPropagationIntent(),
- SingleActivator(LogicalKeyboardKey.enter):
- DoNothingAndStopPropagationIntent(),
- SingleActivator(LogicalKeyboardKey.escape):
- _EndEditingTaskIntent(),
+ shortcuts: {
+ const SingleActivator(LogicalKeyboardKey.space):
+ const DoNothingAndStopPropagationIntent(),
+ const SingleActivator(LogicalKeyboardKey.delete):
+ const DoNothingAndStopPropagationIntent(),
+ if (Platform.isMacOS)
+ LogicalKeySet(
+ LogicalKeyboardKey.fn,
+ LogicalKeyboardKey.backspace,
+ ): const DoNothingAndStopPropagationIntent(),
+ const SingleActivator(LogicalKeyboardKey.enter):
+ const DoNothingAndStopPropagationIntent(),
+ const SingleActivator(LogicalKeyboardKey.escape):
+ const _EndEditingTaskIntent(),
+ const SingleActivator(LogicalKeyboardKey.arrowUp):
+ const DoNothingAndStopPropagationIntent(),
+ const SingleActivator(LogicalKeyboardKey.arrowDown):
+ const DoNothingAndStopPropagationIntent(),
},
child: TextField(
controller: _textController,
diff --git a/frontend/appflowy_flutter/pubspec.lock b/frontend/appflowy_flutter/pubspec.lock
index 6d54057faf..ad25f84ff6 100644
--- a/frontend/appflowy_flutter/pubspec.lock
+++ b/frontend/appflowy_flutter/pubspec.lock
@@ -1101,10 +1101,10 @@ packages:
dependency: transitive
description:
name: markdown
- sha256: "1b134d9f8ff2da15cb298efe6cd8b7d2a78958c1b00384ebcbdf13fe340a6c90"
+ sha256: ef2a1298144e3f985cc736b22e0ccdaf188b5b3970648f2d9dc13efd1d9df051
url: "https://pub.dev"
source: hosted
- version: "7.2.1"
+ version: "7.2.2"
matcher:
dependency: transitive
description: