pushReplacementDuration method

dynamic pushReplacementDuration(
  1. BuildContext context,
  2. Widget page, {
  3. Duration duration = const Duration(milliseconds: 300),
})

Implementation

pushReplacementDuration(BuildContext context, Widget page,
    {Duration duration = const Duration(milliseconds: 300)}) {
  try {
    Navigator.of(context).pushReplacement(
      PageRouteBuilder(
        pageBuilder: (_, __, ___) => page,
        transitionDuration: duration,
        transitionsBuilder: (_, animation, __, child) =>
            FadeTransition(opacity: animation, child: child),
      ),
    );
  } catch (e) {}
}