Update PopupRoute docs and add an example (#106948)

This commit is contained in:
Taha Tesser
2022-07-12 11:59:05 +03:00
committed by GitHub
parent a8d047923b
commit 66cd09dd82
5 changed files with 178 additions and 11 deletions

View File

@@ -1210,8 +1210,10 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T
/// For example, when a dialog is on the screen, the page below the dialog is
/// usually darkened by the modal barrier.
///
/// If [barrierDismissible] is true, then tapping this barrier will cause the
/// current route to be popped (see [Navigator.pop]) with null as the value.
/// If [barrierDismissible] is true, then tapping this barrier, pressing
/// the escape key on the keyboard, or calling route popping functions
/// such as [Navigator.pop] will cause the current route to be popped
/// with null as the value.
///
/// If [barrierDismissible] is false, then tapping the barrier has no effect.
///
@@ -1226,6 +1228,7 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T
///
/// See also:
///
/// * [Navigator.pop], which is used to dismiss the route.
/// * [barrierColor], which controls the color of the scrim for this route.
/// * [ModalBarrier], the widget that implements this feature.
/// {@endtemplate}
@@ -1691,6 +1694,19 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T
}
/// A modal route that overlays a widget over the current route.
///
/// {@macro flutter.widgets.ModalRoute.barrierDismissible}
///
/// {@tool dartpad}
/// This example shows how to create a dialog box that is dismissible.
///
/// ** See code in examples/api/lib/widgets/routes/popup_route.0.dart **
/// {@end-tool}
///
/// See also:
///
/// * [ModalRoute], which is the base class for this class.
/// * [Navigator.pop], which is used to dismiss the route.
abstract class PopupRoute<T> extends ModalRoute<T> {
/// Initializes the [PopupRoute].
PopupRoute({