We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Steps to reproduce:
It also does not work when you replace VWidgetGuard with WillPopScope.
VWidgetGuard
WillPopScope
Versions:
import 'package:flutter/material.dart'; import 'package:vrouter/vrouter.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return VRouter( initialUrl: "/", routes: [ VWidget( path: "/", widget: const Page( name: "/", color: Colors.red, routeTo: ["/home"], ), stackedRoutes: [ VWidget.builder( path: "home", buildTransition: (animation, _, child) { return SlideTransition( position: Tween<Offset>( begin: const Offset(0.0, 1.0), end: Offset.zero, ).animate(animation), child: child, ); }, builder: (context, data) { return VWidgetGuard( beforeLeave: (_, __) async { // The exit transition works when you just return. //return; // Exit transition does not work. await showDialog<bool>( context: context, builder: (context) { return AlertDialog( title: const Text('AlertDialog Title'), content: SingleChildScrollView( child: ListBody( children: const <Widget>[ Text('This is a demo alert dialog.'), Text( 'Would you like to approve of this message?', ), ], ), ), actions: <Widget>[ TextButton( child: const Text('Approve'), onPressed: () { Navigator.of(context).pop(); }, ), ], ); }, ); }, child: const Page( name: "/home", color: Colors.blue, routeTo: ["/"], ), ); }, ), ], ), ], ); } } class Page extends StatelessWidget { final String name; final List<String> routeTo; final Color color; const Page({ required this.name, this.routeTo = const [], required this.color, Key? key, }) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( body: Container( color: color, alignment: Alignment.center, child: Column( children: [ Text( name, style: const TextStyle(fontSize: 100), ), ...routeTo.map((e) { return ElevatedButton( onPressed: () => context.vRouter.to(e), child: Text("to $e"), ); }) ], ), ), ); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Steps to reproduce:
It also does not work when you replace
VWidgetGuard
withWillPopScope
.Versions:
Code
The text was updated successfully, but these errors were encountered: