title: How to animate image size inside a flutter container without changing the container height and width
body: <p>I am trying to apply the animation to the image size which is inside a flutter AnimatedContainer widget without changing the container height and width.</p>
  <p>But, in the below code I am able to achieve this by changing the height and width of the container. Whereas I want the container height and width should be fixed and the animation should be only applied to the image size.</p>
  <p>Is there a way to achieve this with fixed container height and width?</p>
  <pre><code>import 'package:flutter/material.dart';
  
  class ScaleAnimation extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(title: Text(&quot;Scale Animation&quot;)),
        body: ImageAnimation(),
      );
    }
  }
  
  class ImageAnimation extends StatefulWidget {
    @override
    _ImageAnimationState createState() =&gt; _ImageAnimationState();
  }
  
  class _ImageAnimationState extends State&lt;ImageAnimation&gt; {
    bool isTapped = false;
    @override
    Widget build(BuildContext context) {
      return Center(
        child: GestureDetector(
          onTap: () {
            setState(() {
              isTapped = !isTapped;
            });
          },
          child: AnimatedContainer(
            height: isTapped ? 350.0 : 300.0,
            width: isTapped ? 350 : 300.0,
            alignment:
                isTapped ? Alignment.center : AlignmentDirectional.topCenter,
            duration: Duration(seconds: 2),
            curve: Curves.fastOutSlowIn,
            margin: EdgeInsets.fromLTRB(50.0, 100.0, 50.0, 100.0),
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(10),
              boxShadow: [
                BoxShadow(
                  color: Colors.black54,
                  blurRadius: 100.0, // soften the shadow
                )
              ],
              image: DecorationImage(
                  image: NetworkImage(
                      'https://dictionary.cambridge.org/images/thumb/cup_noun_002_09489.jpg'),
                  fit: BoxFit.cover),
            ),
          ),
        ),
      );
    }
  }
  
  </code></pre>