-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: contributor-productivityTeam-specific productivity, code health, technical debt.Team-specific productivity, code health, technical debt.c: tech-debtTechnical debt, code quality, testing, etc.Technical debt, code quality, testing, etc.f: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
It has been appointed to me that some generated templates use Theme.of (Theme lookup) multiple times in the same class
For instance:
flutter/packages/flutter/lib/src/material/navigation_drawer.dart
Lines 674 to 684 in fdc25a1
| @override | |
| Color? get backgroundColor => Theme.of(context).colorScheme.surface; | |
| @override | |
| Color? get surfaceTintColor => Theme.of(context).colorScheme.surfaceTint; | |
| @override | |
| Color? get shadowColor => Colors.transparent; | |
| @override | |
| Color? get indicatorColor => Theme.of(context).colorScheme.secondaryContainer; |
flutter/packages/flutter/lib/src/material/card.dart
Lines 230 to 237 in fdc25a1
| @override | |
| Color? get color => Theme.of(context).colorScheme.surface; | |
| @override | |
| Color? get shadowColor => Theme.of(context).colorScheme.shadow; | |
| @override | |
| Color? get surfaceTintColor => Theme.of(context).colorScheme.surfaceTint; |
These should be refactored to use variables.
flutter/packages/flutter/lib/src/material/navigation_bar.dart
Lines 1367 to 1370 in fdc25a1
| final BuildContext context; | |
| late final ColorScheme _colors = Theme.of(context).colorScheme; | |
| late final TextTheme _textTheme = Theme.of(context).textTheme; | |
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: contributor-productivityTeam-specific productivity, code health, technical debt.Team-specific productivity, code health, technical debt.c: tech-debtTechnical debt, code quality, testing, etc.Technical debt, code quality, testing, etc.f: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Type
Projects
Status
Done (PR merged)