Skip to content

Conversation

@nate-thegrate
Copy link
Contributor

Based on issue #144903, this pull request aims to bring the codebase more in line with the Flutter repo style guide:

Avoid using if chains or ?: or == with enum values

@github-actions github-actions bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. f: cupertino flutter/packages/flutter/cupertino repository f: routes Navigator, Router, and related APIs. labels Apr 4, 2024
@github-actions github-actions bot removed the f: routes Navigator, Router, and related APIs. label Apr 4, 2024
@nate-thegrate nate-thegrate marked this pull request as ready for review April 5, 2024 00:12
Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flutter_LGTM
Thank you!

@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 23, 2024
Copy link
Contributor

@QuncCccccc QuncCccccc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks a lot for your contribution:)!

@auto-submit auto-submit bot merged commit a83e111 into flutter:master Apr 23, 2024
@nate-thegrate nate-thegrate deleted the lib-src-if-chains branch April 23, 2024 16:38
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 24, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 24, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 24, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Apr 24, 2024
flutter/flutter@77043ba...dba4f77

2024-04-24 [email protected] Fix memory leaks in `BottomNavigationBar`  (flutter/flutter#147213)
2024-04-24 [email protected] Disable leak tracking for selection text area (flutter/flutter#147273)
2024-04-24 [email protected] Add missing `overlayColor` property in `styleFrom` methods (flutter/flutter#146685)
2024-04-24 [email protected] Roll Flutter Engine from 3d91141e7e18 to b5d5832f7144 (1 revision) (flutter/flutter#147293)
2024-04-24 [email protected] Roll Flutter Engine from d4f63383d329 to 3d91141e7e18 (1 revision) (flutter/flutter#147281)
2024-04-24 [email protected] Roll Flutter Engine from fcb106011371 to d4f63383d329 (1 revision) (flutter/flutter#147276)
2024-04-24 [email protected] Roll Flutter Engine from 7f89b4367338 to fcb106011371 (1 revision) (flutter/flutter#147272)
2024-04-24 [email protected] Roll Flutter Engine from 9819627013f7 to 7f89b4367338 (2 revisions) (flutter/flutter#147270)
2024-04-24 [email protected] Roll Flutter Engine from d56a231cddc2 to 9819627013f7 (3 revisions) (flutter/flutter#147267)
2024-04-23 [email protected] Roll Flutter Engine from 5f17a779f19d to d56a231cddc2 (1 revision) (flutter/flutter#147266)
2024-04-23 [email protected] Roll Flutter Engine from 303e71890897 to 5f17a779f19d (1 revision) (flutter/flutter#147264)
2024-04-23 [email protected] Remove unneeded local variables and comments in Editable and RenderParagraph (flutter/flutter#146843)
2024-04-23 [email protected] Add test for sliver_animated_opacity.0.dart API example. (flutter/flutter#146722)
2024-04-23 [email protected] Adds AutovalidateMode.onFocusChange to Form and FormField (flutter/flutter#140962)
2024-04-23 [email protected] Roll Flutter Engine from b686508a1dbf to 303e71890897 (4 revisions) (flutter/flutter#147262)
2024-04-23 [email protected] Roll Flutter Engine from f23cc4dda1ad to b686508a1dbf (4 revisions) (flutter/flutter#147258)
2024-04-23 [email protected] Add test for focus_node.0.dart API example. (flutter/flutter#146943)
2024-04-23 [email protected] Roll Flutter Engine from 066953b74042 to f23cc4dda1ad (3 revisions) (flutter/flutter#147255)
2024-04-23 [email protected] Refactor framework + test harness tests (flutter/flutter#146213)
2024-04-23 [email protected] Fix chips delete icon override the default icon size and ignores `IconTheme` from the chip property and `ChipThemeData` (flutter/flutter#146509)
2024-04-23 [email protected] Roll Flutter Engine from f794e6719d3c to 066953b74042 (3 revisions) (flutter/flutter#147248)
2024-04-23 [email protected] Fix frozen `StretchingOverscrollIndicator` animation (flutter/flutter#147195)
2024-04-23 [email protected] Add test for animated_align.0.dart API example. (flutter/flutter#146719)
2024-04-23 [email protected] Fix typos related to Navigator (flutter/flutter#147221)
2024-04-23 [email protected] Fix memory leak in switch painter (flutter/flutter#147228)
2024-04-23 [email protected] Add test for animated_positioned.0.dart API example. (flutter/flutter#146720)
2024-04-23 [email protected] Update icon tree shaker to allow system font fallback (flutter/flutter#147202)
2024-04-23 [email protected] `flutter/lib/src/`: refactoring if-chains into switch expressions (flutter/flutter#146293)
2024-04-23 [email protected] Roll Flutter Engine from 79f49954cce8 to f794e6719d3c (1 revision) (flutter/flutter#147241)
2024-04-23 [email protected] Roll Packages from 01a32c4 to cf6d280 (5 revisions) (flutter/flutter#147240)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
nate-thegrate added a commit that referenced this pull request May 10, 2024
Previous "if-chains" pull requests:
- #144905
- #144977
- #145194
- #146293
- #147472

<br>

I think this one should be enough to wrap things up!

fixes #144903

---------

Co-authored-by: Victor Sanni <[email protected]>
TecHaxter pushed a commit to TecHaxter/flutter_packages that referenced this pull request May 22, 2024
flutter/flutter@77043ba...dba4f77

2024-04-24 [email protected] Fix memory leaks in `BottomNavigationBar`  (flutter/flutter#147213)
2024-04-24 [email protected] Disable leak tracking for selection text area (flutter/flutter#147273)
2024-04-24 [email protected] Add missing `overlayColor` property in `styleFrom` methods (flutter/flutter#146685)
2024-04-24 [email protected] Roll Flutter Engine from 3d91141e7e18 to b5d5832f7144 (1 revision) (flutter/flutter#147293)
2024-04-24 [email protected] Roll Flutter Engine from d4f63383d329 to 3d91141e7e18 (1 revision) (flutter/flutter#147281)
2024-04-24 [email protected] Roll Flutter Engine from fcb106011371 to d4f63383d329 (1 revision) (flutter/flutter#147276)
2024-04-24 [email protected] Roll Flutter Engine from 7f89b4367338 to fcb106011371 (1 revision) (flutter/flutter#147272)
2024-04-24 [email protected] Roll Flutter Engine from 9819627013f7 to 7f89b4367338 (2 revisions) (flutter/flutter#147270)
2024-04-24 [email protected] Roll Flutter Engine from d56a231cddc2 to 9819627013f7 (3 revisions) (flutter/flutter#147267)
2024-04-23 [email protected] Roll Flutter Engine from 5f17a779f19d to d56a231cddc2 (1 revision) (flutter/flutter#147266)
2024-04-23 [email protected] Roll Flutter Engine from 303e71890897 to 5f17a779f19d (1 revision) (flutter/flutter#147264)
2024-04-23 [email protected] Remove unneeded local variables and comments in Editable and RenderParagraph (flutter/flutter#146843)
2024-04-23 [email protected] Add test for sliver_animated_opacity.0.dart API example. (flutter/flutter#146722)
2024-04-23 [email protected] Adds AutovalidateMode.onFocusChange to Form and FormField (flutter/flutter#140962)
2024-04-23 [email protected] Roll Flutter Engine from b686508a1dbf to 303e71890897 (4 revisions) (flutter/flutter#147262)
2024-04-23 [email protected] Roll Flutter Engine from f23cc4dda1ad to b686508a1dbf (4 revisions) (flutter/flutter#147258)
2024-04-23 [email protected] Add test for focus_node.0.dart API example. (flutter/flutter#146943)
2024-04-23 [email protected] Roll Flutter Engine from 066953b74042 to f23cc4dda1ad (3 revisions) (flutter/flutter#147255)
2024-04-23 [email protected] Refactor framework + test harness tests (flutter/flutter#146213)
2024-04-23 [email protected] Fix chips delete icon override the default icon size and ignores `IconTheme` from the chip property and `ChipThemeData` (flutter/flutter#146509)
2024-04-23 [email protected] Roll Flutter Engine from f794e6719d3c to 066953b74042 (3 revisions) (flutter/flutter#147248)
2024-04-23 [email protected] Fix frozen `StretchingOverscrollIndicator` animation (flutter/flutter#147195)
2024-04-23 [email protected] Add test for animated_align.0.dart API example. (flutter/flutter#146719)
2024-04-23 [email protected] Fix typos related to Navigator (flutter/flutter#147221)
2024-04-23 [email protected] Fix memory leak in switch painter (flutter/flutter#147228)
2024-04-23 [email protected] Add test for animated_positioned.0.dart API example. (flutter/flutter#146720)
2024-04-23 [email protected] Update icon tree shaker to allow system font fallback (flutter/flutter#147202)
2024-04-23 [email protected] `flutter/lib/src/`: refactoring if-chains into switch expressions (flutter/flutter#146293)
2024-04-23 [email protected] Roll Flutter Engine from 79f49954cce8 to f794e6719d3c (1 revision) (flutter/flutter#147241)
2024-04-23 [email protected] Roll Packages from 01a32c4 to cf6d280 (5 revisions) (flutter/flutter#147240)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
auto-submit bot pushed a commit that referenced this pull request Jun 18, 2024
fixes [TabBar with isScrollable set to true is broken](#150000)

This regressed due to a tiny mistake in #146293

### Code sample

<details>
<summary>expand to view the code sample</summary> 

```dart
import 'dart:ui';

import 'package:flutter/material.dart';

/// Flutter code sample for [TabBar].

void main() => runApp(const TabBarApp());

class TabBarApp extends StatelessWidget {
  const TabBarApp({super.key});

  @OverRide
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: TabBarExample(),
    );
  }
}

class TabBarExample extends StatelessWidget {
  const TabBarExample({super.key});

  @OverRide
  Widget build(BuildContext context) {
    final List<Tab> tabs =
        List<Tab>.generate(20, (int index) => Tab(text: 'Tab $index'));

    return ScrollConfiguration(
      behavior: ScrollConfiguration.of(context)
          .copyWith(dragDevices: <PointerDeviceKind>{
        PointerDeviceKind.touch,
        PointerDeviceKind.mouse,
      }),
      child: DefaultTabController(
        length: tabs.length,
        child: Scaffold(
          appBar: AppBar(
            title: const Text('TabBar Sample'),
            bottom: TabBar(
              isScrollable: true,
              tabs: tabs,
              tabAlignment: TabAlignment.start,
            ),
          ),
          body: TabBarView(
            children: <Widget>[
              for (int i = 0; i < tabs.length; i++)
                Center(
                  child: Text('Page $i'),
                ),
            ],
          ),
        ),
      ),
    );
  }
}

```

</details>

### Before

https://github.com/flutter/flutter/assets/48603081/b7aa98a2-a6a5-431e-8327-859a11efa129

### After

https://github.com/flutter/flutter/assets/48603081/0435719f-03d4-4d76-8b5a-532894fcf4a3
@nate-thegrate nate-thegrate added the refactor Improving readability/efficiency without behavioral changes label Jul 12, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems autosubmit Merge PR when tree becomes green via auto submit App f: cupertino flutter/packages/flutter/cupertino repository f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. refactor Improving readability/efficiency without behavioral changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants