Loading, please wait...

VTU Circulars & Notifications

VTU Exam Circulars & Notifications

VTU Exam Time Table

VTU Academic Calendar

BCGL657A Program 10

10. Develop an application to implement Animates Logo.

Step to Run

  1. Open your Flutter project in VS Code.
  2. Open lib/main.dart.
  3. Delete the existing code.
  4. Paste the program code given below.
  5. Save the file.
  6. Run the program using flutter run cmd

PROGRAM:

import 'package:flutter/material.dart';

void main() {
  runApp(const AnimatedLogoApp());
}

class AnimatedLogoApp extends StatelessWidget {
  const AnimatedLogoApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Lab Program 10',
      debugShowCheckedModeBanner: false,
      home: const AnimatedLogoScreen(),
    );
  }
}

class AnimatedLogoScreen extends StatefulWidget {
  const AnimatedLogoScreen({super.key});

  @override
  State<AnimatedLogoScreen> createState() => _AnimatedLogoScreenState();
}

class _AnimatedLogoScreenState extends State<AnimatedLogoScreen>
    with SingleTickerProviderStateMixin {
  late AnimationController animationController;
  late Animation<double> sizeAnimation;
  late Animation<double> rotationAnimation;

  @override
  void initState() {
    super.initState();

    animationController = AnimationController(
      vsync: this,
      duration: const Duration(seconds: 2),
    )..repeat(reverse: true);

    sizeAnimation = Tween<double>(
      begin: 100,
      end: 180,
    ).animate(animationController);

    rotationAnimation = Tween<double>(
      begin: 0,
      end: 1,
    ).animate(animationController);
  }

  @override
  void dispose() {
    animationController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Program 10: Animated Logo'),
        centerTitle: true,
        backgroundColor: Colors.blue,
        foregroundColor: Colors.white,
      ),
      body: Center(
        child: AnimatedBuilder(
          animation: animationController,
          builder: (context, child) {
            return Transform.rotate(
              angle: rotationAnimation.value * 6.28,
              child: Container(
                width: sizeAnimation.value,
                height: sizeAnimation.value,
                decoration: BoxDecoration(
                  color: Colors.blue,
                  shape: BoxShape.circle,
                  boxShadow: [
                    BoxShadow(
                      color: Colors.blue.withValues(alpha: 0.4),
                      blurRadius: 20,
                      spreadRadius: 5,
                    ),
                  ],
                ),
                child: const Center(
                  child: FlutterLogo(
                    size: 80,
                  ),
                ),
              ),
            );
          },
        ),
      ),
    );
  }
}

OUTPUT:

BCGL657A Program 10
Syllabus Papers
SGPA CGPA