Refactoring if chains into switch statements (#144905)

Based on issue #144903, this PR aims to bring the codebase more in line with the [Flutter repo style guide](https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#avoid-using-if-chains-or--or--with-enum-values):

> #### Avoid using `if` chains or `?:` or `==` with enum values

<br>

This change unfortunately increases the total line length, but it also improves readability.
This commit is contained in:
Nate
2024-03-11 17:04:57 -06:00
committed by GitHub
parent 187ec75eb5
commit 26e379e0fc
20 changed files with 404 additions and 349 deletions

View File

@@ -40,14 +40,15 @@ class NavigationIconView {
FadeTransition transition(BottomNavigationBarType type, BuildContext context) {
Color? iconColor;
if (type == BottomNavigationBarType.shifting) {
iconColor = _color;
} else {
final ThemeData theme = Theme.of(context);
final ColorScheme colorScheme = theme.colorScheme;
iconColor = theme.brightness == Brightness.light
? colorScheme.primary
: colorScheme.secondary;
switch (type) {
case BottomNavigationBarType.shifting:
iconColor = _color;
case BottomNavigationBarType.fixed:
final ThemeData theme = Theme.of(context);
iconColor = switch (theme.brightness) {
Brightness.light => theme.colorScheme.primary,
Brightness.dark => theme.colorScheme.secondary,
};
}
return FadeTransition(