Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
81 lines (72 sloc) 2.53 KB
import 'package:flutter/material.dart';
import 'package:flutter/painting.dart' as painting;
import 'package:flutter_widget_guide/utils.dart';
import 'package:transparent_image/transparent_image.dart';
import '../Code.dart';
import '../CodeScreen.dart';
class FadeInImageWidget extends StatefulWidget {
_FadeInImageWidgetState createState() => _FadeInImageWidgetState();
class _FadeInImageWidgetState extends State<FadeInImageWidget> {
String _url =
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text(
'FadeInImage Widget',
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold,
fontFamily: Utils.ubuntuRegularFont),
actions: <Widget>[
icon: Icon(Icons.code),
onPressed: () => Navigator.push(
builder: (context) =>
CodeScreen(code: Code.fadeInImageCode),
///Will pop scope is used to detect if the user pressed back button
body: WillPopScope(
child: Stack(children: <Widget>[
///We can choose to show an indicator as well to let user know that
///something is being loaded
child: CircularProgressIndicator(
///this is to specify the color of the CircularProgressIndicator
valueColor: AlwaysStoppedAnimation<Color>(,
child: Container(
child: FadeInImage.memoryNetwork(
///Specifying dimensions of the image before and after
height: 350,
width: 350,
///we are using the transparent_image package
///to show a transparent image as a placeholder.
placeholder: kTransparentImage,
image: _url),
onWillPop: () {
///clear image cache and exit screen
///this is done so that the image loads every time you open the
///screen. (it is cached otherwise)
You can’t perform that action at this time.