From afecb681d29278b0b9d93580652baa526e320896 Mon Sep 17 00:00:00 2001 From: Dain Nilsson Date: Thu, 11 Apr 2024 10:28:54 +0200 Subject: [PATCH] Fix tooltips --- lib/app/views/app_page.dart | 18 ++++++++++++++---- lib/l10n/app_de.arb | 2 ++ lib/l10n/app_en.arb | 2 ++ lib/l10n/app_fr.arb | 2 ++ lib/l10n/app_ja.arb | 2 ++ lib/l10n/app_pl.arb | 2 ++ 6 files changed, 24 insertions(+), 4 deletions(-) diff --git a/lib/app/views/app_page.dart b/lib/app/views/app_page.dart index 1f1ed782..ac75bf7b 100755 --- a/lib/app/views/app_page.dart +++ b/lib/app/views/app_page.dart @@ -139,7 +139,7 @@ class _AppPageState extends ConsumerState { // Fully expanded layout, close existing drawer if open final scaffoldState = scaffoldGlobalKey.currentState; if (scaffoldState?.isDrawerOpen == true) { - scaffoldState?.openEndDrawer(); + scaffoldState?.closeDrawer(); } return _buildScaffold(context, false, true, true); } @@ -481,6 +481,7 @@ class _AppPageState extends ConsumerState { Scaffold _buildScaffold( BuildContext context, bool hasDrawer, bool hasRail, bool hasManage) { + final l10n = AppLocalizations.of(context)!; final fullyExpanded = !hasDrawer && hasRail && hasManage; final showNavigation = ref.watch(_navigationProvider); var body = _buildMainContent(context, hasManage); @@ -605,14 +606,23 @@ class _AppPageState extends ConsumerState { Expanded( child: Padding( padding: const EdgeInsets.symmetric(horizontal: 8), - child: DrawerButton( + child: IconButton( + icon: const Icon(Symbols.menu), + tooltip: showNavigation + ? (fullyExpanded + ? l10n.s_collapse_navigation + : MaterialLocalizations.of(context) + .openAppDrawerTooltip) + : l10n.s_expand_navigation, onPressed: fullyExpanded ? () { ref .read(_navigationProvider.notifier) .toggleExpanded(); } - : null, + : () { + scaffoldGlobalKey.currentState?.openDrawer(); + }, ), )), const SizedBox(width: 12), @@ -644,7 +654,7 @@ class _AppPageState extends ConsumerState { ) : const Icon(Symbols.more_vert), iconSize: 24, - tooltip: AppLocalizations.of(context)!.s_configure_yk, + tooltip: l10n.s_configure_yk, padding: const EdgeInsets.all(12), ), ), diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index 19ab0a9c..e74fd4e9 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -43,6 +43,8 @@ "s_details": null, "s_show_window": "Fenster anzeigen", "s_hide_window": "Fenster verstecken", + "s_expand_navigation": null, + "s_collapse_navigation": null, "q_rename_target": "{label} umbenennen?", "@q_rename_target": { "placeholders": { diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 0f6ec89c..6e1dd7df 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -43,6 +43,8 @@ "s_details": "Details", "s_show_window": "Show window", "s_hide_window": "Hide window", + "s_expand_navigation": "Expand navigation", + "s_collapse_navigation": "Collapse navigation", "q_rename_target": "Rename {label}?", "@q_rename_target": { "placeholders": { diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb index 327a4bd9..a20ea696 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -43,6 +43,8 @@ "s_details": null, "s_show_window": "Afficher la fenêtre", "s_hide_window": "Masquer la fenêtre", + "s_expand_navigation": null, + "s_collapse_navigation": null, "q_rename_target": "Renommer {label}?", "@q_rename_target": { "placeholders": { diff --git a/lib/l10n/app_ja.arb b/lib/l10n/app_ja.arb index b9fdec60..cf23925f 100644 --- a/lib/l10n/app_ja.arb +++ b/lib/l10n/app_ja.arb @@ -43,6 +43,8 @@ "s_details": null, "s_show_window": "ウィンドウを表示", "s_hide_window": "ウィンドウを表示しない", + "s_expand_navigation": null, + "s_collapse_navigation": null, "q_rename_target": "{label}の名前を変更しますか?", "@q_rename_target": { "placeholders": { diff --git a/lib/l10n/app_pl.arb b/lib/l10n/app_pl.arb index 6660de4f..a3f1943e 100644 --- a/lib/l10n/app_pl.arb +++ b/lib/l10n/app_pl.arb @@ -43,6 +43,8 @@ "s_details": "Szczegóły", "s_show_window": "Pokaż okno", "s_hide_window": "Ukryj okno", + "s_expand_navigation": null, + "s_collapse_navigation": null, "q_rename_target": "Zmienić nazwę {label}?", "@q_rename_target": { "placeholders": {