widget_fader

Cross-fades widgets in both directions. Supports:

  • Infinite cross-fading in both directions
  • Swipe to fade
  • Fading via the functions next() and previous()

Example

Installation

Add widget_fader: ^0.1.0 in your pubspec.yaml dependencies. And import it:

import 'package:widget_fader/widget_fader.dart';

How to use

List<Widget> _buildWidgetFaderChildren() {
    var assetPath = "assets/widgetFader";

    return List.generate(
      3, 
      (i) => Container(
        child: Image.asset(
          assetPath + i.toString() + ".jpg",
          fit: BoxFit.cover,
        ),
      )
    );
}

WidgetFader _buildWidgetFader() => WidgetFader(
    children: _buildWidgetFaderChildren(),
    fadeDuration: 750,
    pauseDuration: 750,
    cover: Column(
      children: <Widget>[
        Expanded(child: Container()),
        Container(
          height: 150,
          decoration: BoxDecoration(
            image: DecorationImage(
              image: AssetImage("assets/widgetFaderCover.jpg"),
              fit: BoxFit.cover
            )
          ),
        )
      ],
    ),
);

Future functionality

  • Got any ideas? Make a feature request at the repo or contact me.
  • Rotation
  • Scaling

Libraries

widget_fader