0 purchases
pop scope aware cupertino route
PopScopeAwareCupertinoRoute #
Note: This package can be used on any platform, and is not specific to iOS.
PopScopeAwareCupertinoRouteTransition #
The key to this package is a modified version of
Flutter's CupertinoPageRoute,
and Cupertino Will Pop Scope which has been
enhanced with the following:
Visual feedback when users attempt to "swipe to go back" - the screen is allowed to be dragged a bit before it is
snapped back to place.
If an enclosing route popDisposition is set to doNotPop, the routes onPopInvoked callback is triggered
A working app using this package can be found in the example folder.
Usage #
To use this package, add pop_scope_aware_cupertino_route as
a dependency in your pubspec.yaml file.
Example #
Import the library #
// main.dart
import 'package:pop_scope_aware_cupertino_route/pop_scope_aware_cupertino_route.dart';
copied to clipboard
Configure page transitions #
Set the transition builder of the desired platform to PopScopeAwareCupertinoPageTransitionBuilder in your theme
configuration.
// material_app.dart
final theme = ThemeData(
pageTransitionsTheme: const PageTransitionsTheme(
builders: {
TargetPlatform.android: ZoomPageTransitionsBuilder(),
TargetPlatform.iOS: PopScopeAwareCupertinoPageTransitionBuilder(),
},
),
);
copied to clipboard
Make sure the theme is applied to the app.
// material_app.dart
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: theme,
home: const HomeScreen(),
);
}
copied to clipboard
Using PopScope:
// my_screen.dart
@override
Widget build(BuildContext context) {
return PopScope(
canPop: false,
onPopInvoked: (canPop) {
print(canPop);
},
child: Container(),
);
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.