title: Resizing parent widget to fit child post 'Transform' in Flutter
body: <p>I'm using <code>Transforms</code> in Flutter to create a scrolling carousel for selecting from various options.</p>
  
  <p>This uses standard elements such as <code>ListView.builder</code>, which all works fine, aside from the fact that the parent widget of the Transform doesn't scale down to fit the content as seen here:</p>
  
  <p><img src="https://i.stack.imgur.com/YSwI8.png" alt="notice the gaps around the perspective transforms">
  Here's the code used to generate the 'card' (there was actually a Card in there, but I've stripped it out in an attempt to get everything to scale correctly):</p>
  
  <pre><code>    return Align(
        child: Transform(
          alignment: Alignment.center,
          transform: mat,
          child: Container(
            height: 220,
            color: color,
            width: MediaQuery.of(context).size.width * 0.7,
            child: Text(
              offset.toString(),
              style: TextStyle(color: Colors.white, fontSize: 12.0),
            ),
          ),
        ),
      );
    }
  </code></pre>
  
  <p>Even if I remove the 'height' parameter of the Container (so everything scales to fit the 'Text' widget), the boxes containing the <code>Transform</code> widgets still have the gaps around them.</p>
  
  <p>Flutter doesn't seem to have any documentation to show how to re-scale the parent if the object within is transformed - anyone here knows or has any idea of a workaround?</p>
  
  <p><strong>EDIT:</strong> The widget returned from this is used within a <code>build</code> widget in a Stateful widget. The stack is Column > Container > ListView.builder.</p>
  
  <p>If I remove the Transform, the Containers fit together as I'd like - it seems that performing a perspective transform on the Container 'shrinks' it's content (in this case, the color - check the linked screen grab), but doesn't re-scale the Container itself, which is what I'm trying to achieve.</p>