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:
@@ -36,8 +36,7 @@ class MyAdaptingApp extends StatelessWidget {
|
||||
child: Material(child: child),
|
||||
);
|
||||
},
|
||||
// ignore: use_key_in_widget_constructors, prefer_const_constructors
|
||||
home: PlatformAdaptingHomePage(),
|
||||
home: const PlatformAdaptingHomePage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
@@ -101,7 +101,7 @@ packages:
|
||||
name: matcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.12.10"
|
||||
version: "0.12.11"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -162,7 +162,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:
|
||||
@@ -176,6 +176,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"
|
||||
|
||||
@@ -10,25 +10,33 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:platform_design/main.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Can change platform correctly', (tester) async {
|
||||
await tester.pumpWidget(const MyAdaptingApp());
|
||||
group('Platform tests', () {
|
||||
testWidgets('Builds for Android correctly', (tester) async {
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.android;
|
||||
await tester.pumpWidget(const MyAdaptingApp());
|
||||
|
||||
// The test should be able to find the drawer button.
|
||||
expect(find.byIcon(Icons.menu), findsOneWidget);
|
||||
// There should be a refresh button.
|
||||
expect(find.byIcon(Icons.refresh), findsOneWidget);
|
||||
// The test should be able to find the drawer button.
|
||||
expect(find.byIcon(Icons.menu), findsOneWidget);
|
||||
// There should be a refresh button.
|
||||
expect(find.byIcon(Icons.refresh), findsOneWidget);
|
||||
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
|
||||
await tester.pumpWidget(const MyAdaptingApp());
|
||||
// Since this is a static, undo any change made in the test.
|
||||
debugDefaultTargetPlatformOverride = null;
|
||||
});
|
||||
|
||||
// There should now be a large title style nav bar.
|
||||
expect(find.byType(CupertinoSliverNavigationBar), findsOneWidget);
|
||||
// There's a tab button for the first tab.
|
||||
expect(find.byIcon(CupertinoIcons.music_note), findsOneWidget);
|
||||
// The hamburger button isn't there anymore.
|
||||
expect(find.byIcon(Icons.menu), findsNothing);
|
||||
testWidgets('Builds for iOS correctly', (tester) async {
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
|
||||
await tester.pumpWidget(const MyAdaptingApp());
|
||||
|
||||
// Since this is a static, undo the change made in the test.
|
||||
debugDefaultTargetPlatformOverride = null;
|
||||
// There should now be a large title style nav bar.
|
||||
expect(find.byType(CupertinoSliverNavigationBar), findsOneWidget);
|
||||
// There's a tab button for the first tab.
|
||||
expect(find.byIcon(CupertinoIcons.music_note), findsOneWidget);
|
||||
// The hamburger button isn't there anymore.
|
||||
expect(find.byIcon(Icons.menu), findsNothing);
|
||||
|
||||
// Since this is a static, undo any change made in the test.
|
||||
debugDefaultTargetPlatformOverride = null;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user