mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: desktop grid launch review (#4840)
* chore: disable changing the type of primary fields * fix: don't persist text selection after text update in checklist * chore: allow fn + backspace in macos to delete checklist item * chore: shorten opacity fade between opacity shown and not shown * fix: arrow key focus traversal
This commit is contained in:
parent
cd245b5f0a
commit
2a65c193c2
2
frontend/.vscode/tasks.json
vendored
2
frontend/.vscode/tasks.json
vendored
@ -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"
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user