pushDuration method

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

Implementation

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