mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: Delay tooltip presentations by 300ms (#3558)
* feat:added wait duration to ToolTip widgets * feat:added wait Duration to more tooltips * feat:added wait Duration to more_button tooltip * fix: use flowytooltip * fix:undo install_macos.sh file * fix:undo install_macos.sh file * fix:refactored FlowyTooltip.delayedTooltip to FlowyTooltip.delayed --------- Co-authored-by: Mathias Mogensen <mathias@appflowy.io>
This commit is contained in:
parent
d054439df4
commit
05fa306782
@ -3,6 +3,7 @@ import 'package:flowy_infra/size.dart';
|
||||
import 'package:flowy_infra/theme_extension.dart';
|
||||
|
||||
import 'package:flowy_infra_ui/style_widget/hover.dart';
|
||||
import 'package:flowy_infra_ui/widget/flowy_tooltip.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:styled_widget/styled_widget.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
@ -66,7 +67,7 @@ class _PrimaryCellAccessoryState extends State<PrimaryCellAccessory>
|
||||
with GridCellAccessoryState {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Tooltip(
|
||||
return FlowyTooltip.delayed(
|
||||
message: LocaleKeys.tooltip_openAsPage.tr(),
|
||||
child: SizedBox(
|
||||
width: 26,
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:flowy_infra_ui/widget/flowy_tooltip.dart';
|
||||
import 'package:flowy_infra_ui/widget/ignore_parent_gesture.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@ -20,7 +21,7 @@ class BlockActionButton extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Align(
|
||||
alignment: Alignment.center,
|
||||
child: Tooltip(
|
||||
child: FlowyTooltip.delayed(
|
||||
preferBelow: false,
|
||||
richMessage: richMessage,
|
||||
child: MouseRegion(
|
||||
|
@ -4,6 +4,7 @@ import 'package:appflowy_editor/appflowy_editor.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
import 'package:flowy_infra_ui/widget/flowy_tooltip.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
final alignToolbarItem = ToolbarItem(
|
||||
@ -155,7 +156,7 @@ class _AlignButton extends StatelessWidget {
|
||||
cursor: SystemMouseCursors.click,
|
||||
child: GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Tooltip(
|
||||
child: FlowyTooltip.delayed(
|
||||
message: tooltips,
|
||||
child: FlowySvg(
|
||||
icon,
|
||||
|
@ -3,6 +3,7 @@ import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/more/cubit/document_appearance_cubit.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/more/font_size_switcher.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra_ui/widget/flowy_tooltip.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
@ -16,7 +17,6 @@ class DocumentMoreButton extends StatelessWidget {
|
||||
return PopupMenuButton<int>(
|
||||
color: Theme.of(context).colorScheme.surfaceVariant,
|
||||
offset: const Offset(0, 30),
|
||||
tooltip: LocaleKeys.moreAction_moreOptions.tr(),
|
||||
itemBuilder: (context) {
|
||||
return [
|
||||
PopupMenuItem(
|
||||
@ -29,10 +29,13 @@ class DocumentMoreButton extends StatelessWidget {
|
||||
),
|
||||
];
|
||||
},
|
||||
child: FlowySvg(
|
||||
FlowySvgs.details_s,
|
||||
size: const Size(18, 18),
|
||||
color: Theme.of(context).iconTheme.color,
|
||||
child: FlowyTooltip.delayed(
|
||||
message: LocaleKeys.moreAction_moreOptions.tr(),
|
||||
child: FlowySvg(
|
||||
FlowySvgs.details_s,
|
||||
size: const Size(18, 18),
|
||||
color: Theme.of(context).iconTheme.color,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import 'package:appflowy/workspace/application/menu/menu_bloc.dart';
|
||||
import 'package:appflowy/workspace/presentation/home/home_sizes.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/icon_button.dart';
|
||||
import 'package:flowy_infra_ui/widget/flowy_tooltip.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
@ -69,7 +70,7 @@ class SidebarTopMenu extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
);
|
||||
return Tooltip(
|
||||
return FlowyTooltip.delayed(
|
||||
richMessage: textSpan,
|
||||
child: FlowyIconButton(
|
||||
width: 28,
|
||||
|
@ -7,6 +7,7 @@ import 'package:appflowy/workspace/presentation/settings/settings_dialog.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart';
|
||||
import 'package:appflowy/workspace/presentation/widgets/user_avatar.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/text.dart';
|
||||
import 'package:flowy_infra_ui/widget/flowy_tooltip.dart';
|
||||
import 'package:flowy_infra_ui/widget/spacing.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart'
|
||||
show UserProfilePB;
|
||||
@ -64,7 +65,7 @@ class SidebarUser extends StatelessWidget {
|
||||
|
||||
Widget _buildSettingsButton(BuildContext context, MenuUserState state) {
|
||||
final userProfile = state.userProfile;
|
||||
return Tooltip(
|
||||
return FlowyTooltip.delayed(
|
||||
message: LocaleKeys.settings_menu_open.tr(),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
|
@ -17,6 +17,7 @@ import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/hover.dart';
|
||||
import 'package:flowy_infra_ui/widget/flowy_tooltip.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
@ -338,7 +339,7 @@ class _SingleInnerViewItemState extends State<SingleInnerViewItem> {
|
||||
|
||||
// + button
|
||||
Widget _buildViewAddButton(BuildContext context) {
|
||||
return Tooltip(
|
||||
return FlowyTooltip.delayed(
|
||||
message: LocaleKeys.menuAppHeader_addPageTooltip.tr(),
|
||||
child: ViewAddButton(
|
||||
parentViewId: widget.view.id,
|
||||
@ -378,7 +379,7 @@ class _SingleInnerViewItemState extends State<SingleInnerViewItem> {
|
||||
|
||||
// ··· more action button
|
||||
Widget _buildViewMoreActionButton(BuildContext context) {
|
||||
return Tooltip(
|
||||
return FlowyTooltip.delayed(
|
||||
message: LocaleKeys.menuAppHeader_moreButtonToolTip.tr(),
|
||||
child: ViewMoreActionButton(
|
||||
view: widget.view,
|
||||
|
@ -8,6 +8,7 @@ import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra/size.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/icon_button.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/text.dart';
|
||||
import 'package:flowy_infra_ui/widget/flowy_tooltip.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@ -65,7 +66,7 @@ class FlowyNavigation extends StatelessWidget {
|
||||
if (state.isMenuCollapsed) {
|
||||
return RotationTransition(
|
||||
turns: const AlwaysStoppedAnimation(180 / 360),
|
||||
child: Tooltip(
|
||||
child: FlowyTooltip.delayed(
|
||||
richMessage: sidebarTooltipTextSpan(
|
||||
context,
|
||||
LocaleKeys.sideBar_openSidebar.tr(),
|
||||
|
@ -6,6 +6,7 @@ import 'package:appflowy/workspace/application/appearance.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
import 'package:flowy_infra_ui/widget/flowy_tooltip.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
@ -16,7 +17,7 @@ class BrightnessSetting extends StatelessWidget {
|
||||
const BrightnessSetting({required this.currentThemeMode, super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Tooltip(
|
||||
Widget build(BuildContext context) => FlowyTooltip.delayed(
|
||||
richMessage: themeModeTooltipTextSpan(
|
||||
context,
|
||||
LocaleKeys.settings_appearance_themeMode_label.tr(),
|
||||
|
@ -6,6 +6,7 @@ import 'package:flowy_infra/file_picker/file_picker_service.dart';
|
||||
import 'package:appflowy/workspace/application/settings/settings_location_cubit.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/hover.dart';
|
||||
import 'package:flowy_infra_ui/widget/buttons/secondary_button.dart';
|
||||
import 'package:flowy_infra_ui/widget/flowy_tooltip.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
@ -163,7 +164,7 @@ class _ChangeStoragePathButton extends StatefulWidget {
|
||||
class _ChangeStoragePathButtonState extends State<_ChangeStoragePathButton> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Tooltip(
|
||||
return FlowyTooltip.delayed(
|
||||
message: LocaleKeys.settings_files_changeLocationTooltips.tr(),
|
||||
child: SecondaryTextButton(
|
||||
LocaleKeys.settings_files_change.tr(),
|
||||
|
@ -9,7 +9,6 @@ import 'package:appflowy/user/application/auth/auth_service.dart';
|
||||
import 'package:appflowy/util/debounce.dart';
|
||||
import 'package:appflowy/workspace/application/user/settings_user_bloc.dart';
|
||||
import 'package:appflowy/workspace/presentation/widgets/dialogs.dart';
|
||||
import 'package:appflowy/workspace/presentation/widgets/flowy_tooltip.dart';
|
||||
import 'package:appflowy/workspace/presentation/widgets/user_avatar.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
@ -17,6 +16,7 @@ import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra/size.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/hover.dart';
|
||||
import 'package:flowy_infra_ui/widget/flowy_tooltip.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
@ -217,7 +217,7 @@ class SettingsUserView extends StatelessWidget {
|
||||
required bool hasIcon,
|
||||
required Widget child,
|
||||
}) =>
|
||||
FlowyTooltip.delayedTooltip(
|
||||
FlowyTooltip.delayed(
|
||||
message: LocaleKeys.settings_user_tooltipSelectIcon.tr(),
|
||||
child: Stack(
|
||||
children: [
|
||||
|
@ -9,6 +9,7 @@ import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra/size.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
import 'package:flowy_infra_ui/widget/error_page.dart';
|
||||
import 'package:flowy_infra_ui/widget/flowy_tooltip.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
@ -105,7 +106,7 @@ class EnableEncrypt extends StatelessWidget {
|
||||
const VSpace(6),
|
||||
SizedBox(
|
||||
height: 40,
|
||||
child: Tooltip(
|
||||
child: FlowyTooltip.delayed(
|
||||
message: LocaleKeys.settings_menu_clickToCopySecret.tr(),
|
||||
child: FlowyButton(
|
||||
disable: !(state.config.enableEncrypt),
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'package:flowy_infra/size.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/hover.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/text.dart';
|
||||
import 'package:flowy_infra_ui/widget/flowy_tooltip.dart';
|
||||
import 'package:flowy_infra_ui/widget/ignore_parent_gesture.dart';
|
||||
import 'package:flowy_infra_ui/widget/spacing.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -194,7 +195,7 @@ class FlowyTextButton extends StatelessWidget {
|
||||
);
|
||||
|
||||
if (tooltip != null) {
|
||||
child = Tooltip(
|
||||
child = FlowyTooltip.delayed(
|
||||
message: tooltip!,
|
||||
child: child,
|
||||
);
|
||||
@ -283,7 +284,7 @@ class FlowyRichTextButton extends StatelessWidget {
|
||||
);
|
||||
|
||||
if (tooltip != null) {
|
||||
child = Tooltip(
|
||||
child = FlowyTooltip.delayed(
|
||||
message: tooltip!,
|
||||
child: child,
|
||||
);
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'package:flowy_infra/size.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/hover.dart';
|
||||
import 'package:flowy_infra_ui/widget/flowy_tooltip.dart';
|
||||
import 'package:flowy_svg/flowy_svg.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@ -57,7 +58,7 @@ class FlowyIconButton extends StatelessWidget {
|
||||
height: size.height,
|
||||
),
|
||||
decoration: decoration,
|
||||
child: Tooltip(
|
||||
child: FlowyTooltip.delayed(
|
||||
preferBelow: preferBelow,
|
||||
message: tooltipMessage,
|
||||
richMessage: richTooltipText,
|
||||
|
@ -3,16 +3,18 @@ import 'package:flutter/material.dart';
|
||||
const _tooltipWaitDuration = Duration(milliseconds: 300);
|
||||
|
||||
class FlowyTooltip {
|
||||
static Tooltip delayedTooltip({
|
||||
static Tooltip delayed({
|
||||
String? message,
|
||||
InlineSpan? richMessage,
|
||||
bool? preferBelow,
|
||||
Duration? showDuration,
|
||||
Widget? child,
|
||||
}) {
|
||||
return Tooltip(
|
||||
waitDuration: _tooltipWaitDuration,
|
||||
message: message,
|
||||
richMessage: richMessage,
|
||||
showDuration: showDuration,
|
||||
preferBelow: preferBelow,
|
||||
child: child,
|
||||
);
|
@ -90,4 +90,4 @@ cargo install --force duckscript_cli
|
||||
|
||||
# Check prerequisites
|
||||
printMessage "Checking prerequisites."
|
||||
cargo make appflowy-flutter-deps-tools
|
||||
cargo make appflowy-flutter-deps-tools
|
Loading…
Reference in New Issue
Block a user