Open ericltw opened 6 years ago
Navigator
為Widget,透過Overlay與Route管理child widgets。
Overlay
為Widget,本質上為Stack,被Navigator所引用。
Route
被Navigator所管理的抽象,Route管理Overlay所呈現的內容與過度的動畫效果。
Navigator引用Overlay
https://github.com/flutter/flutter/blob/stable/packages/flutter/lib/src/widgets/navigator.dart#L2187
Navigator給予Route Overlay的控制權
https://github.com/flutter/flutter/blob/stable/packages/flutter/lib/src/widgets/navigator.dart#L1741
https://github.com/flutter/flutter/blob/stable/packages/flutter/lib/src/widgets/navigator.dart#L1565
Navigator紀錄歷史Route
https://github.com/flutter/flutter/blob/stable/packages/flutter/lib/src/widgets/navigator.dart#L1743
Route
https://github.com/flutter/flutter/blob/stable/packages/flutter/lib/src/widgets/navigator.dart#L2189
Route
https://github.com/flutter/flutter/blob/stable/packages/flutter/lib/src/widgets/routes.dart#L43
類型
被Navigator widget所管理的抽象。
OverlayRoute賦予Route能新增Overlay entry的能力。
帶入入口和出口過渡動畫。
禁止與前一個Route交互的Route,每一ModalRoute新增兩層OverlayEntry於Overlay。
https://github.com/flutter/flutter/blob/stable/packages/flutter/lib/src/widgets/routes.dart#L1259
替換整個screen的ModalRoute。
用平台(iOS / Android)自適應過渡效果,替換整個screen的ModalRoute。
各類Route覆寫class成員情況
MaterialPageRute |
PageRoute |
ModalRoute |
TransitionRoute |
OverlayRoute |
Route |
---|---|---|---|---|---|
RouteSettings settings, bool fullscreenDialog WidgetBuilder builder bool maintainState |
RouteSettings settings, bool fullscreenDialog |
RouteSettings settings | RouteSettings settings | RouteSettings settings | RouteSettings settings |
NavigatorState get navigator | |||||
List |
List |
||||
void install(OverlayEntry insertionPoint) | void install(OverlayEntry insertionPoint) | void install(OverlayEntry insertionPoint) | void install(OverlayEntry insertionPoint) | ||
TickerFuture didPush() | TickerFuture didPush() | TickerFuture didPush() | |||
void didReplace(Route |
void didReplace(Route |
||||
Future |
Future |
||||
bool get willHandlePopInternally | |||||
T get currentResult | |||||
Future |
|||||
bool didPop(T result) | bool didPop(T result) | bool didPop(T result) | |||
void didComplete(T result) | |||||
void didPopNext(Route |
void didPopNext(Route |
||||
void didChangeNext(Route |
void didChangeNext(Route |
||||
void didChangePrevious(Route |
void didChangePrevious(Route |
||||
void changedInternalState() | void changedInternalState() | ||||
void changedExternalState() | void changedExternalState() | ||||
void dispose() | void dispose() | void dispose() | void dispose() | ||
bool get isCurrent | |||||
bool get isFirst | |||||
bool get isActive | |||||
Iterable |
Iterable |
||||
bool get finishedWhenPopped | bool get finishedWhenPopped | ||||
Future |
|||||
Duration get transitionDuration | Duration get transitionDuration; | ||||
bool get opaque | bool get opaque; | ||||
Animation |
Animation |
||||
AnimationController get controller | |||||
Animation |
Animation |
||||
AnimationController createAnimationController() | AnimationController createAnimationController( | ||||
Animation |
|||||
T _result | |||||
void _handleStatusChanged(AnimationStatus status) | |||||
void _updateSecondaryAnimation(Route |
|||||
bool canTransitionTo(TransitionRoute |
bool canTransitionTo(TransitionRoute |
bool canTransitionTo(TransitionRoute |
|||
bool canTransitionFrom(TransitionRoute |
bool canTransitionFrom(TransitionRoute |
bool canTransitionFrom(TransitionRoute |
|||
String get debugLabel | String get debugLabel | ||||
String toString() | String toString() | ||||
Widget buildPage( BuildContext context, Animation |
Widget buildPage(BuildContext context, Animation |
||||
Widget buildTransitions(BuildContext context, Animation |
Widget buildTransitions( BuildContext context, Animation |
||||
final FocusScopeNode focusScopeNode | |||||
bool get barrierDismissible | bool get barrierDismissible | ||||
bool get semanticsDismissible | |||||
Color get barrierColor | Color get barrierColor | ||||
String get barrierLabel | String get barrierLabel | ||||
bool get maintainState | |||||
bool get offstage | |||||
BuildContext get subtreeContext | |||||
void addScopedWillPopCallback(WillPopCallback callback) | |||||
void removeScopedWillPopCallback(WillPopCallback callback) | |||||
bool get hasScopedWillPopCallback | |||||
bool get canPop | |||||
OverlayEntry _modalBarrier; | |||||
Widget _buildModalBarrier(BuildContext context) | |||||
Widget _modalScopeCache; | |||||
Widget _buildModalScope(BuildContext context) | |||||
Widget _defaultTransitionsBuilder(BuildContext context, Animation |
https://medium.com/@kpbird/flutter-introduction-of-routing-and-navigation-49738dbd6abe