Skip to main content

Flutter Development (Day-15):


  • All source code : Click Here.
  • In this post we are going to extend our knowledge by exploring more about animations in Flutter.
  • In the last two posts we  have discussed about basic delay animations by creating a simple Login and SignUp Screens.
  • In this post we are going to talk another two types of animations PARENT,VALUE CHANGED ANIMATION.
  •  Parenting animation  -> In the below example one is the box moving along the x axis, and the same box is resizing.
  • Value Changed Animation -> IN the below example the value is changing between 10 to 1 by including some Animation.

       Demo:


      Explanation

  • Define the animations like

  •  
      void initState() {
          super.initState();
          animationController = AnimationController(
            vsync: this,
            duration: Duration(
              seconds: 4,
            ),
          );
          parentAnimation = Tween<double>(
            begin: -0.50,
            end: 0.0,
          ).animate(
            CurvedAnimation(
              curve: Curves.fastOutSlowIn,
              parent: animationController,
            ),
          );
          // Delayed animation
          childAnimation = Tween<double>(
            begin: 2.0,
            end: 100.0,
          ).animate(
            CurvedAnimation(
              parent: animationController,
              curve: Curves.fastOutSlowIn,
            ),
          );
          counterAnimation = IntTween(begin: 10, end: 0).animate(
            CurvedAnimation(
              parent: animationController,
              curve: Curves.bounceInOut,
            ),
          );
  • Add the value in a Text Widget  

    Text("${counterAnimation.value}",)


  • Transform widget must be of parentAnimation like below that it starts from the left side of the screen.


    Transform(
    transform: Matrix4.translationValues(                  
    parentAnimation.value * width,0.0,0.0,),);
  •  And the Child Animation is given to container height and width that we can resize the container size.                

    Container(
    height: childAnimation.value * 2, 
    width: childAnimation.value * 2,
    );
  • If you are following this tutorial / blog please leave your opinion πŸ‘€ / say Hii βœ‹/ Your e-mail in the comment section that I can improve myself and it will gives boost for me to do more tutorials.
  • If you have any doubts feel free to ask me in the comment section or email me ramubugudi4@gmail.com I can definetly give reply.

Follow me on:
 Twitter  Github   LinkedIn

Comments

  1. Thanks for the coding man! It has helped me a lot to clear all my projects.
    top flutter app development companies

    ReplyDelete
  2. Very good insightful post about Flutter development. Parkav InfoTech company is Flutter app development in tamilnadu with Our experience team develop a flutter app to fulfil customer needs, launched in both android and iPhone platform.

    ReplyDelete

Post a Comment

Popular posts from this blog

Flutter Development (Day-00): This is the First Post from this Blog.This blog will tell you about Flutter.If you don't know about it then the upcoming posts will explain you everything.This is 30 day tutorial which explains about Flutter for absolute beginners. prerequsites:  If you are enthusiastic and Curious. All source code :  Click Here . If you are following this tutorial / blog please leave your opinion πŸ‘€ / say Hii βœ‹/ Your e-mail in the comment section that I can improve myself and it will gives boost for me to do more tutorials. If you have any doubts feel free to ask me in the comment section or email me ramubugudi4@gmail.com I can definetly give reply. Follow me on:   Twitter   Github     LinkedIn
Flutter Development (Day-11): In the last post we have discussed about how to implement brand new Todo application. All source code :  Click Here . Building its User Interface. How to display the data. How to remove the items from the List by tapping the Delete Icon or by Swiping it. Showing which item is deleted in the form of SnackBar. And finally modify some UI stuff. If you want to copy the exact same code  click here . List _todos = []; First of all create a empty list which will be holding all of our Todo's. When we tap on the ADD button we have to perfom some operation see below.   _validateForm() {if (_key.currentState.validate()) {setState(() {_todos.add(_controller.text);});_controller.clear();Navigator.of(context).pop();}} Here we have used setState () in order to refresh every single time of changing the data in the TextField and then we add the text to _todos list. Then we clear the data in the TextField and go back to ho...
Flutter Development (Day-13): In this post we are going to talk about basic animations in Flutter First we start the animation by creating two objects Animation animation, AnimationController animationController. Animation lets us deal with different types of animations like Tween. The tween is something in which you specify the input output range. Here begin is set to -1 and end is 0.0 which means the animation happens from out of the screen to the center of the screen. or rather, from the left most edge to the center of the app. We are also doing an ease in animation, so we specify the curve as fast out slow in. In the initState we provide the animation because the animation should occur when user launches the app.    void initState() {      super.initState();      animationController = AnimationController(        vsync: this,        duration: Duration(       ...