Commit 97816e15 authored by Adam Barth's avatar Adam Barth Committed by GitHub

Rename Dismissable to Dismissible (#8919)

The latter is the proper spelling.

Fixes #8883
parent 11c2032a
...@@ -248,7 +248,7 @@ class CardCollectionState extends State<CardCollection> { ...@@ -248,7 +248,7 @@ class CardCollectionState extends State<CardCollection> {
Widget _buildCard(BuildContext context, int index) { Widget _buildCard(BuildContext context, int index) {
final CardModel cardModel = _cardModels[index]; final CardModel cardModel = _cardModels[index];
final Widget card = new Dismissable( final Widget card = new Dismissible(
key: new ObjectKey(cardModel), key: new ObjectKey(cardModel),
direction: _dismissDirection, direction: _dismissDirection,
onDismissed: (DismissDirection direction) { dismissCard(cardModel); }, onDismissed: (DismissDirection direction) { dismissCard(cardModel); },
...@@ -313,7 +313,7 @@ class CardCollectionState extends State<CardCollection> { ...@@ -313,7 +313,7 @@ class CardCollectionState extends State<CardCollection> {
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
final TextStyle backgroundTextStyle = theme.primaryTextTheme.title; 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 // 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 // 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 // Viewport ensures that when the card's resize animation occurs, the
......
...@@ -19,7 +19,7 @@ class _CupertinoDialogDemoState extends State<CupertinoDialogDemo> { ...@@ -19,7 +19,7 @@ class _CupertinoDialogDemoState extends State<CupertinoDialogDemo> {
showDialog<T>( showDialog<T>(
context: context, context: context,
child: child, child: child,
barrierDismissable: false, barrierDismissible: false,
) )
.then<Null>((T value) { // The value passed to Navigator.pop() or null. .then<Null>((T value) { // The value passed to Navigator.pop() or null.
if (value != null) { if (value != null) {
......
...@@ -85,7 +85,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> { ...@@ -85,7 +85,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
Widget buildItem(LeaveBehindItem item) { Widget buildItem(LeaveBehindItem item) {
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
return new Dismissable( return new Dismissible(
key: new ObjectKey(item), key: new ObjectKey(item),
direction: _dismissDirection, direction: _dismissDirection,
onDismissed: (DismissDirection direction) { onDismissed: (DismissDirection direction) {
......
...@@ -215,7 +215,7 @@ class _ModalBottomSheetRoute<T> extends PopupRoute<T> { ...@@ -215,7 +215,7 @@ class _ModalBottomSheetRoute<T> extends PopupRoute<T> {
Duration get transitionDuration => _kBottomSheetDuration; Duration get transitionDuration => _kBottomSheetDuration;
@override @override
bool get barrierDismissable => true; bool get barrierDismissible => true;
@override @override
Color get barrierColor => Colors.black54; Color get barrierColor => Colors.black54;
......
...@@ -317,10 +317,10 @@ class SimpleDialog extends StatelessWidget { ...@@ -317,10 +317,10 @@ class SimpleDialog extends StatelessWidget {
class _DialogRoute<T> extends PopupRoute<T> { class _DialogRoute<T> extends PopupRoute<T> {
_DialogRoute({ _DialogRoute({
@required this.theme, @required this.theme,
bool barrierDismissable: true, bool barrierDismissible: true,
@required this.child, @required this.child,
}) : _barrierDismissable = barrierDismissable { }) : _barrierDismissible = barrierDismissible {
assert(barrierDismissable != null); assert(barrierDismissible != null);
} }
final Widget child; final Widget child;
...@@ -330,8 +330,8 @@ class _DialogRoute<T> extends PopupRoute<T> { ...@@ -330,8 +330,8 @@ class _DialogRoute<T> extends PopupRoute<T> {
Duration get transitionDuration => const Duration(milliseconds: 150); Duration get transitionDuration => const Duration(milliseconds: 150);
@override @override
bool get barrierDismissable => _barrierDismissable; bool get barrierDismissible => _barrierDismissible;
final bool _barrierDismissable; final bool _barrierDismissible;
@override @override
Color get barrierColor => Colors.black54; Color get barrierColor => Colors.black54;
...@@ -368,12 +368,12 @@ class _DialogRoute<T> extends PopupRoute<T> { ...@@ -368,12 +368,12 @@ class _DialogRoute<T> extends PopupRoute<T> {
/// * <https://material.google.com/components/dialogs.html> /// * <https://material.google.com/components/dialogs.html>
Future<T> showDialog<T>({ Future<T> showDialog<T>({
@required BuildContext context, @required BuildContext context,
bool barrierDismissable: true, bool barrierDismissible: true,
@required Widget child, @required Widget child,
}) { }) {
return Navigator.push(context, new _DialogRoute<T>( return Navigator.push(context, new _DialogRoute<T>(
child: child, child: child,
theme: Theme.of(context, shadowThemeOnly: true), theme: Theme.of(context, shadowThemeOnly: true),
barrierDismissable: barrierDismissable, barrierDismissible: barrierDismissible,
)); ));
} }
...@@ -307,7 +307,7 @@ class _DropdownRoute<T> extends PopupRoute<_DropdownRouteResult<T>> { ...@@ -307,7 +307,7 @@ class _DropdownRoute<T> extends PopupRoute<_DropdownRouteResult<T>> {
Duration get transitionDuration => _kDropdownMenuDuration; Duration get transitionDuration => _kDropdownMenuDuration;
@override @override
bool get barrierDismissable => true; bool get barrierDismissible => true;
@override @override
Color get barrierColor => null; Color get barrierColor => null;
......
...@@ -396,7 +396,7 @@ class _PopupMenuRoute<T> extends PopupRoute<T> { ...@@ -396,7 +396,7 @@ class _PopupMenuRoute<T> extends PopupRoute<T> {
Duration get transitionDuration => _kMenuDuration; Duration get transitionDuration => _kMenuDuration;
@override @override
bool get barrierDismissable => true; bool get barrierDismissible => true;
@override @override
Color get barrierColor => null; Color get barrierColor => null;
......
...@@ -231,8 +231,8 @@ class SnackBar extends StatelessWidget { ...@@ -231,8 +231,8 @@ class SnackBar extends StatelessWidget {
}, },
child: new Semantics( child: new Semantics(
container: true, container: true,
child: new Dismissable( child: new Dismissible(
key: const Key('dismissable'), key: const Key('dismissible'),
direction: DismissDirection.down, direction: DismissDirection.down,
resizeDuration: null, resizeDuration: null,
onDismissed: (DismissDirection direction) { onDismissed: (DismissDirection direction) {
......
...@@ -17,32 +17,32 @@ const double _kMinFlingVelocityDelta = 400.0; ...@@ -17,32 +17,32 @@ const double _kMinFlingVelocityDelta = 400.0;
const double _kFlingVelocityScale = 1.0 / 300.0; const double _kFlingVelocityScale = 1.0 / 300.0;
const double _kDismissThreshold = 0.4; 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`. /// the given `direction`.
/// ///
/// Used by [Dismissable.onDismissed]. /// Used by [Dismissible.onDismissed].
typedef void DismissDirectionCallback(DismissDirection direction); 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 { 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, vertical,
/// The [Dismissable] can be dismissed by dragging either left or right. /// The [Dismissible] can be dismissed by dragging either left or right.
horizontal, 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). /// reading direction (e.g., from right to left in left-to-right languages).
endToStart, 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). /// (e.g., from left to right in left-to-right languages).
startToEnd, startToEnd,
/// The [Dismissable] can be dismissed by dragging up only. /// The [Dismissible] can be dismissed by dragging up only.
up, up,
/// The [Dismissable] can be dismissed by dragging down only. /// The [Dismissible] can be dismissed by dragging down only.
down down
} }
...@@ -50,28 +50,28 @@ enum DismissDirection { ...@@ -50,28 +50,28 @@ enum DismissDirection {
/// ///
/// Dragging or flinging this widget in the [DismissDirection] causes the child /// Dragging or flinging this widget in the [DismissDirection] causes the child
/// to slide out of view. Following the slide animation, if [resizeDuration] is /// 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]. /// perpendicular to the dismiss direction) to zero over the [resizeDuration].
/// ///
/// Backgrounds can be used to implement the "leave-behind" idiom. If a background /// 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 child moves.
/// ///
/// The widget calls the [onDimissed] callback either after its size has /// The widget calls the [onDimissed] callback either after its size has
/// collapsed to zero (if [resizeDuration] is non-null) or immediately after /// 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 /// 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. /// 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. /// 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 /// 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, /// 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 /// 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 /// state of the dismissed item. Using keys causes the widgets to sync
/// according to their keys and avoids this pitfall. /// according to their keys and avoids this pitfall.
Dismissable({ Dismissible({
@required Key key, @required Key key,
@required this.child, @required this.child,
this.background, this.background,
...@@ -123,11 +123,11 @@ class Dismissable extends StatefulWidget { ...@@ -123,11 +123,11 @@ class Dismissable extends StatefulWidget {
final Map<DismissDirection, double> dismissThresholds; final Map<DismissDirection, double> dismissThresholds;
@override @override
_DismissableState createState() => new _DismissableState(); _DismissibleState createState() => new _DismissibleState();
} }
class _DismissableClipper extends CustomClipper<Rect> { class _DismissibleClipper extends CustomClipper<Rect> {
_DismissableClipper({ _DismissibleClipper({
this.axis, this.axis,
this.moveAnimation this.moveAnimation
}) : super(reclip: moveAnimation) { }) : super(reclip: moveAnimation) {
...@@ -160,13 +160,13 @@ class _DismissableClipper extends CustomClipper<Rect> { ...@@ -160,13 +160,13 @@ class _DismissableClipper extends CustomClipper<Rect> {
Rect getApproximateClipRect(Size size) => getClip(size); Rect getApproximateClipRect(Size size) => getClip(size);
@override @override
bool shouldReclip(_DismissableClipper oldClipper) { bool shouldReclip(_DismissibleClipper oldClipper) {
return oldClipper.axis != axis return oldClipper.axis != axis
|| oldClipper.moveAnimation.value != moveAnimation.value; || oldClipper.moveAnimation.value != moveAnimation.value;
} }
} }
class _DismissableState extends State<Dismissable> with TickerProviderStateMixin { class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
...@@ -377,8 +377,8 @@ class _DismissableState extends State<Dismissable> with TickerProviderStateMixin ...@@ -377,8 +377,8 @@ class _DismissableState extends State<Dismissable> with TickerProviderStateMixin
if (_resizeAnimation.status != AnimationStatus.forward) { if (_resizeAnimation.status != AnimationStatus.forward) {
assert(_resizeAnimation.status == AnimationStatus.completed); assert(_resizeAnimation.status == AnimationStatus.completed);
throw new FlutterError( throw new FlutterError(
'A dismissed Dismissable widget is still part of the tree.\n' + 'A dismissed Dismissible widget is still part of the tree.\n' +
'Make sure to implement the onDismissed handler and to immediately remove the Dismissable\n' + 'Make sure to implement the onDismissed handler and to immediately remove the Dismissible\n' +
'widget from the application once that handler has fired.' 'widget from the application once that handler has fired.'
); );
} }
...@@ -407,7 +407,7 @@ class _DismissableState extends State<Dismissable> with TickerProviderStateMixin ...@@ -407,7 +407,7 @@ class _DismissableState extends State<Dismissable> with TickerProviderStateMixin
if (!_moveAnimation.isDismissed) { if (!_moveAnimation.isDismissed) {
children.add(new Positioned.fill( children.add(new Positioned.fill(
child: new ClipRect( child: new ClipRect(
clipper: new _DismissableClipper( clipper: new _DismissibleClipper(
axis: _directionIsXAxis ? Axis.horizontal : Axis.vertical, axis: _directionIsXAxis ? Axis.horizontal : Axis.vertical,
moveAnimation: _moveAnimation, moveAnimation: _moveAnimation,
), ),
......
...@@ -15,14 +15,14 @@ class ModalBarrier extends StatelessWidget { ...@@ -15,14 +15,14 @@ class ModalBarrier extends StatelessWidget {
ModalBarrier({ ModalBarrier({
Key key, Key key,
this.color, this.color,
this.dismissable: true this.dismissible: true
}) : super(key: key); }) : super(key: key);
/// If non-null, fill the barrier with this color. /// If non-null, fill the barrier with this color.
final Color color; final Color color;
/// Whether touching the barrier will pop the current route off the [Navigator]. /// Whether touching the barrier will pop the current route off the [Navigator].
final bool dismissable; final bool dismissible;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -30,7 +30,7 @@ class ModalBarrier extends StatelessWidget { ...@@ -30,7 +30,7 @@ class ModalBarrier extends StatelessWidget {
container: true, container: true,
child: new GestureDetector( child: new GestureDetector(
onTapDown: (TapDownDetails details) { onTapDown: (TapDownDetails details) {
if (dismissable) if (dismissible)
Navigator.pop(context); Navigator.pop(context);
}, },
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
...@@ -53,20 +53,20 @@ class AnimatedModalBarrier extends AnimatedWidget { ...@@ -53,20 +53,20 @@ class AnimatedModalBarrier extends AnimatedWidget {
AnimatedModalBarrier({ AnimatedModalBarrier({
Key key, Key key,
Animation<Color> color, Animation<Color> color,
this.dismissable: true this.dismissible: true
}) : super(key: key, listenable: color); }) : super(key: key, listenable: color);
/// If non-null, fill the barrier with this color. /// If non-null, fill the barrier with this color.
Animation<Color> get color => listenable; Animation<Color> get color => listenable;
/// Whether touching the barrier will pop the current route off the [Navigator]. /// Whether touching the barrier will pop the current route off the [Navigator].
final bool dismissable; final bool dismissible;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new ModalBarrier( return new ModalBarrier(
color: color?.value, color: color?.value,
dismissable: dismissable dismissible: dismissible
); );
} }
} }
...@@ -19,7 +19,7 @@ abstract class PageRoute<T> extends ModalRoute<T> { ...@@ -19,7 +19,7 @@ abstract class PageRoute<T> extends ModalRoute<T> {
bool get opaque => true; bool get opaque => true;
@override @override
bool get barrierDismissable => false; bool get barrierDismissible => false;
@override @override
bool canTransitionTo(TransitionRoute<dynamic> nextRoute) => nextRoute is PageRoute<dynamic>; bool canTransitionTo(TransitionRoute<dynamic> nextRoute) => nextRoute is PageRoute<dynamic>;
...@@ -64,7 +64,7 @@ Widget _defaultTransitionsBuilder(BuildContext context, Animation<double> animat ...@@ -64,7 +64,7 @@ Widget _defaultTransitionsBuilder(BuildContext context, Animation<double> animat
class PageRouteBuilder<T> extends PageRoute<T> { class PageRouteBuilder<T> extends PageRoute<T> {
/// Creates a route that deletates to builder callbacks. /// 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. /// and [maintainState] arguments must not be null.
PageRouteBuilder({ PageRouteBuilder({
RouteSettings settings: const RouteSettings(), RouteSettings settings: const RouteSettings(),
...@@ -72,14 +72,14 @@ class PageRouteBuilder<T> extends PageRoute<T> { ...@@ -72,14 +72,14 @@ class PageRouteBuilder<T> extends PageRoute<T> {
this.transitionsBuilder: _defaultTransitionsBuilder, this.transitionsBuilder: _defaultTransitionsBuilder,
this.transitionDuration: const Duration(milliseconds: 300), this.transitionDuration: const Duration(milliseconds: 300),
this.opaque: true, this.opaque: true,
this.barrierDismissable: false, this.barrierDismissible: false,
this.barrierColor: null, this.barrierColor: null,
this.maintainState: true, this.maintainState: true,
}) : super(settings: settings) { }) : super(settings: settings) {
assert(pageBuilder != null); assert(pageBuilder != null);
assert(transitionsBuilder != null); assert(transitionsBuilder != null);
assert(opaque != null); assert(opaque != null);
assert(barrierDismissable != null); assert(barrierDismissible != null);
assert(maintainState != null); assert(maintainState != null);
} }
...@@ -100,7 +100,7 @@ class PageRouteBuilder<T> extends PageRoute<T> { ...@@ -100,7 +100,7 @@ class PageRouteBuilder<T> extends PageRoute<T> {
final bool opaque; final bool opaque;
@override @override
final bool barrierDismissable; final bool barrierDismissible;
@override @override
final Color barrierColor; final Color barrierColor;
......
...@@ -613,7 +613,7 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T ...@@ -613,7 +613,7 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T
// The API for subclasses to override - used by this class // The API for subclasses to override - used by this class
/// Whether you can dismiss this route by tapping the modal barrier. /// Whether you can dismiss this route by tapping the modal barrier.
bool get barrierDismissable; bool get barrierDismissible;
/// The color to use for the modal barrier. If this is null, the barrier will /// The color to use for the modal barrier. If this is null, the barrier will
/// be transparent. /// be transparent.
...@@ -816,10 +816,10 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T ...@@ -816,10 +816,10 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T
)); ));
barrier = new AnimatedModalBarrier( barrier = new AnimatedModalBarrier(
color: color, color: color,
dismissable: barrierDismissable dismissible: barrierDismissible
); );
} else { } else {
barrier = new ModalBarrier(dismissable: barrierDismissable); barrier = new ModalBarrier(dismissible: barrierDismissible);
} }
assert(animation.status != AnimationStatus.dismissed); assert(animation.status != AnimationStatus.dismissed);
return new IgnorePointer( return new IgnorePointer(
......
...@@ -18,7 +18,7 @@ export 'src/widgets/basic.dart'; ...@@ -18,7 +18,7 @@ export 'src/widgets/basic.dart';
export 'src/widgets/binding.dart'; export 'src/widgets/binding.dart';
export 'src/widgets/container.dart'; export 'src/widgets/container.dart';
export 'src/widgets/debug.dart'; export 'src/widgets/debug.dart';
export 'src/widgets/dismissable.dart'; export 'src/widgets/dismissible.dart';
export 'src/widgets/drag_target.dart'; export 'src/widgets/drag_target.dart';
export 'src/widgets/editable_text.dart'; export 'src/widgets/editable_text.dart';
export 'src/widgets/focus.dart'; export 'src/widgets/focus.dart';
......
...@@ -138,7 +138,7 @@ void main() { ...@@ -138,7 +138,7 @@ void main() {
expect(await result, equals(42)); expect(await result, equals(42));
}); });
testWidgets('Barrier dismissable', (WidgetTester tester) async { testWidgets('Barrier dismissible', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
new MaterialApp( new MaterialApp(
home: new Material( home: new Material(
...@@ -175,7 +175,7 @@ void main() { ...@@ -175,7 +175,7 @@ void main() {
showDialog<Null>( showDialog<Null>(
context: context, context: context,
barrierDismissable: false, barrierDismissible: false,
child: new Container( child: new Container(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
......
...@@ -16,8 +16,8 @@ Widget background; ...@@ -16,8 +16,8 @@ Widget background;
Widget buildTest({ double startToEndThreshold }) { Widget buildTest({ double startToEndThreshold }) {
return new StatefulBuilder( return new StatefulBuilder(
builder: (BuildContext context, StateSetter setState) { builder: (BuildContext context, StateSetter setState) {
Widget buildDismissableItem(int item) { Widget buildDismissibleItem(int item) {
return new Dismissable( return new Dismissible(
key: new ValueKey<int>(item), key: new ValueKey<int>(item),
direction: dismissDirection, direction: dismissDirection,
onDismissed: (DismissDirection direction) { onDismissed: (DismissDirection direction) {
...@@ -49,7 +49,7 @@ Widget buildTest({ double startToEndThreshold }) { ...@@ -49,7 +49,7 @@ Widget buildTest({ double startToEndThreshold }) {
itemExtent: itemExtent, itemExtent: itemExtent,
children: <int>[0, 1, 2, 3, 4] children: <int>[0, 1, 2, 3, 4]
.where((int i) => !dismissedItems.contains(i)) .where((int i) => !dismissedItems.contains(i))
.map(buildDismissableItem).toList(), .map(buildDismissibleItem).toList(),
), ),
); );
}, },
...@@ -66,7 +66,7 @@ Future<Null> dismissElement(WidgetTester tester, Finder finder, { DismissDirecti ...@@ -66,7 +66,7 @@ Future<Null> dismissElement(WidgetTester tester, Finder finder, { DismissDirecti
switch (gestureDirection) { switch (gestureDirection) {
case DismissDirection.endToStart: case DismissDirection.endToStart:
// getTopRight() returns a point that's just beyond itemWidget's right // 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); downLocation = tester.getTopRight(finder) + const Offset(-0.1, 0.0);
upLocation = tester.getTopLeft(finder); upLocation = tester.getTopLeft(finder);
break; break;
...@@ -77,7 +77,7 @@ Future<Null> dismissElement(WidgetTester tester, Finder finder, { DismissDirecti ...@@ -77,7 +77,7 @@ Future<Null> dismissElement(WidgetTester tester, Finder finder, { DismissDirecti
break; break;
case DismissDirection.up: case DismissDirection.up:
// getBottomLeft() returns a point that's just below itemWidget's bottom // 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); downLocation = tester.getBottomLeft(finder) + const Offset(0.0, -0.1);
upLocation = tester.getTopLeft(finder); upLocation = tester.getTopLeft(finder);
break; break;
...@@ -111,14 +111,14 @@ Future<Null> dismissItem(WidgetTester tester, int item, { DismissDirection gestu ...@@ -111,14 +111,14 @@ Future<Null> dismissItem(WidgetTester tester, int item, { DismissDirection gestu
await tester.pump(); // rebuild after the callback removes the entry await tester.pump(); // rebuild after the callback removes the entry
} }
class Test1215DismissableWidget extends StatelessWidget { class Test1215DismissibleWidget extends StatelessWidget {
Test1215DismissableWidget(this.text); Test1215DismissibleWidget(this.text);
final String text; final String text;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Dismissable( return new Dismissible(
key: new ObjectKey(text), key: new ObjectKey(text),
child: new AspectRatio( child: new AspectRatio(
aspectRatio: 1.0, aspectRatio: 1.0,
...@@ -236,7 +236,7 @@ void main() { ...@@ -236,7 +236,7 @@ void main() {
expect(dismissedItems, equals(<int>[0])); expect(dismissedItems, equals(<int>[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; scrollDirection = Axis.vertical;
dismissDirection = DismissDirection.horizontal; dismissDirection = DismissDirection.horizontal;
...@@ -282,7 +282,7 @@ void main() { ...@@ -282,7 +282,7 @@ void main() {
// now-obsolete URL https://github.com/flutter/engine/issues/1215 (the URL // 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 // 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 // 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 { testWidgets('dismissing bottom then top (smoketest)', (WidgetTester tester) async {
await tester.pumpWidget(new Center( await tester.pumpWidget(new Center(
child: new Container( child: new Container(
...@@ -290,8 +290,8 @@ void main() { ...@@ -290,8 +290,8 @@ void main() {
height: 1000.0, height: 1000.0,
child: new Column( child: new Column(
children: <Widget>[ children: <Widget>[
new Test1215DismissableWidget('1'), new Test1215DismissibleWidget('1'),
new Test1215DismissableWidget('2'), new Test1215DismissibleWidget('2'),
], ],
), ),
), ),
...@@ -310,7 +310,7 @@ void main() { ...@@ -310,7 +310,7 @@ void main() {
expect(find.text('2'), findsNothing); 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; scrollDirection = Axis.vertical;
dismissDirection = DismissDirection.horizontal; dismissDirection = DismissDirection.horizontal;
background = new Text('background'); background = new Text('background');
......
...@@ -28,7 +28,7 @@ void main() { ...@@ -28,7 +28,7 @@ void main() {
final Widget subject = new Stack( final Widget subject = new Stack(
children: <Widget>[ children: <Widget>[
tapTarget, tapTarget,
new ModalBarrier(dismissable: false), new ModalBarrier(dismissible: false),
] ]
); );
...@@ -42,7 +42,7 @@ void main() { ...@@ -42,7 +42,7 @@ void main() {
testWidgets('ModalBarrier does not prevent interactions with widgets in front of it', (WidgetTester tester) async { testWidgets('ModalBarrier does not prevent interactions with widgets in front of it', (WidgetTester tester) async {
final Widget subject = new Stack( final Widget subject = new Stack(
children: <Widget>[ children: <Widget>[
new ModalBarrier(dismissable: false), new ModalBarrier(dismissible: false),
tapTarget, tapTarget,
] ]
); );
...@@ -99,7 +99,7 @@ class SecondWidget extends StatelessWidget { ...@@ -99,7 +99,7 @@ class SecondWidget extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new ModalBarrier( return new ModalBarrier(
key: const ValueKey<String>('barrier'), key: const ValueKey<String>('barrier'),
dismissable: true dismissible: true
); );
} }
} }
...@@ -532,7 +532,7 @@ ...@@ -532,7 +532,7 @@
"fixedId": true, "fixedId": true,
"id": "libraries/35", "id": "libraries/35",
"name": "", "name": "",
"uri": "package:flutter/src/widgets/dismissable.dart" "uri": "package:flutter/src/widgets/dismissible.dart"
}, },
{ {
"type": "@Library", "type": "@Library",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment