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
0d152a6b
Commit
0d152a6b
authored
Apr 17, 2017
by
Dwayne Slater
Committed by
Adam Barth
Apr 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix DefaultTextStyle not notifying updates for some changes (#9416)
parent
cc3b9147
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
1 deletion
+50
-1
text.dart
packages/flutter/lib/src/widgets/text.dart
+7
-1
default_text_style_test.dart
packages/flutter/test/widgets/default_text_style_test.dart
+43
-0
No files found.
packages/flutter/lib/src/widgets/text.dart
View file @
0d152a6b
...
...
@@ -108,7 +108,13 @@ class DefaultTextStyle extends InheritedWidget {
}
@override
bool
updateShouldNotify
(
DefaultTextStyle
old
)
=>
style
!=
old
.
style
;
bool
updateShouldNotify
(
DefaultTextStyle
old
)
{
return
style
!=
old
.
style
||
textAlign
!=
old
.
textAlign
||
softWrap
!=
old
.
softWrap
||
overflow
!=
old
.
overflow
||
maxLines
!=
old
.
maxLines
;
}
@override
void
debugFillDescription
(
List
<
String
>
description
)
{
...
...
packages/flutter/test/widgets/default_text_style_test.dart
0 → 100644
View file @
0d152a6b
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/widgets.dart'
;
void
main
(
)
{
testWidgets
(
'DefaultTextStyle changes propagate to Text'
,
(
WidgetTester
tester
)
async
{
const
Text
textWidget
=
const
Text
(
'Hello'
);
const
TextStyle
s1
=
const
TextStyle
(
fontSize:
10.0
,
fontWeight:
FontWeight
.
w800
,
height:
123.0
,
);
await
tester
.
pumpWidget
(
const
DefaultTextStyle
(
style:
s1
,
child:
textWidget
));
RichText
text
=
tester
.
firstWidget
(
find
.
byType
(
RichText
));
expect
(
text
,
isNotNull
);
expect
(
text
.
text
.
style
,
s1
);
await
tester
.
pumpWidget
(
const
DefaultTextStyle
(
style:
s1
,
textAlign:
TextAlign
.
justify
,
softWrap:
false
,
overflow:
TextOverflow
.
fade
,
maxLines:
3
,
child:
textWidget
));
text
=
tester
.
firstWidget
(
find
.
byType
(
RichText
));
expect
(
text
,
isNotNull
);
expect
(
text
.
text
.
style
,
s1
);
expect
(
text
.
textAlign
,
TextAlign
.
justify
);
expect
(
text
.
softWrap
,
false
);
expect
(
text
.
overflow
,
TextOverflow
.
fade
);
expect
(
text
.
maxLines
,
3
);
});
}
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