sampleFlipAnimation function

void sampleFlipAnimation(
  1. BuildContext context, {
  2. Widget? initialChild,
  3. Widget? flippedChild,
  4. Duration? duration,
  5. FlipDirection direction = FlipDirection.VERTICAL,
})

Implementation

void sampleFlipAnimation(BuildContext context, {Widget? initialChild, Widget? flippedChild, Duration? duration, FlipDirection direction: FlipDirection.VERTICAL}){
  final animation = NUIFlipAnimation(
      initialChild: initialChild ?? Container(
        color: Colors.blueAccent,
        width: 300,
        height: 200,
        child: Icon(
          Icons.ac_unit,
          color: Colors.white,
          size: 50,
        ),
      ),
    flippedChild: flippedChild ?? Container(
      color: Colors.red,
      width: 300,
      height: 200,
      child: Icon(
        Icons.ac_unit,
        color: Colors.white,
        size: 50,
      ),
    ),
    duration: duration ?? Duration(seconds: 2),
    direction: direction ?? FlipDirection.VERTICAL,
  );

  showDialog(
    context: context,
    builder: (context){
        return Container(
          width: double.infinity,
          height: double.infinity,
          alignment: Alignment.center,
          child: animation,
        );
    }
  );
}