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
018ab3f6
Commit
018ab3f6
authored
Oct 31, 2016
by
Adam Barth
Committed by
GitHub
Oct 31, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Default child lists to empty lists (#6592)
Fixes #6591
parent
07f99987
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
111 additions
and
32 deletions
+111
-32
about.dart
packages/flutter/lib/src/material/about.dart
+1
-1
button_bar.dart
packages/flutter/lib/src/material/button_bar.dart
+1
-1
list.dart
packages/flutter/lib/src/material/list.dart
+1
-1
two_level_list.dart
packages/flutter/lib/src/material/two_level_list.dart
+5
-4
grid.dart
packages/flutter/lib/src/rendering/grid.dart
+4
-0
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+18
-16
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+1
-1
lazy_block.dart
packages/flutter/lib/src/widgets/lazy_block.dart
+1
-1
pageable_list.dart
packages/flutter/lib/src/widgets/pageable_list.dart
+2
-2
scrollable_grid.dart
packages/flutter/lib/src/widgets/scrollable_grid.dart
+10
-2
scrollable_list.dart
packages/flutter/lib/src/widgets/scrollable_list.dart
+2
-2
button_bar_test.dart
packages/flutter/test/material/button_bar_test.dart
+12
-0
list_test.dart
packages/flutter/test/material/list_test.dart
+12
-0
two_level_list_test.dart
packages/flutter/test/material/two_level_list_test.dart
+19
-1
pageable_list_test.dart
packages/flutter/test/widget/pageable_list_test.dart
+4
-0
scrollable_grid_test.dart
packages/flutter/test/widget/scrollable_grid_test.dart
+6
-0
scrollable_list_test.dart
packages/flutter/test/widget/scrollable_list_test.dart
+12
-0
No files found.
packages/flutter/lib/src/material/about.dart
View file @
018ab3f6
...
...
@@ -203,7 +203,7 @@ class AboutDialog extends StatelessWidget {
this
.
applicationVersion
,
this
.
applicationIcon
,
this
.
applicationLegalese
,
this
.
children
this
.
children
,
})
:
super
(
key:
key
);
/// The name of the application.
...
...
packages/flutter/lib/src/material/button_bar.dart
View file @
018ab3f6
...
...
@@ -30,7 +30,7 @@ class ButtonBar extends StatelessWidget {
Key
key
,
this
.
alignment
:
MainAxisAlignment
.
end
,
this
.
mainAxisSize
:
MainAxisSize
.
max
,
this
.
children
this
.
children
:
const
<
Widget
>[],
})
:
super
(
key:
key
);
/// How the children should be placed along the horizontal axis.
...
...
packages/flutter/lib/src/material/list.dart
View file @
018ab3f6
...
...
@@ -68,7 +68,7 @@ class MaterialList extends StatelessWidget {
this
.
onScroll
,
this
.
onScrollEnd
,
this
.
type
:
MaterialListType
.
twoLine
,
this
.
children
,
this
.
children
:
const
<
Widget
>[]
,
this
.
padding
:
EdgeInsets
.
zero
,
this
.
scrollableKey
})
:
super
(
key:
key
);
...
...
packages/flutter/lib/src/material/two_level_list.dart
View file @
018ab3f6
...
...
@@ -3,6 +3,7 @@
// found in the LICENSE file.
import
'package:flutter/widgets.dart'
;
import
'package:meta/meta.dart'
;
import
'colors.dart'
;
import
'icon.dart'
;
...
...
@@ -32,7 +33,7 @@ class TwoLevelListItem extends StatelessWidget {
TwoLevelListItem
({
Key
key
,
this
.
leading
,
this
.
title
,
@required
this
.
title
,
this
.
trailing
,
this
.
enabled
:
true
,
this
.
onTap
,
...
...
@@ -107,10 +108,10 @@ class TwoLevelSublist extends StatefulWidget {
TwoLevelSublist
({
Key
key
,
this
.
leading
,
this
.
title
,
@required
this
.
title
,
this
.
backgroundColor
,
this
.
onOpenChanged
,
this
.
children
this
.
children
:
const
<
Widget
>[],
})
:
super
(
key:
key
);
/// A widget to display before the title.
...
...
@@ -263,7 +264,7 @@ class TwoLevelList extends StatelessWidget {
TwoLevelList
({
Key
key
,
this
.
scrollableKey
,
this
.
children
,
this
.
children
:
const
<
Widget
>[]
,
this
.
type
:
MaterialListType
.
twoLine
,
this
.
padding
})
:
super
(
key:
key
)
{
...
...
packages/flutter/lib/src/rendering/grid.dart
View file @
018ab3f6
...
...
@@ -532,6 +532,10 @@ class RenderGrid extends RenderVirtualViewport<GridParentData> {
/// The delegate that controls the layout of the children.
///
/// For example, a [FixedColumnCountGridDelegate] for grids that have a fixed
/// number of columns or a [MaxTileWidthGridDelegate] for grids that have a
/// maximum tile width.
///
/// If the new delegate is the same as the previous one, this does nothing.
///
/// If the new delegate is the same class as the previous one, then the new
...
...
packages/flutter/lib/src/widgets/basic.dart
View file @
018ab3f6
...
...
@@ -745,8 +745,6 @@ class LayoutId extends ParentDataWidget<CustomMultiChildLayout> {
}
}
const
List
<
Widget
>
_emptyWidgetList
=
const
<
Widget
>[];
/// A widget that defers the layout of multiple children to a delegate.
///
/// The delegate can determine the layout constraints for each child and can
...
...
@@ -767,7 +765,7 @@ class CustomMultiChildLayout extends MultiChildRenderObjectWidget {
CustomMultiChildLayout
({
Key
key
,
@required
this
.
delegate
,
List
<
Widget
>
children:
_emptyWidgetList
List
<
Widget
>
children:
const
<
Widget
>[],
})
:
super
(
key:
key
,
children:
children
)
{
assert
(
delegate
!=
null
);
}
...
...
@@ -1414,7 +1412,7 @@ class BlockBody extends MultiChildRenderObjectWidget {
BlockBody
({
Key
key
,
this
.
mainAxis
:
Axis
.
vertical
,
List
<
Widget
>
children:
_emptyWidgetList
List
<
Widget
>
children:
const
<
Widget
>[],
})
:
super
(
key:
key
,
children:
children
)
{
assert
(
mainAxis
!=
null
);
}
...
...
@@ -1468,7 +1466,7 @@ class Stack extends MultiChildRenderObjectWidget {
Key
key
,
this
.
alignment
:
FractionalOffset
.
topLeft
,
this
.
overflow
:
Overflow
.
clip
,
List
<
Widget
>
children:
_emptyWidgetList
List
<
Widget
>
children:
const
<
Widget
>[],
})
:
super
(
key:
key
,
children:
children
);
/// How to align the non-positioned children in the stack.
...
...
@@ -1514,7 +1512,7 @@ class IndexedStack extends Stack {
Key
key
,
FractionalOffset
alignment:
FractionalOffset
.
topLeft
,
this
.
index
:
0
,
List
<
Widget
>
children:
_emptyWidgetList
List
<
Widget
>
children:
const
<
Widget
>[],
})
:
super
(
key:
key
,
alignment:
alignment
,
children:
children
)
{
assert
(
index
!=
null
);
}
...
...
@@ -1710,8 +1708,8 @@ class Positioned extends ParentDataWidget<Stack> {
abstract
class
GridRenderObjectWidget
extends
MultiChildRenderObjectWidget
{
/// Initializes fields for subclasses.
GridRenderObjectWidget
({
List
<
Widget
>
children:
_emptyWidgetList
,
Key
key
Key
key
,
List
<
Widget
>
children:
const
<
Widget
>[],
})
:
super
(
key:
key
,
children:
children
)
{
_delegate
=
createDelegate
();
}
...
...
@@ -1743,12 +1741,16 @@ class CustomGrid extends GridRenderObjectWidget {
CustomGrid
({
Key
key
,
@required
this
.
delegate
,
List
<
Widget
>
children:
_emptyWidgetList
List
<
Widget
>
children:
const
<
Widget
>[],
})
:
super
(
key:
key
,
children:
children
)
{
assert
(
delegate
!=
null
);
}
/// The delegate that controls the layout of the children.
///
/// For example, a [FixedColumnCountGridDelegate] for grids that have a fixed
/// number of columns or a [MaxTileWidthGridDelegate] for grids that have a
/// maximum tile width.
final
GridDelegate
delegate
;
@override
...
...
@@ -1769,7 +1771,7 @@ class FixedColumnCountGrid extends GridRenderObjectWidget {
this
.
rowSpacing
:
0.0
,
this
.
tileAspectRatio
:
1.0
,
this
.
padding
:
EdgeInsets
.
zero
,
List
<
Widget
>
children:
_emptyWidgetList
List
<
Widget
>
children:
const
<
Widget
>[],
})
:
super
(
key:
key
,
children:
children
)
{
assert
(
columnCount
!=
null
&&
columnCount
>=
0
);
assert
(
tileAspectRatio
!=
null
&&
tileAspectRatio
>
0.0
);
...
...
@@ -1816,7 +1818,7 @@ class MaxTileWidthGrid extends GridRenderObjectWidget {
this
.
rowSpacing
:
0.0
,
this
.
tileAspectRatio
:
1.0
,
this
.
padding
:
EdgeInsets
.
zero
,
List
<
Widget
>
children:
_emptyWidgetList
List
<
Widget
>
children:
const
<
Widget
>[],
})
:
super
(
key:
key
,
children:
children
)
{
assert
(
maxTileWidth
!=
null
&&
maxTileWidth
>=
0.0
);
assert
(
tileAspectRatio
!=
null
&&
tileAspectRatio
>
0.0
);
...
...
@@ -1945,7 +1947,7 @@ class Flex extends MultiChildRenderObjectWidget {
this
.
mainAxisSize
:
MainAxisSize
.
max
,
this
.
crossAxisAlignment
:
CrossAxisAlignment
.
center
,
this
.
textBaseline
,
List
<
Widget
>
children:
_emptyWidgetList
List
<
Widget
>
children:
const
<
Widget
>[],
})
:
super
(
key:
key
,
children:
children
)
{
assert
(
direction
!=
null
);
assert
(
mainAxisAlignment
!=
null
);
...
...
@@ -2047,7 +2049,7 @@ class Row extends Flex {
MainAxisSize
mainAxisSize:
MainAxisSize
.
max
,
CrossAxisAlignment
crossAxisAlignment:
CrossAxisAlignment
.
center
,
TextBaseline
textBaseline
,
List
<
Widget
>
children:
_emptyWidgetList
List
<
Widget
>
children:
const
<
Widget
>[],
})
:
super
(
children:
children
,
key:
key
,
...
...
@@ -2101,7 +2103,7 @@ class Column extends Flex {
MainAxisSize
mainAxisSize:
MainAxisSize
.
max
,
CrossAxisAlignment
crossAxisAlignment:
CrossAxisAlignment
.
center
,
TextBaseline
textBaseline
,
List
<
Widget
>
children:
_emptyWidgetList
List
<
Widget
>
children:
const
<
Widget
>[],
})
:
super
(
children:
children
,
key:
key
,
...
...
@@ -2212,7 +2214,7 @@ class Flow extends MultiChildRenderObjectWidget {
Flow
({
Key
key
,
@required
this
.
delegate
,
List
<
Widget
>
children:
_emptyWidgetList
List
<
Widget
>
children:
const
<
Widget
>[],
})
:
super
(
key:
key
,
children:
RepaintBoundary
.
wrapAll
(
children
))
{
assert
(
delegate
!=
null
);
}
...
...
@@ -2227,7 +2229,7 @@ class Flow extends MultiChildRenderObjectWidget {
Flow
.
unwrapped
({
Key
key
,
this
.
delegate
,
List
<
Widget
>
children:
_emptyWidgetList
List
<
Widget
>
children:
const
<
Widget
>[],
})
:
super
(
key:
key
,
children:
children
)
{
assert
(
delegate
!=
null
);
}
...
...
packages/flutter/lib/src/widgets/framework.dart
View file @
018ab3f6
...
...
@@ -1215,7 +1215,7 @@ abstract class MultiChildRenderObjectWidget extends RenderObjectWidget {
///
/// The [children] argument must not be null and must not contain any null
/// objects.
MultiChildRenderObjectWidget
({
Key
key
,
this
.
children
})
MultiChildRenderObjectWidget
({
Key
key
,
this
.
children
:
const
<
Widget
>[]
})
:
super
(
key:
key
)
{
assert
(
children
!=
null
);
assert
(!
children
.
any
((
Widget
child
)
=>
child
==
null
));
...
...
packages/flutter/lib/src/widgets/lazy_block.dart
View file @
018ab3f6
...
...
@@ -144,7 +144,7 @@ class LazyBlockChildren extends LazyBlockDelegate {
///
/// The list of children must not be modified after being passed to this
/// constructor.
LazyBlockChildren
({
this
.
children
})
{
LazyBlockChildren
({
this
.
children
:
const
<
Widget
>[]
})
{
assert
(
children
!=
null
);
}
...
...
packages/flutter/lib/src/widgets/pageable_list.dart
View file @
018ab3f6
...
...
@@ -122,7 +122,7 @@ class PageableList extends Pageable {
ValueChanged
<
int
>
onPageChanged
,
Duration
duration:
const
Duration
(
milliseconds:
200
),
Curve
curve:
Curves
.
ease
,
this
.
children
this
.
children
:
const
<
Widget
>[],
})
:
super
(
key:
key
,
initialScrollOffset:
initialScrollOffset
,
...
...
@@ -542,7 +542,7 @@ class PageViewport extends _VirtualPageViewport with VirtualViewportFromIterable
Axis
mainAxis:
Axis
.
vertical
,
ViewportAnchor
anchor:
ViewportAnchor
.
start
,
bool
itemsWrap:
false
,
this
.
children
this
.
children
:
const
<
Widget
>[],
})
:
super
(
startOffset
,
mainAxis
,
...
...
packages/flutter/lib/src/widgets/scrollable_grid.dart
View file @
018ab3f6
...
...
@@ -35,7 +35,7 @@ class ScrollableGrid extends StatelessWidget {
this
.
snapOffsetCallback
,
this
.
scrollableKey
,
@required
this
.
delegate
,
this
.
children
this
.
children
:
const
<
Widget
>[],
})
:
super
(
key:
key
)
{
assert
(
delegate
!=
null
);
}
...
...
@@ -75,6 +75,10 @@ class ScrollableGrid extends StatelessWidget {
final
Key
scrollableKey
;
/// The delegate that controls the layout of the children.
///
/// For example, a [FixedColumnCountGridDelegate] for grids that have a fixed
/// number of columns or a [MaxTileWidthGridDelegate] for grids that have a
/// maximum tile width.
final
GridDelegate
delegate
;
/// The children that will be placed in the grid.
...
...
@@ -124,7 +128,7 @@ class GridViewport extends VirtualViewportFromIterable {
this
.
scrollOffset
,
this
.
delegate
,
this
.
onExtentsChanged
,
this
.
children
this
.
children
:
const
<
Widget
>[],
})
{
assert
(
delegate
!=
null
);
}
...
...
@@ -140,6 +144,10 @@ class GridViewport extends VirtualViewportFromIterable {
}
/// The delegate that controls the layout of the children.
///
/// For example, a [FixedColumnCountGridDelegate] for grids that have a fixed
/// number of columns or a [MaxTileWidthGridDelegate] for grids that have a
/// maximum tile width.
final
GridDelegate
delegate
;
/// Called when the interior or exterior dimensions of the viewport change.
...
...
packages/flutter/lib/src/widgets/scrollable_list.dart
View file @
018ab3f6
...
...
@@ -49,7 +49,7 @@ class ScrollableList extends StatelessWidget {
@required
this
.
itemExtent
,
this
.
itemsWrap
:
false
,
this
.
padding
,
this
.
children
this
.
children
:
const
<
Widget
>[],
})
:
super
(
key:
key
)
{
assert
(
scrollDirection
!=
null
);
assert
(
scrollAnchor
!=
null
);
...
...
@@ -389,7 +389,7 @@ class ListViewport extends _VirtualListViewport with VirtualViewportFromIterable
@required
double
itemExtent
,
bool
itemsWrap:
false
,
EdgeInsets
padding
,
this
.
children
this
.
children
:
const
<
Widget
>[],
})
:
super
(
onExtentsChanged
,
scrollOffset
,
...
...
packages/flutter/test/material/button_bar_test.dart
0 → 100644
View file @
018ab3f6
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'ButtonBar default control'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
Center
(
child:
new
ButtonBar
()));
});
}
packages/flutter/test/material/list_test.dart
0 → 100644
View file @
018ab3f6
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'MaterialList default control'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
Center
(
child:
new
MaterialList
()));
});
}
packages/flutter/test/material/two_level_list_test.dart
View file @
018ab3f6
...
...
@@ -7,7 +7,25 @@ import 'package:flutter/widgets.dart';
import
'package:flutter/material.dart'
;
void
main
(
)
{
testWidgets
(
'TwoLeveList basics'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'TwoLevelList default control'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
Center
(
child:
new
TwoLevelList
()));
await
tester
.
pumpWidget
(
new
Material
(
child:
new
Center
(
child:
new
TwoLevelList
(
children:
<
Widget
>[
new
TwoLevelSublist
(
title:
new
Text
(
'Title'
),
)
]
)
)
)
);
});
testWidgets
(
'TwoLevelList basics'
,
(
WidgetTester
tester
)
async
{
final
Key
topKey
=
new
UniqueKey
();
final
Key
sublistKey
=
new
UniqueKey
();
final
Key
bottomKey
=
new
UniqueKey
();
...
...
packages/flutter/test/widget/pageable_list_test.dart
View file @
018ab3f6
...
...
@@ -60,6 +60,10 @@ Future<Null> pageRight(WidgetTester tester) {
}
void
main
(
)
{
testWidgets
(
'PageableList default control'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
Center
(
child:
new
PageableList
()));
});
testWidgets
(
'PageableList with itemsWrap: false'
,
(
WidgetTester
tester
)
async
{
currentPage
=
null
;
await
tester
.
pumpWidget
(
buildFrame
());
...
...
packages/flutter/test/widget/scrollable_grid_test.dart
View file @
018ab3f6
...
...
@@ -7,6 +7,12 @@ import 'package:flutter/widgets.dart';
import
'package:flutter/rendering.dart'
;
void
main
(
)
{
testWidgets
(
'ScrollableGrid default control'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
Center
(
child:
new
ScrollableGrid
(
delegate:
new
FixedColumnCountGridDelegate
(
columnCount:
1
),
)));
});
// Tests https://github.com/flutter/flutter/issues/5522
testWidgets
(
'ScrollableGrid displays correct children with nonzero padding'
,
(
WidgetTester
tester
)
async
{
GlobalKey
<
ScrollableState
>
scrollableKey
=
new
GlobalKey
<
ScrollableState
>();
...
...
packages/flutter/test/widget/scrollable_list_test.dart
0 → 100644
View file @
018ab3f6
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'ScrollableList default control'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
Center
(
child:
new
ScrollableList
(
itemExtent:
100.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