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
6b4f0d57
Unverified
Commit
6b4f0d57
authored
Jan 03, 2024
by
David Iglesias
Committed by
GitHub
Jan 03, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter] Allow ViewCollection to start empty. (#140532)
This enables multi-view apps to start with zero views.
parent
3ac2dba5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
7 deletions
+5
-7
view.dart
packages/flutter/lib/src/widgets/view.dart
+1
-3
tree_shape_test.dart
packages/flutter/test/widgets/tree_shape_test.dart
+2
-2
view_test.dart
packages/flutter/test/widgets/view_test.dart
+2
-2
No files found.
packages/flutter/lib/src/widgets/view.dart
View file @
6b4f0d57
...
...
@@ -475,9 +475,7 @@ class _MultiChildComponentWidget extends Widget {
/// * [WidgetsBinding] for an explanation of rendering and non-rendering zones.
class
ViewCollection
extends
_MultiChildComponentWidget
{
/// Creates a [ViewCollection] widget.
///
/// The provided list of [views] must contain at least one widget.
const
ViewCollection
({
super
.
key
,
required
super
.
views
})
:
assert
(
views
.
length
>
0
);
const
ViewCollection
({
super
.
key
,
required
super
.
views
});
/// The [View] descendants of this widget.
///
...
...
packages/flutter/test/widgets/tree_shape_test.dart
View file @
6b4f0d57
...
...
@@ -293,8 +293,8 @@ void main() {
testWidgets
(
'ViewCollection cannot have render object widgets as children'
,
(
WidgetTester
tester
)
async
{
await
pumpWidgetWithoutViewWrapper
(
tester:
tester
,
widget:
ViewCollection
(
views:
const
<
Widget
>[
widget:
const
ViewCollection
(
views:
<
Widget
>[
ColoredBox
(
color:
Colors
.
red
),
],
),
...
...
packages/flutter/test/widgets/view_test.dart
View file @
6b4f0d57
...
...
@@ -140,8 +140,8 @@ void main() {
);
});
testWidgets
(
'ViewCollection m
ust have one view
'
,
(
WidgetTester
tester
)
async
{
expect
(()
=>
ViewCollection
(
views:
const
<
Widget
>[]),
throwsAssertionError
);
testWidgets
(
'ViewCollection m
ay start with zero views
'
,
(
WidgetTester
tester
)
async
{
expect
(()
=>
const
ViewCollection
(
views:
<
Widget
>[]),
returnsNormally
);
});
testWidgets
(
'ViewAnchor.child does not see surrounding view'
,
(
WidgetTester
tester
)
async
{
...
...
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