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
f9331e2c
Unverified
Commit
f9331e2c
authored
Aug 16, 2022
by
Mahesh Jamdade
Committed by
GitHub
Aug 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass fit property to RenderIndexedStack (#109295)
parent
f4a64ef0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
0 deletions
+67
-0
stack.dart
packages/flutter/lib/src/rendering/stack.dart
+2
-0
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+5
-0
stack_test.dart
packages/flutter/test/widgets/stack_test.dart
+60
-0
No files found.
packages/flutter/lib/src/rendering/stack.dart
View file @
f9331e2c
...
...
@@ -714,6 +714,8 @@ class RenderIndexedStack extends RenderStack {
super
.
children
,
super
.
alignment
,
super
.
textDirection
,
super
.
fit
,
super
.
clipBehavior
,
int
?
index
=
0
,
})
:
_index
=
index
;
...
...
packages/flutter/lib/src/widgets/basic.dart
View file @
f9331e2c
...
...
@@ -3943,6 +3943,7 @@ class IndexedStack extends Stack {
super
.
key
,
super
.
alignment
,
super
.
textDirection
,
super
.
clipBehavior
,
StackFit
sizing
=
StackFit
.
loose
,
this
.
index
=
0
,
super
.
children
,
...
...
@@ -3956,6 +3957,8 @@ class IndexedStack extends Stack {
assert
(
_debugCheckHasDirectionality
(
context
));
return
RenderIndexedStack
(
index:
index
,
fit:
fit
,
clipBehavior:
clipBehavior
,
alignment:
alignment
,
textDirection:
textDirection
??
Directionality
.
maybeOf
(
context
),
);
...
...
@@ -3966,6 +3969,8 @@ class IndexedStack extends Stack {
assert
(
_debugCheckHasDirectionality
(
context
));
renderObject
..
index
=
index
..
fit
=
fit
..
clipBehavior
=
clipBehavior
..
alignment
=
alignment
..
textDirection
=
textDirection
??
Directionality
.
maybeOf
(
context
);
}
...
...
packages/flutter/test/widgets/stack_test.dart
View file @
f9331e2c
...
...
@@ -799,4 +799,64 @@ void main() {
"'alignment', or an explicit 'textDirection', to the Stack."
,
);
});
testWidgets
(
'Can update clipBehavior of IndexedStack'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
IndexedStack
(
textDirection:
TextDirection
.
ltr
));
final
RenderIndexedStack
renderObject
=
tester
.
renderObject
<
RenderIndexedStack
>(
find
.
byType
(
IndexedStack
));
expect
(
renderObject
.
clipBehavior
,
equals
(
Clip
.
hardEdge
));
// Update clipBehavior to Clip.antiAlias
await
tester
.
pumpWidget
(
IndexedStack
(
textDirection:
TextDirection
.
ltr
,
clipBehavior:
Clip
.
antiAlias
,
));
final
RenderIndexedStack
renderIndexedObject
=
tester
.
renderObject
<
RenderIndexedStack
>(
find
.
byType
(
IndexedStack
));
expect
(
renderIndexedObject
.
clipBehavior
,
equals
(
Clip
.
antiAlias
));
});
testWidgets
(
'IndexedStack sizing: explicit'
,
(
WidgetTester
tester
)
async
{
final
List
<
String
>
logs
=
<
String
>[];
Widget
buildIndexedStack
(
StackFit
sizing
)
{
return
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Center
(
child:
ConstrainedBox
(
constraints:
const
BoxConstraints
(
minWidth:
2.0
,
maxWidth:
3.0
,
minHeight:
5.0
,
maxHeight:
7.0
,
),
child:
IndexedStack
(
sizing:
sizing
,
children:
<
Widget
>[
LayoutBuilder
(
builder:
(
BuildContext
context
,
BoxConstraints
constraints
)
{
logs
.
add
(
constraints
.
toString
());
return
const
Placeholder
();
},
),
],
),
),
),
);
}
await
tester
.
pumpWidget
(
buildIndexedStack
(
StackFit
.
loose
));
logs
.
add
(
'=1='
);
await
tester
.
pumpWidget
(
buildIndexedStack
(
StackFit
.
expand
));
logs
.
add
(
'=2='
);
await
tester
.
pumpWidget
(
buildIndexedStack
(
StackFit
.
passthrough
));
expect
(
logs
,
<
String
>[
'BoxConstraints(0.0<=w<=3.0, 0.0<=h<=7.0)'
,
'=1='
,
'BoxConstraints(w=3.0, h=7.0)'
,
'=2='
,
'BoxConstraints(2.0<=w<=3.0, 5.0<=h<=7.0)'
,
]);
});
}
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