-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e7babe9
commit d14f090
Showing
3 changed files
with
75 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class NoAnimationPage<T> extends Page<T> { | ||
const NoAnimationPage({ | ||
required this.child, | ||
this.maintainState = true, | ||
this.fullscreenDialog = false, | ||
this.allowSnapshotting = true, | ||
super.key, | ||
super.name, | ||
super.arguments, | ||
super.restorationId, | ||
}); | ||
|
||
final Widget child; | ||
final bool maintainState; | ||
final bool fullscreenDialog; | ||
final bool allowSnapshotting; | ||
|
||
@override | ||
Route<T> createRoute(BuildContext context) => _NoAnimationPageRoute<T>( | ||
page: this, allowSnapshotting: allowSnapshotting); | ||
} | ||
|
||
class _NoAnimationPageRoute<T> extends PageRoute<T> { | ||
_NoAnimationPageRoute({ | ||
required NoAnimationPage<T> page, | ||
super.allowSnapshotting, | ||
}) : super(settings: page) { | ||
assert(opaque); | ||
} | ||
|
||
NoAnimationPage<T> get _page => settings as NoAnimationPage<T>; | ||
|
||
@override | ||
bool get maintainState => _page.maintainState; | ||
|
||
@override | ||
bool get fullscreenDialog => _page.fullscreenDialog; | ||
|
||
@override | ||
String get debugLabel => '${super.debugLabel}(${_page.name})'; | ||
|
||
@override | ||
Color? get barrierColor => null; | ||
|
||
@override | ||
String? get barrierLabel => null; | ||
|
||
@override | ||
Widget buildPage(BuildContext context, Animation<double> animation, | ||
Animation<double> secondaryAnimation) => | ||
_page.child; | ||
|
||
@override | ||
Duration get transitionDuration => Duration.zero; | ||
} |