Flutter Animation : AnimatedSize

mobile academy

import 'dart:math';

import 'package:flutter/material.dart';

class SizeAnimation extends StatefulWidget {
  const SizeAnimation({Key? key}) : super(key: key);

  @override
  State<SizeAnimation> createState() => _SizeAnimationState();
}

class _SizeAnimationState extends State<SizeAnimation> {
  double _size = 50;
  final Random _random = Random();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: Center(
        child: Column(
          children: [
            const SizedBox(height: 50,),
            AnimatedSize(
              duration: const Duration(milliseconds: 800),
              curve: Curves.bounceOut,
              child: Image.asset(
                'assets/user1.jpg',
                width: _size,
                height: _size,
              ),
            ),

            const SizedBox(
              height: 8,
            ),

            ElevatedButton(
              onPressed: () {
                setState(() {
                  _size = _random.nextDouble() * 300;                 
                });

              }, 
              child: const Text('Click Me!'),
            )

          ],
        ),
      ),
    );
  }
}
Select your currency
INR Indian rupee