From 566b1679e24a6cb314bf1d9824357e36151d8441 Mon Sep 17 00:00:00 2001 From: WXL-steven <76638078+WXL-steven@users.noreply.github.com> Date: Mon, 8 Jul 2024 18:37:36 +0800 Subject: [PATCH 1/4] Fix: Disabled `PaneItem` Still Accessible in Compact Mode of `NavigationPane` **Description:** This Pull Request addresses the issue where `PaneItem` widgets with `enabled: false` are still accessible when the `NavigationPane` is in `PaneDisplayMode.compact` mode. **Changes Made:** - Modified `pane_items.dart` to ensure that `onPressed` and `forceEnabled` values are correctly passed based on the `item.enabled` property. - Updated the `builder` to merge the theme of the icon and title based on the `states`. **Issue Reference:** This PR resolves the bug where disabled `PaneItem` widgets can be navigated to when the `NavigationPane` is in compact mode, as described in the related issue: https://github.com/bdlukaa/fluent_ui/issues/1081 --- .../navigation_view/pane_items.dart | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/lib/src/controls/navigation/navigation_view/pane_items.dart b/lib/src/controls/navigation/navigation_view/pane_items.dart index ce754c4b..7adb3472 100644 --- a/lib/src/controls/navigation/navigation_view/pane_items.dart +++ b/lib/src/controls/navigation/navigation_view/pane_items.dart @@ -927,13 +927,26 @@ class _PaneItemExpanderMenuItem extends MenuFlyoutItemBase { Widget build(BuildContext context) { assert(debugCheckHasFluentTheme(context)); final theme = FluentTheme.of(context); + final navigationTheme = NavigationPaneTheme.of(context); final size = Flyout.of(context).size; return Container( width: size.isEmpty ? null : size.width, padding: MenuFlyout.itemsPadding, child: HoverButton( - onPressed: onPressed, + onPressed: item.enabled ? onPressed : null, + forceEnabled: item.enabled, builder: (context, states) { + final textStyle = (isSelected + ? navigationTheme.selectedTextStyle?.resolve(states) + : navigationTheme.unselectedTextStyle?.resolve(states)) + ?? const TextStyle(); + final iconTheme = IconThemeData( + color: textStyle.color ?? + (isSelected + ? navigationTheme.selectedIconColor?.resolve(states) + : navigationTheme.unselectedIconColor?.resolve(states)), + size: textStyle.fontSize ?? 16.0, + ); return Container( padding: const EdgeInsets.symmetric( horizontal: 10.0, @@ -951,11 +964,17 @@ class _PaneItemExpanderMenuItem extends MenuFlyoutItemBase { child: Row(mainAxisSize: MainAxisSize.min, children: [ Padding( padding: const EdgeInsetsDirectional.only(end: 12.0), - child: item.icon, + child: IconTheme.merge( + data: iconTheme, + child: item.icon, + ), ), Flexible( fit: size.isEmpty ? FlexFit.loose : FlexFit.tight, - child: item.title ?? const SizedBox.shrink(), + child: DefaultTextStyle( + style: textStyle, + child: item.title ?? const SizedBox.shrink(), + ), ), if (item.infoBadge != null) Padding( From 7ec07b3f0e3e2e6d960c7e562a160cef3e0e4abd Mon Sep 17 00:00:00 2001 From: WXL-steven <76638078+WXL-steven@users.noreply.github.com> Date: Mon, 8 Jul 2024 18:51:33 +0800 Subject: [PATCH 2/4] updated CHANGELOG.md & run 'dart format .' --- CHANGELOG.md | 3 +++ lib/src/controls/navigation/navigation_view/pane_items.dart | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36c787c0..434ce4ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## NEXT +* fix: Resolved issue where `PaneItem` within `PaneItemExpander` remained accessible in `NavigationPane` compact mode ([#1081](https://github.com/bdlukaa/fluent_ui/issues/1081)) + ## 4.9.0 * fix: ¹ `DropDownButton.closeAfterClick` is now correctly applied. ² Added `MenuFlyoutItem.closeAfterClick`, which defaults to `true`. ([#1016](https://github.com/bdlukaa/fluent_ui/issues/1016)) diff --git a/lib/src/controls/navigation/navigation_view/pane_items.dart b/lib/src/controls/navigation/navigation_view/pane_items.dart index 7adb3472..b8fea2af 100644 --- a/lib/src/controls/navigation/navigation_view/pane_items.dart +++ b/lib/src/controls/navigation/navigation_view/pane_items.dart @@ -937,9 +937,9 @@ class _PaneItemExpanderMenuItem extends MenuFlyoutItemBase { forceEnabled: item.enabled, builder: (context, states) { final textStyle = (isSelected - ? navigationTheme.selectedTextStyle?.resolve(states) - : navigationTheme.unselectedTextStyle?.resolve(states)) - ?? const TextStyle(); + ? navigationTheme.selectedTextStyle?.resolve(states) + : navigationTheme.unselectedTextStyle?.resolve(states)) ?? + const TextStyle(); final iconTheme = IconThemeData( color: textStyle.color ?? (isSelected From 5196d0274647ee6ce5b51a7c89ac2134471ed1b8 Mon Sep 17 00:00:00 2001 From: Bruno D'Luka Date: Mon, 8 Jul 2024 12:07:12 -0300 Subject: [PATCH 3/4] feat: Improve linting and formatting --- example/pubspec.lock | 2 +- .../generated/fluent_localizations_ar.dart | 2 +- .../generated/fluent_localizations_be.dart | 2 +- .../generated/fluent_localizations_bn.dart | 2 +- .../generated/fluent_localizations_ca.dart | 2 +- .../generated/fluent_localizations_cs.dart | 2 +- .../generated/fluent_localizations_de.dart | 2 +- .../generated/fluent_localizations_el.dart | 2 +- .../generated/fluent_localizations_en.dart | 2 +- .../generated/fluent_localizations_es.dart | 2 +- .../generated/fluent_localizations_fa.dart | 2 +- .../generated/fluent_localizations_fr.dart | 2 +- .../generated/fluent_localizations_he.dart | 2 +- .../generated/fluent_localizations_hi.dart | 2 +- .../generated/fluent_localizations_hr.dart | 2 +- .../generated/fluent_localizations_hu.dart | 2 +- .../generated/fluent_localizations_id.dart | 2 +- .../generated/fluent_localizations_it.dart | 2 +- .../generated/fluent_localizations_ja.dart | 2 +- .../generated/fluent_localizations_ko.dart | 2 +- .../generated/fluent_localizations_ku.dart | 2 +- .../generated/fluent_localizations_ms.dart | 2 +- .../generated/fluent_localizations_my.dart | 2 +- .../generated/fluent_localizations_nl.dart | 2 +- .../generated/fluent_localizations_pl.dart | 2 +- .../generated/fluent_localizations_pt.dart | 2 +- .../generated/fluent_localizations_ro.dart | 2 +- .../generated/fluent_localizations_ru.dart | 2 +- .../generated/fluent_localizations_sk.dart | 2 +- .../generated/fluent_localizations_sv.dart | 2 +- .../generated/fluent_localizations_ta.dart | 2 +- .../generated/fluent_localizations_th.dart | 2 +- .../generated/fluent_localizations_tr.dart | 2 +- .../generated/fluent_localizations_uk.dart | 2 +- .../generated/fluent_localizations_ur.dart | 2 +- .../generated/fluent_localizations_uz.dart | 2 +- .../generated/fluent_localizations_vi.dart | 2 +- .../generated/fluent_localizations_zh.dart | 2 +- .../navigation_view/pane_items.dart | 36 +++++++++---------- lib/src/controls/surfaces/info_bar.dart | 3 +- lib/src/styles/color.dart | 3 +- pubspec.lock | 8 ++--- pubspec.yaml | 2 +- 43 files changed, 64 insertions(+), 64 deletions(-) diff --git a/example/pubspec.lock b/example/pubspec.lock index 03ee3969..d67ba0c1 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -135,7 +135,7 @@ packages: path: ".." relative: true source: path - version: "4.8.7" + version: "4.9.0" flutter: dependency: "direct main" description: flutter diff --git a/lib/l10n/generated/fluent_localizations_ar.dart b/lib/l10n/generated/fluent_localizations_ar.dart index 721a24db..358b2b8e 100644 --- a/lib/l10n/generated/fluent_localizations_ar.dart +++ b/lib/l10n/generated/fluent_localizations_ar.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Arabic (`ar`). class FluentLocalizationsAr extends FluentLocalizations { - FluentLocalizationsAr([String locale = 'ar']) : super(locale); + FluentLocalizationsAr([super.locale = 'ar']); @override String get backButtonTooltip => 'رجوع'; diff --git a/lib/l10n/generated/fluent_localizations_be.dart b/lib/l10n/generated/fluent_localizations_be.dart index 02d406e8..4111c38f 100644 --- a/lib/l10n/generated/fluent_localizations_be.dart +++ b/lib/l10n/generated/fluent_localizations_be.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Belarusian (`be`). class FluentLocalizationsBe extends FluentLocalizations { - FluentLocalizationsBe([String locale = 'be']) : super(locale); + FluentLocalizationsBe([super.locale = 'be']); @override String get backButtonTooltip => 'Назад'; diff --git a/lib/l10n/generated/fluent_localizations_bn.dart b/lib/l10n/generated/fluent_localizations_bn.dart index d7090f29..6a1b4a18 100644 --- a/lib/l10n/generated/fluent_localizations_bn.dart +++ b/lib/l10n/generated/fluent_localizations_bn.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Bengali Bangla (`bn`). class FluentLocalizationsBn extends FluentLocalizations { - FluentLocalizationsBn([String locale = 'bn']) : super(locale); + FluentLocalizationsBn([super.locale = 'bn']); @override String get backButtonTooltip => 'পিছনে'; diff --git a/lib/l10n/generated/fluent_localizations_ca.dart b/lib/l10n/generated/fluent_localizations_ca.dart index 60ffadd8..8b00bddf 100644 --- a/lib/l10n/generated/fluent_localizations_ca.dart +++ b/lib/l10n/generated/fluent_localizations_ca.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Catalan Valencian (`ca`). class FluentLocalizationsCa extends FluentLocalizations { - FluentLocalizationsCa([String locale = 'ca']) : super(locale); + FluentLocalizationsCa([super.locale = 'ca']); @override String get backButtonTooltip => 'Tornar'; diff --git a/lib/l10n/generated/fluent_localizations_cs.dart b/lib/l10n/generated/fluent_localizations_cs.dart index 8783f92e..4bdf64fa 100644 --- a/lib/l10n/generated/fluent_localizations_cs.dart +++ b/lib/l10n/generated/fluent_localizations_cs.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Czech (`cs`). class FluentLocalizationsCs extends FluentLocalizations { - FluentLocalizationsCs([String locale = 'cs']) : super(locale); + FluentLocalizationsCs([super.locale = 'cs']); @override String get backButtonTooltip => 'Zpět'; diff --git a/lib/l10n/generated/fluent_localizations_de.dart b/lib/l10n/generated/fluent_localizations_de.dart index 0b97e732..dcc5f3f2 100644 --- a/lib/l10n/generated/fluent_localizations_de.dart +++ b/lib/l10n/generated/fluent_localizations_de.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for German (`de`). class FluentLocalizationsDe extends FluentLocalizations { - FluentLocalizationsDe([String locale = 'de']) : super(locale); + FluentLocalizationsDe([super.locale = 'de']); @override String get backButtonTooltip => 'Zurück'; diff --git a/lib/l10n/generated/fluent_localizations_el.dart b/lib/l10n/generated/fluent_localizations_el.dart index 5e1074cf..49319079 100644 --- a/lib/l10n/generated/fluent_localizations_el.dart +++ b/lib/l10n/generated/fluent_localizations_el.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Modern Greek (`el`). class FluentLocalizationsEl extends FluentLocalizations { - FluentLocalizationsEl([String locale = 'el']) : super(locale); + FluentLocalizationsEl([super.locale = 'el']); @override String get backButtonTooltip => 'Πίσω'; diff --git a/lib/l10n/generated/fluent_localizations_en.dart b/lib/l10n/generated/fluent_localizations_en.dart index 64cd9003..cf0c3794 100644 --- a/lib/l10n/generated/fluent_localizations_en.dart +++ b/lib/l10n/generated/fluent_localizations_en.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for English (`en`). class FluentLocalizationsEn extends FluentLocalizations { - FluentLocalizationsEn([String locale = 'en']) : super(locale); + FluentLocalizationsEn([super.locale = 'en']); @override String get backButtonTooltip => 'Back'; diff --git a/lib/l10n/generated/fluent_localizations_es.dart b/lib/l10n/generated/fluent_localizations_es.dart index 3b6e63b0..028ec54c 100644 --- a/lib/l10n/generated/fluent_localizations_es.dart +++ b/lib/l10n/generated/fluent_localizations_es.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Spanish Castilian (`es`). class FluentLocalizationsEs extends FluentLocalizations { - FluentLocalizationsEs([String locale = 'es']) : super(locale); + FluentLocalizationsEs([super.locale = 'es']); @override String get backButtonTooltip => 'Volver'; diff --git a/lib/l10n/generated/fluent_localizations_fa.dart b/lib/l10n/generated/fluent_localizations_fa.dart index 801e26a6..8216e8c8 100644 --- a/lib/l10n/generated/fluent_localizations_fa.dart +++ b/lib/l10n/generated/fluent_localizations_fa.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Persian (`fa`). class FluentLocalizationsFa extends FluentLocalizations { - FluentLocalizationsFa([String locale = 'fa']) : super(locale); + FluentLocalizationsFa([super.locale = 'fa']); @override String get backButtonTooltip => 'برگشت'; diff --git a/lib/l10n/generated/fluent_localizations_fr.dart b/lib/l10n/generated/fluent_localizations_fr.dart index beb1d427..bafe717a 100644 --- a/lib/l10n/generated/fluent_localizations_fr.dart +++ b/lib/l10n/generated/fluent_localizations_fr.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for French (`fr`). class FluentLocalizationsFr extends FluentLocalizations { - FluentLocalizationsFr([String locale = 'fr']) : super(locale); + FluentLocalizationsFr([super.locale = 'fr']); @override String get backButtonTooltip => 'Retour'; diff --git a/lib/l10n/generated/fluent_localizations_he.dart b/lib/l10n/generated/fluent_localizations_he.dart index b4f8c71f..2ac7003c 100644 --- a/lib/l10n/generated/fluent_localizations_he.dart +++ b/lib/l10n/generated/fluent_localizations_he.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Hebrew (`he`). class FluentLocalizationsHe extends FluentLocalizations { - FluentLocalizationsHe([String locale = 'he']) : super(locale); + FluentLocalizationsHe([super.locale = 'he']); @override String get backButtonTooltip => 'הקודם'; diff --git a/lib/l10n/generated/fluent_localizations_hi.dart b/lib/l10n/generated/fluent_localizations_hi.dart index cc358f1f..4d1ebac8 100644 --- a/lib/l10n/generated/fluent_localizations_hi.dart +++ b/lib/l10n/generated/fluent_localizations_hi.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Hindi (`hi`). class FluentLocalizationsHi extends FluentLocalizations { - FluentLocalizationsHi([String locale = 'hi']) : super(locale); + FluentLocalizationsHi([super.locale = 'hi']); @override String get backButtonTooltip => 'वापस'; diff --git a/lib/l10n/generated/fluent_localizations_hr.dart b/lib/l10n/generated/fluent_localizations_hr.dart index 58768e9e..9df4802c 100644 --- a/lib/l10n/generated/fluent_localizations_hr.dart +++ b/lib/l10n/generated/fluent_localizations_hr.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Croatian (`hr`). class FluentLocalizationsHr extends FluentLocalizations { - FluentLocalizationsHr([String locale = 'hr']) : super(locale); + FluentLocalizationsHr([super.locale = 'hr']); @override String get backButtonTooltip => 'Natrag'; diff --git a/lib/l10n/generated/fluent_localizations_hu.dart b/lib/l10n/generated/fluent_localizations_hu.dart index 1089e26a..657998d7 100644 --- a/lib/l10n/generated/fluent_localizations_hu.dart +++ b/lib/l10n/generated/fluent_localizations_hu.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Hungarian (`hu`). class FluentLocalizationsHu extends FluentLocalizations { - FluentLocalizationsHu([String locale = 'hu']) : super(locale); + FluentLocalizationsHu([super.locale = 'hu']); @override String get backButtonTooltip => 'Vissza'; diff --git a/lib/l10n/generated/fluent_localizations_id.dart b/lib/l10n/generated/fluent_localizations_id.dart index ea550d5d..3c0dd25d 100644 --- a/lib/l10n/generated/fluent_localizations_id.dart +++ b/lib/l10n/generated/fluent_localizations_id.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Indonesian (`id`). class FluentLocalizationsId extends FluentLocalizations { - FluentLocalizationsId([String locale = 'id']) : super(locale); + FluentLocalizationsId([super.locale = 'id']); @override String get backButtonTooltip => 'Kembali'; diff --git a/lib/l10n/generated/fluent_localizations_it.dart b/lib/l10n/generated/fluent_localizations_it.dart index 764ee9b3..71d3de38 100644 --- a/lib/l10n/generated/fluent_localizations_it.dart +++ b/lib/l10n/generated/fluent_localizations_it.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Italian (`it`). class FluentLocalizationsIt extends FluentLocalizations { - FluentLocalizationsIt([String locale = 'it']) : super(locale); + FluentLocalizationsIt([super.locale = 'it']); @override String get backButtonTooltip => 'Indietro'; diff --git a/lib/l10n/generated/fluent_localizations_ja.dart b/lib/l10n/generated/fluent_localizations_ja.dart index 2bf9753a..d6a2de39 100644 --- a/lib/l10n/generated/fluent_localizations_ja.dart +++ b/lib/l10n/generated/fluent_localizations_ja.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Japanese (`ja`). class FluentLocalizationsJa extends FluentLocalizations { - FluentLocalizationsJa([String locale = 'ja']) : super(locale); + FluentLocalizationsJa([super.locale = 'ja']); @override String get backButtonTooltip => '戻る'; diff --git a/lib/l10n/generated/fluent_localizations_ko.dart b/lib/l10n/generated/fluent_localizations_ko.dart index fd004be4..9fc57088 100644 --- a/lib/l10n/generated/fluent_localizations_ko.dart +++ b/lib/l10n/generated/fluent_localizations_ko.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Korean (`ko`). class FluentLocalizationsKo extends FluentLocalizations { - FluentLocalizationsKo([String locale = 'ko']) : super(locale); + FluentLocalizationsKo([super.locale = 'ko']); @override String get backButtonTooltip => '뒤로'; diff --git a/lib/l10n/generated/fluent_localizations_ku.dart b/lib/l10n/generated/fluent_localizations_ku.dart index 1788b9d5..8081f852 100644 --- a/lib/l10n/generated/fluent_localizations_ku.dart +++ b/lib/l10n/generated/fluent_localizations_ku.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Kurdish (`ku`). class FluentLocalizationsKu extends FluentLocalizations { - FluentLocalizationsKu([String locale = 'ku']) : super(locale); + FluentLocalizationsKu([super.locale = 'ku']); @override String get backButtonTooltip => 'گەڕانەوە'; diff --git a/lib/l10n/generated/fluent_localizations_ms.dart b/lib/l10n/generated/fluent_localizations_ms.dart index ad3f01d5..e0cf2c2c 100644 --- a/lib/l10n/generated/fluent_localizations_ms.dart +++ b/lib/l10n/generated/fluent_localizations_ms.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Malay (`ms`). class FluentLocalizationsMs extends FluentLocalizations { - FluentLocalizationsMs([String locale = 'ms']) : super(locale); + FluentLocalizationsMs([super.locale = 'ms']); @override String get backButtonTooltip => 'Kembali'; diff --git a/lib/l10n/generated/fluent_localizations_my.dart b/lib/l10n/generated/fluent_localizations_my.dart index 645da0a2..ff19d518 100644 --- a/lib/l10n/generated/fluent_localizations_my.dart +++ b/lib/l10n/generated/fluent_localizations_my.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Burmese (`my`). class FluentLocalizationsMy extends FluentLocalizations { - FluentLocalizationsMy([String locale = 'my']) : super(locale); + FluentLocalizationsMy([super.locale = 'my']); @override String get backButtonTooltip => 'နောက်သို့'; diff --git a/lib/l10n/generated/fluent_localizations_nl.dart b/lib/l10n/generated/fluent_localizations_nl.dart index 79da9d6a..77cf0b4e 100644 --- a/lib/l10n/generated/fluent_localizations_nl.dart +++ b/lib/l10n/generated/fluent_localizations_nl.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Dutch Flemish (`nl`). class FluentLocalizationsNl extends FluentLocalizations { - FluentLocalizationsNl([String locale = 'nl']) : super(locale); + FluentLocalizationsNl([super.locale = 'nl']); @override String get backButtonTooltip => 'Terug'; diff --git a/lib/l10n/generated/fluent_localizations_pl.dart b/lib/l10n/generated/fluent_localizations_pl.dart index 75995d29..f2173933 100644 --- a/lib/l10n/generated/fluent_localizations_pl.dart +++ b/lib/l10n/generated/fluent_localizations_pl.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Polish (`pl`). class FluentLocalizationsPl extends FluentLocalizations { - FluentLocalizationsPl([String locale = 'pl']) : super(locale); + FluentLocalizationsPl([super.locale = 'pl']); @override String get backButtonTooltip => 'Wstecz'; diff --git a/lib/l10n/generated/fluent_localizations_pt.dart b/lib/l10n/generated/fluent_localizations_pt.dart index 1a62ea83..9a8366ea 100644 --- a/lib/l10n/generated/fluent_localizations_pt.dart +++ b/lib/l10n/generated/fluent_localizations_pt.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Portuguese (`pt`). class FluentLocalizationsPt extends FluentLocalizations { - FluentLocalizationsPt([String locale = 'pt']) : super(locale); + FluentLocalizationsPt([super.locale = 'pt']); @override String get backButtonTooltip => 'Voltar'; diff --git a/lib/l10n/generated/fluent_localizations_ro.dart b/lib/l10n/generated/fluent_localizations_ro.dart index 8b616a04..ae17aaf4 100644 --- a/lib/l10n/generated/fluent_localizations_ro.dart +++ b/lib/l10n/generated/fluent_localizations_ro.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Romanian Moldavian Moldovan (`ro`). class FluentLocalizationsRo extends FluentLocalizations { - FluentLocalizationsRo([String locale = 'ro']) : super(locale); + FluentLocalizationsRo([super.locale = 'ro']); @override String get backButtonTooltip => 'Înapoi'; diff --git a/lib/l10n/generated/fluent_localizations_ru.dart b/lib/l10n/generated/fluent_localizations_ru.dart index 6758b2d0..47eb8d7e 100644 --- a/lib/l10n/generated/fluent_localizations_ru.dart +++ b/lib/l10n/generated/fluent_localizations_ru.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Russian (`ru`). class FluentLocalizationsRu extends FluentLocalizations { - FluentLocalizationsRu([String locale = 'ru']) : super(locale); + FluentLocalizationsRu([super.locale = 'ru']); @override String get backButtonTooltip => 'Назад'; diff --git a/lib/l10n/generated/fluent_localizations_sk.dart b/lib/l10n/generated/fluent_localizations_sk.dart index 9a69d149..5c619e1e 100644 --- a/lib/l10n/generated/fluent_localizations_sk.dart +++ b/lib/l10n/generated/fluent_localizations_sk.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Slovak (`sk`). class FluentLocalizationsSk extends FluentLocalizations { - FluentLocalizationsSk([String locale = 'sk']) : super(locale); + FluentLocalizationsSk([super.locale = 'sk']); @override String get backButtonTooltip => 'Naspäť'; diff --git a/lib/l10n/generated/fluent_localizations_sv.dart b/lib/l10n/generated/fluent_localizations_sv.dart index 86dd3174..0221cf48 100644 --- a/lib/l10n/generated/fluent_localizations_sv.dart +++ b/lib/l10n/generated/fluent_localizations_sv.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Swedish (`sv`). class FluentLocalizationsSv extends FluentLocalizations { - FluentLocalizationsSv([String locale = 'sv']) : super(locale); + FluentLocalizationsSv([super.locale = 'sv']); @override String get backButtonTooltip => 'Tillbaka'; diff --git a/lib/l10n/generated/fluent_localizations_ta.dart b/lib/l10n/generated/fluent_localizations_ta.dart index 275eb612..d8b0fa95 100644 --- a/lib/l10n/generated/fluent_localizations_ta.dart +++ b/lib/l10n/generated/fluent_localizations_ta.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Tamil (`ta`). class FluentLocalizationsTa extends FluentLocalizations { - FluentLocalizationsTa([String locale = 'ta']) : super(locale); + FluentLocalizationsTa([super.locale = 'ta']); @override String get backButtonTooltip => 'பின்'; diff --git a/lib/l10n/generated/fluent_localizations_th.dart b/lib/l10n/generated/fluent_localizations_th.dart index 89e8f5ba..e5db0e77 100644 --- a/lib/l10n/generated/fluent_localizations_th.dart +++ b/lib/l10n/generated/fluent_localizations_th.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Thai (`th`). class FluentLocalizationsTh extends FluentLocalizations { - FluentLocalizationsTh([String locale = 'th']) : super(locale); + FluentLocalizationsTh([super.locale = 'th']); @override String get backButtonTooltip => 'กลับ'; diff --git a/lib/l10n/generated/fluent_localizations_tr.dart b/lib/l10n/generated/fluent_localizations_tr.dart index 38743696..50285fa2 100644 --- a/lib/l10n/generated/fluent_localizations_tr.dart +++ b/lib/l10n/generated/fluent_localizations_tr.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Turkish (`tr`). class FluentLocalizationsTr extends FluentLocalizations { - FluentLocalizationsTr([String locale = 'tr']) : super(locale); + FluentLocalizationsTr([super.locale = 'tr']); @override String get backButtonTooltip => 'Geri'; diff --git a/lib/l10n/generated/fluent_localizations_uk.dart b/lib/l10n/generated/fluent_localizations_uk.dart index f179832b..63c81fde 100644 --- a/lib/l10n/generated/fluent_localizations_uk.dart +++ b/lib/l10n/generated/fluent_localizations_uk.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Ukrainian (`uk`). class FluentLocalizationsUk extends FluentLocalizations { - FluentLocalizationsUk([String locale = 'uk']) : super(locale); + FluentLocalizationsUk([super.locale = 'uk']); @override String get backButtonTooltip => 'Назад'; diff --git a/lib/l10n/generated/fluent_localizations_ur.dart b/lib/l10n/generated/fluent_localizations_ur.dart index 3f074745..cda21780 100644 --- a/lib/l10n/generated/fluent_localizations_ur.dart +++ b/lib/l10n/generated/fluent_localizations_ur.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Urdu (`ur`). class FluentLocalizationsUr extends FluentLocalizations { - FluentLocalizationsUr([String locale = 'ur']) : super(locale); + FluentLocalizationsUr([super.locale = 'ur']); @override String get backButtonTooltip => 'آگے'; diff --git a/lib/l10n/generated/fluent_localizations_uz.dart b/lib/l10n/generated/fluent_localizations_uz.dart index 78814bdc..092b4d1a 100644 --- a/lib/l10n/generated/fluent_localizations_uz.dart +++ b/lib/l10n/generated/fluent_localizations_uz.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Uzbek (`uz`). class FluentLocalizationsUz extends FluentLocalizations { - FluentLocalizationsUz([String locale = 'uz']) : super(locale); + FluentLocalizationsUz([super.locale = 'uz']); @override String get backButtonTooltip => 'Ortga'; diff --git a/lib/l10n/generated/fluent_localizations_vi.dart b/lib/l10n/generated/fluent_localizations_vi.dart index b8ad3b42..583b93f0 100644 --- a/lib/l10n/generated/fluent_localizations_vi.dart +++ b/lib/l10n/generated/fluent_localizations_vi.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Vietnamese (`vi`). class FluentLocalizationsVi extends FluentLocalizations { - FluentLocalizationsVi([String locale = 'vi']) : super(locale); + FluentLocalizationsVi([super.locale = 'vi']); @override String get backButtonTooltip => 'Quay lại'; diff --git a/lib/l10n/generated/fluent_localizations_zh.dart b/lib/l10n/generated/fluent_localizations_zh.dart index 8c16d01d..a12fe480 100644 --- a/lib/l10n/generated/fluent_localizations_zh.dart +++ b/lib/l10n/generated/fluent_localizations_zh.dart @@ -2,7 +2,7 @@ import 'fluent_localizations.dart'; /// The translations for Chinese (`zh`). class FluentLocalizationsZh extends FluentLocalizations { - FluentLocalizationsZh([String locale = 'zh']) : super(locale); + FluentLocalizationsZh([super.locale = 'zh']); @override String get backButtonTooltip => '返回'; diff --git a/lib/src/controls/navigation/navigation_view/pane_items.dart b/lib/src/controls/navigation/navigation_view/pane_items.dart index ce754c4b..88bbd024 100644 --- a/lib/src/controls/navigation/navigation_view/pane_items.dart +++ b/lib/src/controls/navigation/navigation_view/pane_items.dart @@ -1014,9 +1014,9 @@ extension ItemExtension on Widget { if (this is Text) { final title = this as Text; switch (T) { - case String: + case const (String): return (title.data ?? title.textSpan?.toPlainText()) as T?; - case InlineSpan: + case const (InlineSpan): return (title.textSpan ?? TextSpan( text: title.data ?? '', @@ -1024,59 +1024,59 @@ extension ItemExtension on Widget { title.getProperty()?.merge(def as TextStyle?) ?? def as TextStyle?, )) as T?; - case TextStyle: + case const (TextStyle): return title.style as T?; - case TextAlign: + case const (TextAlign): return title.textAlign as T?; - case TextHeightBehavior: + case const (TextHeightBehavior): return title.textHeightBehavior as T?; - case TextWidthBasis: + case const (TextWidthBasis): return title.textWidthBasis as T?; } } else if (this is RichText) { final title = this as RichText; switch (T) { - case String: + case const (String): return title.text.toPlainText() as T?; - case InlineSpan: + case const (InlineSpan): if (T is InlineSpan) { final span = title.text; span.style?.merge(def as TextStyle?); return span as T; } return title.text as T; - case TextStyle: + case const (TextStyle): return (title.text.style as T?) ?? def as T?; - case TextAlign: + case const (TextAlign): return title.textAlign as T?; - case TextHeightBehavior: + case const (TextHeightBehavior): return title.textHeightBehavior as T?; - case TextWidthBasis: + case const (TextWidthBasis): return title.textWidthBasis as T?; } } else if (this is Icon) { final title = this as Icon; switch (T) { - case String: + case const (String): if (title.icon?.codePoint == null) return null; return String.fromCharCode(title.icon!.codePoint) as T?; - case InlineSpan: + case const (InlineSpan): return TextSpan( text: String.fromCharCode(title.icon!.codePoint), style: title.getProperty(), ) as T?; - case TextStyle: + case const (TextStyle): return TextStyle( color: title.color, fontSize: title.size, fontFamily: title.icon?.fontFamily, package: title.icon?.fontPackage, ) as T?; - case TextAlign: + case const (TextAlign): return null; - case TextHeightBehavior: + case const (TextHeightBehavior): return null; - case TextWidthBasis: + case const (TextWidthBasis): return null; } } diff --git a/lib/src/controls/surfaces/info_bar.dart b/lib/src/controls/surfaces/info_bar.dart index b89970d4..36707232 100644 --- a/lib/src/controls/surfaces/info_bar.dart +++ b/lib/src/controls/surfaces/info_bar.dart @@ -434,7 +434,8 @@ class InfoBarThemeData with Diagnosticable { actionStyle: const ButtonStyle( padding: WidgetStatePropertyAll(EdgeInsets.all(6)), ), - closeButtonStyle: const ButtonStyle(iconSize: WidgetStatePropertyAll(16.0)), + closeButtonStyle: + const ButtonStyle(iconSize: WidgetStatePropertyAll(16.0)), ); } diff --git a/lib/src/styles/color.dart b/lib/src/styles/color.dart index 09219896..63282e6f 100644 --- a/lib/src/styles/color.dart +++ b/lib/src/styles/color.dart @@ -187,8 +187,7 @@ class Colors { } class ShadedColor extends ColorSwatch { - const ShadedColor(int primary, Map swatch) - : super(primary, swatch); + const ShadedColor(super.primary, super.swatch); @override Color operator [](int index) { diff --git a/pubspec.lock b/pubspec.lock index 89274dd1..c03ae7cb 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -122,10 +122,10 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 + sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" url: "https://pub.dev" source: hosted - version: "2.0.3" + version: "4.0.0" flutter_localizations: dependency: "direct main" description: flutter @@ -204,10 +204,10 @@ packages: dependency: transitive description: name: lints - sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "4.0.0" matcher: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 3b165568..39c4a985 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -36,7 +36,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^2.0.2 + flutter_lints: ^4.0.0 intl_utils: ^2.8.3 flutter: From f911e7baa170591ac4fa9876a7c106946ccf6bcf Mon Sep 17 00:00:00 2001 From: Bruno D'Luka Date: Mon, 8 Jul 2024 12:13:57 -0300 Subject: [PATCH 4/4] fix: Expose private members --- analysis_options.yaml | 26 +------------------ lib/src/controls/flyouts/content_manager.dart | 4 +-- .../navigation/navigation_view/body.dart | 20 +++++++------- .../navigation_view/indicators.dart | 8 +++--- .../navigation/navigation_view/pane.dart | 8 +++--- .../navigation_view/pane_items.dart | 18 ++++++------- .../navigation/navigation_view/view.dart | 11 ++++---- lib/src/controls/utils/hover_button.dart | 25 +++++++++--------- 8 files changed, 48 insertions(+), 72 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 50ea4a31..f16eeada 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,28 +1,4 @@ include: package:flutter_lints/flutter.yaml linter: - rules: - library_private_types_in_public_api: false - prefer_single_quotes: true - sort_child_properties_last: true - directives_ordering: true - sized_box_for_whitespace: true - use_colored_box: true - use_decorated_box: true - avoid_unnecessary_containers: true - omit_local_variable_types: true - prefer_contains: true - unnecessary_await_in_return: true - unnecessary_parenthesis: true - unnecessary_to_list_in_spreads: true - use_build_context_synchronously: true - use_to_and_as_if_applicable: true - unnecessary_lambdas: true - exhaustive_cases: true - cascade_invocations: true - avoid_redundant_argument_values: true - use_rethrow_when_possible: true - sort_unnamed_constructors_first: true - tighten_type_of_initializing_formals: true - prefer_iterable_whereType: true - await_only_futures: true \ No newline at end of file + rules: \ No newline at end of file diff --git a/lib/src/controls/flyouts/content_manager.dart b/lib/src/controls/flyouts/content_manager.dart index 8e9a314f..0e6ca146 100644 --- a/lib/src/controls/flyouts/content_manager.dart +++ b/lib/src/controls/flyouts/content_manager.dart @@ -96,7 +96,7 @@ class FlyoutState extends State { } } -typedef _MenuBuilder = Widget Function( +typedef MenuBuilder = Widget Function( BuildContext context, BoxConstraints rootSize, Iterable menus, @@ -104,7 +104,7 @@ typedef _MenuBuilder = Widget Function( ); class MenuInfoProvider extends StatefulWidget { - final _MenuBuilder builder; + final MenuBuilder builder; @protected const MenuInfoProvider({super.key, required this.builder}); diff --git a/lib/src/controls/navigation/navigation_view/body.dart b/lib/src/controls/navigation/navigation_view/body.dart index 7392f539..f39bb8f8 100644 --- a/lib/src/controls/navigation/navigation_view/body.dart +++ b/lib/src/controls/navigation/navigation_view/body.dart @@ -85,7 +85,7 @@ class _NavigationBodyState extends State<_NavigationBody> { @override void didChangeDependencies() { super.didChangeDependencies(); - final view = _InheritedNavigationView.of(context); + final view = InheritedNavigationView.of(context); final selected = view.pane?.selected ?? 0; _pageController ??= PageController(initialPage: selected); @@ -101,7 +101,7 @@ class _NavigationBodyState extends State<_NavigationBody> { @override Widget build(BuildContext context) { assert(debugCheckHasFluentTheme(context)); - final view = _InheritedNavigationView.of(context); + final view = InheritedNavigationView.of(context); final theme = FluentTheme.of(context); return ColoredBox( @@ -186,9 +186,9 @@ class _NavigationBodyState extends State<_NavigationBody> { /// See also: /// /// * [NavigationView], which provides the information for this -class _InheritedNavigationView extends InheritedWidget { +class InheritedNavigationView extends InheritedWidget { /// Creates an inherited navigation view. - const _InheritedNavigationView({ + const InheritedNavigationView({ super.key, required super.child, required this.displayMode, @@ -221,12 +221,12 @@ class _InheritedNavigationView extends InheritedWidget { /// Whether the navigation panes are transitioning or not. final bool isTransitioning; - static _InheritedNavigationView? maybeOf(BuildContext context) { + static InheritedNavigationView? maybeOf(BuildContext context) { return context - .dependOnInheritedWidgetOfExactType<_InheritedNavigationView>(); + .dependOnInheritedWidgetOfExactType(); } - static _InheritedNavigationView of(BuildContext context) { + static InheritedNavigationView of(BuildContext context) { return maybeOf(context)!; } @@ -242,8 +242,8 @@ class _InheritedNavigationView extends InheritedWidget { bool? isTransitioning, }) { return Builder(builder: (context) { - final current = _InheritedNavigationView.maybeOf(context); - return _InheritedNavigationView( + final current = InheritedNavigationView.maybeOf(context); + return InheritedNavigationView( key: key, displayMode: displayMode ?? current?.displayMode ?? PaneDisplayMode.open, @@ -258,7 +258,7 @@ class _InheritedNavigationView extends InheritedWidget { } @override - bool updateShouldNotify(covariant _InheritedNavigationView oldWidget) { + bool updateShouldNotify(covariant InheritedNavigationView oldWidget) { return oldWidget.displayMode != displayMode || oldWidget.minimalPaneOpen != minimalPaneOpen || oldWidget.pane != pane || diff --git a/lib/src/controls/navigation/navigation_view/indicators.dart b/lib/src/controls/navigation/navigation_view/indicators.dart index 759b2e50..9c612733 100644 --- a/lib/src/controls/navigation/navigation_view/indicators.dart +++ b/lib/src/controls/navigation/navigation_view/indicators.dart @@ -71,7 +71,7 @@ class NavigationIndicatorState extends State { } NavigationPane get pane { - return _InheritedNavigationView.of(context).pane!; + return InheritedNavigationView.of(context).pane!; } int get selectedIndex { @@ -83,7 +83,7 @@ class NavigationIndicatorState extends State { } Axis get axis { - if (_InheritedNavigationView.maybeOf(context)?.displayMode == + if (InheritedNavigationView.maybeOf(context)?.displayMode == PaneDisplayMode.top) { return Axis.vertical; } @@ -91,11 +91,11 @@ class NavigationIndicatorState extends State { } int get itemIndex { - return _InheritedNavigationView.of(context).currentItemIndex; + return InheritedNavigationView.of(context).currentItemIndex; } int get previousItemIndex { - return _InheritedNavigationView.of(context).previousItemIndex; + return InheritedNavigationView.of(context).previousItemIndex; } PaneItem get item { diff --git a/lib/src/controls/navigation/navigation_view/pane.dart b/lib/src/controls/navigation/navigation_view/pane.dart index 7cb53fa8..30d077cc 100644 --- a/lib/src/controls/navigation/navigation_view/pane.dart +++ b/lib/src/controls/navigation/navigation_view/pane.dart @@ -692,7 +692,7 @@ class _TopNavigationPaneState extends State<_TopNavigationPane> { @override Widget build(BuildContext context) { assert(debugCheckHasFluentTheme(context)); - final view = _InheritedNavigationView.of(context); + final view = InheritedNavigationView.of(context); final height = widget.pane.size?.topHeight ?? kOneLineTileHeight; return SizedBox( key: widget.pane.paneKey, @@ -725,7 +725,7 @@ class _TopNavigationPaneState extends State<_TopNavigationPane> { placementMode: FlyoutPlacementMode.bottomCenter, forceAvailableSpace: true, builder: (context) { - return _InheritedNavigationView( + return InheritedNavigationView( displayMode: view.displayMode, currentItemIndex: view.currentItemIndex, minimalPaneOpen: view.minimalPaneOpen, @@ -853,7 +853,7 @@ class _MenuFlyoutPaneItem extends MenuFlyoutItemBase { final size = Flyout.of(context).size; final theme = NavigationPaneTheme.of(context); final fluentTheme = FluentTheme.of(context); - final view = _InheritedNavigationView.of(context); + final view = InheritedNavigationView.of(context); final selected = view.pane?.isSelected(item) ?? false; final titleText = item.title?.getProperty() ?? ''; @@ -1076,7 +1076,7 @@ class _CompactNavigationPane extends StatelessWidget { static Widget _buildItem(BuildContext context, NavigationPaneItem item) { assert(debugCheckHasFluentTheme(context)); - final pane = _InheritedNavigationView.of(context).pane!; + final pane = InheritedNavigationView.of(context).pane!; if (item is PaneItemHeader) { // Item Header is not visible on compact pane return const SizedBox(); diff --git a/lib/src/controls/navigation/navigation_view/pane_items.dart b/lib/src/controls/navigation/navigation_view/pane_items.dart index 88bbd024..e7bec99e 100644 --- a/lib/src/controls/navigation/navigation_view/pane_items.dart +++ b/lib/src/controls/navigation/navigation_view/pane_items.dart @@ -123,7 +123,7 @@ class PaneItem extends NavigationPaneItem { int? itemIndex, bool? autofocus, }) { - final maybeBody = _InheritedNavigationView.maybeOf(context); + final maybeBody = InheritedNavigationView.maybeOf(context); final mode = displayMode ?? maybeBody?.displayMode ?? maybeBody?.pane?.displayMode ?? @@ -363,7 +363,7 @@ class PaneItem extends NavigationPaneItem { return Stack(children: [ button, Positioned.fill( - child: _InheritedNavigationView.merge( + child: InheritedNavigationView.merge( currentItemIndex: index, currentItemSelected: selected, child: KeyedSubtree( @@ -480,7 +480,7 @@ class PaneItemHeader extends NavigationPaneItem { Widget build(BuildContext context) { assert(debugCheckHasFluentTheme(context)); final theme = NavigationPaneTheme.of(context); - final view = _InheritedNavigationView.of(context); + final view = InheritedNavigationView.of(context); return KeyedSubtree( key: key, @@ -560,7 +560,7 @@ class PaneItemAction extends PaneItem { } } -typedef _PaneItemExpanderKey = GlobalKey<__PaneItemExpanderState>; +typedef PaneItemExpanderKey = GlobalKey<__PaneItemExpanderState>; /// Hierhical navigation item used on [NavigationView] /// @@ -580,7 +580,7 @@ typedef _PaneItemExpanderKey = GlobalKey<__PaneItemExpanderState>; /// * [PaneItemSeparator], used to group navigation items /// * [PaneItemHeader], used to label groups of items. class PaneItemExpander extends PaneItem { - final _PaneItemExpanderKey expanderKey = _PaneItemExpanderKey(); + final PaneItemExpanderKey expanderKey = PaneItemExpanderKey(); PaneItemExpander({ super.key, @@ -620,7 +620,7 @@ class PaneItemExpander extends PaneItem { bool? autofocus, int? itemIndex, }) { - final maybeBody = _InheritedNavigationView.maybeOf(context); + final maybeBody = InheritedNavigationView.maybeOf(context); final mode = displayMode ?? maybeBody?.displayMode ?? maybeBody?.pane?.displayMode ?? @@ -711,7 +711,7 @@ class __PaneItemExpanderState extends State<_PaneItemExpander> } int get index { - final body = _InheritedNavigationView.of(context); + final body = InheritedNavigationView.of(context); return body.pane?.effectiveIndexOf(widget.item) ?? 0; } @@ -726,7 +726,7 @@ class __PaneItemExpanderState extends State<_PaneItemExpander> ); if (_open) { if (useFlyout && doFlyout && flyoutController.isAttached) { - final body = _InheritedNavigationView.of(context); + final body = InheritedNavigationView.of(context); final displayMode = body.displayMode; final navigationTheme = NavigationPaneTheme.of(context); @@ -791,7 +791,7 @@ class __PaneItemExpanderState extends State<_PaneItemExpander> Widget build(BuildContext context) { assert(debugCheckHasFluentTheme(context)); final theme = FluentTheme.of(context); - final body = _InheritedNavigationView.of(context); + final body = InheritedNavigationView.of(context); assert(body.pane!.selected != null, 'The selected of NavigationPane can not be null!Try offer a value in NavigationPane!'); diff --git a/lib/src/controls/navigation/navigation_view/view.dart b/lib/src/controls/navigation/navigation_view/view.dart index a0c73a72..05faa72a 100644 --- a/lib/src/controls/navigation/navigation_view/view.dart +++ b/lib/src/controls/navigation/navigation_view/view.dart @@ -153,9 +153,9 @@ class NavigationView extends StatefulWidget { /// Get useful info about the current navigation view. /// /// As a normal user, you will rarely need this information. - static _InheritedNavigationView dataOf(BuildContext context) { + static InheritedNavigationView dataOf(BuildContext context) { return context - .dependOnInheritedWidgetOfExactType<_InheritedNavigationView>()!; + .dependOnInheritedWidgetOfExactType()!; } @override @@ -792,7 +792,7 @@ class NavigationViewState extends State { return Mica( backgroundColor: theme.backgroundColor, - child: _InheritedNavigationView( + child: InheritedNavigationView( displayMode: _compactOverlayOpen ? PaneDisplayMode.open : displayMode, minimalPaneOpen: minimalPaneOpen, pane: widget.pane, @@ -962,9 +962,8 @@ class _NavigationAppBar extends StatelessWidget { assert(debugCheckHasMediaQuery(context)); assert(debugCheckHasFluentLocalizations(context)); - final displayMode = - _InheritedNavigationView.maybeOf(context)?.displayMode ?? - PaneDisplayMode.top; + final displayMode = InheritedNavigationView.maybeOf(context)?.displayMode ?? + PaneDisplayMode.top; final leading = appBar._buildLeading(displayMode != PaneDisplayMode.top); final title = () { if (appBar.title != null) { diff --git a/lib/src/controls/utils/hover_button.dart b/lib/src/controls/utils/hover_button.dart index 796cb383..22013970 100644 --- a/lib/src/controls/utils/hover_button.dart +++ b/lib/src/controls/utils/hover_button.dart @@ -7,24 +7,25 @@ typedef WidgetStateWidgetBuilder = Widget Function( Set state, ); -class _HoverButtonInherited extends InheritedWidget { - const _HoverButtonInherited({ +class HoverButtonInherited extends InheritedWidget { + const HoverButtonInherited({ + super.key, required super.child, required this.states, }); final Set states; - static _HoverButtonInherited of(BuildContext context) { - return context.dependOnInheritedWidgetOfExactType<_HoverButtonInherited>()!; + static HoverButtonInherited of(BuildContext context) { + return context.dependOnInheritedWidgetOfExactType()!; } - static _HoverButtonInherited? maybeOf(BuildContext context) { - return context.dependOnInheritedWidgetOfExactType<_HoverButtonInherited>(); + static HoverButtonInherited? maybeOf(BuildContext context) { + return context.dependOnInheritedWidgetOfExactType(); } @override - bool updateShouldNotify(_HoverButtonInherited oldWidget) { + bool updateShouldNotify(HoverButtonInherited oldWidget) { return states != oldWidget.states; } } @@ -165,12 +166,12 @@ class HoverButton extends StatefulWidget { @override State createState() => _HoverButtonState(); - static _HoverButtonInherited of(BuildContext context) { - return _HoverButtonInherited.of(context); + static HoverButtonInherited of(BuildContext context) { + return HoverButtonInherited.of(context); } - static _HoverButtonInherited? maybeOf(BuildContext context) { - return _HoverButtonInherited.maybeOf(context); + static HoverButtonInherited? maybeOf(BuildContext context) { + return HoverButtonInherited.maybeOf(context); } } @@ -342,7 +343,7 @@ class _HoverButtonState extends State { ); if (widget.margin != null) w = Padding(padding: widget.margin!, child: w); - w = _HoverButtonInherited( + w = HoverButtonInherited( states: states, child: w, );