1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315
#![allow(unused_imports)]
use std::{future::Future, time::Duration};
use crate::{
prelude::Color,
ui::{ImageFilter, VoidCallback},
widgets::{
BuildContext, NavigatorState, NoneWidget, Route, RoutePopDisposition, TickerFuture, Widget,
WidgetBuilder,
},
};
// Route<T> -> OverlayRoute<T> -> TransitionRoute<T> -> ModalRoute<T> -> PageRoute<T>
pub struct MaterialPageRoute {
// The animation that drives the route's transition and the previous route's forward transition.
// pub animation: Option<Animation<f32>>,
// The color to use for the modal barrier. If this is null, the barrier will be transparent.
pub barrier_color: Option<Color>,
// The curve that is used for animating the modal barrier in and out.
// pub barrier_curve: Curve,
// Whether you can dismiss this route by tapping the modal barrier.
pub barrier_dismissible: bool,
// The semantic label used for a dismissible barrier.
pub barrier_label: Option<String>,
// Builds the primary contents of the route.
pub builder: WidgetBuilder,
// Whether this route can be popped.
pub can_pop: bool,
// This future completes only once the transition itself has finished,
// after the overlay entries have been removed from the navigator's overlay.
// pub completed: Future<Option<T>>,
// The animation controller that the route uses to drive the transitions.
// pub controller: Option<AnimationController>,
// When this route is popped (see Navigator.pop) if the result isn't specified or if it's null, this value will be used instead.
// pub current_result: Option<T>,
// A short description of this route useful for debugging.
pub debug_label: String,
// The filter to add to the barrier.
pub filter: Option<ImageFilter>,
// Controls whether didPop calls NavigatorState.finalizeRoute.
pub finished_when_popped: bool,
// Whether this page route is a full-screen dialog.
pub fullscreen_dialog: bool,
// Whether there is at least one active route underneath this route.
pub has_active_route_below: bool,
// True if one or more WillPopCallback callbacks exist.
pub has_scoped_will_pop_callback: bool,
// Whether this route is on the navigator.
pub is_active: bool,
// Whether this route is the top-most route on the navigator.
pub is_current: bool,
// Whether this route is the bottom-most active route on the navigator.
pub is_first: bool,
// Whether the route should remain in memory when it is inactive.
pub maintain_state: bool,
// The navigator that the route is in, if any.
pub navigator: Option<NavigatorState>,
// Whether this route is currently offstage.
pub offstage: bool,
// Whether the route obscures previous routes when the transition is complete.
pub opaque: bool,
// The overlay entries of this route.
// pub overlay_entries: Vec<OverlayEntry>,
// A future that completes when this route is popped off the navigator.
// pub popped: Future<Option<T>>,
// The restoration scope ID to be used for the RestorationScope surrounding this route.
// pub restoration_scope_id: ValueListenable<Option<String>>,
// The duration the transition going in reverse.
pub reverse_transition_duration: Duration,
// The animation for the route being pushed on top of this route.
// This animation lets this route coordinate with the entrance and exit
// transition of route pushed on top of this route.
// pub secondary_animation: Option<Animation<f32>>,
// Whether the semantics of the modal barrier are included in the semantics tree.
pub semantics_dismissible: bool,
// // The settings for this route.
// pub settings: RouteSettings,
// The build context for the subtree containing the primary content of this route.
pub subtree_context: Option<BuildContext>,
// The duration the transition going forwards.
pub transition_duration: Duration,
// Whether to takeover the controller created by createAnimationController.
pub will_dispose_animation_controller: bool,
// Whether calling didPop would return false.
pub will_handle_pop_internally: bool,
}
impl MaterialPageRoute {
// Adds a local history entry to this route.
// pub fn add_local_history_entry(&self, entry: LocalHistoryEntry) {
// todo!()
// }
// Enables this route to veto attempts by the user to dismiss it.
// pub fn add_scoped_will_pop_callback(&self, callback: WillPopCallback) {
// todo!()
// }
// Builds the primary contents of the route.
pub fn build_content(&self, context: BuildContext) -> Box<dyn Widget> {
todo!()
}
// Override this method to build the primary content of this route.
// pub fn build_page(
// &self,
// context: BuildContext,
// animation: Animation<f32>,
// secondaryAnimation: Animation<f32>,
// ) -> Box<dyn Widget> {
// todo!()
// }
// Override this method to wrap the child with one or more transition widgets that
// define how the route arrives on and leaves the screen.
// pub fn build_transitions(
// &self,
// context: BuildContext,
// animation: Animation<f32>,
// secondaryAnimation: Animation<f32>,
// child: Box<dyn Widget>,
// ) -> Box<dyn Widget> {
// todo!()
// }
// Returns true if previousRoute should animate when this route is pushed on top of it
// or when then this route is popped off of it.
// pub fn can_transition_from(&self, previousRoute: TransitionRoute) -> bool {
// todo!()
// }
// Returns true if this route supports a transition animation that runs when nextRoute
// is pushed on top of it or when nextRoute is popped off of it.
// pub fn can_transition_to(&self, nextRoute: TransitionRoute) -> bool {
// todo!()
// }
// Called whenever the Navigator has updated in some manner that might affect routes,
// to indicate that the route may wish to rebuild as well.
pub fn changed_external_state(&self) {
todo!()
}
// Called whenever the internal state of the route has changed.
pub fn changed_internal_state(&self) {
todo!()
}
// Called to create the animation that exposes the current progress of the transition
// controlled by the animation controller created by createAnimationController().
// pub fn create_animation(&self) -> Animation<f32> {
// todo!()
// }
// Called to create the animation controller that will drive the transitions to this
// route from the previous one, and back to the previous route from this one.
// pub fn create_animation_controller(&self) -> AnimationController {
// todo!()
// }
// Subclasses should override this getter to return the builders for the overlay.
// pub fn create_overlay_entries(&self) -> Iterable<OverlayEntry> {
// todo!()
// }
// Called after install when the route is added to the navigator.
pub fn did_add(&self) {
todo!()
}
// This route's next route has changed to the given new route.
pub fn did_change_next(&self, next_route: Option<Box<dyn Route>>) {
todo!()
}
// This route's previous route has changed to the given new route.
pub fn did_change_previous(&self, previous_route: Option<Box<dyn Route>>) {
todo!()
}
// The route was popped or is otherwise being removed somewhat gracefully.
// pub fn did_complete(&self, result: Option<T>) {
// todo!()
// }
// A request was made to pop this route. If the route can handle it internally
// (e.g. because it has its own stack of internal state) then return false,
// otherwise return true (by returning the value of calling super.didPop).
// Returning false will prevent the default behavior of NavigatorState.pop.
// pub fn did_pop(&self, result: Option<T>) -> bool {
// todo!()
// }
// The given route, which was above this one, has been popped off the navigator.
pub fn did_pop_next(&self, next_route: Box<dyn Route>) {
todo!()
}
// Called after install when the route is pushed onto the navigator.
pub fn did_push(&self) -> TickerFuture {
todo!()
}
// Called after install when the route replaced another in the navigator.
pub fn did_replace(&self, old_route: Option<Box<dyn Route>>) {
todo!()
}
// Discards any resources used by the object.
pub fn dispose(&self) {
todo!()
}
// Called when the route is inserted into the navigator.
pub fn install(&self) {
todo!()
}
// Remove a local history entry from this route.
// pub fn remove_local_history_entry(entry: LocalHistoryEntry) {
// todo!()
// }
// Remove one of the callbacks run by willPop.
// pub fn remove_scoped_will_pop_callback(&self, callback: WillPopCallback) {
// todo!()
// }
// Schedule a call to buildTransitions.
pub fn set_state(&self, func: VoidCallback) {
todo!()
}
// Returns RoutePopDisposition.doNotPop if any of callbacks added with addScopedWillPopCallback
// returns either false or null. If they all return true, the base Route.willPop's result will be returned.
// The callbacks will be called in the order they were added, and will only be called
// if all previous callbacks returned true.
// pub fn will_pop(&self) -> Future<RoutePopDisposition> {
// todo!()
// }
}
impl Default for MaterialPageRoute {
fn default() -> Self {
Self {
// animation: Default::default(),
barrier_color: Default::default(),
// barrier_curve: Default::default(),
barrier_dismissible: Default::default(),
barrier_label: Default::default(),
builder: box |_| box NoneWidget,
can_pop: Default::default(),
// completed: Default::default(),
// controller: Default::default(),
// current_result: Default::default(),
debug_label: Default::default(),
filter: Default::default(),
finished_when_popped: Default::default(),
fullscreen_dialog: Default::default(),
has_active_route_below: Default::default(),
has_scoped_will_pop_callback: Default::default(),
is_active: Default::default(),
is_current: Default::default(),
is_first: Default::default(),
maintain_state: Default::default(),
navigator: Default::default(),
offstage: Default::default(),
opaque: Default::default(),
// overlay_entries: Default::default(),
// popped: Default::default(),
// restoration_scope_id: Default::default(),
reverse_transition_duration: Default::default(),
// secondary_animation: Default::default(),
semantics_dismissible: Default::default(),
// settings: Default::default(),
subtree_context: Default::default(),
transition_duration: Default::default(),
will_dispose_animation_controller: Default::default(),
will_handle_pop_internally: Default::default(),
}
}
}