diff --git a/dev/manual_tests/card_collection.dart b/dev/manual_tests/card_collection.dart index 1e2c2610478..a79749ecb1f 100644 --- a/dev/manual_tests/card_collection.dart +++ b/dev/manual_tests/card_collection.dart @@ -248,7 +248,7 @@ class CardCollectionState extends State { Widget _buildCard(BuildContext context, int index) { final CardModel cardModel = _cardModels[index]; - final Widget card = new Dismissable( + final Widget card = new Dismissible( key: new ObjectKey(cardModel), direction: _dismissDirection, onDismissed: (DismissDirection direction) { dismissCard(cardModel); }, @@ -313,7 +313,7 @@ class CardCollectionState extends State { final ThemeData theme = Theme.of(context); final TextStyle backgroundTextStyle = theme.primaryTextTheme.title; - // The background Widget appears behind the Dismissable card when the card + // The background Widget appears behind the Dismissible card when the card // moves to the left or right. The Positioned widget ensures that the // size of the background,card Stack will be based only on the card. The // Viewport ensures that when the card's resize animation occurs, the diff --git a/examples/flutter_gallery/lib/demo/cupertino/cupertino_dialog_demo.dart b/examples/flutter_gallery/lib/demo/cupertino/cupertino_dialog_demo.dart index 7c17f97fff5..b8f54978ace 100644 --- a/examples/flutter_gallery/lib/demo/cupertino/cupertino_dialog_demo.dart +++ b/examples/flutter_gallery/lib/demo/cupertino/cupertino_dialog_demo.dart @@ -19,7 +19,7 @@ class _CupertinoDialogDemoState extends State { showDialog( context: context, child: child, - barrierDismissable: false, + barrierDismissible: false, ) .then((T value) { // The value passed to Navigator.pop() or null. if (value != null) { diff --git a/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart b/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart index d57f9e82f72..26d39733941 100644 --- a/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart +++ b/examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart @@ -85,7 +85,7 @@ class LeaveBehindDemoState extends State { Widget buildItem(LeaveBehindItem item) { final ThemeData theme = Theme.of(context); - return new Dismissable( + return new Dismissible( key: new ObjectKey(item), direction: _dismissDirection, onDismissed: (DismissDirection direction) { diff --git a/packages/flutter/lib/src/material/bottom_sheet.dart b/packages/flutter/lib/src/material/bottom_sheet.dart index ca94a8a9310..c66d0aba4a3 100644 --- a/packages/flutter/lib/src/material/bottom_sheet.dart +++ b/packages/flutter/lib/src/material/bottom_sheet.dart @@ -215,7 +215,7 @@ class _ModalBottomSheetRoute extends PopupRoute { Duration get transitionDuration => _kBottomSheetDuration; @override - bool get barrierDismissable => true; + bool get barrierDismissible => true; @override Color get barrierColor => Colors.black54; diff --git a/packages/flutter/lib/src/material/dialog.dart b/packages/flutter/lib/src/material/dialog.dart index 6fe4fe92576..fa169a8e583 100644 --- a/packages/flutter/lib/src/material/dialog.dart +++ b/packages/flutter/lib/src/material/dialog.dart @@ -317,10 +317,10 @@ class SimpleDialog extends StatelessWidget { class _DialogRoute extends PopupRoute { _DialogRoute({ @required this.theme, - bool barrierDismissable: true, + bool barrierDismissible: true, @required this.child, - }) : _barrierDismissable = barrierDismissable { - assert(barrierDismissable != null); + }) : _barrierDismissible = barrierDismissible { + assert(barrierDismissible != null); } final Widget child; @@ -330,8 +330,8 @@ class _DialogRoute extends PopupRoute { Duration get transitionDuration => const Duration(milliseconds: 150); @override - bool get barrierDismissable => _barrierDismissable; - final bool _barrierDismissable; + bool get barrierDismissible => _barrierDismissible; + final bool _barrierDismissible; @override Color get barrierColor => Colors.black54; @@ -368,12 +368,12 @@ class _DialogRoute extends PopupRoute { /// * Future showDialog({ @required BuildContext context, - bool barrierDismissable: true, + bool barrierDismissible: true, @required Widget child, }) { return Navigator.push(context, new _DialogRoute( child: child, theme: Theme.of(context, shadowThemeOnly: true), - barrierDismissable: barrierDismissable, + barrierDismissible: barrierDismissible, )); } diff --git a/packages/flutter/lib/src/material/dropdown.dart b/packages/flutter/lib/src/material/dropdown.dart index d24a0608664..0f2c0d44b00 100644 --- a/packages/flutter/lib/src/material/dropdown.dart +++ b/packages/flutter/lib/src/material/dropdown.dart @@ -307,7 +307,7 @@ class _DropdownRoute extends PopupRoute<_DropdownRouteResult> { Duration get transitionDuration => _kDropdownMenuDuration; @override - bool get barrierDismissable => true; + bool get barrierDismissible => true; @override Color get barrierColor => null; diff --git a/packages/flutter/lib/src/material/popup_menu.dart b/packages/flutter/lib/src/material/popup_menu.dart index 07c4042f694..84b986311bc 100644 --- a/packages/flutter/lib/src/material/popup_menu.dart +++ b/packages/flutter/lib/src/material/popup_menu.dart @@ -396,7 +396,7 @@ class _PopupMenuRoute extends PopupRoute { Duration get transitionDuration => _kMenuDuration; @override - bool get barrierDismissable => true; + bool get barrierDismissible => true; @override Color get barrierColor => null; diff --git a/packages/flutter/lib/src/material/snack_bar.dart b/packages/flutter/lib/src/material/snack_bar.dart index aa224f80ac1..5b426dfd82e 100644 --- a/packages/flutter/lib/src/material/snack_bar.dart +++ b/packages/flutter/lib/src/material/snack_bar.dart @@ -231,8 +231,8 @@ class SnackBar extends StatelessWidget { }, child: new Semantics( container: true, - child: new Dismissable( - key: const Key('dismissable'), + child: new Dismissible( + key: const Key('dismissible'), direction: DismissDirection.down, resizeDuration: null, onDismissed: (DismissDirection direction) { diff --git a/packages/flutter/lib/src/widgets/dismissable.dart b/packages/flutter/lib/src/widgets/dismissible.dart similarity index 91% rename from packages/flutter/lib/src/widgets/dismissable.dart rename to packages/flutter/lib/src/widgets/dismissible.dart index 4556d31303c..47a9362e44b 100644 --- a/packages/flutter/lib/src/widgets/dismissable.dart +++ b/packages/flutter/lib/src/widgets/dismissible.dart @@ -17,32 +17,32 @@ const double _kMinFlingVelocityDelta = 400.0; const double _kFlingVelocityScale = 1.0 / 300.0; const double _kDismissThreshold = 0.4; -/// Signature used by [Dismissable] to indicate that it has been dismissed in +/// Signature used by [Dismissible] to indicate that it has been dismissed in /// the given `direction`. /// -/// Used by [Dismissable.onDismissed]. +/// Used by [Dismissible.onDismissed]. typedef void DismissDirectionCallback(DismissDirection direction); -/// The direction in which a [Dismissable] can be dismissed. +/// The direction in which a [Dismissible] can be dismissed. enum DismissDirection { - /// The [Dismissable] can be dismissed by dragging either up or down. + /// The [Dismissible] can be dismissed by dragging either up or down. vertical, - /// The [Dismissable] can be dismissed by dragging either left or right. + /// The [Dismissible] can be dismissed by dragging either left or right. horizontal, - /// The [Dismissable] can be dismissed by dragging in the reverse of the + /// The [Dismissible] can be dismissed by dragging in the reverse of the /// reading direction (e.g., from right to left in left-to-right languages). endToStart, - /// The [Dismissable] can be dismissed by dragging in the reading direction + /// The [Dismissible] can be dismissed by dragging in the reading direction /// (e.g., from left to right in left-to-right languages). startToEnd, - /// The [Dismissable] can be dismissed by dragging up only. + /// The [Dismissible] can be dismissed by dragging up only. up, - /// The [Dismissable] can be dismissed by dragging down only. + /// The [Dismissible] can be dismissed by dragging down only. down } @@ -50,28 +50,28 @@ enum DismissDirection { /// /// Dragging or flinging this widget in the [DismissDirection] causes the child /// to slide out of view. Following the slide animation, if [resizeDuration] is -/// non-null, the Dismissable widget animates its height (or width, whichever is +/// non-null, the Dismissible widget animates its height (or width, whichever is /// perpendicular to the dismiss direction) to zero over the [resizeDuration]. /// /// Backgrounds can be used to implement the "leave-behind" idiom. If a background -/// is specified it is stacked behind the Dismissable's child and is exposed when +/// is specified it is stacked behind the Dismissible's child and is exposed when /// the child moves. /// /// The widget calls the [onDimissed] callback either after its size has /// collapsed to zero (if [resizeDuration] is non-null) or immediately after -/// the slide animation (if [resizeDuration] is null). If the Dismissable is a +/// the slide animation (if [resizeDuration] is null). If the Dismissible is a /// list item, it must have a key that distinguishes it from the other items and /// its [onDismissed] callback must remove the item from the list. -class Dismissable extends StatefulWidget { +class Dismissible extends StatefulWidget { /// Creates a widget that can be dismissed. /// - /// The [key] argument must not be null because [Dismissable]s are commonly + /// The [key] argument must not be null because [Dismissible]s are commonly /// used in lists and removed from the list when dismissed. Without keys, the /// default behavior is to sync widgets based on their index in the list, /// which means the item after the dismissed item would be synced with the /// state of the dismissed item. Using keys causes the widgets to sync /// according to their keys and avoids this pitfall. - Dismissable({ + Dismissible({ @required Key key, @required this.child, this.background, @@ -123,11 +123,11 @@ class Dismissable extends StatefulWidget { final Map dismissThresholds; @override - _DismissableState createState() => new _DismissableState(); + _DismissibleState createState() => new _DismissibleState(); } -class _DismissableClipper extends CustomClipper { - _DismissableClipper({ +class _DismissibleClipper extends CustomClipper { + _DismissibleClipper({ this.axis, this.moveAnimation }) : super(reclip: moveAnimation) { @@ -160,13 +160,13 @@ class _DismissableClipper extends CustomClipper { Rect getApproximateClipRect(Size size) => getClip(size); @override - bool shouldReclip(_DismissableClipper oldClipper) { + bool shouldReclip(_DismissibleClipper oldClipper) { return oldClipper.axis != axis || oldClipper.moveAnimation.value != moveAnimation.value; } } -class _DismissableState extends State with TickerProviderStateMixin { +class _DismissibleState extends State with TickerProviderStateMixin { @override void initState() { super.initState(); @@ -377,8 +377,8 @@ class _DismissableState extends State with TickerProviderStateMixin if (_resizeAnimation.status != AnimationStatus.forward) { assert(_resizeAnimation.status == AnimationStatus.completed); throw new FlutterError( - 'A dismissed Dismissable widget is still part of the tree.\n' + - 'Make sure to implement the onDismissed handler and to immediately remove the Dismissable\n' + + 'A dismissed Dismissible widget is still part of the tree.\n' + + 'Make sure to implement the onDismissed handler and to immediately remove the Dismissible\n' + 'widget from the application once that handler has fired.' ); } @@ -407,7 +407,7 @@ class _DismissableState extends State with TickerProviderStateMixin if (!_moveAnimation.isDismissed) { children.add(new Positioned.fill( child: new ClipRect( - clipper: new _DismissableClipper( + clipper: new _DismissibleClipper( axis: _directionIsXAxis ? Axis.horizontal : Axis.vertical, moveAnimation: _moveAnimation, ), diff --git a/packages/flutter/lib/src/widgets/modal_barrier.dart b/packages/flutter/lib/src/widgets/modal_barrier.dart index 782388c9555..2246b8ee1b7 100644 --- a/packages/flutter/lib/src/widgets/modal_barrier.dart +++ b/packages/flutter/lib/src/widgets/modal_barrier.dart @@ -15,14 +15,14 @@ class ModalBarrier extends StatelessWidget { ModalBarrier({ Key key, this.color, - this.dismissable: true + this.dismissible: true }) : super(key: key); /// If non-null, fill the barrier with this color. final Color color; /// Whether touching the barrier will pop the current route off the [Navigator]. - final bool dismissable; + final bool dismissible; @override Widget build(BuildContext context) { @@ -30,7 +30,7 @@ class ModalBarrier extends StatelessWidget { container: true, child: new GestureDetector( onTapDown: (TapDownDetails details) { - if (dismissable) + if (dismissible) Navigator.pop(context); }, behavior: HitTestBehavior.opaque, @@ -53,20 +53,20 @@ class AnimatedModalBarrier extends AnimatedWidget { AnimatedModalBarrier({ Key key, Animation color, - this.dismissable: true + this.dismissible: true }) : super(key: key, listenable: color); /// If non-null, fill the barrier with this color. Animation get color => listenable; /// Whether touching the barrier will pop the current route off the [Navigator]. - final bool dismissable; + final bool dismissible; @override Widget build(BuildContext context) { return new ModalBarrier( color: color?.value, - dismissable: dismissable + dismissible: dismissible ); } } diff --git a/packages/flutter/lib/src/widgets/pages.dart b/packages/flutter/lib/src/widgets/pages.dart index db9467db3f5..224af503b7c 100644 --- a/packages/flutter/lib/src/widgets/pages.dart +++ b/packages/flutter/lib/src/widgets/pages.dart @@ -19,7 +19,7 @@ abstract class PageRoute extends ModalRoute { bool get opaque => true; @override - bool get barrierDismissable => false; + bool get barrierDismissible => false; @override bool canTransitionTo(TransitionRoute nextRoute) => nextRoute is PageRoute; @@ -64,7 +64,7 @@ Widget _defaultTransitionsBuilder(BuildContext context, Animation animat class PageRouteBuilder extends PageRoute { /// Creates a route that deletates to builder callbacks. /// - /// The [pageBuilder], [transitionsBuilder], [opaque], [barrierDismissable], + /// The [pageBuilder], [transitionsBuilder], [opaque], [barrierDismissible], /// and [maintainState] arguments must not be null. PageRouteBuilder({ RouteSettings settings: const RouteSettings(), @@ -72,14 +72,14 @@ class PageRouteBuilder extends PageRoute { this.transitionsBuilder: _defaultTransitionsBuilder, this.transitionDuration: const Duration(milliseconds: 300), this.opaque: true, - this.barrierDismissable: false, + this.barrierDismissible: false, this.barrierColor: null, this.maintainState: true, }) : super(settings: settings) { assert(pageBuilder != null); assert(transitionsBuilder != null); assert(opaque != null); - assert(barrierDismissable != null); + assert(barrierDismissible != null); assert(maintainState != null); } @@ -100,7 +100,7 @@ class PageRouteBuilder extends PageRoute { final bool opaque; @override - final bool barrierDismissable; + final bool barrierDismissible; @override final Color barrierColor; diff --git a/packages/flutter/lib/src/widgets/routes.dart b/packages/flutter/lib/src/widgets/routes.dart index 0b943b8f2bf..8ae45ad7072 100644 --- a/packages/flutter/lib/src/widgets/routes.dart +++ b/packages/flutter/lib/src/widgets/routes.dart @@ -613,7 +613,7 @@ abstract class ModalRoute extends TransitionRoute with LocalHistoryRoute extends TransitionRoute with LocalHistoryRoute( context: context, - barrierDismissable: false, + barrierDismissible: false, child: new Container( width: 100.0, height: 100.0, diff --git a/packages/flutter/test/widgets/dismissable_test.dart b/packages/flutter/test/widgets/dismissible_test.dart similarity index 94% rename from packages/flutter/test/widgets/dismissable_test.dart rename to packages/flutter/test/widgets/dismissible_test.dart index d4a64128847..2dd7d8e3c27 100644 --- a/packages/flutter/test/widgets/dismissable_test.dart +++ b/packages/flutter/test/widgets/dismissible_test.dart @@ -16,8 +16,8 @@ Widget background; Widget buildTest({ double startToEndThreshold }) { return new StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - Widget buildDismissableItem(int item) { - return new Dismissable( + Widget buildDismissibleItem(int item) { + return new Dismissible( key: new ValueKey(item), direction: dismissDirection, onDismissed: (DismissDirection direction) { @@ -49,7 +49,7 @@ Widget buildTest({ double startToEndThreshold }) { itemExtent: itemExtent, children: [0, 1, 2, 3, 4] .where((int i) => !dismissedItems.contains(i)) - .map(buildDismissableItem).toList(), + .map(buildDismissibleItem).toList(), ), ); }, @@ -66,7 +66,7 @@ Future dismissElement(WidgetTester tester, Finder finder, { DismissDirecti switch (gestureDirection) { case DismissDirection.endToStart: // getTopRight() returns a point that's just beyond itemWidget's right - // edge and outside the Dismissable event listener's bounds. + // edge and outside the Dismissible event listener's bounds. downLocation = tester.getTopRight(finder) + const Offset(-0.1, 0.0); upLocation = tester.getTopLeft(finder); break; @@ -77,7 +77,7 @@ Future dismissElement(WidgetTester tester, Finder finder, { DismissDirecti break; case DismissDirection.up: // getBottomLeft() returns a point that's just below itemWidget's bottom - // edge and outside the Dismissable event listener's bounds. + // edge and outside the Dismissible event listener's bounds. downLocation = tester.getBottomLeft(finder) + const Offset(0.0, -0.1); upLocation = tester.getTopLeft(finder); break; @@ -111,14 +111,14 @@ Future dismissItem(WidgetTester tester, int item, { DismissDirection gestu await tester.pump(); // rebuild after the callback removes the entry } -class Test1215DismissableWidget extends StatelessWidget { - Test1215DismissableWidget(this.text); +class Test1215DismissibleWidget extends StatelessWidget { + Test1215DismissibleWidget(this.text); final String text; @override Widget build(BuildContext context) { - return new Dismissable( + return new Dismissible( key: new ObjectKey(text), child: new AspectRatio( aspectRatio: 1.0, @@ -236,7 +236,7 @@ void main() { expect(dismissedItems, equals([0])); }); - testWidgets('drag-left has no effect on dismissable with a high dismiss threshold', (WidgetTester tester) async { + testWidgets('drag-left has no effect on dismissible with a high dismiss threshold', (WidgetTester tester) async { scrollDirection = Axis.vertical; dismissDirection = DismissDirection.horizontal; @@ -282,7 +282,7 @@ void main() { // now-obsolete URL https://github.com/flutter/engine/issues/1215 (the URL // died in the migration to the new repo). Don't copy this test; it doesn't // actually remove the dismissed widget, which is a violation of the - // Dismissable contract. This is not an example of good practice. + // Dismissible contract. This is not an example of good practice. testWidgets('dismissing bottom then top (smoketest)', (WidgetTester tester) async { await tester.pumpWidget(new Center( child: new Container( @@ -290,8 +290,8 @@ void main() { height: 1000.0, child: new Column( children: [ - new Test1215DismissableWidget('1'), - new Test1215DismissableWidget('2'), + new Test1215DismissibleWidget('1'), + new Test1215DismissibleWidget('2'), ], ), ), @@ -310,7 +310,7 @@ void main() { expect(find.text('2'), findsNothing); }); - testWidgets('Dismissable starts from the full size when collapsing', (WidgetTester tester) async { + testWidgets('Dismissible starts from the full size when collapsing', (WidgetTester tester) async { scrollDirection = Axis.vertical; dismissDirection = DismissDirection.horizontal; background = new Text('background'); diff --git a/packages/flutter/test/widgets/modal_barrier_test.dart b/packages/flutter/test/widgets/modal_barrier_test.dart index b98ec45308d..fa55ee1904b 100644 --- a/packages/flutter/test/widgets/modal_barrier_test.dart +++ b/packages/flutter/test/widgets/modal_barrier_test.dart @@ -28,7 +28,7 @@ void main() { final Widget subject = new Stack( children: [ tapTarget, - new ModalBarrier(dismissable: false), + new ModalBarrier(dismissible: false), ] ); @@ -42,7 +42,7 @@ void main() { testWidgets('ModalBarrier does not prevent interactions with widgets in front of it', (WidgetTester tester) async { final Widget subject = new Stack( children: [ - new ModalBarrier(dismissable: false), + new ModalBarrier(dismissible: false), tapTarget, ] ); @@ -99,7 +99,7 @@ class SecondWidget extends StatelessWidget { Widget build(BuildContext context) { return new ModalBarrier( key: const ValueKey('barrier'), - dismissable: true + dismissible: true ); } } diff --git a/packages/flutter_tools/test/replay/osx/simulator_application_binary/vmservice/MANIFEST.txt b/packages/flutter_tools/test/replay/osx/simulator_application_binary/vmservice/MANIFEST.txt index 09b42b21a7d..d9f0b0cf838 100644 --- a/packages/flutter_tools/test/replay/osx/simulator_application_binary/vmservice/MANIFEST.txt +++ b/packages/flutter_tools/test/replay/osx/simulator_application_binary/vmservice/MANIFEST.txt @@ -532,7 +532,7 @@ "fixedId": true, "id": "libraries/35", "name": "", - "uri": "package:flutter/src/widgets/dismissable.dart" + "uri": "package:flutter/src/widgets/dismissible.dart" }, { "type": "@Library",