@@ -389,17 +389,13 @@ class NavigationViewState extends State<NavigationView> {
389389
390390 void _generateKeys () {
391391 if (widget.pane == null ) return ;
392- _itemKeys
393- ..clear ()
394- ..addAll (
395- Map .fromIterables (
396- List .generate (widget.pane! .effectiveItems.length, (i) => i),
397- List .generate (
398- widget.pane! .effectiveItems.length,
399- (i) => GlobalKey (debugLabel: 'NavigationView item key#$i ' ),
400- ),
401- ),
402- );
392+ final itemCount = widget.pane! .effectiveItems.length;
393+ if (_itemKeys.length == itemCount) return ;
394+
395+ _itemKeys.clear ();
396+ for (var i = 0 ; i < itemCount; i++ ) {
397+ _itemKeys[i] = GlobalKey (debugLabel: 'NavigationView item key#$i ' );
398+ }
403399 }
404400
405401 @override
@@ -445,7 +441,9 @@ class NavigationViewState extends State<NavigationView> {
445441 );
446442
447443 final theme = NavigationPaneTheme .of (context);
444+ final fluentTheme = FluentTheme .of (context);
448445 final localizations = FluentLocalizations .of (context);
446+ final mediaQuerySize = MediaQuery .sizeOf (context);
449447 final EdgeInsetsGeometry appBarPadding = EdgeInsetsDirectional .only (
450448 top: widget.appBar? .finalHeight (context) ?? 0.0 ,
451449 );
@@ -486,7 +484,7 @@ class NavigationViewState extends State<NavigationView> {
486484 /// (641px to 1007px).
487485 /// - Only a menu button (minimal) on small window widths (640px or less).
488486 var width = consts.biggest.width;
489- if (width.isInfinite) width = MediaQuery . sizeOf (context) .width;
487+ if (width.isInfinite) width = mediaQuerySize .width;
490488
491489 PaneDisplayMode autoDisplayMode;
492490 if (width <= 640 ) {
@@ -801,7 +799,7 @@ class NavigationViewState extends State<NavigationView> {
801799 end: 0 ,
802800 height: widget.appBar? .finalHeight (context) ?? 0.0 ,
803801 child: ColoredBox (
804- color: FluentTheme . of (context) .scaffoldBackgroundColor,
802+ color: fluentTheme .scaffoldBackgroundColor,
805803 ),
806804 ),
807805 PositionedDirectional (
@@ -829,7 +827,7 @@ class NavigationViewState extends State<NavigationView> {
829827 curve: theme.animationCurve ?? Curves .linear,
830828 start: minimalPaneOpen ? 0.0 : - openSize,
831829 width: openSize,
832- height: MediaQuery . sizeOf (context) .height,
830+ height: mediaQuerySize .height,
833831 onEnd: () {
834832 _isTransitioning = false ;
835833 if (mounted) setState (() {});
@@ -1014,6 +1012,7 @@ class NavigationAppBar with Diagnosticable {
10141012 assert (debugCheckHasFluentLocalizations (context));
10151013 assert (debugCheckHasFluentTheme (context));
10161014 final localizations = FluentLocalizations .of (context);
1015+ final localFluentTheme = FluentTheme .of (context);
10171016 final onPressed = canPop ? () => Navigator .maybePop (context) : null ;
10181017 widget = NavigationPaneTheme (
10191018 data: NavigationPaneTheme .of (context).merge (
@@ -1023,7 +1022,7 @@ class NavigationAppBar with Diagnosticable {
10231022 return ButtonThemeData .buttonColor (context, states);
10241023 }
10251024 return ButtonThemeData .uncheckedInputColor (
1026- FluentTheme . of (context) ,
1025+ localFluentTheme ,
10271026 states,
10281027 ).basedOnLuminance ();
10291028 }),
@@ -1088,6 +1087,7 @@ class _NavigationAppBar extends StatelessWidget {
10881087 if (appBar.title != null ) {
10891088 assert (debugCheckHasFluentTheme (context));
10901089 final theme = NavigationPaneTheme .of (context);
1090+ final fluentTheme = FluentTheme .of (context);
10911091
10921092 return AnimatedPadding (
10931093 duration: theme.animationDuration ?? Duration .zero,
@@ -1096,7 +1096,7 @@ class _NavigationAppBar extends StatelessWidget {
10961096 const EdgeInsetsDirectional .only (start: 6 ),
10971097 ),
10981098 child: DefaultTextStyle .merge (
1099- style: FluentTheme . of (context) .typography.caption,
1099+ style: fluentTheme .typography.caption,
11001100 maxLines: 1 ,
11011101 softWrap: false ,
11021102 child: appBar.title! ,
@@ -1154,13 +1154,13 @@ class _NavigationAppBar extends StatelessWidget {
11541154 default :
11551155 return const SizedBox .shrink ();
11561156 }
1157- final topPadding = MediaQuery .paddingOf (context).top ;
1157+ final mediaQueryPadding = MediaQuery .paddingOf (context);
11581158
11591159 return Container (
11601160 color: appBar.backgroundColor,
11611161 decoration: appBar.decoration,
11621162 height: appBar.finalHeight (context),
1163- padding: EdgeInsetsDirectional .only (top: topPadding ),
1163+ padding: EdgeInsetsDirectional .only (top: mediaQueryPadding.top ),
11641164 child: result,
11651165 );
11661166 }
0 commit comments