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
aaf1003a
Unverified
Commit
aaf1003a
authored
Nov 08, 2021
by
Darren Austin
Committed by
GitHub
Nov 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Force the color used by WidgetApp's Title to be fully opaque. (#93267)
parent
7c1eb1bc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
app.dart
packages/flutter/lib/src/widgets/app.dart
+2
-2
app_title_test.dart
packages/flutter/test/widgets/app_title_test.dart
+11
-2
No files found.
packages/flutter/lib/src/widgets/app.dart
View file @
aaf1003a
...
...
@@ -1631,7 +1631,7 @@ class _WidgetsAppState extends State<WidgetsApp> with WidgetsBindingObserver {
assert
(
title
!=
null
,
'onGenerateTitle must return a non-null String'
);
return
Title
(
title:
title
,
color:
widget
.
color
,
color:
widget
.
color
.
withOpacity
(
1.0
)
,
child:
result
,
);
},
...
...
@@ -1639,7 +1639,7 @@ class _WidgetsAppState extends State<WidgetsApp> with WidgetsBindingObserver {
}
else
{
title
=
Title
(
title:
widget
.
title
,
color:
widget
.
color
,
color:
widget
.
color
.
withOpacity
(
1.0
)
,
child:
result
,
);
}
...
...
packages/flutter/test/widgets/app_title_test.dart
View file @
aaf1003a
...
...
@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
const
Color
kTitleColor
=
Color
(
0xFF333333
);
const
String
kTitleString
=
'Hello World'
;
Future
<
void
>
pumpApp
(
WidgetTester
tester
,
{
GenerateAppTitle
?
onGenerateTitle
})
async
{
Future
<
void
>
pumpApp
(
WidgetTester
tester
,
{
GenerateAppTitle
?
onGenerateTitle
,
Color
?
color
})
async
{
await
tester
.
pumpWidget
(
WidgetsApp
(
supportedLocales:
const
<
Locale
>[
...
...
@@ -16,7 +16,7 @@ Future<void> pumpApp(WidgetTester tester, { GenerateAppTitle? onGenerateTitle })
Locale
(
'en'
,
'GB'
),
],
title:
kTitleString
,
color:
kTitleColor
,
color:
color
??
kTitleColor
,
onGenerateTitle:
onGenerateTitle
,
onGenerateRoute:
(
RouteSettings
settings
)
{
return
PageRouteBuilder
<
void
>(
...
...
@@ -36,6 +36,15 @@ void main() {
expect
(
tester
.
widget
<
Title
>(
find
.
byType
(
Title
)).
color
,
kTitleColor
);
});
testWidgets
(
'Specified color is made opaque for Title'
,
(
WidgetTester
tester
)
async
{
// The Title widget can only handle fully opaque colors, the WidgetApp should
// ensure it only uses a fully opaque version of its color for the title.
const
Color
transparentBlue
=
Color
(
0xDD0000ff
);
const
Color
opaqueBlue
=
Color
(
0xFF0000ff
);
await
pumpApp
(
tester
,
color:
transparentBlue
);
expect
(
tester
.
widget
<
Title
>(
find
.
byType
(
Title
)).
color
,
opaqueBlue
);
});
testWidgets
(
'onGenerateTitle handles changing locales'
,
(
WidgetTester
tester
)
async
{
String
generateTitle
(
BuildContext
context
)
{
return
Localizations
.
localeOf
(
context
).
toString
();
...
...
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