Skip to content

Added Badge.count constructor #115297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 17, 2022
Merged

Conversation

HansMuller
Copy link
Contributor

Added a named Badge.count constructor as a convenience for the common case of creating a Badge whose label is an integer with 1-3 digits. Count values greater than 999 are displayed as '999+'.

Per a suggest from @darrenaustin - #114560 (comment).

@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Nov 14, 2022
Copy link
Contributor

@darrenaustin darrenaustin left a comment

Choose a reason for hiding this comment

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

LGTM. Just a question about the test. Thx!

alignment: Alignment.topLeft,
child: Builder(
builder: (BuildContext context) {
// theme.textTtheme is updated when the MaterialApp is built.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// theme.textTtheme is updated when the MaterialApp is built.
// theme.textTheme is updated when the MaterialApp is built.

@@ -111,6 +111,63 @@ void main() {
expect(box, paints..rrect(rrect: RRect.fromLTRBR(-8, -4, 12, 12, const Radius.circular(8)), color: theme.colorScheme.error));
});

// Essentially the same as 'Large Badge defaults'
testWidgets('Badge.count', (WidgetTester tester) async {
late final ThemeData theme;
Copy link
Contributor

Choose a reason for hiding this comment

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

Couldn't this just be:

Suggested change
late final ThemeData theme;
late final ThemeData theme = ThemeData.light(useMaterial3: true);

And then you wouldn't have to pull it from the context later in the build? You could use it for both the build method and the expect clauses. Or I am missing something with the Builder widget?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ThemeData.textTheme is updated lazily so the initial value of ThemeData.light(useMaterial3: true).textTheme.labelSmall isn't the final value.

@HansMuller HansMuller merged commit e9622ce into flutter:master Nov 17, 2022
@HansMuller HansMuller deleted the badge_count branch November 17, 2022 14:05
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2022
HansMuller pushed a commit that referenced this pull request Nov 17, 2022
HansMuller added a commit that referenced this pull request Nov 17, 2022
This reverts commit e9622ce.

Landing before presubmits have completed to unblock the build.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2022
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Nov 17, 2022
* d359af2 a062a2063 [macOS] Merge FlutterMetalCompositor, superclass (flutter/engine#37648) (flutter/flutter#115474)

* cacf1d2 Roll Flutter Engine from a062a20638d1 to 97974ebb5ff8 (3 revisions) (flutter/flutter#115478)

* 490fe28 Updated instructions for adding new localized messages. (flutter/flutter#115390)

* 84357cb re-enable firebase release smoke test since infra outage is over (flutter/flutter#115402)

* f205471 Use concrete factory constructor for DomXMLHttpRequest (flutter/flutter#115094)

* 55927d8 3c83b275a [Impeller] Reland: Refactor color source resolution to use explicit factory types (flutter/engine#37677) (flutter/flutter#115482)

* 829e44d Fixed label alignment (flutter/flutter#115409)

* b579109 Roll Flutter Engine from 3c83b275a511 to 35ecb2bf4139 (2 revisions) (flutter/flutter#115495)

* d01874d [framework] re-rasterize page transition when layout size changes (flutter/flutter#115371)

* 68740a2 fee463552 Roll Fuchsia Linux SDK from T7_W8eoMNuMdG-5R9... to haqxMhaSf7-4ZeVL8... (flutter/engine#37684) (flutter/flutter#115498)

* 26a990f Roll Flutter Engine from fee463552a93 to c5e6a38dd0bc (2 revisions) (flutter/flutter#115504)

* f255390 Remove redundant arguments passed to redirecting factory constructors (flutter/flutter#115497)

* 20139c6 4f3f45617 Move windows engine_v2 to prod. (flutter/engine#37680) (flutter/flutter#115508)

* 2ad4dc5 dcdb96e9d Roll Skia from 1dfecd7cd478 to 7f385b0ae434 (9 revisions) (flutter/engine#37693) (flutter/flutter#115512)

* 9c54635 Bump codecov/codecov-action from 3.1.0 to 3.1.1 (flutter/flutter#113126)

* fafa11d Roll Flutter Engine from dcdb96e9db6b to cb403c1feaee (2 revisions) (flutter/flutter#115516)

* 59f389d Remove unneeded comparison to `double.nan` (flutter/flutter#115470)

* c071950 d422023f3 Migrate const_finder tests to be null safe (flutter/engine#37683) (flutter/flutter#115524)

* bf6d0f3 5bbf070c3 Roll Skia from 7f385b0ae434 to 8589c8ac6ee6 (1 revision) (flutter/engine#37702) (flutter/flutter#115531)

* 83d205e 7156b87c7 Roll Skia from 8589c8ac6ee6 to 68784d303cd6 (4 revisions) (flutter/engine#37705) (flutter/flutter#115538)

* 7e8568b 83c2482d7 [Impeller] Add Impeller scene (flutter/engine#37694) (flutter/flutter#115541)

* 07de108 ad3038c25 Roll Skia from 68784d303cd6 to 95ac3b53be37 (1 revision) (flutter/engine#37706) (flutter/flutter#115548)

* 1b23ad6 Roll Flutter Engine from ad3038c25cfa to 832aae2f850a (2 revisions) (flutter/flutter#115552)

* e8cbd44 Added Badge.isLabelVisible flag (flutter/flutter#115292)

* e9622ce Added Badge.count constructor (flutter/flutter#115297)

* 537f89c Revert "Added Badge.count constructor (#115297)" (flutter/flutter#115564)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Nov 17, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Nov 18, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Nov 18, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Nov 18, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Nov 18, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Nov 18, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Nov 18, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Nov 18, 2022
shogohida pushed a commit to shogohida/flutter that referenced this pull request Dec 7, 2022
shogohida pushed a commit to shogohida/flutter that referenced this pull request Dec 7, 2022
This reverts commit e9622ce.

Landing before presubmits have completed to unblock the build.
gspencergoog pushed a commit to gspencergoog/flutter that referenced this pull request Jan 19, 2023
gspencergoog pushed a commit to gspencergoog/flutter that referenced this pull request Jan 19, 2023
This reverts commit e9622ce.

Landing before presubmits have completed to unblock the build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants