Tkko / Flutter_dismissible_page

Flutter page widget that is dismissed by swipe gestures, with Hero style animations, Inspired by Facebook and Instagram stories.
https://pub.dev/packages/dismissible_page
MIT License
151 stars 39 forks source link

Usage with AutoRoute? #22

Closed simplenotezy closed 1 year ago

simplenotezy commented 1 year ago

Thanks for a super sweet package - well done!

I was wondering if you could provide an example of how it would be possible to push using AutoRoute?

It works, partly, without using AutoRoute, however, I have a listener on AppRouter in my application, and that is not getting triggered when using Navigator

simplenotezy commented 1 year ago
CustomRoute(
  page: SomeScreen,
  customRouteBuilder: dismissablePageRouteBuilder,
);

import 'package:dismissible_page/dismissible_page.dart';

Route<T> dismissablePageRouteBuilder<T>(
  BuildContext context,
  Widget child,
  CustomPage<T> page,
) {
  return TransparentRoute<T>(
    builder: (_) => child,
    backgroundColor: Colors.transparent,
    transitionDuration: Duration(milliseconds: 250),
    reverseTransitionDuration: Duration(milliseconds: 250),
    settings: page,
  );
}