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:
Richard Shiue 2024-03-07 21:05:19 +08:00 committed by GitHub
parent cd245b5f0a
commit 2a65c193c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 73 additions and 53 deletions

View File

@ -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"
}

View File

@ -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,

View File

@ -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,11 +527,14 @@ class _SwitchFieldButtonState extends State<SwitchFieldButton> {
@override
Widget build(BuildContext context) {
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: PopoverTriggerFlags.hover,
triggerActions: isPrimary ? 0 : PopoverTriggerFlags.hover,
mutex: widget.popoverMutex,
controller: _popoverController,
offset: const Offset(8, 0),
@ -553,21 +550,29 @@ class _SwitchFieldButtonState extends State<SwitchFieldButton> {
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: _buildMoreButton(context),
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,
),
),
),
),
);
}
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),
},
);
}
}

View File

@ -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,

View File

@ -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: