title: how do I animate the opening screen text in flutter?
body: <p>I tried the other StackOverflow answers and in all, that onPressed() is mentioned and the setState() is called in there but I don't know where to call setState() in my app as I don't have any buttons. so does setState() really required here?
  <strong>This is my main class</strong></p>
  <pre><code>class OpeningScreen extends StatefulWidget {
    @override
    _OpeningScreenState createState() =&gt; _OpeningScreenState();
  }
  
  class _OpeningScreenState extends State&lt;OpeningScreen&gt; {
    @override
  
    void initState(){
      super.initState();
      Timer(Duration(seconds: 5), () =&gt; Navigator.of(context)
          .pushAndRemoveUntil(MaterialPageRoute(
          builder: (context) =&gt; home_screen()),
              (Route&lt;dynamic&gt; route) =&gt; false));
    }
    Widget build(BuildContext context) {
      return Scaffold(
        body: Container(
          decoration: openingScreenBgDecoration,
          child: Center(
            child: Column(
              children: [
                textAnimation(welcomeText),
              ],
            ),
          ),
        ),
      );
    }
  }
  </code></pre>
  <p><strong>this is where I declared my animated default text style</strong></p>
  <pre><code>String welcomeText = &quot;Welcome to My App&quot;;
  bool animated = true;
  
  TextStyle openingScreenTextStyle =
      TextStyle(
          color: Colors.black,
          fontSize: 48.0,
          fontWeight: FontWeight.bold,
      );
  
  TextStyle openingScreenTextStyle1 =
  TextStyle(
      color: Colors.black,
      fontSize: 24.0,
      fontWeight: FontWeight.bold,
  );
  
  textAnimation (welcomeText){
      AnimatedDefaultTextStyle(
          child: Text(welcomeText),
          style: animated ? openingScreenTextStyle : openingScreenTextStyle1,
          duration: Duration(milliseconds: 200));
      return textAnimation;
  }
  </code></pre>
  <p>This is the error I got</p>
  <pre><code>══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
  The following _TypeError was thrown building OpeningScreen(dirty, state: _OpeningScreenState#aa235):
  type '(dynamic) =&gt; dynamic' is not a subtype of type 'Widget'
  
  The relevant error-causing widget was:
    OpeningScreen file:///C:/Users/IdeaProjects/i_app/lib/main.dart:5:13
  
  When the exception was thrown, this was the stack:
  #0      _OpeningScreenState.build (package:i_app/ui/neercs_gninepo.dart:29:15)
  #1      StatefulElement.build (package:flutter/src/widgets/framework.dart:4663:28)
  #2      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4546:15)
  #3      StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
  #4      Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
  #5      ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4525:5)
  #6      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4710:11)
  #7      ComponentElement.mount (package:flutter/src/widgets/framework.dart:4520:5)
  ...     Normal element mounting (132 frames)
  #139    Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
  #140    MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5991:32)
  ...     Normal element mounting (267 frames)
  #407    Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
  #408    Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
  #409    RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1174:16)
  #410    RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:1145:5)
  #411    RenderObjectToWidgetAdapter.attachToRenderTree.&lt;anonymous closure&gt; (package:flutter/src/widgets/binding.dart:1087:17)
  #412    BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2620:19)
  #413    RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:1086:13)
  #414    WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:927:7)
  #415    WidgetsBinding.scheduleAttachRootWidget.&lt;anonymous closure&gt; (package:flutter/src/widgets/binding.dart:908:7)
  (elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)
  
  ════════════════════════════════════════════════════════════════════════════════════════════════════
  
  ════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
  The following _TypeError was thrown building OpeningScreen(dirty, state: _OpeningScreenState#aa235):
  type '(dynamic) =&gt; dynamic' is not a subtype of type 'Widget'
  
  The relevant error-causing widget was: 
    OpeningScreen file:///C:/Users/IdeaProjects/i_app/lib/main.dart:5:13
  When the exception was thrown, this was the stack: 
  #0      _OpeningScreenState.build (package:i_app/ui/neercs_gninepo.dart:29:15)
  #1      StatefulElement.build (package:flutter/src/widgets/framework.dart:4663:28)
  #2      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4546:15)
  #3      StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4719:11)
  #4      Element.rebuild (package:flutter/src/widgets/framework.dart:4262:5)
  </code></pre>