chore: cancel button not visible in [Reset to Default] for shortcuts(#7171) (#7257)

This commit is contained in:
Morn 2025-01-23 13:58:48 +08:00 committed by GitHub
parent dd812d0501
commit 85b69bde15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 27 deletions

View File

@ -8,6 +8,7 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/copy_and_p
import 'package:appflowy/plugins/document/presentation/editor_plugins/toggle/toggle_block_shortcuts.dart'; import 'package:appflowy/plugins/document/presentation/editor_plugins/toggle/toggle_block_shortcuts.dart';
import 'package:appflowy/workspace/application/settings/shortcuts/settings_shortcuts_cubit.dart'; import 'package:appflowy/workspace/application/settings/shortcuts/settings_shortcuts_cubit.dart';
import 'package:appflowy/workspace/application/settings/shortcuts/settings_shortcuts_service.dart'; import 'package:appflowy/workspace/application/settings/shortcuts/settings_shortcuts_service.dart';
import 'package:appflowy/workspace/presentation/home/menu/sidebar/space/shared_widget.dart';
import 'package:appflowy/workspace/presentation/settings/shared/settings_alert_dialog.dart'; import 'package:appflowy/workspace/presentation/settings/shared/settings_alert_dialog.dart';
import 'package:appflowy/workspace/presentation/settings/shared/settings_body.dart'; import 'package:appflowy/workspace/presentation/settings/shared/settings_body.dart';
import 'package:appflowy/workspace/presentation/settings/widgets/emoji_picker/emoji_shortcut_event.dart'; import 'package:appflowy/workspace/presentation/settings/widgets/emoji_picker/emoji_shortcut_event.dart';
@ -55,21 +56,24 @@ class _SettingsShortcutsViewState extends State<SettingsShortcutsView> {
), ),
const HSpace(10), const HSpace(10),
_ResetButton( _ResetButton(
onReset: () => SettingsAlertDialog( onReset: () {
isDangerous: true, showConfirmDialog(
title: LocaleKeys.settings_shortcutsPage_resetDialog_title context: context,
.tr(), title: LocaleKeys.settings_shortcutsPage_resetDialog_title
subtitle: LocaleKeys .tr(),
.settings_shortcutsPage_resetDialog_description description: LocaleKeys
.tr(), .settings_shortcutsPage_resetDialog_description
confirmLabel: LocaleKeys .tr(),
.settings_shortcutsPage_resetDialog_buttonLabel confirmLabel: LocaleKeys
.tr(), .settings_shortcutsPage_resetDialog_buttonLabel
confirm: () { .tr(),
Navigator.of(context).pop(); onConfirm: () {
context.read<ShortcutsCubit>().resetToDefault(); context.read<ShortcutsCubit>().resetToDefault();
}, Navigator.of(context).pop();
).show(context), },
style: ConfirmPopupStyle.cancelAndOk,
);
},
), ),
], ],
), ),

View File

@ -1,12 +1,10 @@
import 'package:flutter/material.dart';
import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra/size.dart'; import 'package:flowy_infra/size.dart';
import 'package:flowy_infra/theme_extension.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flowy_infra_ui/widget/dialog/styled_dialogs.dart'; import 'package:flowy_infra_ui/widget/dialog/styled_dialogs.dart';
import 'package:flutter/material.dart';
class SettingsAlertDialog extends StatefulWidget { class SettingsAlertDialog extends StatefulWidget {
const SettingsAlertDialog({ const SettingsAlertDialog({
@ -201,18 +199,16 @@ class _Actions extends StatelessWidget {
children: [ children: [
if (!hideCancelButton) ...[ if (!hideCancelButton) ...[
SizedBox( SizedBox(
height: 24, height: 48,
child: FlowyTextButton( child: PrimaryRoundedButton(
LocaleKeys.button_cancel.tr(), text: LocaleKeys.button_cancel.tr(),
padding: const EdgeInsets.symmetric( margin: const EdgeInsets.symmetric(
horizontal: 24, horizontal: 24,
vertical: 12, vertical: 12,
), ),
fontColor: AFThemeExtension.of(context).textColor, fontWeight: FontWeight.w600,
fillColor: Colors.transparent, radius: 12.0,
hoverColor: Colors.transparent, onTap: () {
radius: Corners.s12Border,
onPressed: () {
cancel?.call(); cancel?.call();
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },