forked from firka/flutter
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:
@@ -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,
|
||||
),
|
||||
|
||||
@@ -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>[
|
||||
|
||||
@@ -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!,
|
||||
);
|
||||
},
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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>[
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user