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
e0a9ad15
Unverified
Commit
e0a9ad15
authored
Jul 05, 2023
by
Snonky
Committed by
GitHub
Jul 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MergeableMaterial: Fix adding a slice and separating it (#128804)
parent
76bdf463
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
1 deletion
+75
-1
mergeable_material.dart
packages/flutter/lib/src/material/mergeable_material.dart
+6
-1
mergeable_material_test.dart
packages/flutter/test/material/mergeable_material_test.dart
+69
-0
No files found.
packages/flutter/lib/src/material/mergeable_material.dart
View file @
e0a9ad15
...
...
@@ -470,7 +470,12 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
_removeChild
(
j
);
}
while
(
i
<
newChildren
.
length
)
{
_insertChild
(
j
,
newChildren
[
i
]);
final
MergeableMaterialItem
newChild
=
newChildren
[
i
];
_insertChild
(
j
,
newChild
);
if
(
newChild
is
MaterialGap
)
{
_animationTuples
[
newChild
.
key
]!.
controller
.
forward
();
}
i
+=
1
;
j
+=
1
;
...
...
packages/flutter/test/material/mergeable_material_test.dart
View file @
e0a9ad15
...
...
@@ -1088,6 +1088,75 @@ void main() {
matches
(
getBorderRadius
(
tester
,
1
),
RadiusType
.
Round
,
RadiusType
.
Round
);
});
testWidgets
(
'MergeableMaterial insert and separate slice'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Scaffold
(
body:
SingleChildScrollView
(
child:
MergeableMaterial
(
children:
<
MergeableMaterialItem
>[
MaterialSlice
(
key:
ValueKey
<
String
>(
'A'
),
child:
SizedBox
(
width:
100.0
,
height:
100.0
,
),
),
],
),
),
),
),
);
final
RenderBox
box
=
tester
.
renderObject
(
find
.
byType
(
MergeableMaterial
));
expect
(
box
.
size
.
height
,
equals
(
100
));
matches
(
getBorderRadius
(
tester
,
0
),
RadiusType
.
Round
,
RadiusType
.
Round
);
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Scaffold
(
body:
SingleChildScrollView
(
child:
MergeableMaterial
(
children:
<
MergeableMaterialItem
>[
MaterialSlice
(
key:
ValueKey
<
String
>(
'A'
),
child:
SizedBox
(
width:
100.0
,
height:
100.0
,
),
),
MaterialGap
(
key:
ValueKey
<
String
>(
'x'
),
),
MaterialSlice
(
key:
ValueKey
<
String
>(
'B'
),
child:
SizedBox
(
width:
100.0
,
height:
100.0
,
),
),
],
),
),
),
),
);
await
tester
.
pump
(
const
Duration
(
milliseconds:
100
));
expect
(
box
.
size
.
height
,
lessThan
(
216
));
matches
(
getBorderRadius
(
tester
,
0
),
RadiusType
.
Round
,
RadiusType
.
Shifting
);
matches
(
getBorderRadius
(
tester
,
1
),
RadiusType
.
Shifting
,
RadiusType
.
Round
);
await
tester
.
pump
(
const
Duration
(
milliseconds:
100
));
expect
(
box
.
size
.
height
,
equals
(
216
));
matches
(
getBorderRadius
(
tester
,
0
),
RadiusType
.
Round
,
RadiusType
.
Round
);
matches
(
getBorderRadius
(
tester
,
1
),
RadiusType
.
Round
,
RadiusType
.
Round
);
});
bool
isDivider
(
BoxDecoration
decoration
,
bool
top
,
bool
bottom
)
{
const
BorderSide
side
=
BorderSide
(
color:
Color
(
0x1F000000
),
width:
0.5
);
...
...
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