From 5b3293c5aef493f045d911777d89d9e506cb2697 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Thu, 26 Oct 2023 13:57:52 -0700 Subject: [PATCH] Fix dislocated doc and comment on ThemeData localize cache (#137315) This comment on _localizedThemeDataCacheSize was a bit garbled from getting split up, and the doc on _localizedThemeDataCache was missing from having been moved elsewhere. It looks like the dislocation happened in 8b86d238b (#116088), which was otherwise making unrelated changes, including a couple of lines near these. Likely it was due to an error in resolving merge or rebase conflicts at some point while revising that PR. --- packages/flutter/lib/src/material/theme_data.dart | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/flutter/lib/src/material/theme_data.dart b/packages/flutter/lib/src/material/theme_data.dart index 94f0e01328..8a96051d6e 100644 --- a/packages/flutter/lib/src/material/theme_data.dart +++ b/packages/flutter/lib/src/material/theme_data.dart @@ -1465,13 +1465,6 @@ class ThemeData with Diagnosticable { Color get toggleableActiveColor => _toggleableActiveColor!; final Color? _toggleableActiveColor; - // The number 5 was chosen without any real science or research behind it. It - - // copies of ThemeData in memory comfortably) and not too small (most apps - // shouldn't have more than 5 theme/localization pairs). - static const int _localizedThemeDataCacheSize = 5; - /// Caches localized themes to speed up the [localize] method. - /// Creates a copy of this theme but with the given fields replaced with the new values. /// /// The [brightness] value is applied to the [colorScheme]. @@ -1708,7 +1701,14 @@ class ThemeData with Diagnosticable { bottomAppBarColor: bottomAppBarColor ?? _bottomAppBarColor, ); } + + // The number 5 was chosen without any real science or research behind it. It // just seemed like a number that's not too big (we should be able to fit 5 + // copies of ThemeData in memory comfortably) and not too small (most apps + // shouldn't have more than 5 theme/localization pairs). + static const int _localizedThemeDataCacheSize = 5; + + /// Caches localized themes to speed up the [localize] method. static final _FifoCache<_IdentityThemeDataCacheKey, ThemeData> _localizedThemeDataCache = _FifoCache<_IdentityThemeDataCacheKey, ThemeData>(_localizedThemeDataCacheSize);