1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 13:58:47 +00:00

Updates for 2.8! (#961)

This commit is contained in:
Andrew Brogdon
2021-12-08 22:15:57 -05:00
committed by GitHub
parent be34b0bf43
commit 664b63c03c
54 changed files with 216 additions and 233 deletions

View File

@@ -3,7 +3,6 @@
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
class AnimatedListDemo extends StatefulWidget {
const AnimatedListDemo({Key? key}) : super(key: key);

View File

@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/physics.dart';

View File

@@ -2,9 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
class CarouselDemo extends StatelessWidget {
CarouselDemo({Key? key}) : super(key: key);

View File

@@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.1"
version: "2.8.2"
boolean_selector:
dependency: transitive
description:
@@ -21,7 +21,7 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.0"
charcode:
dependency: transitive
description:
@@ -87,7 +87,7 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10"
version: "0.12.11"
meta:
dependency: transitive
description:
@@ -148,7 +148,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.2"
version: "0.4.3"
typed_data:
dependency: transitive
description:
@@ -162,6 +162,6 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.1"
sdks:
dart: ">=2.12.0 <3.0.0"
dart: ">=2.14.0 <3.0.0"

View File

@@ -3,8 +3,7 @@
// found in the LICENSE file.
import 'package:animations/src/misc/card_swipe.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/material.dart' hide Card;
import 'package:flutter_test/flutter_test.dart';
Widget createCardSwipeScreen() => const MaterialApp(
@@ -17,45 +16,44 @@ void main() {
await tester.pumpWidget(createCardSwipeScreen());
// Get the total number of cards available.
var totalCards = tester.widgetList(find.byType(SwipeableCard)).length;
var totalCards = tester.widgetList(find.byType(Card)).length;
// Ensure card is visible.
await tester.ensureVisible(find.byType(Card).last);
// Swipe out one card.
await tester.drag(
find.byType(SwipeableCard).first, const Offset(100.0, 0.0));
await tester.drag(find.byType(Card).last, const Offset(100.0, 0.0));
await tester.pumpAndSettle();
// Check if removed properly.
expect(tester.widgetList(find.byType(SwipeableCard)).length,
lessThan(totalCards));
expect(tester.widgetList(find.byType(Card)).length, lessThan(totalCards));
});
testWidgets('All cards swiped out', (tester) async {
await tester.pumpWidget(createCardSwipeScreen());
// Get the total number of cards availabe.
var totalCards = tester.widgetList(find.byType(SwipeableCard)).length;
var totalCards = tester.widgetList(find.byType(Card)).length;
// Swipe out all cards.
for (var i = 0; i < totalCards; i++) {
// Swipe out one by one.
await tester.drag(
find.byType(SwipeableCard).first, const Offset(100.0, 0.0));
await tester.drag(find.byType(Card).last, const Offset(100.0, 0.0));
await tester.pumpAndSettle();
}
// Check if any card is remaining.
expect(find.byType(SwipeableCard), findsNothing);
expect(find.byType(Card), findsNothing);
});
testWidgets('Stack refilled with cards', (tester) async {
await tester.pumpWidget(createCardSwipeScreen());
// Get the total number of cards availabe.
var totalCards = tester.widgetList(find.byType(SwipeableCard)).length;
var totalCards = tester.widgetList(find.byType(Card)).length;
// Swipe out one card.
await tester.drag(
find.byType(SwipeableCard).first, const Offset(100.0, 0.0));
await tester.drag(find.byType(Card).last, const Offset(100.0, 0.0));
await tester.pumpAndSettle();
// Tap the Refill button.
@@ -63,7 +61,7 @@ void main() {
await tester.pumpAndSettle();
// Check if the entire stack is refilled.
expect(find.byType(SwipeableCard), findsNWidgets(totalCards));
expect(find.byType(Card), findsNWidgets(totalCards));
});
});
}