Show loading while image is loading in flutter

This Article is posted by seven.srikanth at 10/2/2021 11:48:25 AM



<p>Here is an example of how to show loading while an image is loading in flutter.</p> <p>For this, you need to add your loading icon into pubspec.yaml file.</p> <p>And then use the FadeInImage widget.</p> <p>Here is the full code from main.dart file.</p> <p id="4ec9b0;](MyApp());" color:="">color: #9cdcfe;](args) </p> <p>color: #569cd6;](class color: #4ec9b0;](MyApp color: #569cd6;](extends color: #4ec9b0;](StatelessWidget { color: #9cdcfe;](@ color: #9cdcfe;](override</p> <p>color: #4ec9b0;](Widget color: #dcdcaa;](build(color: #4ec9b0;](BuildContext color: #9cdcfe;](context) { color: #c586c0;](return color: #4ec9b0;](MaterialApp( color: #9cdcfe;](home: color: #4ec9b0;](Scaffold(color: #9cdcfe;](body: color: #4ec9b0;](MyHomePage()), ); } }</p> <p>color: #569cd6;](class color: #4ec9b0;](MyHomePage color: #569cd6;](extends color: #4ec9b0;](StatelessWidget { color: #9cdcfe;](@ color: #9cdcfe;](override</p> <p>color: #4ec9b0;](Widget color: #dcdcaa;](build(color: #4ec9b0;](BuildContext color: #9cdcfe;](context) { color: #c586c0;](return color: #4ec9b0;](Center( color: #9cdcfe;](child: color: #4ec9b0;](Padding( color: #9cdcfe;](padding: color: #569cd6;](const color: #4ec9b0;](EdgeInsets.color: #4ec9b0;](all(color: #b5cea8;](38.0), color: #9cdcfe;](child: color: #4ec9b0;](FadeInImage( color: #9cdcfe;](image: color: #4ec9b0;](NetworkImage( color: #ce9178;]('https://flutter.dev/assets/images/shared/brand/flutter/logo/flutter-lockup.png'), color: #9cdcfe;](placeholder: color: #4ec9b0;](AssetImage(color: #ce9178;]('assets/spinner2.gif'), ), ), ); } } ` Thanks,Srikanth</p>


Tags: How to show loading while image is loading;








0 Comments
Login to comment.
Recent Comments