Migrate to Theme.brightnessOf method (#163950)

Refactor: Migrate to Theme.brightnessOf method
fixes: #163837

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
This commit is contained in:
Kishan Rathore
2025-04-03 06:04:53 +05:30
committed by GitHub
parent 503672ff1d
commit 3bf6754d48
14 changed files with 18 additions and 18 deletions

View File

@@ -30,7 +30,7 @@ class _InputDropdown extends StatelessWidget {
Icon(
Icons.arrow_drop_down,
color:
Theme.of(context).brightness == Brightness.light
Theme.brightnessOf(context) == Brightness.light
? Colors.grey.shade700
: Colors.white70,
),

View File

@@ -77,7 +77,7 @@ class MenuDemoState extends State<MenuDemo> {
),
body: ListTileTheme(
iconColor:
Theme.of(context).brightness == Brightness.light ? Colors.grey[600] : Colors.grey[500],
Theme.brightnessOf(context) == Brightness.light ? Colors.grey[600] : Colors.grey[500],
child: ListView(
padding: kMaterialListPadding,
children: <Widget>[

View File

@@ -169,7 +169,7 @@ class _GalleryAppState extends State<GalleryApp> {
Builder(
builder: (BuildContext context) {
return CupertinoTheme(
data: CupertinoThemeData(brightness: Theme.of(context).brightness),
data: CupertinoThemeData(brightness: Theme.brightnessOf(context)),
child: child!,
);
},

View File

@@ -187,7 +187,7 @@ class FullScreenCodeDialogState extends State<FullScreenCodeDialog> {
@override
Widget build(BuildContext context) {
final SyntaxHighlighterStyle style =
Theme.of(context).brightness == Brightness.dark
Theme.brightnessOf(context) == Brightness.dark
? SyntaxHighlighterStyle.darkThemeStyle
: SyntaxHighlighterStyle.lightThemeStyle;

View File

@@ -131,7 +131,7 @@ class _BooleanItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
final bool isDark = Theme.of(context).brightness == Brightness.dark;
final bool isDark = Theme.brightnessOf(context) == Brightness.dark;
return _OptionsItem(
child: Row(
children: <Widget>[

View File

@@ -77,7 +77,7 @@ class _ReplyAppState extends State<ReplyApp> with RestorationMixin {
final ThemeMode galleryThemeMode = GalleryOptions.of(context).themeMode;
final bool isDark =
galleryThemeMode == ThemeMode.system
? Theme.of(context).brightness == Brightness.dark
? Theme.brightnessOf(context) == Brightness.dark
: galleryThemeMode == ThemeMode.dark;
final ThemeData replyTheme =

View File

@@ -288,7 +288,7 @@ class _MailPreviewActionBar extends StatelessWidget {
@override
Widget build(BuildContext context) {
final bool isDark = Theme.of(context).brightness == Brightness.dark;
final bool isDark = Theme.brightnessOf(context) == Brightness.dark;
final Color color = isDark ? ReplyColors.white50 : ReplyColors.blue600;
final bool isDesktop = isDisplayDesktop(context);
final Color starredIconColor = isStarred ? Theme.of(context).colorScheme.secondary : color;