Commit 51cd8b67 authored by Dragoș Tiselice's avatar Dragoș Tiselice Committed by GitHub

Added a stretch Positioned constructor. (#5894)

Fixes #5835.
parent 573eaf0b
...@@ -363,11 +363,7 @@ class CardCollectionState extends State<CardCollection> { ...@@ -363,11 +363,7 @@ class CardCollectionState extends State<CardCollection> {
// size of the background,card Stack will be based only on the card. The // size of the background,card Stack will be based only on the card. The
// Viewport ensures that when the card's resize animation occurs, the // Viewport ensures that when the card's resize animation occurs, the
// background (text and icons) will just be clipped, not resized. // background (text and icons) will just be clipped, not resized.
Widget background = new Positioned( Widget background = new Positioned.stretch(
top: 0.0,
right: 0.0,
bottom: 0.0,
left: 0.0,
child: new Container( child: new Container(
margin: const EdgeInsets.all(4.0), margin: const EdgeInsets.all(4.0),
child: new Viewport( child: new Viewport(
......
...@@ -61,11 +61,7 @@ class TravelDestinationItem extends StatelessWidget { ...@@ -61,11 +61,7 @@ class TravelDestinationItem extends StatelessWidget {
height: 184.0, height: 184.0,
child: new Stack( child: new Stack(
children: <Widget>[ children: <Widget>[
new Positioned( new Positioned.stretch(
left: 0.0,
top: 0.0,
bottom: 0.0,
right: 0.0,
child: new Image.asset( child: new Image.asset(
destination.assetName, destination.assetName,
fit: ImageFit.cover fit: ImageFit.cover
......
...@@ -38,11 +38,7 @@ class GridTile extends StatelessWidget { ...@@ -38,11 +38,7 @@ class GridTile extends StatelessWidget {
return child; return child;
final List<Widget> children = <Widget>[ final List<Widget> children = <Widget>[
new Positioned( new Positioned.stretch(
top: 0.0,
left: 0.0,
bottom: 0.0,
right: 0.0,
child: child child: child
) )
]; ];
......
...@@ -265,11 +265,7 @@ class _TooltipOverlay extends StatelessWidget { ...@@ -265,11 +265,7 @@ class _TooltipOverlay extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Positioned( return new Positioned.stretch(
top: 0.0,
left: 0.0,
right: 0.0,
bottom: 0.0,
child: new IgnorePointer( child: new IgnorePointer(
child: new CustomSingleChildLayout( child: new CustomSingleChildLayout(
delegate: new _TooltipPositionDelegate( delegate: new _TooltipPositionDelegate(
......
...@@ -1517,6 +1517,19 @@ class Positioned extends ParentDataWidget<Stack> { ...@@ -1517,6 +1517,19 @@ class Positioned extends ParentDataWidget<Stack> {
bottom = null, bottom = null,
super(key: key, child: child); super(key: key, child: child);
/// Creates a Positioned object with [left], [top], [right], and [bottom] set
/// to 0.0 unless a value for them is passed.
Positioned.stretch({
Key key,
Widget child,
this.left: 0.0,
this.top: 0.0,
this.right: 0.0,
this.bottom: 0.0
}) : width = null,
height = null,
super(key: key, child: child);
/// The distance that the child's left edge is inset from the left of the stack. /// The distance that the child's left edge is inset from the left of the stack.
/// ///
/// Only two out of the three horizontal values ([left], [right], [width]) can be /// Only two out of the three horizontal values ([left], [right], [width]) can be
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment