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
d71bbfb4
Unverified
Commit
d71bbfb4
authored
Jul 11, 2023
by
Ian Hickson
Committed by
GitHub
Jul 11, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement preferPaintInterior correctly for _CompoundBorder (#129851)
parent
81d7297d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
1 deletion
+68
-1
borders.dart
packages/flutter/lib/src/painting/borders.dart
+1
-1
border_test.dart
packages/flutter/test/painting/border_test.dart
+67
-0
No files found.
packages/flutter/lib/src/painting/borders.dart
View file @
d71bbfb4
...
...
@@ -840,7 +840,7 @@ class _CompoundBorder extends ShapeBorder {
}
@override
bool
get
preferPaintInterior
=>
true
;
bool
get
preferPaintInterior
=>
borders
.
every
((
ShapeBorder
border
)
=>
border
.
preferPaintInterior
)
;
@override
void
paint
(
Canvas
canvas
,
Rect
rect
,
{
TextDirection
?
textDirection
})
{
...
...
packages/flutter/test/painting/border_test.dart
View file @
d71bbfb4
...
...
@@ -402,4 +402,71 @@ void main() {
await
tester
.
pumpWidget
(
buildWidget
(
border:
allowedBorderDirectionalVariations
,
boxShape:
BoxShape
.
circle
));
expect
(
tester
.
takeException
(),
isNull
);
});
test
(
'Compound borders with differing preferPaintInteriors'
,
()
{
expect
(
ShapeWithInterior
().
preferPaintInterior
,
isTrue
);
expect
(
ShapeWithoutInterior
().
preferPaintInterior
,
isFalse
);
expect
((
ShapeWithInterior
()
+
ShapeWithInterior
()).
preferPaintInterior
,
isTrue
);
expect
((
ShapeWithInterior
()
+
ShapeWithoutInterior
()).
preferPaintInterior
,
isFalse
);
expect
((
ShapeWithoutInterior
()
+
ShapeWithInterior
()).
preferPaintInterior
,
isFalse
);
expect
((
ShapeWithoutInterior
()
+
ShapeWithoutInterior
()).
preferPaintInterior
,
isFalse
);
});
}
class
ShapeWithInterior
extends
ShapeBorder
{
@override
bool
get
preferPaintInterior
=>
true
;
@override
ShapeBorder
scale
(
double
t
)
{
return
this
;
}
@override
EdgeInsetsGeometry
get
dimensions
=>
EdgeInsets
.
zero
;
@override
Path
getInnerPath
(
Rect
rect
,
{
TextDirection
?
textDirection
})
{
return
Path
();
}
@override
Path
getOuterPath
(
Rect
rect
,
{
TextDirection
?
textDirection
})
{
return
Path
();
}
@override
void
paintInterior
(
Canvas
canvas
,
Rect
rect
,
Paint
paint
,
{
TextDirection
?
textDirection
})
{
}
@override
void
paint
(
Canvas
canvas
,
Rect
rect
,
{
TextDirection
?
textDirection
})
{
}
}
class
ShapeWithoutInterior
extends
ShapeBorder
{
@override
bool
get
preferPaintInterior
=>
false
;
@override
ShapeBorder
scale
(
double
t
)
{
return
this
;
}
@override
EdgeInsetsGeometry
get
dimensions
=>
EdgeInsets
.
zero
;
@override
Path
getInnerPath
(
Rect
rect
,
{
TextDirection
?
textDirection
})
{
return
Path
();
}
@override
Path
getOuterPath
(
Rect
rect
,
{
TextDirection
?
textDirection
})
{
return
Path
();
}
@override
void
paintInterior
(
Canvas
canvas
,
Rect
rect
,
Paint
paint
,
{
TextDirection
?
textDirection
})
{
}
@override
void
paint
(
Canvas
canvas
,
Rect
rect
,
{
TextDirection
?
textDirection
})
{
}
}
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