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:
@@ -41,11 +41,13 @@ class _BottomAppBarDemoState extends State<BottomAppBarDemo> {
|
||||
_isVisible ? FloatingActionButtonLocation.endContained : FloatingActionButtonLocation.endFloat;
|
||||
|
||||
void _listen() {
|
||||
final ScrollDirection direction = _controller.position.userScrollDirection;
|
||||
if (direction == ScrollDirection.forward) {
|
||||
_show();
|
||||
} else if (direction == ScrollDirection.reverse) {
|
||||
_hide();
|
||||
switch (_controller.position.userScrollDirection) {
|
||||
case ScrollDirection.idle:
|
||||
break;
|
||||
case ScrollDirection.forward:
|
||||
_show();
|
||||
case ScrollDirection.reverse:
|
||||
_hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user