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
effa7d52
Unverified
Commit
effa7d52
authored
Mar 04, 2021
by
Michael Goderbauer
Committed by
GitHub
Mar 04, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use textdirection for gradient of ShapeDecoration (#77186)
parent
6c062894
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
shape_decoration.dart
packages/flutter/lib/src/painting/shape_decoration.dart
+1
-1
shape_decoration_test.dart
packages/flutter/test/widgets/shape_decoration_test.dart
+26
-0
No files found.
packages/flutter/lib/src/painting/shape_decoration.dart
View file @
effa7d52
...
@@ -329,7 +329,7 @@ class _ShapeDecorationPainter extends BoxPainter {
...
@@ -329,7 +329,7 @@ class _ShapeDecorationPainter extends BoxPainter {
_interiorPaint
!.
color
=
_decoration
.
color
!;
_interiorPaint
!.
color
=
_decoration
.
color
!;
}
}
if
(
_decoration
.
gradient
!=
null
)
if
(
_decoration
.
gradient
!=
null
)
_interiorPaint
!.
shader
=
_decoration
.
gradient
!.
createShader
(
rect
);
_interiorPaint
!.
shader
=
_decoration
.
gradient
!.
createShader
(
rect
,
textDirection:
textDirection
);
if
(
_decoration
.
shadows
!=
null
)
{
if
(
_decoration
.
shadows
!=
null
)
{
if
(
_shadowCount
==
null
)
{
if
(
_shadowCount
==
null
)
{
_shadowCount
=
_decoration
.
shadows
!.
length
;
_shadowCount
=
_decoration
.
shadows
!.
length
;
...
...
packages/flutter/test/widgets/shape_decoration_test.dart
View file @
effa7d52
...
@@ -114,6 +114,32 @@ Future<void> main() async {
...
@@ -114,6 +114,32 @@ Future<void> main() async {
);
);
});
});
testWidgets
(
'Does not crash with directional gradient'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/76967.
await
tester
.
pumpWidget
(
const
Directionality
(
textDirection:
TextDirection
.
rtl
,
child:
DecoratedBox
(
decoration:
ShapeDecoration
(
gradient:
RadialGradient
(
focal:
AlignmentDirectional
(
0
,
1
),
focalRadius:
5
,
radius:
2
,
colors:
<
Color
>[
Colors
.
red
,
Colors
.
black
],
stops:
<
double
>[
0.0
,
0.4
],
),
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
8.0
)),
),
),
),
),
);
expect
(
tester
.
takeException
(),
isNull
);
});
test
(
'ShapeDecoration equality'
,
()
{
test
(
'ShapeDecoration equality'
,
()
{
const
ShapeDecoration
a
=
ShapeDecoration
(
const
ShapeDecoration
a
=
ShapeDecoration
(
color:
Color
(
0xFFFFFFFF
),
color:
Color
(
0xFFFFFFFF
),
...
...
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