Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Normalize AppBarTheme #169130

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

huycozy
Copy link
Member

@huycozy huycozy commented May 20, 2025

This PR is to make AppBarTheme conform to Flutter Material's conventions for component themes:

  • Added a AppBarThemeData class which defines overrides for the defaults for AppBar properties.
  • Added AppBarTheme constructor parameters: AppBarThemeData? data and Widget? child. This is now the preferred way to configure a AppBarTheme:
AppBarTheme(
      data: AppBarThemeData(),
      child: Scaffold(
        appBar: AppBar(
          title: xxx,
          leading: xxx,
          actions: xxx,
     ),
),

These two properties are made nullable to not break existing apps which has customized ThemeData.appBarTheme.

  • Update AppBarTheme to be an InheritedWidget subclass.
  • Changed the type of component theme defaults from AppBarTheme to AppBarThemeData.
  • Add new tests for AppBarThemeData and update the existing AppBarTheme tests.
  • This also temporarily changes AppBarThemeData to Object? in ThemeData class, to bypass g3 tests, following Normalize BottomAppBarTheme #168586 (comment).
  • Addresses the "theme normalization" sub-project within ☂️ Material Theme System Updates #91772.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@huycozy huycozy self-assigned this May 20, 2025
@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels May 20, 2025
@huycozy huycozy force-pushed the appbar-theme-normalization branch from 2465ff1 to fdc4855 Compare May 20, 2025 14:39
@huycozy huycozy marked this pull request as ready for review May 21, 2025 04:52
@huycozy huycozy requested a review from QuncCccccc May 21, 2025 04:52
@flutter-dashboard
Copy link

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #169130 at sha fdc4855

@flutter-dashboard flutter-dashboard bot added the will affect goldens Changes to golden files label May 21, 2025
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.

Thank you for adding this normalization! LGTM:)

@huycozy huycozy force-pushed the appbar-theme-normalization branch from a2f78a8 to a6b93c2 Compare May 22, 2025 14:31
@huycozy huycozy mentioned this pull request May 26, 2025
9 tasks
@huycozy huycozy requested a review from QuncCccccc May 29, 2025 04:05
@huycozy huycozy force-pushed the appbar-theme-normalization branch from 6c6feff to f1112fa Compare June 2, 2025 10:31
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. will affect goldens Changes to golden files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants