Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
f5fb9e8c
Unverified
Commit
f5fb9e8c
authored
May 11, 2022
by
Andree Yosua
Committed by
GitHub
May 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix ThemeData extension throws when the ThemeExtension not found (#103343)
parent
a259fcb6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
theme_data.dart
packages/flutter/lib/src/material/theme_data.dart
+1
-1
theme_data_test.dart
packages/flutter/test/material/theme_data_test.dart
+8
-0
No files found.
packages/flutter/lib/src/material/theme_data.dart
View file @
f5fb9e8c
...
...
@@ -1077,7 +1077,7 @@ class ThemeData with Diagnosticable {
/// Obtain with `Theme.of(context).extension<MyThemeExtension>()`.
///
/// See [extensions] for an interactive example.
T
?
extension
<
T
>()
=>
extensions
[
T
]
as
T
;
T
?
extension
<
T
>()
=>
extensions
[
T
]
as
T
?
;
/// The default [InputDecoration] values for [InputDecorator], [TextField],
/// and [TextFormField] are based on this theme.
...
...
packages/flutter/test/material/theme_data_test.dart
View file @
f5fb9e8c
...
...
@@ -561,6 +561,14 @@ void main() {
expect
(
lerped
.
extension
<
MyThemeExtensionA
>()!.
color2
,
const
Color
(
0xff90ab7d
));
expect
(
lerped
.
extension
<
MyThemeExtensionB
>()!.
textStyle
,
const
TextStyle
(
fontSize:
100
));
// Not lerped
});
testWidgets
(
'should return null on extension not found'
,
(
WidgetTester
tester
)
async
{
final
ThemeData
theme
=
ThemeData
(
extensions:
const
<
ThemeExtension
<
dynamic
>>{},
);
expect
(
theme
.
extension
<
MyThemeExtensionA
>(),
isNull
);
});
});
test
(
'copyWith, ==, hashCode basics'
,
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment