Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- flutter/examples/api/macos/Podfile-1
- flutter/examples/api/pubspec.yaml+57-56
- flutter/examples/api/test/flutter_test_config.dart+1-2
- flutter/examples/api/test/material/bottom_navigation_bar/bottom_navigation_bar.1_test.dart+3-4
- flutter/examples/api/test/material/bottom_navigation_bar/bottom_navigation_bar.2_test.dart+3-4
- flutter/examples/api/test/material/bottom_sheet/show_bottom_sheet.0_test.dart+4-4
- flutter/examples/api/test/material/bottom_sheet/show_modal_bottom_sheet.0_test.dart+3-4
- flutter/examples/api/test/material/bottom_sheet/show_modal_bottom_sheet.1_test.dart+3-4
- flutter/examples/api/test/material/bottom_sheet/show_modal_bottom_sheet.2_test.dart+6-5
- flutter/examples/api/test/material/button_style/button_style.0_test.dart+56-56
- flutter/examples/api/test/material/button_style_button/button_style_button.icon_alignment.0_test.dart+7-9
- flutter/examples/api/test/material/card/card.0_test.dart+5-4
- flutter/examples/api/test/material/card/card.2_test.dart+21-19
- flutter/examples/api/test/material/carousel/carousel.0_test.dart+29-6
- flutter/examples/api/test/material/checkbox/checkbox.0_test.dart+8-28
- flutter/examples/api/test/material/checkbox/checkbox.1_test.dart+2-5
- flutter/examples/api/test/material/checkbox_list_tile/checkbox_list_tile.0_test.dart+3-4
- flutter/examples/api/test/material/checkbox_list_tile/checkbox_list_tile.1_test.dart+4-7
- flutter/examples/api/test/material/checkbox_list_tile/custom_labeled_checkbox.0_test.dart+3-4
- flutter/examples/api/test/material/checkbox_list_tile/custom_labeled_checkbox.1_test.dart+3-4
- flutter/examples/api/test/material/chip/chip_attributes.avatar_box_constraints.0_test.dart+24-20
- flutter/examples/api/test/material/chip/chip_attributes.chip_animation_style.0_test.dart+18-17
- flutter/examples/api/test/sample_templates/cupertino.0_test.dart+1-3
- flutter/examples/api/test/sample_templates/material.0_test.dart+1-3
- flutter/examples/api/test/sample_templates/widgets.0_test.dart+1-3
- flutter/examples/api/test/widgets/actions/action.action_overridable.0_test.dart+6-6
- flutter/examples/api/test/widgets/actions/action_listener.0_test.dartAdded+47
- flutter/examples/api/test/widgets/actions/actions.0_test.dart+7-24
- flutter/examples/api/test/widgets/actions/focusable_action_detector.0_test.dartAdded+67
- flutter/examples/api/test/widgets/animated_grid/animated_grid.0_test.dart+2-5
- flutter/examples/api/test/widgets/animated_grid/sliver_animated_grid.0_test.dart+2-5
- flutter/examples/api/test/widgets/animated_list/animated_list.0_test.dartAdded+44
- flutter/examples/api/test/widgets/animated_list/animated_list_separated.0_test.dart+47-47
- flutter/examples/api/test/widgets/animated_list/sliver_animated_list.0_test.dart+34-35
- flutter/examples/api/test/widgets/animated_size/animated_size.0_test.dart+8-25
- flutter/examples/api/test/widgets/animated_switcher/animated_switcher.0_test.dart+5-16
- flutter/examples/api/test/widgets/app/widgets_app.widgets_app.0_test.dart+1-3
- flutter/examples/api/test/widgets/app_lifecycle_listener/app_lifecycle_listener.0_test.dart+3-4
- flutter/examples/api/test/widgets/app_lifecycle_listener/app_lifecycle_listener.1_test.dart+4-5
- flutter/examples/api/test/widgets/async/future_builder.0_test.dart+2-5
- flutter/examples/api/test/widgets/async/stream_builder.0_test.dart+7-30
- flutter/examples/api/test/widgets/autocomplete/raw_autocomplete.0_test.dart+4-4
- flutter/examples/api/test/widgets/autocomplete/raw_autocomplete.1_test.dart+8-8
- flutter/examples/api/test/widgets/autocomplete/raw_autocomplete.2_test.dart+9-5
- flutter/examples/api/test/widgets/autocomplete/raw_autocomplete.focus_node.0_test.dart+5-13
- flutter/examples/api/test/widgets/autofill/autofill_group.0_test.dartAdded+64
- flutter/examples/api/test/widgets/basic/absorb_pointer.0_test.dart+13-6
- flutter/examples/api/test/widgets/basic/aspect_ratio.0_test.dart+1-3
- flutter/examples/api/test/widgets/basic/aspect_ratio.1_test.dart+1-3
- flutter/examples/api/test/widgets/basic/aspect_ratio.2_test.dart+1-3
27 unmodified lines2829303131323327 unmodified lines
target 'Runner' do use_frameworks! use_modular_headers!
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))end6 unmodified lines7891010111213141415161718192021181920212223249 unmodified lines3435363737383940414243444546474849505152535455565758596061623940414243444546474849505152535455565758596061626364656664656667686970686970717273747576777879727374757677787980818283848586878889818283848586878889909191929394959696976 unmodified linesversion: 1.0.0
environment: sdk: '>=3.2.0-0 <4.0.0' sdk: ^3.7.0-0 flutter: ">=2.5.0-6.0.pre.30 <3.0.0"
dependencies: cupertino_icons: 1.0.6 cupertino_icons: 1.0.8 flutter: sdk: flutter
characters: 1.3.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" collection: 1.18.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" material_color_utilities: 0.8.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" meta: 1.11.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" characters: 1.4.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" collection: 1.19.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" material_color_utilities: 0.11.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" meta: 1.16.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" vector_math: 2.1.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
dev_dependencies:9 unmodified lines sdk: flutter flutter_web_plugins: sdk: flutter test: 1.24.9 test: 1.25.15
_fe_analyzer_shared: 65.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" analyzer: 6.3.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" args: 2.4.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" async: 2.11.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" boolean_selector: 2.1.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" clock: 1.1.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" convert: 3.1.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" coverage: 1.7.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" crypto: 3.0.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" fake_async: 1.3.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" file: 7.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" frontend_server_client: 3.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" glob: 2.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" http_multi_server: 3.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" http_parser: 4.0.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" intl: 0.18.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" io: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" js: 0.6.7 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" leak_tracker: 10.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" leak_tracker_flutter_testing: 2.0.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" leak_tracker_testing: 2.0.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" logging: 1.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" matcher: 0.12.16+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" mime: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" _fe_analyzer_shared: 80.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" analyzer: 7.3.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" args: 2.7.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" async: 2.13.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" boolean_selector: 2.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" clock: 1.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" convert: 3.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" coverage: 1.11.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" crypto: 3.0.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" fake_async: 1.3.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" file: 7.0.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" frontend_server_client: 4.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" glob: 2.1.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" http_multi_server: 3.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" http_parser: 4.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" intl: 0.20.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" io: 1.0.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" js: 0.7.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" leak_tracker: 10.0.9 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" leak_tracker_flutter_testing: 3.0.9 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" leak_tracker_testing: 3.0.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" logging: 1.3.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" matcher: 0.12.17 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" mime: 2.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" node_preamble: 2.0.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" package_config: 2.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" path: 1.9.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" platform: 3.1.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" package_config: 2.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" path: 1.9.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" platform: 3.1.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" pool: 1.5.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" process: 5.0.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" pub_semver: 2.1.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" shelf: 1.4.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" process: 5.0.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" pub_semver: 2.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" shelf: 1.4.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" shelf_packages_handler: 3.0.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" shelf_static: 1.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" shelf_web_socket: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" source_map_stack_trace: 2.1.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" source_maps: 0.10.12 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" source_span: 1.10.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" stack_trace: 1.11.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" stream_channel: 2.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" string_scanner: 1.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" shelf_static: 1.1.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" shelf_web_socket: 2.0.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" source_map_stack_trace: 2.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" source_maps: 0.10.13 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" source_span: 1.10.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" stack_trace: 1.12.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" stream_channel: 2.1.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" string_scanner: 1.4.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" sync_http: 0.3.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" term_glyph: 1.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" test_api: 0.6.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" test_core: 0.5.9 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" typed_data: 1.3.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" vm_service: 13.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" watcher: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" web: 0.4.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" web_socket_channel: 2.4.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" webdriver: 3.0.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" term_glyph: 1.2.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" test_api: 0.7.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" test_core: 0.6.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" typed_data: 1.4.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" vm_service: 15.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" watcher: 1.1.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" web: 1.1.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" web_socket: 0.1.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" web_socket_channel: 3.0.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" webdriver: 3.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" webkit_inspection_protocol: 1.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" yaml: 3.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" yaml: 3.1.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
flutter: uses-material-design: true
# PUBSPEC CHECKSUM: e00b# PUBSPEC CHECKSUM: 2cd73 unmodified lines45678789103 unmodified lines
import 'dart:async';
import 'goldens_io.dart' if (dart.library.html) 'goldens_web.dart' as flutter_goldens;import 'goldens_io.dart' if (dart.library.js_interop) 'goldens_web.dart' as flutter_goldens;
Future<void> testExecutable(FutureOr<void> Function() testMain) { // Enable golden file testing using Skia Gold.2 unmodified lines345667891011111213121314152 unmodified lines// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/material/bottom_navigation_bar/bottom_navigation_bar.1.dart' as example;import 'package:flutter_api_samples/material/bottom_navigation_bar/bottom_navigation_bar.1.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('BottomNavigationBar Updates Screen Content', (WidgetTester tester) async { await tester.pumpWidget( const example.BottomNavigationBarExampleApp(), ); await tester.pumpWidget(const example.BottomNavigationBarExampleApp());
expect(find.widgetWithText(AppBar, 'BottomNavigationBar Sample'), findsOneWidget); expect(find.byType(BottomNavigationBar), findsOneWidget);2 unmodified lines345667891011111213121314152 unmodified lines// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/material/bottom_navigation_bar/bottom_navigation_bar.2.dart' as example;import 'package:flutter_api_samples/material/bottom_navigation_bar/bottom_navigation_bar.2.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('BottomNavigationBar Updates Screen Content', (WidgetTester tester) async { await tester.pumpWidget( const example.BottomNavigationBarExampleApp(), ); await tester.pumpWidget(const example.BottomNavigationBarExampleApp());
expect(find.widgetWithText(AppBar, 'BottomNavigationBar Sample'), findsOneWidget); expect(find.byType(BottomNavigationBar), findsOneWidget);6 unmodified lines78910111213101112131415166 unmodified linesimport 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('Bottom sheet animation can be customized using AnimationStyle', (WidgetTester tester) async { await tester.pumpWidget( const example.BottomSheetExampleApp(), ); testWidgets('Bottom sheet animation can be customized using AnimationStyle', ( WidgetTester tester, ) async { await tester.pumpWidget(const example.BottomSheetExampleApp());
// Show the bottom sheet with default animation style. await tester.tap(find.widgetWithText(ElevatedButton, 'showBottomSheet'));2 unmodified lines34566789101 unmodified line121314141516151617182 unmodified lines// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/material/bottom_sheet/show_modal_bottom_sheet.0.dart' as example;import 'package:flutter_api_samples/material/bottom_sheet/show_modal_bottom_sheet.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() {1 unmodified line const String titleText = 'Modal BottomSheet'; const String closeText = 'Close BottomSheet';
await tester.pumpWidget( const example.BottomSheetApp(), ); await tester.pumpWidget(const example.BottomSheetApp());
expect(find.text(titleText), findsNothing); expect(find.text(closeText), findsNothing);2 unmodified lines34566789101 unmodified line121314141516151617182 unmodified lines// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/material/bottom_sheet/show_modal_bottom_sheet.1.dart' as example;import 'package:flutter_api_samples/material/bottom_sheet/show_modal_bottom_sheet.1.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() {1 unmodified line const String titleText = 'Modal BottomSheet'; const String closeText = 'Close BottomSheet';
await tester.pumpWidget( const example.BottomSheetApp(), ); await tester.pumpWidget(const example.BottomSheetApp());
expect(find.text(titleText), findsNothing); expect(find.text(closeText), findsNothing);2 unmodified lines345667891010111213111213141516172 unmodified lines// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/material/bottom_sheet/show_modal_bottom_sheet.2.dart' as example;import 'package:flutter_api_samples/material/bottom_sheet/show_modal_bottom_sheet.2.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('Modal bottom sheet animation can be customized using AnimationStyle', (WidgetTester tester) async { await tester.pumpWidget( const example.ModalBottomSheetApp(), ); testWidgets('Modal bottom sheet animation can be customized using AnimationStyle', ( WidgetTester tester, ) async { await tester.pumpWidget(const example.ModalBottomSheetApp());
// Show the bottom sheet with default animation style. await tester.tap(find.widgetWithText(ElevatedButton, 'showModalBottomSheet'));2 unmodified lines34567678910121314111213141617181920211516171819202123242526272822232425262728303132333435362930313233343536383940414243443738394041424344464748495051454647484950515354555657585253545556575860616263646559606162636465676869707172736667686970717273742 unmodified lines// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/material/button_style/button_style.0.dart' as example;import 'package:flutter_api_samples/material/button_style/button_style.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets( 'Shows ElevatedButtons, FilledButtons, OutlinedButtons and TextButtons in enabled and disabled states', (WidgetTester tester) async { await tester.pumpWidget(const example.ButtonApp()); 'Shows ElevatedButtons, FilledButtons, OutlinedButtons and TextButtons in enabled and disabled states', (WidgetTester tester) async { await tester.pumpWidget(const example.ButtonApp());
expect( find.byWidgetPredicate((Widget widget) { return widget is ElevatedButton && widget.onPressed == null; }), findsOne, ); expect( find.byWidgetPredicate((Widget widget) { return widget is ElevatedButton && widget.onPressed == null; }), findsOne, );
expect( find.byWidgetPredicate((Widget widget) { return widget is ElevatedButton && widget.onPressed != null; }), findsOne, ); expect( find.byWidgetPredicate((Widget widget) { return widget is ElevatedButton && widget.onPressed != null; }), findsOne, );
// One OutlinedButton with onPressed null. expect( find.byWidgetPredicate((Widget widget) { return widget is OutlinedButton && widget.onPressed == null; }), findsOne, ); // One OutlinedButton with onPressed null. expect( find.byWidgetPredicate((Widget widget) { return widget is OutlinedButton && widget.onPressed == null; }), findsOne, );
// One OutlinedButton with onPressed not null. expect( find.byWidgetPredicate((Widget widget) { return widget is OutlinedButton && widget.onPressed != null; }), findsOne, ); // One OutlinedButton with onPressed not null. expect( find.byWidgetPredicate((Widget widget) { return widget is OutlinedButton && widget.onPressed != null; }), findsOne, );
expect( find.byWidgetPredicate((Widget widget) { return widget is TextButton && widget.onPressed == null; }), findsOne, ); expect( find.byWidgetPredicate((Widget widget) { return widget is TextButton && widget.onPressed == null; }), findsOne, );
expect( find.byWidgetPredicate((Widget widget) { return widget is TextButton && widget.onPressed != null; }), findsOne, ); expect( find.byWidgetPredicate((Widget widget) { return widget is TextButton && widget.onPressed != null; }), findsOne, );
expect( find.byWidgetPredicate((Widget widget) { return widget is FilledButton && widget.onPressed != null; }), findsNWidgets(2), ); expect( find.byWidgetPredicate((Widget widget) { return widget is FilledButton && widget.onPressed != null; }), findsNWidgets(2), );
expect( find.byWidgetPredicate((Widget widget) { return widget is FilledButton && widget.onPressed == null; }), findsNWidgets(2), ); }); expect( find.byWidgetPredicate((Widget widget) { return widget is FilledButton && widget.onPressed == null; }), findsNWidgets(2), ); }, );}2 unmodified lines34566789101011121311121314151616171819171819202 unmodified lines// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/material/button_style_button/button_style_button.icon_alignment.0.dart' as example;import 'package:flutter_api_samples/material/button_style_button/button_style_button.icon_alignment.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('ButtonStyleButton.iconAlignment updates button icons alignment', (WidgetTester tester) async { await tester.pumpWidget( const example.ButtonStyleButtonIconAlignmentApp(), ); testWidgets('ButtonStyleButton.iconAlignment updates button icons alignment', ( WidgetTester tester, ) async { await tester.pumpWidget(const example.ButtonStyleButtonIconAlignmentApp());
Finder findButtonMaterial(String text) { return find.ancestor( of: find.text(text), matching: find.byType(Material), ).first; return find.ancestor(of: find.text(text), matching: find.byType(Material)).first; }
void expectedLeftIconPosition({7 unmodified lines89101112131112131417151617181920217 unmodified lines
void main() { testWidgets('Card Smoke Test', (WidgetTester tester) async { await tester.pumpWidget( const example.CardExampleApp(), ); await tester.pumpWidget(const example.CardExampleApp()); expect(find.byType(Card), findsOneWidget); expect(find.widgetWithIcon(Card, Icons.album), findsOneWidget); expect(find.widgetWithText(Card, 'The Enchanted Nightingale'), findsOneWidget); expect(find.widgetWithText(Card, 'Music by Julie Gable. Lyrics by Sidney Stein.'), findsOneWidget); expect( find.widgetWithText(Card, 'Music by Julie Gable. Lyrics by Sidney Stein.'), findsOneWidget, ); expect(find.widgetWithText(Card, 'BUY TICKETS'), findsOneWidget); expect(find.widgetWithText(Card, 'LISTEN'), findsOneWidget); });17 unmodified lines18192021222324212223242526273132333428293031323336343536373841424344394041424344454647484950515152535455525354555657585759606117 unmodified lines
Material getCardMaterial(WidgetTester tester, int cardIndex) { return tester.widget<Material>( find.descendant( of: find.byType(Card).at(cardIndex), matching: find.byType(Material), ), find.descendant(of: find.byType(Card).at(cardIndex), matching: find.byType(Material)), ); }
final Material defaultCard = getCardMaterial(tester, 0); expect(defaultCard.clipBehavior, Clip.none); expect(defaultCard.elevation, 1.0); expect(defaultCard.shape, const RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(12.0)), )); expect(defaultCard.color, const Color(0xfffffbfe)); expect( defaultCard.shape, const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(12.0))), ); expect(defaultCard.color, const Color(0xfff7f2fa)); expect(defaultCard.shadowColor, const Color(0xff000000)); expect(defaultCard.surfaceTintColor, const Color(0xff6750a4)); expect(defaultCard.surfaceTintColor, Colors.transparent);
final Material filledCard = getCardMaterial(tester, 1); expect(filledCard.clipBehavior, Clip.none); expect(filledCard.elevation, 0.0); expect(filledCard.shape, const RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(12.0)), )); expect(filledCard.color, const Color(0xffe7e0ec)); expect( filledCard.shape, const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(12.0))), ); expect(filledCard.color, const Color(0xffe6e0e9)); expect(filledCard.shadowColor, const Color(0xff000000)); expect(filledCard.surfaceTintColor, const Color(0x00000000));
final Material outlinedCard = getCardMaterial(tester, 2); expect(outlinedCard.clipBehavior, Clip.none); expect(outlinedCard.elevation, 0.0); expect( outlinedCard.shape, expect(outlinedCard.shape, const RoundedRectangleBorder( side: BorderSide(color: Color(0xffcac4d0)), borderRadius: BorderRadius.all(Radius.circular(12.0)), )); expect(outlinedCard.color, const Color(0xfffffbfe)); const RoundedRectangleBorder( side: BorderSide(color: Color(0xffcac4d0)), borderRadius: BorderRadius.all(Radius.circular(12.0)), ), ); expect(outlinedCard.color, const Color(0xfffef7ff)); expect(outlinedCard.shadowColor, const Color(0xff000000)); expect(outlinedCard.surfaceTintColor, const Color(0xff6750a4)); expect(outlinedCard.surfaceTintColor, Colors.transparent); });}1 unmodified line234567891011121314151617181112131419202122232425262728293031323334353637161738394041421 unmodified line// Use of this source code is governed by a BSD-style license that can be// found in the LICENSE file.
import 'dart:io';
import 'package:flutter/material.dart';import 'package:flutter_api_samples/material/carousel/carousel.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { // The app being tested loads images via HTTP which the test // framework defeats by default. setUpAll(() { HttpOverrides.global = null; });
testWidgets('Carousel Smoke Test', (WidgetTester tester) async { await tester.pumpWidget( const example.CarouselExampleApp(), ); expect(find.byType(CarouselView), findsOneWidget); await tester.pumpWidget(const example.CarouselExampleApp());
expect(find.widgetWithText(example.HeroLayoutCard, 'Through the Pane'), findsOneWidget); final Finder firstCarousel = find.byType(CarouselView).first; await tester.drag(firstCarousel, const Offset(150, 0)); await tester.pumpAndSettle(); expect(find.widgetWithText(example.HeroLayoutCard, 'The Flow'), findsOneWidget);
await tester.drag(firstCarousel, const Offset(0, -200)); await tester.pumpAndSettle();
expect(find.widgetWithText(CarouselView, 'Cameras'), findsOneWidget); expect(find.widgetWithText(CarouselView, 'Lighting'), findsOneWidget); expect(find.widgetWithText(CarouselView, 'Climate'), findsOneWidget); expect(find.widgetWithText(CarouselView, 'Wifi'), findsOneWidget);
await tester.drag(find.widgetWithText(CarouselView, 'Cameras'), const Offset(0, -200)); await tester.pumpAndSettle();
expect(find.widgetWithText(example.UncontainedLayoutCard, 'Item 0'), findsOneWidget); expect(find.widgetWithText(example.UncontainedLayoutCard, 'Item 1'), findsOneWidget); expect(find.text('Uncontained layout'), findsOneWidget); expect(find.widgetWithText(CarouselView, 'Show 0'), findsOneWidget); expect(find.widgetWithText(CarouselView, 'Show 1'), findsOneWidget); });}2 unmodified lines345676789101213141112131412 unmodified lines2728293334353031323839404142434445464748495051525354555657333435363738392 unmodified lines// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/material/checkbox/checkbox.0.dart' as example;import 'package:flutter_api_samples/material/checkbox/checkbox.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('Checkbox can be checked', (WidgetTester tester) async { await tester.pumpWidget( const example.CheckboxExampleApp(), ); await tester.pumpWidget(const example.CheckboxExampleApp());
Checkbox checkbox = tester.widget(find.byType(Checkbox)); expect(checkbox.value, isFalse);12 unmodified lines });
testWidgets('Checkbox color can be changed', (WidgetTester tester) async { await tester.pumpWidget( const example.CheckboxExampleApp(), ); await tester.pumpWidget(const example.CheckboxExampleApp()); final Checkbox checkbox = tester.widget(find.byType(Checkbox));
expect( checkbox.checkColor, Colors.white, ); expect( checkbox.fillColor!.resolve(<MaterialState>{}), Colors.red, ); expect( checkbox.fillColor!.resolve(<MaterialState>{MaterialState.pressed}), Colors.blue, ); expect( checkbox.fillColor!.resolve(<MaterialState>{MaterialState.hovered}), Colors.blue, ); expect( checkbox.fillColor!.resolve(<MaterialState>{MaterialState.focused}), Colors.blue, ); expect(checkbox.checkColor, Colors.white); expect(checkbox.fillColor!.resolve(<MaterialState>{}), Colors.red); expect(checkbox.fillColor!.resolve(<MaterialState>{MaterialState.pressed}), Colors.blue); expect(checkbox.fillColor!.resolve(<MaterialState>{MaterialState.hovered}), Colors.blue); expect(checkbox.fillColor!.resolve(<MaterialState>{MaterialState.focused}), Colors.blue); });}2 unmodified lines34567678910121314111213142 unmodified lines// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/material/checkbox/checkbox.1.dart' as example;import 'package:flutter_api_samples/material/checkbox/checkbox.1.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('Checkbox can be checked', (WidgetTester tester) async { await tester.pumpWidget( const example.CheckboxExampleApp(), ); await tester.pumpWidget(const example.CheckboxExampleApp());
expect(find.byType(Checkbox), findsNWidgets(3)); Checkbox checkbox = tester.widget(find.byType(Checkbox).first);3 unmodified lines4567789101112121314131415163 unmodified lines
import 'package:flutter/material.dart';import 'package:flutter/scheduler.dart';import 'package:flutter_api_samples/material/checkbox_list_tile/checkbox_list_tile.0.dart' as example;import 'package:flutter_api_samples/material/checkbox_list_tile/checkbox_list_tile.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('CheckboxListTile can be checked', (WidgetTester tester) async { await tester.pumpWidget( const example.CheckboxListTileApp(), ); await tester.pumpWidget(const example.CheckboxListTileApp());
CheckboxListTile checkboxListTile = tester.widget(find.byType(CheckboxListTile)); expect(checkboxListTile.value, isFalse);2 unmodified lines3456678910111112131213141517 unmodified lines333435373839363738392 unmodified lines// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/material/checkbox_list_tile/checkbox_list_tile.1.dart' as example;import 'package:flutter_api_samples/material/checkbox_list_tile/checkbox_list_tile.1.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('Checkbox aligns appropriately', (WidgetTester tester) async { await tester.pumpWidget( const example.CheckboxListTileApp(), ); await tester.pumpWidget(const example.CheckboxListTileApp());
expect(find.byType(CheckboxListTile), findsNWidgets(3));
17 unmodified lines });
testWidgets('Checkboxes can be checked', (WidgetTester tester) async { await tester.pumpWidget( const example.CheckboxListTileApp(), ); await tester.pumpWidget(const example.CheckboxListTileApp());
expect(find.byType(CheckboxListTile), findsNWidgets(3));
2 unmodified lines345667891011111213121314152 unmodified lines// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/material/checkbox_list_tile/custom_labeled_checkbox.0.dart' as example;import 'package:flutter_api_samples/material/checkbox_list_tile/custom_labeled_checkbox.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('LinkedLabelCheckbox contains RichText and Checkbox', (WidgetTester tester) async { await tester.pumpWidget( const example.LabeledCheckboxApp(), ); await tester.pumpWidget(const example.LabeledCheckboxApp());
// Label text is in a RichText widget with the correct text. final RichText richText = tester.widget(find.byType(RichText).first);2 unmodified lines345667891011111213121314152 unmodified lines// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/material/checkbox_list_tile/custom_labeled_checkbox.1.dart' as example;import 'package:flutter_api_samples/material/checkbox_list_tile/custom_labeled_checkbox.1.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('Tapping LabeledCheckbox toggles the checkbox', (WidgetTester tester) async { await tester.pumpWidget( const example.LabeledCheckboxApp(), ); await tester.pumpWidget(const example.LabeledCheckboxApp());
// Checkbox is initially unchecked. Checkbox checkbox = tester.widget(find.byType(Checkbox));2 unmodified lines3456678910101112131415161715161718192021222223242523242526272827293031323334353435363736373839404139424344454647484647484949505152535451555657582 unmodified lines// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/material/chip/chip_attributes.avatar_box_constraints.0.dart' as example;import 'package:flutter_api_samples/material/chip/chip_attributes.avatar_box_constraints.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('RawChip.avatarBoxConstraints updates avatar size constraints', (WidgetTester tester) async { testWidgets('RawChip.avatarBoxConstraints updates avatar size constraints', ( WidgetTester tester, ) async { const double border = 1.0; const double iconSize = 18.0; const double padding = 8.0;
await tester.pumpWidget( const example.AvatarBoxConstraintsApp(), ); await tester.pumpWidget(const example.AvatarBoxConstraintsApp());
expect(tester.getSize(find.byType(RawChip).at(0)).width, equals(202.0)); expect(tester.getSize(find.byType(RawChip).at(0)).height, equals(58.0));
Offset chipTopLeft = tester.getTopLeft(find.byWidget(tester.widget<Material>( find.descendant( of: find.byType(RawChip).at(0), matching: find.byType(Material), Offset chipTopLeft = tester.getTopLeft( find.byWidget( tester.widget<Material>( find.descendant(of: find.byType(RawChip).at(0), matching: find.byType(Material)), ), ), ))); ); Offset avatarCenter = tester.getCenter(find.byIcon(Icons.star).at(0)); expect(chipTopLeft.dx, avatarCenter.dx - (iconSize / 2) - padding - border);
expect(tester.getSize(find.byType(RawChip).at(1)).width, equals(202.0)); expect(tester.getSize(find.byType(RawChip).at(1)).height, equals(78.0));
chipTopLeft = tester.getTopLeft(find.byWidget(tester.widget<Material>( find.descendant( of: find.byType(RawChip).at(1), matching: find.byType(Material), chipTopLeft = tester.getTopLeft( find.byWidget( tester.widget<Material>( find.descendant(of: find.byType(RawChip).at(1), matching: find.byType(Material)), ), ), ))); ); avatarCenter = tester.getCenter(find.byIcon(Icons.star).at(1)); expect(chipTopLeft.dx, avatarCenter.dx - (iconSize / 2) - padding - border);
expect(tester.getSize(find.byType(RawChip).at(2)).width, equals(202.0)); expect(tester.getSize(find.byType(RawChip).at(2)).height, equals(78.0));
chipTopLeft = tester.getTopLeft(find.byWidget(tester.widget<Material>( find.descendant( of: find.byType(RawChip).at(2), matching: find.byType(Material), chipTopLeft = tester.getTopLeft( find.byWidget( tester.widget<Material>( find.descendant(of: find.byType(RawChip).at(2), matching: find.byType(Material)), ), ), ))); ); avatarCenter = tester.getCenter(find.byIcon(Icons.star).at(2)); expect(chipTopLeft.dx, avatarCenter.dx - (iconSize / 2) - padding - border); });2 unmodified lines3456678910101112131112131415161725 unmodified lines434445454647484647484950515225 unmodified lines787980808182838182838485868718 unmodified lines1061071081081091101111091101111121131141152 unmodified lines// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/material/chip/chip_attributes.chip_animation_style.0.dart' as example;import 'package:flutter_api_samples/material/chip/chip_attributes.chip_animation_style.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('ChipAnimationStyle.enableAnimation overrides chip enable animation', (WidgetTester tester) async { await tester.pumpWidget( const example.ChipAnimationStyleExampleApp(), ); testWidgets('ChipAnimationStyle.enableAnimation overrides chip enable animation', ( WidgetTester tester, ) async { await tester.pumpWidget(const example.ChipAnimationStyleExampleApp());
final RenderBox materialBox = tester.firstRenderObject<RenderBox>( find.descendant(25 unmodified lines expect(materialBox, paints..rrect(color: const Color(0xffffc107))); });
testWidgets('ChipAnimationStyle.selectAnimation overrides chip select animation', (WidgetTester tester) async { await tester.pumpWidget( const example.ChipAnimationStyleExampleApp(), ); testWidgets('ChipAnimationStyle.selectAnimation overrides chip select animation', ( WidgetTester tester, ) async { await tester.pumpWidget(const example.ChipAnimationStyleExampleApp());
final RenderBox materialBox = tester.firstRenderObject<RenderBox>( find.descendant(25 unmodified lines expect(materialBox, paints..rrect(color: const Color(0xffffc107))); });
testWidgets('ChipAnimationStyle.avatarDrawerAnimation overrides chip checkmark animation', (WidgetTester tester) async { await tester.pumpWidget( const example.ChipAnimationStyleExampleApp(), ); testWidgets('ChipAnimationStyle.avatarDrawerAnimation overrides chip checkmark animation', ( WidgetTester tester, ) async { await tester.pumpWidget(const example.ChipAnimationStyleExampleApp());
expect(tester.getSize(find.widgetWithText(RawChip, 'Checked')).width, closeTo(152.6, 0.1));
18 unmodified lines expect(tester.getSize(find.widgetWithText(RawChip, 'Checked')).width, closeTo(152.6, 0.1)); });
testWidgets('ChipAnimationStyle.deleteDrawerAnimation overrides chip delete icon animation', (WidgetTester tester) async { await tester.pumpWidget( const example.ChipAnimationStyleExampleApp(), ); testWidgets('ChipAnimationStyle.deleteDrawerAnimation overrides chip delete icon animation', ( WidgetTester tester, ) async { await tester.pumpWidget(const example.ChipAnimationStyleExampleApp());
expect(tester.getSize(find.widgetWithText(RawChip, 'Deletable')).width, closeTo(180.9, 0.1));
13 unmodified lines1415161718191718192013 unmodified lines
void main() { testWidgets('Example app has a placeholder', (WidgetTester tester) async { await tester.pumpWidget( const example.SampleApp(), ); await tester.pumpWidget(const example.SampleApp());
expect(find.byType(Placeholder), findsOneWidget); });13 unmodified lines1415161718191718192013 unmodified lines
void main() { testWidgets('Example app has a placeholder', (WidgetTester tester) async { await tester.pumpWidget( const example.SampleApp(), ); await tester.pumpWidget(const example.SampleApp());
expect(find.byType(Scaffold), findsOneWidget); expect(find.byType(Placeholder), findsOneWidget);13 unmodified lines1415161718191718192013 unmodified lines
void main() { testWidgets('Example app has a placeholder', (WidgetTester tester) async { await tester.pumpWidget( const example.SampleApp(), ); await tester.pumpWidget(const example.SampleApp());
expect(find.byType(Placeholder), findsOneWidget); });11 unmodified lines12131415161718192015161718192021222311 unmodified lines final _MockClipboard mockClipboard = _MockClipboard();
testWidgets('Copies text on Ctrl-C', (WidgetTester tester) async { tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(SystemChannels.platform, mockClipboard.handleMethodCall); await tester.pumpWidget(const MaterialApp( home: Scaffold( body: Center(child: example.VerificationCodeGenerator()), ), ), tester.binding.defaultBinaryMessenger.setMockMethodCallHandler( SystemChannels.platform, mockClipboard.handleMethodCall, ); await tester.pumpWidget( const MaterialApp(home: Scaffold(body: Center(child: example.VerificationCodeGenerator()))), );
expect(primaryFocus, isNotNull);1234567891011121314151617181920212223242526272829303132333435363738394041424344454647// Copyright 2014 The Flutter Authors. All rights reserved.// 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_api_samples/widgets/actions/action_listener.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('ActionListener can be enabled, triggered, and disabled', ( WidgetTester tester, ) async { final List<String?> log = <String?>[];
final DebugPrintCallback originalDebugPrint = debugPrint; debugPrint = (String? message, {int? wrapWidth}) { log.add(message); }; try { await tester.pumpWidget(const example.ActionListenerExampleApp());
expect(find.widgetWithText(AppBar, 'ActionListener Sample'), findsOne); expect(find.widgetWithText(OutlinedButton, 'Enable'), findsOne);
await tester.tap(find.byType(OutlinedButton)); await tester.pump();
expect(find.widgetWithText(OutlinedButton, 'Disable'), findsOne); expect(find.widgetWithText(ElevatedButton, 'Call Action Listener'), findsOne); expect(log, const <String?>['Action Listener was added']);
await tester.tap(find.text('Call Action Listener')); await tester.pumpAndSettle();
expect(find.widgetWithText(SnackBar, 'Action Listener Called'), findsOne);
await tester.tap(find.text('Disable')); await tester.pump();
expect(find.widgetWithText(OutlinedButton, 'Enable'), findsOne); expect(log, const <String?>['Action Listener was added', 'Action Listener was removed']); } finally { debugPrint = originalDebugPrint; } });}11 unmodified lines121314151617151617181 unmodified line2021222526272324252619 unmodified lines4647485354554950515226 unmodified lines79808188899082838485868796979899888990916 unmodified lines98991001121131141151011021031049 unmodified lines11411511613113213313411711811912011 unmodified lines final ButtonStyleButton button = tester.widget<ButtonStyleButton>( find.descendant( of: find.byType(example.SaveButton), matching: find.byWidgetPredicate( (Widget widget) => widget is TextButton, ), matching: find.byWidgetPredicate((Widget widget) => widget is TextButton), ), );
1 unmodified line }
testWidgets('Increments and decrements value', (WidgetTester tester) async { await tester.pumpWidget( const example.ActionsExampleApp(), ); await tester.pumpWidget(const example.ActionsExampleApp());
int value = 0;
19 unmodified lines });
testWidgets('SaveButton indicates dirty status', (WidgetTester tester) async { await tester.pumpWidget( const example.ActionsExampleApp(), ); await tester.pumpWidget(const example.ActionsExampleApp());
// Verify that initial color is green, as the value is not marked as dirty. Color? saveButtonColor = getSaveButtonColor(tester);26 unmodified lines log.add(message); };
await tester.pumpWidget( const example.ActionsExampleApp(), ); await tester.pumpWidget(const example.ActionsExampleApp());
// Verify that value is not marked as dirty. Color? saveButtonColor = getSaveButtonColor(tester); expect(saveButtonColor, equals(Colors.green)); expect( find.descendant( of: find.byType(example.SaveButton), matching: find.text('0'), ), find.descendant(of: find.byType(example.SaveButton), matching: find.text('0')), findsOneWidget, );
6 unmodified lines saveButtonColor = getSaveButtonColor(tester); expect(saveButtonColor, equals(Colors.red)); expect( find.descendant( of: find.byType(example.SaveButton), matching: find.text('0'), ), find.descendant(of: find.byType(example.SaveButton), matching: find.text('0')), findsOneWidget, );
9 unmodified lines saveButtonColor = getSaveButtonColor(tester); expect(saveButtonColor, equals(Colors.green)); expect( find.descendant( of: find.byType(example.SaveButton), matching: find.text('-1'), ), find.descendant(of: find.byType(example.SaveButton), matching: find.text('-1')), findsOneWidget, );
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667// Copyright 2014 The Flutter Authors. All rights reserved.// Use of this source code is governed by a BSD-style license that can be// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:flutter_api_samples/widgets/actions/focusable_action_detector.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { final Finder redContainerFinder = find.byWidgetPredicate( (Widget widget) => widget is Container && widget.color == Colors.red, );
testWidgets('Taps on the "And me" button toggle the red box', (WidgetTester tester) async { await tester.pumpWidget(const example.FocusableActionDetectorExampleApp());
expect(find.widgetWithText(AppBar, 'FocusableActionDetector Example'), findsOne);
expect(redContainerFinder, findsNothing);
await tester.tap(find.text('And Me')); await tester.pump();
expect(redContainerFinder, findsOne);
await tester.tap(find.text('And Me')); await tester.pump();
expect(redContainerFinder, findsNothing); });
testWidgets('Hits on the X key when "And me" is focused toggle the red box', ( WidgetTester tester, ) async { await tester.pumpWidget(const example.FocusableActionDetectorExampleApp());
expect(find.widgetWithText(AppBar, 'FocusableActionDetector Example'), findsOne);
expect(redContainerFinder, findsNothing);
await tester.sendKeyEvent(LogicalKeyboardKey.tab); // Focuses the "Press Me" button. await tester.pump();
expect(redContainerFinder, findsNothing);
await tester.sendKeyEvent(LogicalKeyboardKey.keyX); await tester.pump();
expect(redContainerFinder, findsNothing);
await tester.sendKeyEvent(LogicalKeyboardKey.tab); // Focuses the "And Me" button. await tester.pump();
expect(redContainerFinder, findsNothing);
await tester.sendKeyEvent(LogicalKeyboardKey.keyX); await tester.pump();
expect(redContainerFinder, findsOne);
await tester.sendKeyEvent(LogicalKeyboardKey.keyX); await tester.pump();
expect(redContainerFinder, findsNothing); });}2 unmodified lines34567678910121314111213142 unmodified lines// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/widgets/animated_grid/animated_grid.0.dart' as example;import 'package:flutter_api_samples/widgets/animated_grid/animated_grid.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('AnimatedGrid example', (WidgetTester tester) async { await tester.pumpWidget( const example.AnimatedGridSample(), ); await tester.pumpWidget(const example.AnimatedGridSample());
expect(find.text('1'), findsOneWidget); expect(find.text('2'), findsOneWidget);2 unmodified lines34567678910121314111213142 unmodified lines// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/widgets/animated_grid/sliver_animated_grid.0.dart' as example;import 'package:flutter_api_samples/widgets/animated_grid/sliver_animated_grid.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('SliverAnimatedGrid example', (WidgetTester tester) async { await tester.pumpWidget( const example.SliverAnimatedGridSample(), ); await tester.pumpWidget(const example.SliverAnimatedGridSample());
expect(find.text('1'), findsOneWidget); expect(find.text('2'), findsOneWidget);1234567891011121314151617181920212223242526272829303132333435363738394041424344// Copyright 2014 The Flutter Authors. All rights reserved.// Use of this source code is governed by a BSD-style license that can be// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/widgets/animated_list/animated_list.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('Items can be selected, added, and removed from AnimatedList', ( WidgetTester tester, ) async { await tester.pumpWidget(const example.AnimatedListSample());
expect(find.text('Item 0'), findsOne); expect(find.text('Item 1'), findsOne); expect(find.text('Item 2'), findsOne);
// Add an item at the end of the list. await tester.tap(find.byIcon(Icons.add_circle)); await tester.pumpAndSettle(); expect(find.text('Item 3'), findsOne);
// Select Item 1. await tester.tap(find.text('Item 1')); await tester.pumpAndSettle();
// Add item at the top of the list. await tester.tap(find.byIcon(Icons.add_circle)); await tester.pumpAndSettle(); expect(find.text('Item 4'), findsOne);
// Remove selected item. await tester.tap(find.byIcon(Icons.remove_circle));
// Item animation is not completed. await tester.pump(); expect(find.text('Item 1'), findsOne);
// When the animation completes, Item 1 disappears. await tester.pumpAndSettle(); expect(find.text('Item 1'), findsNothing); });}2 unmodified lines345667891010111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455562 unmodified lines// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/widgets/animated_list/animated_list_separated.0.dart' as example;import 'package:flutter_api_samples/widgets/animated_list/animated_list_separated.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets( 'Items can be selected, added, and removed from AnimatedList.separated', (WidgetTester tester) async { await tester.pumpWidget(const example.AnimatedListSeparatedSample());
expect(find.text('Item 0'), findsOneWidget); expect(find.text('Separator 0'), findsOneWidget); expect(find.text('Item 1'), findsOneWidget); expect(find.text('Separator 1'), findsOneWidget); expect(find.text('Item 2'), findsOneWidget);
// Add an item at the end of the list await tester.tap(find.byIcon(Icons.add_circle)); await tester.pumpAndSettle(); expect(find.text('Separator 2'), findsOneWidget); expect(find.text('Item 3'), findsOneWidget);
// Select Item 1. await tester.tap(find.text('Item 1')); await tester.pumpAndSettle();
// Add item at the top of the list await tester.tap(find.byIcon(Icons.add_circle)); await tester.pumpAndSettle(); expect(find.text('Item 4'), findsOneWidget); // Contrary to the behavior for insertion at other places, // the Separator for the last item of the list will be added // before that item instead of after it. expect(find.text('Separator 4'), findsOneWidget);
// Remove selected item. await tester.tap(find.byIcon(Icons.remove_circle));
// Item animation is not completed. await tester.pump(); expect(find.text('Item 1'), findsOneWidget); expect(find.text('Separator 1'), findsNothing); expect(find.text('Removing separator'), findsOneWidget);
// When the animation completes, Item 1 disappears. await tester.pumpAndSettle(); expect(find.text('Item 1'), findsNothing); expect(find.text('Separator 1'), findsNothing); expect(find.text('Removing separator'), findsNothing); }, ); testWidgets('Items can be selected, added, and removed from AnimatedList.separated', ( WidgetTester tester, ) async { await tester.pumpWidget(const example.AnimatedListSeparatedSample());
expect(find.text('Item 0'), findsOneWidget); expect(find.text('Separator 0'), findsOneWidget); expect(find.text('Item 1'), findsOneWidget); expect(find.text('Separator 1'), findsOneWidget); expect(find.text('Item 2'), findsOneWidget);
// Add an item at the end of the list await tester.tap(find.byIcon(Icons.add_circle)); await tester.pumpAndSettle(); expect(find.text('Separator 2'), findsOneWidget); expect(find.text('Item 3'), findsOneWidget);
// Select Item 1. await tester.tap(find.text('Item 1')); await tester.pumpAndSettle();
// Add item at the top of the list await tester.tap(find.byIcon(Icons.add_circle)); await tester.pumpAndSettle(); expect(find.text('Item 4'), findsOneWidget); // Contrary to the behavior for insertion at other places, // the Separator for the last item of the list will be added // before that item instead of after it. expect(find.text('Separator 4'), findsOneWidget);
// Remove selected item. await tester.tap(find.byIcon(Icons.remove_circle));
// Item animation is not completed. await tester.pump(); expect(find.text('Item 1'), findsOneWidget); expect(find.text('Separator 1'), findsNothing); expect(find.text('Removing separator'), findsOneWidget);
// When the animation completes, Item 1 disappears. await tester.pumpAndSettle(); expect(find.text('Item 1'), findsNothing); expect(find.text('Separator 1'), findsNothing); expect(find.text('Removing separator'), findsNothing); });}6 unmodified lines789101112131415161718192021222324252627282930313233343536373839404142434410111213141516171819202122232425262728293031323334353637383940414243446 unmodified linesimport 'package:flutter_test/flutter_test.dart';
void main() { testWidgets( 'Items can be selected, added, and removed from SliverAnimatedList', (WidgetTester tester) async { await tester.pumpWidget(const example.SliverAnimatedListSample());
expect(find.text('Item 0'), findsOneWidget); expect(find.text('Item 1'), findsOneWidget); expect(find.text('Item 2'), findsOneWidget);
// Add an item at the end of the list await tester.tap(find.byIcon(Icons.add_circle)); await tester.pumpAndSettle(); expect(find.text('Item 3'), findsOneWidget);
// Select Item 1. await tester.tap(find.text('Item 1')); await tester.pumpAndSettle();
// Add item at the top of the list await tester.tap(find.byIcon(Icons.add_circle)); await tester.pumpAndSettle(); expect(find.text('Item 4'), findsOneWidget);
// Remove selected item. await tester.tap(find.byIcon(Icons.remove_circle));
// Item animation is not completed. await tester.pump(); expect(find.text('Item 1'), findsOneWidget);
// When the animation completes, Item 1 disappears. await tester.pumpAndSettle(); expect(find.text('Item 1'), findsNothing); }, ); testWidgets('Items can be selected, added, and removed from SliverAnimatedList', ( WidgetTester tester, ) async { await tester.pumpWidget(const example.SliverAnimatedListSample());
expect(find.text('Item 0'), findsOneWidget); expect(find.text('Item 1'), findsOneWidget); expect(find.text('Item 2'), findsOneWidget);
// Add an item at the end of the list await tester.tap(find.byIcon(Icons.add_circle)); await tester.pumpAndSettle(); expect(find.text('Item 3'), findsOneWidget);
// Select Item 1. await tester.tap(find.text('Item 1')); await tester.pumpAndSettle();
// Add item at the top of the list await tester.tap(find.byIcon(Icons.add_circle)); await tester.pumpAndSettle(); expect(find.text('Item 4'), findsOneWidget);
// Remove selected item. await tester.tap(find.byIcon(Icons.remove_circle));
// Item animation is not completed. await tester.pump(); expect(find.text('Item 1'), findsOneWidget);
// When the animation completes, Item 1 disappears. await tester.pumpAndSettle(); expect(find.text('Item 1'), findsNothing); });}2 unmodified lines34567678910121314111213149 unmodified lines242526303132272829303137383940323334434445353637386 unmodified lines45464758596048495063646566515253697071545556572 unmodified lines// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/widgets/animated_size/animated_size.0.dart' as example;import 'package:flutter_api_samples/widgets/animated_size/animated_size.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('AnimatedSize animates on tap', (WidgetTester tester) async { await tester.pumpWidget( const example.AnimatedSizeExampleApp(), ); await tester.pumpWidget(const example.AnimatedSizeExampleApp());
const Size beginSize = Size.square(100.0); const Size endSize = Size.square(250.0);9 unmodified lines expect(box.size, equals(beginSize));
// Advance animation to the middle. await tester.pump( example.AnimatedSizeExampleApp.duration ~/ 2, ); await tester.pump(example.AnimatedSizeExampleApp.duration ~/ 2);
final double t = example.AnimatedSizeExampleApp.curve.transform(0.5);
box = tester.renderObject(find.byType(AnimatedSize)); expect( box.size, equals(Size.lerp(beginSize, endSize, t)), ); expect(box.size, equals(Size.lerp(beginSize, endSize, t)));
// Advance animation to the end. await tester.pump( example.AnimatedSizeExampleApp.duration ~/ 2, ); await tester.pump(example.AnimatedSizeExampleApp.duration ~/ 2);
box = tester.renderObject(find.byType(AnimatedSize)); expect(box.size, equals(endSize));6 unmodified lines expect(box.size, equals(endSize));
// Advance animation to the middle. await tester.pump( example.AnimatedSizeExampleApp.duration ~/ 2, ); await tester.pump(example.AnimatedSizeExampleApp.duration ~/ 2);
box = tester.renderObject(find.byType(AnimatedSize)); expect( box.size, equals(Size.lerp(endSize, beginSize, t)), ); expect(box.size, equals(Size.lerp(endSize, beginSize, t)));
// Advance animation to the end. await tester.pump( example.AnimatedSizeExampleApp.duration ~/ 2, ); await tester.pump(example.AnimatedSizeExampleApp.duration ~/ 2);
box = tester.renderObject(find.byType(AnimatedSize)); expect(box.size, equals(beginSize));2 unmodified lines34567678910121314111213142 unmodified lines17181923242526202122235 unmodified lines2930313839403233343515 unmodified lines51525362636465545556572 unmodified lines// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/widgets/animated_switcher/animated_switcher.0.dart' as example;import 'package:flutter_api_samples/widgets/animated_switcher/animated_switcher.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('Increments counter on button tap', (WidgetTester tester) async { await tester.pumpWidget( const example.AnimatedSwitcherExampleApp(), ); await tester.pumpWidget(const example.AnimatedSwitcherExampleApp());
int counter = 0;
2 unmodified lines while (counter < 10) { // Tap on the button to increment the counter. await tester.tap( find.ancestor( of: find.text('Increment'), matching: find.byType(ElevatedButton), ), find.ancestor(of: find.text('Increment'), matching: find.byType(ElevatedButton)), ); await tester.pumpAndSettle();
5 unmodified lines });
testWidgets('Animates counter change', (WidgetTester tester) async { await tester.pumpWidget( const example.AnimatedSwitcherExampleApp(), ); await tester.pumpWidget(const example.AnimatedSwitcherExampleApp());
// The animation duration defined in the example app. const Duration animationDuration = Duration(milliseconds: 500);15 unmodified lines
// Tap on the button to increment the counter. await tester.tap( find.ancestor( of: find.text('Increment'), matching: find.byType(ElevatedButton), ), find.ancestor(of: find.text('Increment'), matching: find.byType(ElevatedButton)), ); await tester.pump();
6 unmodified lines789101112101112136 unmodified lines
void main() { testWidgets('WidgetsApp test', (WidgetTester tester) async { await tester.pumpWidget( const example.WidgetsAppExampleApp(), ); await tester.pumpWidget(const example.WidgetsAppExampleApp());
expect(find.text('Hello World'), findsOneWidget); });1 unmodified line23455678910101112111213141 unmodified line// Use of this source code is governed by a BSD-style license that can be// found in the LICENSE file.
import 'package:flutter_api_samples/widgets/app_lifecycle_listener/app_lifecycle_listener.0.dart' as example;import 'package:flutter_api_samples/widgets/app_lifecycle_listener/app_lifecycle_listener.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('AppLifecycleListener example', (WidgetTester tester) async { await tester.pumpWidget( const example.AppLifecycleListenerExample(), ); await tester.pumpWidget(const example.AppLifecycleListenerExample());
expect(find.textContaining('Current State:'), findsOneWidget); expect(find.textContaining('State History:'), findsOneWidget);1 unmodified line23455678910101112111213141 unmodified line16171820192021221 unmodified line// Use of this source code is governed by a BSD-style license that can be// found in the LICENSE file.
import 'package:flutter_api_samples/widgets/app_lifecycle_listener/app_lifecycle_listener.1.dart' as example;import 'package:flutter_api_samples/widgets/app_lifecycle_listener/app_lifecycle_listener.1.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('AppLifecycleListener example', (WidgetTester tester) async { await tester.pumpWidget( const example.AppLifecycleListenerExample(), ); await tester.pumpWidget(const example.AppLifecycleListenerExample());
expect(find.text('Do Not Allow Exit'), findsOneWidget); expect(find.text('Allow Exit'), findsOneWidget);1 unmodified line expect(find.textContaining('Exit Request:'), findsOneWidget); await tester.tap(find.text('Quit')); await tester.pump(); // Responding to the the quit request happens in a Future that we don't have // Responding to the quit request happens in a Future that we don't have // visibility for, so to avoid a flaky test with a delay, we just check to // see if the request string prefix is still there, rather than the request // response string. Testing it wasn't worth exposing a Completer in the2 unmodified lines34567678910121314111213142 unmodified lines// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/widgets/async/future_builder.0.dart' as example;import 'package:flutter_api_samples/widgets/async/future_builder.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('StreamBuilder listens to internal stream', (WidgetTester tester) async { await tester.pumpWidget( const example.FutureBuilderExampleApp(), ); await tester.pumpWidget(const example.FutureBuilderExampleApp());
expect(find.byType(CircularProgressIndicator), findsOne); expect(find.text('Awaiting result...'), findsOne);4 unmodified lines56789891011121415161314151617 unmodified lines3435364041424344373839402 unmodified lines4344455354555657464748493 unmodified lines5354556768697071565758597 unmodified lines6768698586878889707172734 unmodified lines787980100101102103104818283844 unmodified linesimport 'dart:async';
import 'package:flutter/material.dart';import 'package:flutter_api_samples/widgets/async/stream_builder.0.dart' as example;import 'package:flutter_api_samples/widgets/async/stream_builder.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('StreamBuilder listens to internal stream', (WidgetTester tester) async { await tester.pumpWidget( const example.StreamBuilderExampleApp(), ); await tester.pumpWidget(const example.StreamBuilderExampleApp());
expect(find.byType(CircularProgressIndicator), findsOneWidget); expect(find.text('Awaiting bids...'), findsOneWidget);17 unmodified lines controller.addError('Unexpected error!', StackTrace.empty); };
await tester.pumpWidget( MaterialApp( home: example.BidsStatus(bids: controller.stream), ), ); await tester.pumpWidget(MaterialApp(home: example.BidsStatus(bids: controller.stream))); await tester.pump();
expect(find.byIcon(Icons.error_outline), findsOneWidget);2 unmodified lines });
testWidgets('BidsStatus correctly displays none state', (WidgetTester tester) async { await tester.pumpWidget( const MaterialApp( home: example.BidsStatus(bids: null), ), ); await tester.pumpWidget(const MaterialApp(home: example.BidsStatus(bids: null)));
expect(find.byIcon(Icons.info), findsOneWidget); expect(find.text('Select a lot'), findsOneWidget);3 unmodified lines final StreamController<int> controller = StreamController<int>(); addTearDown(controller.close);
await tester.pumpWidget( MaterialApp( home: example.BidsStatus(bids: controller.stream), ), ); await tester.pumpWidget(MaterialApp(home: example.BidsStatus(bids: controller.stream)));
expect(find.byType(CircularProgressIndicator), findsOneWidget); expect(find.text('Awaiting bids...'), findsOneWidget);7 unmodified lines controller.add(1); };
await tester.pumpWidget( MaterialApp( home: example.BidsStatus(bids: controller.stream), ), ); await tester.pumpWidget(MaterialApp(home: example.BidsStatus(bids: controller.stream))); await tester.pump();
expect(find.byIcon(Icons.check_circle_outline), findsOneWidget);4 unmodified lines final StreamController<int> controller = StreamController<int>(); controller.close();
await tester.pumpWidget( MaterialApp( home: example.BidsStatus(bids: controller.stream), ), ); await tester.pumpWidget(MaterialApp(home: example.BidsStatus(bids: controller.stream))); await tester.pump();
expect(find.byIcon(Icons.info), findsOneWidget);38 unmodified lines3940414243444542434445464738 unmodified lines await tester.pump();
expect(find.byType(ListTile), findsNothing); expect(find.descendant( of: find.byType(TextFormField), matching: find.text('bobcat'), ), findsOneWidget); expect( find.descendant(of: find.byType(TextFormField), matching: find.text('bobcat')), findsOneWidget, ); });}38 unmodified lines394041424344454243444546474819 unmodified lines6869707172737471727374757638 unmodified lines await tester.pump();
expect(find.byType(ListTile), findsNothing); expect(find.descendant( of: find.byType(TextFormField), matching: find.text('Bob'), ), findsOneWidget); expect( find.descendant(of: find.byType(TextFormField), matching: find.text('Bob')), findsOneWidget, ); });
testWidgets('Finds users by email address', (WidgetTester tester) async {19 unmodified lines await tester.pump();
expect(find.byType(ListTile), findsNothing); expect(find.descendant( of: find.byType(TextFormField), matching: find.text('Charlie'), ), findsOneWidget); expect( find.descendant(of: find.byType(TextFormField), matching: find.text('Charlie')), findsOneWidget, ); });}6 unmodified lines7891010111213141544 unmodified lines606162636162636464656667686970716 unmodified linesimport 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('Form is entirely visible and rejects invalid responses', (WidgetTester tester) async { testWidgets('Form is entirely visible and rejects invalid responses', ( WidgetTester tester, ) async { await tester.pumpWidget(const example.AutocompleteExampleApp()); expect(find.text('RawAutocomplete Form'), findsOneWidget); expect(find.byType(TextFormField), findsNWidgets(2));44 unmodified lines 'regular user input', );
await tester.tap( await tester.tap(find.ancestor( of: find.text('This is a RawAutocomplete!'), matching: find.byType(TextFormField), )); find.ancestor( of: find.text('This is a RawAutocomplete!'), matching: find.byType(TextFormField), ), ); await tester.pump(); expect(find.text('aardvark'), findsOneWidget); expect(find.text('bobcat'), findsOneWidget);2 unmodified lines34566789103 unmodified lines14151616171819171819202 unmodified lines232425282930312627282921 unmodified lines51525359606162545556572 unmodified lines// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/widgets/autocomplete/raw_autocomplete.focus_node.0.dart' as example;import 'package:flutter_api_samples/widgets/autocomplete/raw_autocomplete.focus_node.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() {3 unmodified lines expect(find.byType(AppBar), findsOneWidget); expect(find.byType(TextFormField), findsOneWidget); expect( find.descendant( of: find.byType(AppBar), matching: find.byType(TextFormField) ), find.descendant(of: find.byType(AppBar), matching: find.byType(TextFormField)), findsOneWidget, );
2 unmodified lines expect(find.text('bobcat'), findsNothing); expect(find.text('chameleon'), findsNothing); expect( find.ancestor( matching: find.byType(AppBar), of: find.byType(RawAutocomplete) ), find.ancestor(matching: find.byType(AppBar), of: find.byType(RawAutocomplete)), findsNothing, ); });21 unmodified lines
expect(find.byType(ListTile), findsNothing); expect( find.descendant( of: find.byType(TextFormField), matching: find.text('bobcat'), ), find.descendant(of: find.byType(TextFormField), matching: find.text('bobcat')), findsOneWidget, ); });12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364// Copyright 2014 The Flutter Authors. All rights reserved.// Use of this source code is governed by a BSD-style license that can be// found in the LICENSE file.
import 'package:flutter/material.dart';import 'package:flutter_api_samples/widgets/autofill/autofill_group.0.dart' as example;import 'package:flutter_test/flutter_test.dart';
void main() { testWidgets('AutofillGroupExample renders and updates correctly', (WidgetTester tester) async { await tester.pumpWidget(const example.AutofillGroupExampleApp());
expect(find.text('Shipping address'), findsOneWidget); expect(find.text('Billing address'), findsOneWidget); expect(find.byType(TextField), findsNWidgets(5)); expect(find.byType(Checkbox), findsOneWidget); expect(find.text('Contact Phone Number'), findsOneWidget);
final Checkbox checkbox = tester.widget(find.byType(Checkbox)); expect(checkbox.value, isTrue);
// Tap to uncheck the checkbox (to show billing address fields). await tester.tap(find.byType(Checkbox)); await tester.pump();
expect( find.byType(AutofillGroup), findsNWidgets(3), // 3 AutofillGroup widgets created );
expect( find.byType(TextField), findsNWidgets(7), // 5 initial + 2 billing address fields );
final TextField shippingAddress1 = tester.widget(find.byType(TextField).at(0)); expect(shippingAddress1.autofillHints, contains(AutofillHints.streetAddressLine1));
final TextField shippingAddress2 = tester.widget(find.byType(TextField).at(1)); expect(shippingAddress2.autofillHints, contains(AutofillHints.streetAddressLine2));
final TextField billingAddress1 = tester.widget(find.byType(TextField).at(2)); expect(billingAddress1.autofillHints, contains(AutofillHints.streetAddressLine1));
final TextField billingAddress2 = tester.widget(find.byType(TextField).at(3)); expect(billingAddress2.autofillHints, contains(AutofillHints.streetAddressLine2));
// Credit card information fields. final TextField creditCardNumber = tester.widget(find.byType(TextField).at(4)); expect(creditCardNumber.autofillHints, contains(AutofillHints.creditCardNumber));
final TextField creditCardSecurityCode = tester.widget(find.byType(TextField).at(5)); expect(creditCardSecurityCode.autofillHints, contains(AutofillHints.creditCardSecurityCode));
// Contact phone number field. final TextField phoneNumber = tester.widget(find.byType(TextField).at(6)); expect(phoneNumber.autofillHints, contains(AutofillHints.telephoneNumber));
await tester.tap(find.byType(Checkbox)); await tester.pump();
expect(find.byType(TextField), findsNWidgets(5)); });}9 unmodified lines1011121314151314151617201819202122232324252627282930273132333435369 unmodified lines
void main() { testWidgets('AbsorbPointer prevents hit testing on its child', (WidgetTester tester) async { await tester.pumpWidget( const example.AbsorbPointerApp(), ); await tester.pumpWidget(const example.AbsorbPointerApp());
// Get the center of the stack. final Offset center = tester.getCenter(find.byType(Stack).first);
final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse, pointer: 1); final TestGesture gesture = await tester.createGesture( kind: PointerDeviceKind.mouse, pointer: 1, ); // Add the point to the center of the stack where the AbsorbPointer is. await gesture.addPointer(location: center); expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.basic); expect( RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.basic, );
// Move the pointer to the left of the stack where the AbsorbPointer is not. await gesture.moveTo(center + const Offset(-100, 0)); expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.click); expect( RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.click, ); });}9 unmodified lines101112131415131415169 unmodified lines testWidgets('AspectRatio applies 16 / 9 aspect ratio on its child', (WidgetTester tester) async { const double height = 100.0;
await tester.pumpWidget( const example.AspectRatioApp(), ); await tester.pumpWidget(const example.AspectRatioApp());
final Size parentContainer = tester.getSize(find.byType(Container).first); expect(parentContainer.width, 800.0);9 unmodified lines101112131415131415169 unmodified lines testWidgets('AspectRatio applies 2.0 aspect ratio on its child', (WidgetTester tester) async { const Size containerSize = Size(100, 100);
await tester.pumpWidget( const example.AspectRatioApp(), ); await tester.pumpWidget(const example.AspectRatioApp());
final Size parentContainer = tester.getSize(find.byType(Container).first); expect(parentContainer, containerSize);9 unmodified lines101112131415131415169 unmodified lines testWidgets('AspectRatio applies 0.5 aspect ratio on its child', (WidgetTester tester) async { const Size containerSize = Size(100, 100);
await tester.pumpWidget( const example.AspectRatioApp(), ); await tester.pumpWidget(const example.AspectRatioApp());
final Size parentContainer = tester.getSize(find.byType(Container).first); expect(parentContainer, containerSize);flutter/examples/api/macos/Podfile-1
flutter/examples/api/pubspec.yaml+57-56
flutter/examples/api/test/flutter_test_config.dart+1-2
flutter/examples/api/test/material/bottom_navigation_bar/bottom_navigation_bar.1_test.dart+3-4
flutter/examples/api/test/material/bottom_navigation_bar/bottom_navigation_bar.2_test.dart+3-4
flutter/examples/api/test/material/bottom_sheet/show_bottom_sheet.0_test.dart+4-4
flutter/examples/api/test/material/bottom_sheet/show_modal_bottom_sheet.0_test.dart+3-4
flutter/examples/api/test/material/bottom_sheet/show_modal_bottom_sheet.1_test.dart+3-4
flutter/examples/api/test/material/bottom_sheet/show_modal_bottom_sheet.2_test.dart+6-5
flutter/examples/api/test/material/button_style/button_style.0_test.dart+56-56
flutter/examples/api/test/material/button_style_button/button_style_button.icon_alignment.0_test.dart+7-9
flutter/examples/api/test/material/card/card.0_test.dart+5-4
flutter/examples/api/test/material/card/card.2_test.dart+21-19
flutter/examples/api/test/material/carousel/carousel.0_test.dart+29-6
flutter/examples/api/test/material/checkbox/checkbox.0_test.dart+8-28
flutter/examples/api/test/material/checkbox/checkbox.1_test.dart+2-5
flutter/examples/api/test/material/checkbox_list_tile/checkbox_list_tile.0_test.dart+3-4
flutter/examples/api/test/material/checkbox_list_tile/checkbox_list_tile.1_test.dart+4-7
flutter/examples/api/test/material/checkbox_list_tile/custom_labeled_checkbox.0_test.dart+3-4
flutter/examples/api/test/material/checkbox_list_tile/custom_labeled_checkbox.1_test.dart+3-4
flutter/examples/api/test/material/chip/chip_attributes.avatar_box_constraints.0_test.dart+24-20
flutter/examples/api/test/material/chip/chip_attributes.chip_animation_style.0_test.dart+18-17
flutter/examples/api/test/sample_templates/cupertino.0_test.dart+1-3
flutter/examples/api/test/sample_templates/material.0_test.dart+1-3
flutter/examples/api/test/sample_templates/widgets.0_test.dart+1-3
flutter/examples/api/test/widgets/actions/action.action_overridable.0_test.dart+6-6
flutter/examples/api/test/widgets/actions/action_listener.0_test.dartAdded+47
flutter/examples/api/test/widgets/actions/actions.0_test.dart+7-24
flutter/examples/api/test/widgets/actions/focusable_action_detector.0_test.dartAdded+67
flutter/examples/api/test/widgets/animated_grid/animated_grid.0_test.dart+2-5
flutter/examples/api/test/widgets/animated_grid/sliver_animated_grid.0_test.dart+2-5
flutter/examples/api/test/widgets/animated_list/animated_list.0_test.dartAdded+44
flutter/examples/api/test/widgets/animated_list/animated_list_separated.0_test.dart+47-47
flutter/examples/api/test/widgets/animated_list/sliver_animated_list.0_test.dart+34-35
flutter/examples/api/test/widgets/animated_size/animated_size.0_test.dart+8-25
flutter/examples/api/test/widgets/animated_switcher/animated_switcher.0_test.dart+5-16
flutter/examples/api/test/widgets/app/widgets_app.widgets_app.0_test.dart+1-3
flutter/examples/api/test/widgets/app_lifecycle_listener/app_lifecycle_listener.0_test.dart+3-4
flutter/examples/api/test/widgets/app_lifecycle_listener/app_lifecycle_listener.1_test.dart+4-5
flutter/examples/api/test/widgets/async/future_builder.0_test.dart+2-5
flutter/examples/api/test/widgets/async/stream_builder.0_test.dart+7-30
flutter/examples/api/test/widgets/autocomplete/raw_autocomplete.0_test.dart+4-4
flutter/examples/api/test/widgets/autocomplete/raw_autocomplete.1_test.dart+8-8
flutter/examples/api/test/widgets/autocomplete/raw_autocomplete.2_test.dart+9-5
flutter/examples/api/test/widgets/autocomplete/raw_autocomplete.focus_node.0_test.dart+5-13
flutter/examples/api/test/widgets/autofill/autofill_group.0_test.dartAdded+64
flutter/examples/api/test/widgets/basic/absorb_pointer.0_test.dart+13-6
flutter/examples/api/test/widgets/basic/aspect_ratio.0_test.dart+1-3
flutter/examples/api/test/widgets/basic/aspect_ratio.1_test.dart+1-3
flutter/examples/api/test/widgets/basic/aspect_ratio.2_test.dart+1-3