diff --git a/analysis_options.yaml b/analysis_options.yaml index f34fbe346b..55c346a3c6 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -74,7 +74,7 @@ linter: # - avoid_positional_boolean_parameters # would have been nice to enable this but by now there's too many places that break it - avoid_print # - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356) - - avoid_redundant_argument_values + # - avoid_redundant_argument_values # not yet tested - avoid_relative_lib_imports - avoid_renaming_method_parameters - avoid_return_types_on_setters diff --git a/dev/benchmarks/complex_layout/lib/main.dart b/dev/benchmarks/complex_layout/lib/main.dart index 65f289edaf..ab5249fc64 100644 --- a/dev/benchmarks/complex_layout/lib/main.dart +++ b/dev/benchmarks/complex_layout/lib/main.dart @@ -370,6 +370,7 @@ class UserHeader extends StatelessWidget { ), Expanded( child: Column( + mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ RichText(text: TextSpan( @@ -568,6 +569,7 @@ class BottomBar extends StatelessWidget { border: Border( top: BorderSide( color: Theme.of(context).dividerColor, + width: 1.0, ), ), ), diff --git a/dev/benchmarks/complex_layout/test_memory/scroll_perf.dart b/dev/benchmarks/complex_layout/test_memory/scroll_perf.dart index addd1eff19..47dff1ac12 100644 --- a/dev/benchmarks/complex_layout/test_memory/scroll_perf.dart +++ b/dev/benchmarks/complex_layout/test_memory/scroll_perf.dart @@ -28,6 +28,7 @@ Future main() async { }, behavior: HitTestBehavior.opaque, child: const IgnorePointer( + ignoring: true, child: ComplexLayoutApp(), ), )); diff --git a/dev/benchmarks/macrobenchmarks/lib/src/color_filter_and_fade.dart b/dev/benchmarks/macrobenchmarks/lib/src/color_filter_and_fade.dart index eb7d854e3b..783ce964e6 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/color_filter_and_fade.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/color_filter_and_fade.dart @@ -147,6 +147,7 @@ class _ShadowWidget extends StatelessWidget { ), size: Size(width, height), isComplex: true, + willChange: false, ), ); } diff --git a/dev/benchmarks/macrobenchmarks/lib/src/filtered_child_animation.dart b/dev/benchmarks/macrobenchmarks/lib/src/filtered_child_animation.dart index 7d84f85c63..97bcbf7e09 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/filtered_child_animation.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/filtered_child_animation.dart @@ -73,6 +73,7 @@ class _FilteredChildAnimationPageState extends State color: Colors.green, boxShadow: complex ? [ const BoxShadow( + color: Colors.black, blurRadius: 10.0, ), ] : null, diff --git a/dev/benchmarks/macrobenchmarks/lib/src/multi_widget_construction.dart b/dev/benchmarks/macrobenchmarks/lib/src/multi_widget_construction.dart index fa242d943b..05ed764157 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/multi_widget_construction.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/multi_widget_construction.dart @@ -32,6 +32,7 @@ class _MultiWidgetConstructTableState extends State _controller = AnimationController( vsync: this, duration: const Duration(milliseconds: 10000), + lowerBound: 0, upperBound: colorList.length + 1.0, )..repeat(); } diff --git a/dev/benchmarks/macrobenchmarks/lib/src/web/bench_pageview_scroll_linethrough.dart b/dev/benchmarks/macrobenchmarks/lib/src/web/bench_pageview_scroll_linethrough.dart index d517a8ab4b..92dd2ffc2f 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/web/bench_pageview_scroll_linethrough.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/web/bench_pageview_scroll_linethrough.dart @@ -113,7 +113,7 @@ class _CustomPainter extends CustomPainter { _textPainter.text = span; - _textPainter.layout(maxWidth: width); + _textPainter.layout(minWidth: 0, maxWidth: width); _linePainter.style = PaintingStyle.fill; canvas.drawRect( Rect.fromLTWH(xPosition, yPosition - viewPadding, width, height), diff --git a/dev/benchmarks/macrobenchmarks/lib/src/web/bench_paths_recording.dart b/dev/benchmarks/macrobenchmarks/lib/src/web/bench_paths_recording.dart index e1a7c0ba8a..ee55513849 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/web/bench_paths_recording.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/web/bench_paths_recording.dart @@ -1833,7 +1833,7 @@ void pathOps78() { void pathOps79() { final Path path79 = Path(); - path79.addRRect(RRect.fromRectAndCorners(const Rect.fromLTRB(0, 0, 64, 56), bottomLeft: const Radius.circular(10), )); + path79.addRRect(RRect.fromRectAndCorners(const Rect.fromLTRB(0, 0, 64, 56), topLeft: Radius.zero, topRight: Radius.zero, bottomLeft: const Radius.circular(10), bottomRight: Radius.zero, )); gFillType = path79.fillType; path80 = path79.shift(const Offset(906, 136)); gFillType = path79.fillType; @@ -5828,7 +5828,7 @@ void pathOps576() { path576.moveTo(0, 0); path576.lineTo(220.60000000000002, 0); path576.quadraticBezierTo(235.60000000000002, 0, 237.569696969697, 7.817946907441011); - path576.arcToPoint(const Offset(299.630303030303, 7.817946907441011), radius: const Radius.circular(32), clockwise: false); + path576.arcToPoint(const Offset(299.630303030303, 7.817946907441011), radius: const Radius.circular(32), rotation: 0, largeArc: false, clockwise: false); path576.quadraticBezierTo(301.6, 0, 316.6, 0); path576.lineTo(312.6, 0); path576.lineTo(312.6, 48); diff --git a/dev/benchmarks/macrobenchmarks/lib/src/web/bench_simple_lazy_text_scroll.dart b/dev/benchmarks/macrobenchmarks/lib/src/web/bench_simple_lazy_text_scroll.dart index 6ea32b1e76..3dfcd4695e 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/web/bench_simple_lazy_text_scroll.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/web/bench_simple_lazy_text_scroll.dart @@ -25,6 +25,7 @@ class BenchSimpleLazyTextScroll extends WidgetRecorder { child: Row( children: const [ Flexible( + flex: 1, child: _TestScrollingWidget( initialScrollOffset: 0, scrollDistance: 300, @@ -32,6 +33,7 @@ class BenchSimpleLazyTextScroll extends WidgetRecorder { ), ), Flexible( + flex: 1, child: _TestScrollingWidget( initialScrollOffset: 1000, scrollDistance: 500, @@ -39,6 +41,7 @@ class BenchSimpleLazyTextScroll extends WidgetRecorder { ), ), Flexible( + flex: 1, child: _TestScrollingWidget( initialScrollOffset: 2000, scrollDistance: 700, diff --git a/dev/benchmarks/macrobenchmarks/lib/src/web/bench_text_layout.dart b/dev/benchmarks/macrobenchmarks/lib/src/web/bench_text_layout.dart index a233f26b1a..d52d111deb 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/web/bench_text_layout.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/web/bench_text_layout.dart @@ -417,6 +417,7 @@ class ColorItem extends StatelessWidget { bottom: false, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Text('$_counter:$prefix$index'), Text(colorString()), diff --git a/dev/benchmarks/macrobenchmarks/lib/src/web/bench_wrapbox_scroll.dart b/dev/benchmarks/macrobenchmarks/lib/src/web/bench_wrapbox_scroll.dart index 1b3e3ef12e..785f5fa251 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/web/bench_wrapbox_scroll.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/web/bench_wrapbox_scroll.dart @@ -155,6 +155,7 @@ class ProductOption extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 11, vertical: 5), decoration: BoxDecoration( border: Border.all( + width: 1, color: const Color(0xffebebeb), ), borderRadius: const BorderRadius.all(Radius.circular(15)), diff --git a/dev/benchmarks/macrobenchmarks/lib/web_benchmarks.dart b/dev/benchmarks/macrobenchmarks/lib/web_benchmarks.dart index f05fe958bc..72778b22a3 100644 --- a/dev/benchmarks/macrobenchmarks/lib/web_benchmarks.dart +++ b/dev/benchmarks/macrobenchmarks/lib/web_benchmarks.dart @@ -31,7 +31,7 @@ import 'src/web/recorder.dart'; typedef RecorderFactory = Recorder Function(); -const bool isCanvasKit = bool.fromEnvironment('FLUTTER_WEB_USE_SKIA'); +const bool isCanvasKit = bool.fromEnvironment('FLUTTER_WEB_USE_SKIA', defaultValue: false); /// List of all benchmarks that run in the devicelab. /// diff --git a/dev/benchmarks/macrobenchmarks/test/frame_policy.dart b/dev/benchmarks/macrobenchmarks/test/frame_policy.dart index 8256ca4f63..7e13444b54 100644 --- a/dev/benchmarks/macrobenchmarks/test/frame_policy.dart +++ b/dev/benchmarks/macrobenchmarks/test/frame_policy.dart @@ -31,9 +31,11 @@ void main() { final List records = [ PointerEventRecord(Duration.zero, [ PointerAddedEvent( + timeStamp: Duration.zero, position: location, ), PointerDownEvent( + timeStamp: Duration.zero, position: location, pointer: 1, ), diff --git a/dev/benchmarks/microbenchmarks/lib/foundation/change_notifier_bench.dart b/dev/benchmarks/microbenchmarks/lib/foundation/change_notifier_bench.dart index a40000b40b..0ab7a400d1 100644 --- a/dev/benchmarks/microbenchmarks/lib/foundation/change_notifier_bench.dart +++ b/dev/benchmarks/microbenchmarks/lib/foundation/change_notifier_bench.dart @@ -167,16 +167,16 @@ void main() { } runAddListenerBenchmark(_kNumWarmUp, addResult: false); - runAddListenerBenchmark(_kNumIterations); + runAddListenerBenchmark(_kNumIterations, addResult: true); runNotifyListenerBenchmark(_kNumWarmUp, addResult: false); - runNotifyListenerBenchmark(_kNumIterations); + runNotifyListenerBenchmark(_kNumIterations, addResult: true); runRemoveListenerBenchmark(_kNumWarmUp, addResult: false); - runRemoveListenerBenchmark(_kNumIterations); + runRemoveListenerBenchmark(_kNumIterations, addResult: true); runRemoveListenerWhileNotifyingBenchmark(_kNumWarmUp, addResult: false); - runRemoveListenerWhileNotifyingBenchmark(_kNumIterations); + runRemoveListenerWhileNotifyingBenchmark(_kNumIterations, addResult: true); printer.printToStdout(); } diff --git a/dev/benchmarks/microbenchmarks/lib/geometry/curves_bench.dart b/dev/benchmarks/microbenchmarks/lib/geometry/curves_bench.dart index a971209f17..b373d21bd5 100644 --- a/dev/benchmarks/microbenchmarks/lib/geometry/curves_bench.dart +++ b/dev/benchmarks/microbenchmarks/lib/geometry/curves_bench.dart @@ -48,7 +48,7 @@ void main() { Offset(0.70, 0.04), Offset(0.78, 0.98), Offset(0.88, -0.00), - ]); + ], tension: 0.00); _testCurve( catmullRomCurve, name: 'catmullrom_transform_iteration', diff --git a/dev/benchmarks/microbenchmarks/lib/language/sync_star_semantics_bench.dart b/dev/benchmarks/microbenchmarks/lib/language/sync_star_semantics_bench.dart index c44fe3049d..db4472f18d 100644 --- a/dev/benchmarks/microbenchmarks/lib/language/sync_star_semantics_bench.dart +++ b/dev/benchmarks/microbenchmarks/lib/language/sync_star_semantics_bench.dart @@ -19,7 +19,7 @@ void main() { for (int i = 0; i < words.length; i++) { if (i.isEven) { data.add( - InlineSpanSemanticsInformation(words[i]), + InlineSpanSemanticsInformation(words[i], isPlaceholder: false), ); } else if (i.isEven) { data.add( diff --git a/dev/benchmarks/platform_views_layout_hybrid_composition/lib/android_platform_view.dart b/dev/benchmarks/platform_views_layout_hybrid_composition/lib/android_platform_view.dart index 98f35ec078..35d8397253 100644 --- a/dev/benchmarks/platform_views_layout_hybrid_composition/lib/android_platform_view.dart +++ b/dev/benchmarks/platform_views_layout_hybrid_composition/lib/android_platform_view.dart @@ -38,6 +38,7 @@ class AndroidPlatformView extends StatelessWidget { id: params.id, viewType: viewType, layoutDirection: TextDirection.ltr, + creationParams: null, creationParamsCodec: const StandardMessageCodec(), ) ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) diff --git a/dev/bots/analyze_sample_code.dart b/dev/bots/analyze_sample_code.dart index 3fcd63bbe4..2e750d30a1 100644 --- a/dev/bots/analyze_sample_code.dart +++ b/dev/bots/analyze_sample_code.dart @@ -30,12 +30,14 @@ Future main(List arguments) async { final ArgParser argParser = ArgParser(); argParser.addOption( 'temp', + defaultsTo: null, help: 'A location where temporary files may be written. Defaults to a ' 'directory in the system temp folder. If specified, will not be ' 'automatically removed at the end of execution.', ); argParser.addFlag( 'verbose', + defaultsTo: false, negatable: false, help: 'Print verbose output for the analysis process.', ); @@ -50,10 +52,12 @@ Future main(List arguments) async { argParser.addFlag( 'include-dart-ui', defaultsTo: true, + negatable: true, help: 'Includes the dart:ui code supplied by the engine in the analysis.', ); argParser.addFlag( 'help', + defaultsTo: false, negatable: false, help: 'Print help for this command.', ); @@ -65,6 +69,7 @@ Future main(List arguments) async { argParser.addFlag( 'global-activate-snippets', defaultsTo: true, + negatable: true, help: 'Whether or not to "pub global activate" the snippets package. If set, will ' 'activate version $_snippetsActivateVersion', ); @@ -471,6 +476,7 @@ class SampleChecker { if (!Platform.environment.containsKey('FLUTTER_ROOT')) 'FLUTTER_ROOT': _flutterRoot, if (_flutterVersion!.isNotEmpty) 'FLUTTER_VERSION': _flutterVersion!, }, + includeParentEnvironment: true, ); } @@ -1149,7 +1155,7 @@ class Sample { final StringBuffer buf = StringBuffer('sample ${args.join(' ')}\n'); int count = start.line; for (final String line in input) { - buf.writeln(' ${count.toString().padLeft(4)}: $line'); + buf.writeln(' ${count.toString().padLeft(4, ' ')}: $line'); count++; } return buf.toString(); diff --git a/dev/bots/browser.dart b/dev/bots/browser.dart index b650d8153c..e0303dbe13 100644 --- a/dev/bots/browser.dart +++ b/dev/bots/browser.dart @@ -94,6 +94,8 @@ class AppServer { debugPort: browserDebugPort, url: appUrl, userDataDirectory: userDataDirectory.path, + windowHeight: 1024, + windowWidth: 1024, ), onError: chromeErrorCompleter.complete); return AppServer._(server, chrome, chromeErrorCompleter.future); } diff --git a/dev/bots/prepare_package.dart b/dev/bots/prepare_package.dart index 433b7be48e..df57ea66ff 100644 --- a/dev/bots/prepare_package.dart +++ b/dev/bots/prepare_package.dart @@ -687,6 +687,7 @@ class ArchivePublisher { try { await _runGsUtil( ['stat', cloudPath], + failOk: false, ); } on PreparePackageException { // `gsutil stat gs://path/to/file` will exit with 1 if file does not exist @@ -736,6 +737,7 @@ Future main(List rawArguments) async { final ArgParser argParser = ArgParser(); argParser.addOption( 'temp_dir', + defaultsTo: null, help: 'A location where temporary files may be written. Defaults to a ' 'directory in the system temp folder. Will write a few GiB of data, ' 'so it should have sufficient free space. If a temp_dir is not ' @@ -743,15 +745,18 @@ Future main(List rawArguments) async { 'removed automatically.', ); argParser.addOption('revision', + defaultsTo: null, help: 'The Flutter git repo revision to build the ' 'archive with. Must be the full 40-character hash. Required.'); argParser.addOption( 'branch', + defaultsTo: null, allowed: Branch.values.map((Branch branch) => getBranchName(branch)), help: 'The Flutter branch to build the archive with. Required.', ); argParser.addOption( 'output', + defaultsTo: null, help: 'The path to the directory where the output archive should be ' 'written. If --output is not specified, the archive will be written to ' "the current directory. If the output directory doesn't exist, it, and " @@ -759,6 +764,7 @@ Future main(List rawArguments) async { ); argParser.addFlag( 'publish', + defaultsTo: false, help: 'If set, will publish the archive to Google Cloud Storage upon ' 'successful creation of the archive. Will publish under this ' 'directory: $baseUrl$releaseFolder', @@ -766,15 +772,18 @@ Future main(List rawArguments) async { argParser.addFlag( 'force', abbr: 'f', + defaultsTo: false, help: 'Overwrite a previously uploaded package.', ); argParser.addFlag( 'dry_run', + defaultsTo: false, negatable: false, help: 'Prints gsutil commands instead of executing them.', ); argParser.addFlag( 'help', + defaultsTo: false, negatable: false, help: 'Print help for this command.', ); diff --git a/dev/bots/test.dart b/dev/bots/test.dart index 61a431a796..a76a0f20fe 100644 --- a/dev/bots/test.dart +++ b/dev/bots/test.dart @@ -645,7 +645,7 @@ Future _runFrameworkTests() async { Future runLibraries() async { final List tests = Directory(path.join(flutterRoot, 'packages', 'flutter', 'test')) - .listSync(followLinks: false) + .listSync(followLinks: false, recursive: false) .whereType() .where((Directory dir) => dir.path.endsWith('widgets') == false) .map((Directory dir) => path.join('test', path.basename(dir.path)) + path.separator) @@ -1215,7 +1215,7 @@ Future _ensureChromeDriverIsRunning() async { final Uri chromeDriverUrl = Uri.parse('http://localhost:4444/status'); final HttpClientRequest request = await client.getUrl(chromeDriverUrl); final HttpClientResponse response = await request.close(); - final Map webDriverStatus = json.decode(await response.transform(utf8.decoder).join()) as Map; + final Map webDriverStatus = json.decode(await response.transform(utf8.decoder).join('')) as Map; client.close(); final bool webDriverReady = (webDriverStatus['value'] as Map)['ready'] as bool; if (!webDriverReady) { diff --git a/dev/bots/test/analyze_test.dart b/dev/bots/test/analyze_test.dart index 04e6a4b61e..54dcc22b66 100644 --- a/dev/bots/test/analyze_test.dart +++ b/dev/bots/test/analyze_test.dart @@ -193,6 +193,6 @@ void main() { const Hash256(0xA8100AE6AA1940D0, 0xB663BB31CD466142, 0xEBBDBD5187131B92, 0xD93818987832EB89), // sha256("\xff") const Hash256(0x155644D3F13D98BF, 0, 0, 0), }, - )); + ), exitCode: 0); }); } diff --git a/dev/bots/test/prepare_package_test.dart b/dev/bots/test/prepare_package_test.dart index d1f89aed93..a6f9f552c4 100644 --- a/dev/bots/test/prepare_package_test.dart +++ b/dev/bots/test/prepare_package_test.dart @@ -266,6 +266,7 @@ void main() { tempDir, testRef, Branch.dev, + strict: true, processManager: processManager, subprocessOutput: false, platform: platform, @@ -494,7 +495,7 @@ void main() { '$gsutilCall -- stat $gsArchivePath': [ProcessResult(0, 0, '', '')], }; processManager.addCommands(convertResults(calls)); - expect(() async => publisher.publishArchive(), throwsException); + expect(() async => publisher.publishArchive(false), throwsException); }); test('publishArchive does not throw if forceUpload is true and artifact already exists on cloud storage', () async { diff --git a/dev/bots/unpublish_package.dart b/dev/bots/unpublish_package.dart index 831b895e96..3e8e2bb42b 100644 --- a/dev/bots/unpublish_package.dart +++ b/dev/bots/unpublish_package.dart @@ -401,6 +401,7 @@ Future main(List rawArguments) async { final ArgParser argParser = ArgParser(); argParser.addOption( 'temp_dir', + defaultsTo: null, help: 'A location where temporary files may be written. Defaults to a ' 'directory in the system temp folder. If a temp_dir is not ' 'specified, then by default a generated temporary directory will be ' @@ -430,6 +431,7 @@ Future main(List rawArguments) async { ); argParser.addFlag( 'confirm', + defaultsTo: false, help: 'If set, will actually remove the archive from Google Cloud Storage ' 'upon successful execution of this script. Published archives will be ' 'removed from this directory: $baseUrl$releaseFolder. This option ' @@ -438,6 +440,7 @@ Future main(List rawArguments) async { ); argParser.addFlag( 'help', + defaultsTo: false, negatable: false, help: 'Print help for this command.', ); diff --git a/dev/conductor/core/lib/src/repository.dart b/dev/conductor/core/lib/src/repository.dart index e1f9e08723..2087dc366d 100644 --- a/dev/conductor/core/lib/src/repository.dart +++ b/dev/conductor/core/lib/src/repository.dart @@ -496,6 +496,7 @@ class FrameworkRepository extends Repository { name: RemoteName.upstream, url: 'file://$upstreamPath/', ), + localUpstream: false, previousCheckoutLocation: previousCheckoutLocation, ); } diff --git a/dev/conductor/core/lib/src/roll_dev.dart b/dev/conductor/core/lib/src/roll_dev.dart index 41ae61ac89..3598f93e85 100644 --- a/dev/conductor/core/lib/src/roll_dev.dart +++ b/dev/conductor/core/lib/src/roll_dev.dart @@ -43,6 +43,7 @@ class RollDevCommand extends Command { kCandidateBranch, help: 'Specifies which git branch to roll to the dev branch. Required.', valueHelp: 'branch', + defaultsTo: null, // This option is required ); argParser.addFlag( kForce, diff --git a/dev/conductor/core/lib/src/state.dart b/dev/conductor/core/lib/src/state.dart index c76a19e967..28681d5bf1 100644 --- a/dev/conductor/core/lib/src/state.dart +++ b/dev/conductor/core/lib/src/state.dart @@ -42,10 +42,10 @@ String presentState(pb.ConductorState state) { buffer.writeln('Conductor version: ${state.conductorVersion}'); buffer.writeln('Release channel: ${state.releaseChannel}'); buffer.writeln('Release version: ${state.releaseVersion}'); - buffer.writeln(); + buffer.writeln(''); buffer.writeln('Release started at: ${DateTime.fromMillisecondsSinceEpoch(state.createdDate.toInt())}'); buffer.writeln('Last updated at: ${DateTime.fromMillisecondsSinceEpoch(state.lastUpdatedDate.toInt())}'); - buffer.writeln(); + buffer.writeln(''); buffer.writeln('Engine Repo'); buffer.writeln('\tCandidate branch: ${state.engine.candidateBranch}'); buffer.writeln('\tStarting git HEAD: ${state.engine.startingGitHead}'); @@ -77,7 +77,7 @@ String presentState(pb.ConductorState state) { } else { buffer.writeln('0 Framework cherrypicks.'); } - buffer.writeln(); + buffer.writeln(''); if (state.currentPhase == ReleasePhase.VERIFY_RELEASE) { buffer.writeln( '${state.releaseChannel} release ${state.releaseVersion} has been published and verified.\n', @@ -88,7 +88,7 @@ String presentState(pb.ConductorState state) { buffer.writeln(presentPhases(state.currentPhase)); buffer.writeln(phaseInstructions(state)); - buffer.writeln(); + buffer.writeln(''); buffer.writeln('Issue `conductor next` when you are ready to proceed.'); return buffer.toString(); } diff --git a/dev/conductor/core/lib/src/status.dart b/dev/conductor/core/lib/src/status.dart index b3c6ab90af..9c5ad0a9ee 100644 --- a/dev/conductor/core/lib/src/status.dart +++ b/dev/conductor/core/lib/src/status.dart @@ -30,6 +30,7 @@ class StatusCommand extends Command { argParser.addFlag( kVerboseFlag, abbr: 'v', + defaultsTo: false, help: 'Also print logs.', ); } diff --git a/dev/conductor/core/test/repository_test.dart b/dev/conductor/core/test/repository_test.dart index 32a7429a67..ce8a53660b 100644 --- a/dev/conductor/core/test/repository_test.dart +++ b/dev/conductor/core/test/repository_test.dart @@ -56,7 +56,7 @@ void main() { 'cherry-pick', '--no-commit', commit, - ]), + ], exitCode: 0), const FakeCommand(command: [ 'git', 'reset', diff --git a/dev/conductor/core/test/roll_dev_test.dart b/dev/conductor/core/test/roll_dev_test.dart index cc2b18640e..0d9d1cd57e 100644 --- a/dev/conductor/core/test/roll_dev_test.dart +++ b/dev/conductor/core/test/roll_dev_test.dart @@ -174,7 +174,7 @@ void main() { ), false, ); - expect(stdio.logs.join().contains(nextVersion), true); + expect(stdio.logs.join('').contains(nextVersion), true); }); test("exits with exception if --skip-tagging is provided but commit isn't already tagged", () { diff --git a/dev/conductor/ui/lib/main.dart b/dev/conductor/ui/lib/main.dart index 0b36a22021..bc7ac695bd 100644 --- a/dev/conductor/ui/lib/main.dart +++ b/dev/conductor/ui/lib/main.dart @@ -53,6 +53,7 @@ class MyApp extends StatelessWidget { padding: const EdgeInsets.all(20.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ const SelectableText( 'Desktop app for managing a release of the Flutter SDK, currently in development', diff --git a/dev/conductor/ui/lib/widgets/progression.dart b/dev/conductor/ui/lib/widgets/progression.dart index d6cc87bd69..0bb97e917d 100644 --- a/dev/conductor/ui/lib/widgets/progression.dart +++ b/dev/conductor/ui/lib/widgets/progression.dart @@ -75,7 +75,12 @@ class MainProgressionState extends State { stateFilePath: widget.stateFilePath, ), Stepper( - controlsBuilder: (BuildContext context, ControlsDetails details) => Row(), + controlsBuilder: (BuildContext context, ControlsDetails details) { + return Row( + children: const [], + ); + }, + type: StepperType.vertical, physics: const ScrollPhysics(), currentStep: _completedStep, onStepContinue: nextStep, @@ -122,7 +127,9 @@ class MainProgressionState extends State { ), Step( title: Text(MainProgression._stepTitles[4]), - content: Column(), + content: Column( + children: const [], + ), isActive: true, state: handleStepState(4), ), diff --git a/dev/conductor/ui/test/widgets/stepper_test.dart b/dev/conductor/ui/test/widgets/stepper_test.dart index 60d8d13229..daa1638045 100644 --- a/dev/conductor/ui/test/widgets/stepper_test.dart +++ b/dev/conductor/ui/test/widgets/stepper_test.dart @@ -18,6 +18,7 @@ void main() { child: Column( children: const [ MainProgression( + releaseState: null, stateFilePath: './testPath', ), ], @@ -61,6 +62,7 @@ void main() { child: Column( children: const [ MainProgression( + releaseState: null, stateFilePath: './testPath', ), ], diff --git a/dev/customer_testing/run_tests.dart b/dev/customer_testing/run_tests.dart index a0c90bf7df..c792722a8b 100644 --- a/dev/customer_testing/run_tests.dart +++ b/dev/customer_testing/run_tests.dart @@ -41,18 +41,22 @@ Future run(List arguments) async { ) ..addFlag( 'skip-on-fetch-failure', + defaultsTo: false, help: 'Whether to skip tests that we fail to download.', ) ..addFlag( 'skip-template', + defaultsTo: false, help: 'Whether to skip tests named "template.test".', ) ..addFlag( 'verbose', + defaultsTo: false, help: 'Describe what is happening in detail.', ) ..addFlag( 'help', + defaultsTo: false, negatable: false, help: 'Print this help message.', ); diff --git a/dev/devicelab/bin/run.dart b/dev/devicelab/bin/run.dart index 515b3a185a..2967b66f6a 100644 --- a/dev/devicelab/bin/run.dart +++ b/dev/devicelab/bin/run.dart @@ -239,6 +239,7 @@ final ArgParser _argParser = ArgParser() ..addMultiOption( 'task', abbr: 't', + splitCommas: true, help: 'Either:\n' ' - the name of a task defined in manifest.yaml.\n' ' Example: complex_layout__start_up.\n' @@ -361,10 +362,13 @@ final ArgParser _argParser = ArgParser() ) ..addFlag( 'silent', + negatable: true, + defaultsTo: false, ) ..addMultiOption( 'test', hide: true, + splitCommas: true, callback: (List value) { if (value.isNotEmpty) { throw const FormatException( diff --git a/dev/devicelab/bin/tasks/animated_image_gc_perf.dart b/dev/devicelab/bin/tasks/animated_image_gc_perf.dart index bb80e522fb..b5fe9f8e0c 100644 --- a/dev/devicelab/bin/tasks/animated_image_gc_perf.dart +++ b/dev/devicelab/bin/tasks/animated_image_gc_perf.dart @@ -13,5 +13,7 @@ Future main() async { '${flutterDirectory.path}/dev/benchmarks/macrobenchmarks', 'test_driver/animated_image.dart', 'animated_image', + measureCpuGpu: true, + measureMemory: true, ).run); } diff --git a/dev/devicelab/bin/tasks/complex_layout_scroll_perf_ios__timeline_summary.dart b/dev/devicelab/bin/tasks/complex_layout_scroll_perf_ios__timeline_summary.dart index 0deb613e26..b514d35741 100644 --- a/dev/devicelab/bin/tasks/complex_layout_scroll_perf_ios__timeline_summary.dart +++ b/dev/devicelab/bin/tasks/complex_layout_scroll_perf_ios__timeline_summary.dart @@ -8,5 +8,5 @@ import 'package:flutter_devicelab/tasks/perf_tests.dart'; Future main() async { deviceOperatingSystem = DeviceOperatingSystem.ios; - await task(createComplexLayoutScrollPerfTest()); + await task(createComplexLayoutScrollPerfTest(measureCpuGpu: true)); } diff --git a/dev/devicelab/bin/tasks/ios_app_with_extensions_test.dart b/dev/devicelab/bin/tasks/ios_app_with_extensions_test.dart index a410eb2c47..11b21b390e 100644 --- a/dev/devicelab/bin/tasks/ios_app_with_extensions_test.dart +++ b/dev/devicelab/bin/tasks/ios_app_with_extensions_test.dart @@ -115,6 +115,7 @@ Future main() async { 'list', 'runtimes', ], + canFail: false, workingDirectory: flutterDirectory.path, ); @@ -165,6 +166,7 @@ Future main() async { 'com.apple.CoreSimulator.SimDeviceType.iPhone-11', iOSSimRuntime, ], + canFail: false, workingDirectory: flutterDirectory.path, ); @@ -178,6 +180,7 @@ Future main() async { 'com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-5-44mm', watchSimRuntime, ], + canFail: false, workingDirectory: flutterDirectory.path, ); @@ -185,6 +188,7 @@ Future main() async { await eval( 'xcrun', ['simctl', 'pair', watchDeviceID, phoneDeviceID], + canFail: false, workingDirectory: flutterDirectory.path, ); @@ -192,11 +196,13 @@ Future main() async { await eval( 'xcrun', ['simctl', 'bootstatus', phoneDeviceID, '-b'], + canFail: false, workingDirectory: flutterDirectory.path, ); await eval( 'xcrun', ['simctl', 'bootstatus', watchDeviceID, '-b'], + canFail: false, workingDirectory: flutterDirectory.path, ); diff --git a/dev/devicelab/bin/tasks/large_image_changer_perf_ios.dart b/dev/devicelab/bin/tasks/large_image_changer_perf_ios.dart index 5af76d438d..ae17c3266f 100644 --- a/dev/devicelab/bin/tasks/large_image_changer_perf_ios.dart +++ b/dev/devicelab/bin/tasks/large_image_changer_perf_ios.dart @@ -13,6 +13,8 @@ Future main() async { '${flutterDirectory.path}/dev/benchmarks/macrobenchmarks', 'test_driver/large_image_changer.dart', 'large_image_changer', + measureCpuGpu: true, + measureMemory: true, // This benchmark doesn't care about frame times, frame times will be heavily // impacted by IO time for loading the image initially. benchmarkScoreKeys: [ diff --git a/dev/devicelab/bin/tasks/post_backdrop_filter_perf_ios__timeline_summary.dart b/dev/devicelab/bin/tasks/post_backdrop_filter_perf_ios__timeline_summary.dart index 7baf142bc6..066a033acf 100644 --- a/dev/devicelab/bin/tasks/post_backdrop_filter_perf_ios__timeline_summary.dart +++ b/dev/devicelab/bin/tasks/post_backdrop_filter_perf_ios__timeline_summary.dart @@ -8,5 +8,5 @@ import 'package:flutter_devicelab/tasks/perf_tests.dart'; Future main() async { deviceOperatingSystem = DeviceOperatingSystem.ios; - await task(createPostBackdropFilterPerfTest()); + await task(createPostBackdropFilterPerfTest(measureCpuGpu: true)); } diff --git a/dev/devicelab/bin/tasks/routing_test.dart b/dev/devicelab/bin/tasks/routing_test.dart index d694117566..cdd956f45e 100644 --- a/dev/devicelab/bin/tasks/routing_test.dart +++ b/dev/devicelab/bin/tasks/routing_test.dart @@ -32,6 +32,7 @@ void main() { '/smuggle-it', 'lib/route.dart', ], + canFail: false, ); }); section('TEST WHETHER `flutter run --route` WORKS'); diff --git a/dev/devicelab/bin/tasks/simple_animation_perf_ios.dart b/dev/devicelab/bin/tasks/simple_animation_perf_ios.dart index 4f94ecd791..56d8431d79 100644 --- a/dev/devicelab/bin/tasks/simple_animation_perf_ios.dart +++ b/dev/devicelab/bin/tasks/simple_animation_perf_ios.dart @@ -8,5 +8,5 @@ import 'package:flutter_devicelab/tasks/perf_tests.dart'; Future main() async { deviceOperatingSystem = DeviceOperatingSystem.ios; - await task(createSimpleAnimationPerfTest()); + await task(createSimpleAnimationPerfTest(measureCpuGpu: true)); } diff --git a/dev/devicelab/lib/command/test.dart b/dev/devicelab/lib/command/test.dart index 58e8489d04..9e35fdde2d 100644 --- a/dev/devicelab/lib/command/test.dart +++ b/dev/devicelab/lib/command/test.dart @@ -49,6 +49,8 @@ class TestCommand extends Command { 'task, will write test results to the file.'); argParser.addFlag( 'silent', + negatable: true, + defaultsTo: false, ); } diff --git a/dev/devicelab/lib/framework/devices.dart b/dev/devicelab/lib/framework/devices.dart index 70ed680917..071bdcf65c 100644 --- a/dev/devicelab/lib/framework/devices.dart +++ b/dev/devicelab/lib/framework/devices.dart @@ -274,7 +274,7 @@ class AndroidDeviceDiscovery implements DeviceDiscovery { @override Future> discoverDevices() async { - final List output = (await eval(adbPath, ['devices', '-l'])) + final List output = (await eval(adbPath, ['devices', '-l'], canFail: false)) .trim().split('\n'); final List results = []; for (final String line in output) { @@ -327,7 +327,7 @@ class AndroidDeviceDiscovery implements DeviceDiscovery { // Restarting `adb` helps with keeping device connections alive. When `adb` // runs non-stop for too long it loses connections to devices. There may be // a better method, but so far that's the best one I've found. - await exec(adbPath, ['kill-server']); + await exec(adbPath, ['kill-server'], canFail: false); } } @@ -555,6 +555,7 @@ class AndroidDevice extends Device { adbPath, ['-s', deviceId, ...arguments], environment: environment, + canFail: false, printStdout: !silent, printStderr: !silent, ); diff --git a/dev/devicelab/lib/framework/utils.dart b/dev/devicelab/lib/framework/utils.dart index ea2856d65e..7983e27bc0 100644 --- a/dev/devicelab/lib/framework/utils.dart +++ b/dev/devicelab/lib/framework/utils.dart @@ -224,7 +224,7 @@ Future getDartVersion() async { Future getCurrentFlutterRepoCommit() { if (!dir('${flutterDirectory.path}/.git').existsSync()) { - return Future.value(); + return Future.value(null); } return inDirectory(flutterDirectory, () { diff --git a/dev/devicelab/lib/tasks/dart_plugin_registry_tests.dart b/dev/devicelab/lib/tasks/dart_plugin_registry_tests.dart index fe6bbf2534..c3ee1a8697 100644 --- a/dev/devicelab/lib/tasks/dart_plugin_registry_tests.dart +++ b/dev/devicelab/lib/tasks/dart_plugin_registry_tests.dart @@ -145,6 +145,7 @@ class PluginPlatformInterfaceMacOS { final Process run = await startProcess( path.join(flutterDirectory.path, 'bin', 'flutter'), flutterCommandArgs('run', ['-d', 'macos', '-v']), + environment: null, ); Completer registryExecutedCompleter = Completer(); final StreamSubscription subscription = run.stdout diff --git a/dev/devicelab/lib/tasks/web_benchmarks.dart b/dev/devicelab/lib/tasks/web_benchmarks.dart index b402a68c30..cdafeadf42 100644 --- a/dev/devicelab/lib/tasks/web_benchmarks.dart +++ b/dev/devicelab/lib/tasks/web_benchmarks.dart @@ -133,6 +133,8 @@ Future runWebBenchmark({ required bool useCanvasKit }) async { final ChromeOptions options = ChromeOptions( url: 'http://localhost:$benchmarkServerPort/index.html', userDataDirectory: userDataDir, + windowHeight: 1024, + windowWidth: 1024, headless: isUncalibratedSmokeTest, debugPort: chromeDebugPort, ); diff --git a/dev/devicelab/test/adb_test.dart b/dev/devicelab/test/adb_test.dart index 1f0f8a0bca..d49bfad184 100644 --- a/dev/devicelab/test/adb_test.dart +++ b/dev/devicelab/test/adb_test.dart @@ -27,8 +27,8 @@ void main() { final AndroidDevice androidDevice = device as AndroidDevice; expect(await androidDevice.isArm64(), isTrue); expectLog([ - cmd(command: 'getprop', arguments: ['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk']), - cmd(command: 'getprop', arguments: ['ro.product.cpu.abi']), + cmd(command: 'getprop', arguments: ['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk'], environment: null), + cmd(command: 'getprop', arguments: ['ro.product.cpu.abi'], environment: null), ]); }); }); @@ -51,7 +51,7 @@ void main() { test('sends power event', () async { await device.togglePower(); expectLog([ - cmd(command: 'getprop', arguments: ['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk']), + cmd(command: 'getprop', arguments: ['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk'], environment: null), cmd(command: 'input', arguments: ['keyevent', '26']), ]); }); @@ -62,7 +62,7 @@ void main() { FakeDevice.pretendAwake(); await device.wakeUp(); expectLog([ - cmd(command: 'getprop', arguments: ['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk']), + cmd(command: 'getprop', arguments: ['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk'], environment: null), cmd(command: 'dumpsys', arguments: ['power']), ]); }); @@ -71,7 +71,7 @@ void main() { FakeDevice.pretendAsleep(); await device.wakeUp(); expectLog([ - cmd(command: 'getprop', arguments: ['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk']), + cmd(command: 'getprop', arguments: ['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk'], environment: null), cmd(command: 'dumpsys', arguments: ['power']), cmd(command: 'input', arguments: ['keyevent', '26']), ]); @@ -83,7 +83,7 @@ void main() { FakeDevice.pretendAsleep(); await device.sendToSleep(); expectLog([ - cmd(command: 'getprop', arguments: ['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk']), + cmd(command: 'getprop', arguments: ['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk'], environment: null), cmd(command: 'dumpsys', arguments: ['power']), ]); }); @@ -92,7 +92,7 @@ void main() { FakeDevice.pretendAwake(); await device.sendToSleep(); expectLog([ - cmd(command: 'getprop', arguments: ['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk']), + cmd(command: 'getprop', arguments: ['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk'], environment: null), cmd(command: 'dumpsys', arguments: ['power']), cmd(command: 'input', arguments: ['keyevent', '26']), ]); @@ -104,7 +104,7 @@ void main() { FakeDevice.pretendAwake(); await device.unlock(); expectLog([ - cmd(command: 'getprop', arguments: ['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk']), + cmd(command: 'getprop', arguments: ['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk'], environment: null), cmd(command: 'dumpsys', arguments: ['power']), cmd(command: 'input', arguments: ['keyevent', '82']), ]); @@ -115,7 +115,7 @@ void main() { test('tap', () async { await device.tap(100, 200); expectLog([ - cmd(command: 'getprop', arguments: ['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk']), + cmd(command: 'getprop', arguments: ['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk'], environment: null), cmd(command: 'input', arguments: ['tap', '100', '200']), ]); }); diff --git a/dev/devicelab/test/running_processes_test.dart b/dev/devicelab/test/running_processes_test.dart index 76f3df029e..ec27b8e742 100644 --- a/dev/devicelab/test/running_processes_test.dart +++ b/dev/devicelab/test/running_processes_test.dart @@ -61,7 +61,7 @@ Sat Mar 9 20:13:00 2019 49 /usr/sbin/syslogd ), RunningProcessInfo( '49', - DateTime(2019, 3, 9, 20, 13), + DateTime(2019, 3, 9, 20, 13, 00), '/usr/sbin/syslogd', ), ])); diff --git a/dev/integration_tests/android_semantics_testing/lib/src/tests/text_field_page.dart b/dev/integration_tests/android_semantics_testing/lib/src/tests/text_field_page.dart index 20a22449aa..71c061f377 100644 --- a/dev/integration_tests/android_semantics_testing/lib/src/tests/text_field_page.dart +++ b/dev/integration_tests/android_semantics_testing/lib/src/tests/text_field_page.dart @@ -32,12 +32,14 @@ class _TextFieldPageState extends State { TextField( key: normalTextFieldKey, controller: _normalController, + autofocus: false, ), const Spacer(), TextField( key: passwordTextFieldKey, controller: _passwordController, obscureText: true, + autofocus: false, ), ], ), diff --git a/dev/integration_tests/android_views/lib/motion_events_page.dart b/dev/integration_tests/android_views/lib/motion_events_page.dart index e4753e57e8..374877739a 100644 --- a/dev/integration_tests/android_views/lib/motion_events_page.dart +++ b/dev/integration_tests/android_views/lib/motion_events_page.dart @@ -227,7 +227,7 @@ class MotionEventsBodyState extends State { setState(() {}); break; } - return Future.value(); + return Future.value(null); } Future onViewMethodChannelCall(MethodCall call) { @@ -240,7 +240,7 @@ class MotionEventsBodyState extends State { setState(() {}); break; } - return Future.value(); + return Future.value(null); } Widget buildEventTile(BuildContext context, int index) { diff --git a/dev/integration_tests/channels/lib/src/method_calls.dart b/dev/integration_tests/channels/lib/src/method_calls.dart index a7fac958a7..3a412ae8dd 100644 --- a/dev/integration_tests/channels/lib/src/method_calls.dart +++ b/dev/integration_tests/channels/lib/src/method_calls.dart @@ -10,7 +10,8 @@ import 'test_step.dart'; Future methodCallJsonSuccessHandshake(dynamic payload) async { const MethodChannel channel = MethodChannel('json-method', JSONMethodCodec()); - return _methodCallSuccessHandshake('JSON success($payload)', channel, payload); + return _methodCallSuccessHandshake( + 'JSON success($payload)', channel, payload); } Future methodCallJsonErrorHandshake(dynamic payload) async { @@ -31,7 +32,8 @@ Future methodCallStandardSuccessHandshake( 'std-method', StandardMethodCodec(ExtendedStandardMessageCodec()), ); - return _methodCallSuccessHandshake('Standard success($payload)', channel, payload); + return _methodCallSuccessHandshake( + 'Standard success($payload)', channel, payload); } Future methodCallStandardErrorHandshake(dynamic payload) async { @@ -39,7 +41,8 @@ Future methodCallStandardErrorHandshake(dynamic payload) async { 'std-method', StandardMethodCodec(ExtendedStandardMessageCodec()), ); - return _methodCallErrorHandshake('Standard error($payload)', channel, payload); + return _methodCallErrorHandshake( + 'Standard error($payload)', channel, payload); } Future methodCallStandardNotImplementedHandshake() async { @@ -47,7 +50,8 @@ Future methodCallStandardNotImplementedHandshake() async { 'std-method', StandardMethodCodec(ExtendedStandardMessageCodec()), ); - return _methodCallNotImplementedHandshake('Standard notImplemented()', channel); + return _methodCallNotImplementedHandshake( + 'Standard notImplemented()', channel); } Future _methodCallSuccessHandshake( @@ -85,7 +89,8 @@ Future _methodCallErrorHandshake( final List received = []; channel.setMethodCallHandler((MethodCall call) async { received.add(call.arguments); - throw PlatformException(code: 'error', details: arguments); + throw PlatformException( + code: 'error', message: null, details: arguments); }); dynamic errorDetails = nothing; dynamic error = nothing; diff --git a/dev/integration_tests/flutter_gallery/lib/demo/animation/widgets.dart b/dev/integration_tests/flutter_gallery/lib/demo/animation/widgets.dart index 2c0ad69db8..13f65ff2b0 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/animation/widgets.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/animation/widgets.dart @@ -23,6 +23,8 @@ class SectionCard extends StatelessWidget { child: DecoratedBox( decoration: BoxDecoration( gradient: LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, colors: [ section.leftColor!, section.rightColor!, @@ -130,6 +132,7 @@ class SectionDetailView extends StatelessWidget { package: detail.imageAssetPackage, ), fit: BoxFit.cover, + alignment: Alignment.center, ), ), ); diff --git a/dev/integration_tests/flutter_gallery/lib/demo/calculator/logic.dart b/dev/integration_tests/flutter_gallery/lib/demo/calculator/logic.dart index 407eec101d..e92a765d1c 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/calculator/logic.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/calculator/logic.dart @@ -136,7 +136,7 @@ class CalcExpression { /// in the calculator's display panel. @override String toString() { - final StringBuffer buffer = StringBuffer(); + final StringBuffer buffer = StringBuffer(''); buffer.writeAll(_list); return buffer.toString(); } diff --git a/dev/integration_tests/flutter_gallery/lib/demo/colors_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/colors_demo.dart index f3fb6c3e62..04ad7dc1e3 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/colors_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/colors_demo.dart @@ -67,6 +67,7 @@ class ColorItem extends StatelessWidget { bottom: false, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Text('$prefix$index'), Text(colorString()), diff --git a/dev/integration_tests/flutter_gallery/lib/demo/cupertino/cupertino_navigation_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/cupertino/cupertino_navigation_demo.dart index 14559903a9..e98b1b89af 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/cupertino/cupertino_navigation_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/cupertino/cupertino_navigation_demo.dart @@ -327,6 +327,7 @@ class Tab1ItemPageState extends State { Padding( padding: const EdgeInsets.symmetric(horizontal: 16.0), child: Row( + mainAxisSize: MainAxisSize.max, children: [ Container( height: 128.0, diff --git a/dev/integration_tests/flutter_gallery/lib/demo/cupertino/cupertino_picker_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/cupertino/cupertino_picker_demo.dart index 8843f39691..fdec6b3e4b 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/cupertino/cupertino_picker_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/cupertino/cupertino_picker_demo.dart @@ -247,6 +247,7 @@ class _CupertinoPickerDemoState extends State { return _BottomPicker( child: CupertinoDatePicker( backgroundColor: CupertinoColors.systemBackground.resolveFrom(context), + mode: CupertinoDatePickerMode.dateAndTime, initialDateTime: dateTime, onDateTimeChanged: (DateTime newDateTime) { setState(() => dateTime = newDateTime); diff --git a/dev/integration_tests/flutter_gallery/lib/demo/cupertino/cupertino_segmented_control_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/cupertino/cupertino_segmented_control_demo.dart index 351e3b2ad5..7abe52675f 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/cupertino/cupertino_segmented_control_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/cupertino/cupertino_segmented_control_demo.dart @@ -117,11 +117,13 @@ class _CupertinoSegmentedControlDemoState extends State { children: [ CupertinoSlider( value: _value, + min: 0.0, max: 100.0, onChanged: (double value) { setState(() { @@ -57,6 +58,7 @@ class _CupertinoSliderDemoState extends State { children: [ CupertinoSlider( value: _discreteValue, + min: 0.0, max: 100.0, divisions: 5, onChanged: (double value) { diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/bottom_app_bar_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/bottom_app_bar_demo.dart index e299f692a8..8710aa0a4a 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/bottom_app_bar_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/bottom_app_bar_demo.dart @@ -27,6 +27,7 @@ class _BottomAppBarDemoState extends State { static const _ChoiceValue kNoFab = _ChoiceValue( title: 'None', label: 'do not show a floating action button', + value: null, ); static const _ChoiceValue kCircularFab = _ChoiceValue( diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/buttons_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/buttons_demo.dart index 8cd0bcc711..d19527e9ad 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/buttons_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/buttons_demo.dart @@ -275,6 +275,7 @@ class _ButtonsDemoState extends State { return Padding( padding: const EdgeInsets.all(24.0), child: Column( + mainAxisAlignment: MainAxisAlignment.start, children: [ ListTile( title: const Text('Simple dropdown:'), diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/chip_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/chip_demo.dart index d897f79a8b..5b1723907a 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/chip_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/chip_demo.dart @@ -344,7 +344,7 @@ class _ChipDemoState extends State { data: _showShapeBorder ? theme.chipTheme.copyWith( shape: BeveledRectangleBorder( - side: const BorderSide(width: 0.66, color: Colors.grey), + side: const BorderSide(width: 0.66, style: BorderStyle.solid, color: Colors.grey), borderRadius: BorderRadius.circular(10.0), )) : theme.chipTheme, diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/dialog_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/dialog_demo.dart index ecd88b9bb4..b2102adc0b 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/dialog_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/dialog_demo.dart @@ -33,6 +33,8 @@ class DialogDemoItem extends StatelessWidget { return SimpleDialogOption( onPressed: onPressed, child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Icon(icon, size: 36.0, color: color), Padding( diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/expansion_panels_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/expansion_panels_demo.dart index fd2592e906..289fc85272 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/expansion_panels_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/expansion_panels_demo.dart @@ -308,6 +308,7 @@ class _ExpansionPanelsDemoState extends State { // Allow room for the value indicator. padding: const EdgeInsets.only(top: 44.0), child: Slider( + min: 0.0, max: 100.0, divisions: 5, activeColor: Colors.orange[100 + (field.value! * 5.0).round()], diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/slider_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/slider_demo.dart index 30b5477b68..eda0cd1d39 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/slider_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/slider_demo.dart @@ -284,6 +284,7 @@ class _SlidersState extends State<_Sliders> { Slider.adaptive( label: _continuousValue.toStringAsFixed(6), value: _continuousValue, + min: 0.0, max: 100.0, onChanged: (double value) { setState(() { @@ -306,6 +307,7 @@ class _SlidersState extends State<_Sliders> { children: [ Slider.adaptive( value: _discreteValue, + min: 0.0, max: 200.0, divisions: 5, label: '${_discreteValue.round()}', @@ -336,6 +338,7 @@ class _SlidersState extends State<_Sliders> { ), child: Slider( value: _discreteCustomValue, + min: 0.0, max: 200.0, divisions: 5, semanticFormatterCallback: (double value) => value.round().toString(), @@ -378,6 +381,7 @@ class _RangeSlidersState extends State<_RangeSliders> { children: [ RangeSlider( values: _continuousValues, + min: 0.0, max: 100.0, onChanged: (RangeValues values) { setState(() { @@ -400,6 +404,7 @@ class _RangeSlidersState extends State<_RangeSliders> { children: [ RangeSlider( values: _discreteValues, + min: 0.0, max: 200.0, divisions: 5, labels: RangeLabels('${_discreteValues.start.round()}', '${_discreteValues.end.round()}'), @@ -428,6 +433,7 @@ class _RangeSlidersState extends State<_RangeSliders> { ), child: RangeSlider( values: _discreteCustomValues, + min: 0.0, max: 200.0, divisions: 5, labels: RangeLabels('${_discreteCustomValues.start.round()}', '${_discreteCustomValues.end.round()}'), diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/tabs_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/tabs_demo.dart index 3f0df84a74..dd8e59f1cd 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/tabs_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/tabs_demo.dart @@ -107,6 +107,7 @@ class _CardDataItem extends StatelessWidget { padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisAlignment: MainAxisAlignment.start, children: [ Align( alignment: page!.id == 'H' diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/text_form_field_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/text_form_field_demo.dart index 3f80761c2d..395e81cb5b 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/text_form_field_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/text_form_field_demo.dart @@ -252,6 +252,7 @@ class TextFormFieldDemoState extends State { suffixText: 'USD', suffixStyle: TextStyle(color: Colors.green), ), + maxLines: 1, ), const SizedBox(height: 24.0), PasswordField( diff --git a/dev/integration_tests/flutter_gallery/lib/demo/shrine/expanding_bottom_sheet.dart b/dev/integration_tests/flutter_gallery/lib/demo/shrine/expanding_bottom_sheet.dart index baf897c356..0e7d14516e 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/shrine/expanding_bottom_sheet.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/shrine/expanding_bottom_sheet.dart @@ -171,7 +171,7 @@ class ExpandingBottomSheetState extends State with TickerP ).animate( CurvedAnimation( parent: _controller.view, - curve: const Interval(0.434, 1.0), // not used + curve: const Interval(0.434, 1.0, curve: Curves.linear), // not used // only the reverseCurve will be used reverseCurve: Interval(0.434, 1.0, curve: Curves.fastOutSlowIn.flipped), ), @@ -448,7 +448,7 @@ class _ProductThumbnailRowState extends State { ); final Animation opacity = CurvedAnimation( - curve: const Interval(0.33, 1.0), + curve: const Interval(0.33, 1.0, curve: Curves.linear), parent: animation, ); diff --git a/dev/integration_tests/flutter_gallery/lib/demo/shrine/shopping_cart.dart b/dev/integration_tests/flutter_gallery/lib/demo/shrine/shopping_cart.dart index 5bce30d033..f5cdf07539 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/shrine/shopping_cart.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/shrine/shopping_cart.dart @@ -124,6 +124,7 @@ class ShoppingCartSummary extends StatelessWidget { child: Column( children: [ Row( + crossAxisAlignment: CrossAxisAlignment.center, children: [ const Expanded( child: Text('TOTAL'), diff --git a/dev/integration_tests/flutter_gallery/lib/demo/shrine/supplemental/product_card.dart b/dev/integration_tests/flutter_gallery/lib/demo/shrine/supplemental/product_card.dart index 082d61e73a..0b1b6b8c89 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/shrine/supplemental/product_card.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/shrine/supplemental/product_card.dart @@ -45,6 +45,7 @@ class ProductCard extends StatelessWidget { children: [ Column( mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ AspectRatio( aspectRatio: imageAspectRatio, @@ -55,6 +56,7 @@ class ProductCard extends StatelessWidget { width: 121.0, child: Column( mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( product == null ? '' : product!.name, diff --git a/dev/integration_tests/flutter_gallery/lib/gallery/example_code.dart b/dev/integration_tests/flutter_gallery/lib/gallery/example_code.dart index 0b335bd2c2..260622cf26 100644 --- a/dev/integration_tests/flutter_gallery/lib/gallery/example_code.dart +++ b/dev/integration_tests/flutter_gallery/lib/gallery/example_code.dart @@ -253,6 +253,7 @@ class GridLists { // loaded from the web. GridView.count( crossAxisCount: 3, + childAspectRatio: 1.0, padding: const EdgeInsets.all(4.0), mainAxisSpacing: 4.0, crossAxisSpacing: 4.0, diff --git a/dev/integration_tests/flutter_gallery/lib/gallery/home.dart b/dev/integration_tests/flutter_gallery/lib/gallery/home.dart index ffe6b2e9a1..2011ce08e6 100644 --- a/dev/integration_tests/flutter_gallery/lib/gallery/home.dart +++ b/dev/integration_tests/flutter_gallery/lib/gallery/home.dart @@ -58,12 +58,14 @@ class _CategoryItem extends StatelessWidget { // repainted when the button's ink splash animates. return RepaintBoundary( child: RawMaterialButton( + padding: EdgeInsets.zero, hoverColor: theme.primaryColor.withOpacity(0.05), splashColor: theme.primaryColor.withOpacity(0.12), highlightColor: Colors.transparent, onPressed: onTap, child: Column( mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Padding( padding: const EdgeInsets.all(6.0), @@ -182,6 +184,7 @@ class _DemoItem extends StatelessWidget { final bool isDark = theme.brightness == Brightness.dark; final double textScaleFactor = MediaQuery.textScaleFactorOf(context); return RawMaterialButton( + padding: EdgeInsets.zero, splashColor: theme.primaryColor.withOpacity(0.12), highlightColor: Colors.transparent, onPressed: () { diff --git a/dev/integration_tests/flutter_gallery/test/smoke_test.dart b/dev/integration_tests/flutter_gallery/test/smoke_test.dart index ee448eabe8..78239ba11d 100644 --- a/dev/integration_tests/flutter_gallery/test/smoke_test.dart +++ b/dev/integration_tests/flutter_gallery/test/smoke_test.dart @@ -162,7 +162,7 @@ Future smokeGallery(WidgetTester tester) async { await tester.tap(find.text(category.name)); await tester.pumpAndSettle(); for (final GalleryDemo demo in kGalleryCategoryToDemos[category]!) { - await Scrollable.ensureVisible(tester.element(find.text(demo.title))); + await Scrollable.ensureVisible(tester.element(find.text(demo.title)), alignment: 0.0); await smokeDemo(tester, demo); tester.binding.debugAssertNoTransientCallbacks('A transient callback was still active after running $demo'); } diff --git a/dev/integration_tests/flutter_gallery/test_driver/run_demos.dart b/dev/integration_tests/flutter_gallery/test_driver/run_demos.dart index 84eed79d1e..b959ced68f 100644 --- a/dev/integration_tests/flutter_gallery/test_driver/run_demos.dart +++ b/dev/integration_tests/flutter_gallery/test_driver/run_demos.dart @@ -45,7 +45,7 @@ Future runDemos(List demos, WidgetController controller) async { await controller.pumpAndSettle(); // Scroll back to the top await controller.drag(demoList, const Offset(0.0, 10000.0)); - await controller.pumpAndSettle(); + await controller.pumpAndSettle(const Duration(milliseconds: 100)); } currentDemoCategory = demoCategory; diff --git a/dev/integration_tests/flutter_gallery/test_driver/transitions_perf_e2e.dart b/dev/integration_tests/flutter_gallery/test_driver/transitions_perf_e2e.dart index eb9825c2ba..cb3a81730a 100644 --- a/dev/integration_tests/flutter_gallery/test_driver/transitions_perf_e2e.dart +++ b/dev/integration_tests/flutter_gallery/test_driver/transitions_perf_e2e.dart @@ -31,7 +31,7 @@ void main([List args = const []]) { await tester.pumpAndSettle(); final int id = tester.getSemantics(find.bySemanticsLabel('Material')).id; expect(id, greaterThan(-1)); - }, skip: !withSemantics); + }, skip: !withSemantics, semanticsEnabled: true); testWidgets( 'all demos', diff --git a/dev/integration_tests/flutter_gallery/test_memory/memory_nav.dart b/dev/integration_tests/flutter_gallery/test_memory/memory_nav.dart index 460b3d0ad3..67b47692f6 100644 --- a/dev/integration_tests/flutter_gallery/test_memory/memory_nav.dart +++ b/dev/integration_tests/flutter_gallery/test_memory/memory_nav.dart @@ -31,6 +31,7 @@ Future main() async { }, behavior: HitTestBehavior.opaque, child: const IgnorePointer( + ignoring: true, child: GalleryApp(testMode: true), ), )); diff --git a/dev/integration_tests/hybrid_android_views/lib/motion_events_page.dart b/dev/integration_tests/hybrid_android_views/lib/motion_events_page.dart index ac136e55cf..c9f6150bff 100644 --- a/dev/integration_tests/hybrid_android_views/lib/motion_events_page.dart +++ b/dev/integration_tests/hybrid_android_views/lib/motion_events_page.dart @@ -199,7 +199,7 @@ class MotionEventsBodyState extends State { setState(() {}); break; } - return Future.value(); + return Future.value(null); } Future onViewMethodChannelCall(MethodCall call) { @@ -212,7 +212,7 @@ class MotionEventsBodyState extends State { setState(() {}); break; } - return Future.value(); + return Future.value(null); } Widget buildEventTile(BuildContext context, int index) { diff --git a/dev/integration_tests/web_e2e_tests/lib/scroll_wheel_main.dart b/dev/integration_tests/web_e2e_tests/lib/scroll_wheel_main.dart index cd76389369..5c223b1b27 100644 --- a/dev/integration_tests/web_e2e_tests/lib/scroll_wheel_main.dart +++ b/dev/integration_tests/web_e2e_tests/lib/scroll_wheel_main.dart @@ -105,5 +105,6 @@ void dispatchMouseWheelEvent(int mouseX, int mouseY, deltaMode: deltaMode, deltaX : deltaX, deltaY : deltaY, + shiftKey: false, )); } diff --git a/dev/manual_tests/lib/drag_and_drop.dart b/dev/manual_tests/lib/drag_and_drop.dart index 14dc71c725..234112fdc7 100644 --- a/dev/manual_tests/lib/drag_and_drop.dart +++ b/dev/manual_tests/lib/drag_and_drop.dart @@ -248,10 +248,13 @@ class DragAndDropAppState extends State { children: [ Expanded( child: Row( + crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ ExampleDragSource( color: Colors.yellow.shade300, + under: true, + heavy: false, child: const Text('under'), ), ExampleDragSource( @@ -263,6 +266,7 @@ class DragAndDropAppState extends State { ExampleDragSource( color: Colors.indigo.shade300, under: false, + heavy: false, child: const Text('above'), ), ], diff --git a/dev/manual_tests/lib/hover.dart b/dev/manual_tests/lib/hover.dart index ec15311a11..788dfdd31d 100644 --- a/dev/manual_tests/lib/hover.dart +++ b/dev/manual_tests/lib/hover.dart @@ -89,6 +89,7 @@ class _HoverDemoState extends State { const Padding( padding: EdgeInsets.all(8.0), child: TextField( + autofocus: false, decoration: InputDecoration( border: OutlineInputBorder(), labelText: 'Enter Text', diff --git a/dev/manual_tests/lib/text.dart b/dev/manual_tests/lib/text.dart index 576c93c75f..6facdf210c 100644 --- a/dev/manual_tests/lib/text.dart +++ b/dev/manual_tests/lib/text.dart @@ -96,6 +96,7 @@ class _HomeState extends State { Padding( padding: const EdgeInsets.symmetric(horizontal: 20.0), child: Slider( + min: 0.0, max: 1024.0, value: seed.toDouble(), label: '$seed', diff --git a/dev/tools/dartdoc.dart b/dev/tools/dartdoc.dart index 7f63307131..5cbcaa5eb7 100644 --- a/dev/tools/dartdoc.dart +++ b/dev/tools/dartdoc.dart @@ -250,15 +250,15 @@ ArgParser _createArgsParser() { final ArgParser parser = ArgParser(); parser.addFlag('help', abbr: 'h', negatable: false, help: 'Show command help.'); - parser.addFlag('verbose', defaultsTo: true, + parser.addFlag('verbose', negatable: true, defaultsTo: true, help: 'Whether to report all error messages (on) or attempt to ' 'filter out some known false positives (off). Shut this off ' 'locally if you want to address Flutter-specific issues.'); - parser.addFlag('checked', abbr: 'c', + parser.addFlag('checked', abbr: 'c', negatable: true, help: 'Run dartdoc in checked mode.'); - parser.addFlag('json', + parser.addFlag('json', negatable: true, help: 'Display json-formatted output from dartdoc and skip stdout/stderr prefixing.'); - parser.addFlag('validate-links', + parser.addFlag('validate-links', negatable: true, help: 'Display warnings for broken links generated by dartdoc (slow)'); return parser; } diff --git a/dev/tools/examples_smoke_test.dart b/dev/tools/examples_smoke_test.dart index 7878b1b002..cf36762f9d 100644 --- a/dev/tools/examples_smoke_test.dart +++ b/dev/tools/examples_smoke_test.dart @@ -50,7 +50,7 @@ Future cleanUp(File integrationTest) async { try { await integrationTest.delete(); // Delete the integration_test directory if it is empty. - await integrationTest.parent.delete(); + await integrationTest.parent.delete(recursive: false); } on FileSystemException { // Ignore, there might be other files in there preventing it from // being removed, or it might not exist. @@ -205,6 +205,7 @@ Future runCommand( process = await processManager.start( cmd, workingDirectory: workingDirectory.absolute.path, + includeParentEnvironment: true, environment: environment, ); process.stdout.listen( diff --git a/dev/tools/gen_keycodes/bin/gen_keycodes.dart b/dev/tools/gen_keycodes/bin/gen_keycodes.dart index 27bf0ca2ed..eda611ce1f 100644 --- a/dev/tools/gen_keycodes/bin/gen_keycodes.dart +++ b/dev/tools/gen_keycodes/bin/gen_keycodes.dart @@ -132,6 +132,7 @@ Future main(List rawArguments) async { ); argParser.addFlag( 'collect', + defaultsTo: false, negatable: false, help: 'If this flag is set, then collect and parse header files from ' 'Chromium and Android instead of reading pre-parsed data from ' @@ -140,6 +141,7 @@ Future main(List rawArguments) async { ); argParser.addFlag( 'help', + defaultsTo: false, negatable: false, help: 'Print help for this command.', ); diff --git a/dev/tools/gen_keycodes/lib/constants.dart b/dev/tools/gen_keycodes/lib/constants.dart index bb3a18191f..3fe8b758c0 100644 --- a/dev/tools/gen_keycodes/lib/constants.dart +++ b/dev/tools/gen_keycodes/lib/constants.dart @@ -22,7 +22,7 @@ class MaskConstant { return name .split(' ') .map((String word) => lowerCamelToUpperCamel(word.toLowerCase())) - .join(); + .join(''); } String get lowerCamelName { diff --git a/dev/tools/gen_keycodes/lib/ios_code_gen.dart b/dev/tools/gen_keycodes/lib/ios_code_gen.dart index 41bd10ae46..1cf3d82a57 100644 --- a/dev/tools/gen_keycodes/lib/ios_code_gen.dart +++ b/dev/tools/gen_keycodes/lib/ios_code_gen.dart @@ -81,7 +81,7 @@ class IOSCodeGenerator extends PlatformCodeGenerator { buffer.write(wrapString(constant.description, prefix: ' * ')); buffer.writeln(' */'); buffer.writeln('const uint64_t k${constant.upperCamelName} = ${toHex(constant.value, digits: 11)};'); - buffer.writeln(); + buffer.writeln(''); } return buffer.toString().trimRight(); } diff --git a/dev/tools/gen_keycodes/lib/keyboard_keys_code_gen.dart b/dev/tools/gen_keycodes/lib/keyboard_keys_code_gen.dart index 70c32d9490..642e061513 100644 --- a/dev/tools/gen_keycodes/lib/keyboard_keys_code_gen.dart +++ b/dev/tools/gen_keycodes/lib/keyboard_keys_code_gen.dart @@ -61,7 +61,7 @@ class KeyboardKeysCodeGenerator extends BaseCodeGenerator { '[RawKeyEvent.physicalKey] for more information.'); lines.add(entry.usbHidCode, ''' $firstComment /// -$otherComments static const PhysicalKeyboardKey ${entry.constantName} = PhysicalKeyboardKey(${toHex(entry.usbHidCode)}); +$otherComments static const PhysicalKeyboardKey ${entry.constantName} = PhysicalKeyboardKey(${toHex(entry.usbHidCode, digits: 8)}); '''); } return lines.sortedJoin().trimRight(); @@ -71,7 +71,7 @@ $otherComments static const PhysicalKeyboardKey ${entry.constantName} = Physica final OutputLines lines = OutputLines('Physical debug names'); for (final PhysicalKeyEntry entry in keyData.entries) { lines.add(entry.usbHidCode, ''' - ${toHex(entry.usbHidCode)}: '${entry.commentName}','''); + ${toHex(entry.usbHidCode, digits: 8)}: '${entry.commentName}','''); } return lines.sortedJoin().trimRight(); } diff --git a/dev/tools/gen_keycodes/lib/testing_key_codes_gen.dart b/dev/tools/gen_keycodes/lib/testing_key_codes_gen.dart index 26081e1e58..3f48dd6082 100644 --- a/dev/tools/gen_keycodes/lib/testing_key_codes_gen.dart +++ b/dev/tools/gen_keycodes/lib/testing_key_codes_gen.dart @@ -23,7 +23,7 @@ class KeyCodesCcGenerator extends BaseCodeGenerator { final OutputLines lines = OutputLines('Physical Key list'); for (final PhysicalKeyEntry entry in keyData.entries) { lines.add(entry.usbHidCode, ''' -constexpr uint64_t kPhysical${_toUpperCammel(entry.constantName)} = ${toHex(entry.usbHidCode)};'''); +constexpr uint64_t kPhysical${_toUpperCammel(entry.constantName)} = ${toHex(entry.usbHidCode, digits: 8)};'''); } return lines.sortedJoin().trimRight(); } diff --git a/dev/tools/localization/bin/gen_subtag_registry.dart b/dev/tools/localization/bin/gen_subtag_registry.dart index c2779bfc71..b1b2cbea33 100644 --- a/dev/tools/localization/bin/gen_subtag_registry.dart +++ b/dev/tools/localization/bin/gen_subtag_registry.dart @@ -15,7 +15,7 @@ Future main() async { final HttpClient client = HttpClient(); final HttpClientRequest request = await client.getUrl(Uri.parse(registry)); final HttpClientResponse response = await request.close(); - final String body = (await response.cast>().transform(utf8.decoder).toList()).join(); + final String body = (await response.cast>().transform(utf8.decoder).toList()).join(''); final File subtagRegistry = File('../language_subtag_registry.dart'); final File subtagRegistryFlutterTools = File('../../../../packages/flutter_tools/lib/src/localizations/language_subtag_registry.dart'); diff --git a/dev/tools/localization/localizations_utils.dart b/dev/tools/localization/localizations_utils.dart index e6d29cb8d5..e3373dce2c 100644 --- a/dev/tools/localization/localizations_utils.dart +++ b/dev/tools/localization/localizations_utils.dart @@ -118,7 +118,7 @@ class LocaleInfo implements Comparable { return originalString .split('_') .map((String part) => part.substring(0, 1).toUpperCase() + part.substring(1).toLowerCase()) - .join(); + .join(''); } @override @@ -232,14 +232,17 @@ GeneratorOptions parseArgs(List rawArgs) { ..addFlag( 'overwrite', abbr: 'w', + defaultsTo: false, ) ..addFlag( 'material', help: 'Whether to print the generated classes for the Material package only. Ignored when --overwrite is passed.', + defaultsTo: false, ) ..addFlag( 'cupertino', help: 'Whether to print the generated classes for the Cupertino package only. Ignored when --overwrite is passed.', + defaultsTo: false, ); final argslib.ArgResults args = argParser.parse(rawArgs); final bool writeToFile = args['overwrite'] as bool; diff --git a/dev/tools/mega_gallery.dart b/dev/tools/mega_gallery.dart index cf478beb2c..fca4fd9ace 100644 --- a/dev/tools/mega_gallery.dart +++ b/dev/tools/mega_gallery.dart @@ -165,7 +165,7 @@ class SourceStats { SourceStats getStatsFor(Directory dir, [SourceStats? stats]) { stats ??= SourceStats(); - for (final FileSystemEntity entity in dir.listSync(followLinks: false)) { + for (final FileSystemEntity entity in dir.listSync(recursive: false, followLinks: false)) { final String name = path.basename(entity.path); if (entity is File && name.endsWith('.dart')) { stats.files += 1; diff --git a/dev/tools/update_icons.dart b/dev/tools/update_icons.dart index 33cb323c49..bfdba6a542 100644 --- a/dev/tools/update_icons.dart +++ b/dev/tools/update_icons.dart @@ -212,7 +212,7 @@ ArgResults _handleArguments(List args) { ..addOption(_iconsClassPathOption, defaultsTo: _defaultIconsPath, help: 'Location of the material icons file') - ..addFlag(_dryRunOption); + ..addFlag(_dryRunOption, defaultsTo: false); argParser.addFlag('help', abbr: 'h', negatable: false, callback: (bool help) { if (help) { print(argParser.usage); @@ -289,7 +289,7 @@ String _regenerateIconsFile(String iconData, Map tokenPairMap) { // Generate for Icons if (line.contains(_beginGeneratedMark)) { generating = true; - final String iconDeclarationsString = newIcons.map((_Icon icon) => icon.fullDeclaration).join(); + final String iconDeclarationsString = newIcons.map((_Icon icon) => icon.fullDeclaration).join(''); buf.write(iconDeclarationsString); } else if (line.contains(_endGeneratedMark)) { generating = false; diff --git a/examples/api/lib/animation/curves/curve2_d.0.dart b/examples/api/lib/animation/curves/curve2_d.0.dart index 9aeb10c673..367862b6ac 100644 --- a/examples/api/lib/animation/curves/curve2_d.0.dart +++ b/examples/api/lib/animation/curves/curve2_d.0.dart @@ -39,6 +39,7 @@ final CatmullRomSpline path = CatmullRomSpline( ], startHandle: const Offset(0.93, 0.93), endHandle: const Offset(0.18, 0.23), + tension: 0.0, ); class FollowCurve2D extends StatefulWidget { @@ -73,7 +74,7 @@ class _FollowCurve2DState extends State animation = CurvedAnimation(parent: controller, curve: widget.curve); // Have the controller repeat indefinitely. If you want it to "bounce" back // and forth, set the reverse parameter to true. - controller.repeat(); + controller.repeat(reverse: false); controller.addListener(() => setState(() {})); } @@ -106,6 +107,7 @@ class MyStatelessWidget extends StatelessWidget { alignment: Alignment.center, child: FollowCurve2D( path: path, + curve: Curves.easeInOut, duration: const Duration(seconds: 3), child: CircleAvatar( backgroundColor: Colors.yellow, diff --git a/examples/api/lib/cupertino/refresh/cupertino_sliver_refresh_control.0.dart b/examples/api/lib/cupertino/refresh/cupertino_sliver_refresh_control.0.dart index ce63503d8b..4ba371a63d 100644 --- a/examples/api/lib/cupertino/refresh/cupertino_sliver_refresh_control.0.dart +++ b/examples/api/lib/cupertino/refresh/cupertino_sliver_refresh_control.0.dart @@ -53,6 +53,8 @@ class _MyStatefulWidgetState extends State { largeTitle: Text('Scroll down'), ), CupertinoSliverRefreshControl( + refreshTriggerPullDistance: 100.0, + refreshIndicatorExtent: 60.0, onRefresh: () async { await Future.delayed( const Duration(milliseconds: 1000), diff --git a/examples/api/lib/gestures/pointer_signal_resolver/pointer_signal_resolver.0.dart b/examples/api/lib/gestures/pointer_signal_resolver/pointer_signal_resolver.0.dart index 4cad004fe6..3831047f6a 100644 --- a/examples/api/lib/gestures/pointer_signal_resolver/pointer_signal_resolver.0.dart +++ b/examples/api/lib/gestures/pointer_signal_resolver/pointer_signal_resolver.0.dart @@ -116,6 +116,7 @@ class _MyStatefulWidgetState extends State { Align( alignment: Alignment.topLeft, child: Row( + crossAxisAlignment: CrossAxisAlignment.center, children: [ Switch( value: useResolver, diff --git a/examples/api/lib/material/date_picker/show_date_picker.0.dart b/examples/api/lib/material/date_picker/show_date_picker.0.dart index c524affe2c..73cb2c33aa 100644 --- a/examples/api/lib/material/date_picker/show_date_picker.0.dart +++ b/examples/api/lib/material/date_picker/show_date_picker.0.dart @@ -64,8 +64,8 @@ class _MyStatefulWidgetState extends State restorationId: 'date_picker_dialog', initialEntryMode: DatePickerEntryMode.calendarOnly, initialDate: DateTime.fromMillisecondsSinceEpoch(arguments! as int), - firstDate: DateTime(2021), - lastDate: DateTime(2022), + firstDate: DateTime(2021, 1, 1), + lastDate: DateTime(2022, 1, 1), ); }, ); diff --git a/examples/api/lib/material/date_picker/show_date_range_picker.0.dart b/examples/api/lib/material/date_picker/show_date_range_picker.0.dart index 47d77876ce..62a96eca14 100644 --- a/examples/api/lib/material/date_picker/show_date_range_picker.0.dart +++ b/examples/api/lib/material/date_picker/show_date_range_picker.0.dart @@ -41,7 +41,7 @@ class _MyStatefulWidgetState extends State String? get restorationId => widget.restorationId; final RestorableDateTimeN _startDate = - RestorableDateTimeN(DateTime(2021)); + RestorableDateTimeN(DateTime(2021, 1, 1)); final RestorableDateTimeN _endDate = RestorableDateTimeN(DateTime(2021, 1, 5)); late final RestorableRouteFuture @@ -85,9 +85,9 @@ class _MyStatefulWidgetState extends State restorationId: 'date_picker_dialog', initialDateRange: _initialDateTimeRange(arguments! as Map), - firstDate: DateTime(2021), + firstDate: DateTime(2021, 1, 1), currentDate: DateTime(2021, 1, 25), - lastDate: DateTime(2022), + lastDate: DateTime(2022, 1, 1), ); }, ); diff --git a/examples/api/lib/material/dropdown/dropdown_button.0.dart b/examples/api/lib/material/dropdown/dropdown_button.0.dart index fcf87e5cbc..3ceb1a1cfa 100644 --- a/examples/api/lib/material/dropdown/dropdown_button.0.dart +++ b/examples/api/lib/material/dropdown/dropdown_button.0.dart @@ -42,6 +42,7 @@ class _MyStatefulWidgetState extends State { return DropdownButton( value: dropdownValue, icon: const Icon(Icons.arrow_downward), + iconSize: 24, elevation: 16, style: const TextStyle(color: Colors.deepPurple), underline: Container( diff --git a/examples/api/lib/material/list_tile/list_tile.5.dart b/examples/api/lib/material/list_tile/list_tile.5.dart index 15fd4b1685..6a350ebc66 100644 --- a/examples/api/lib/material/list_tile/list_tile.5.dart +++ b/examples/api/lib/material/list_tile/list_tile.5.dart @@ -47,6 +47,7 @@ class _ArticleDescription extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( + flex: 1, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -72,6 +73,7 @@ class _ArticleDescription extends StatelessWidget { ), ), Expanded( + flex: 1, child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.end, diff --git a/examples/api/lib/material/material_state/material_state_border_side.0.dart b/examples/api/lib/material/material_state/material_state_border_side.0.dart index 8a65691742..4130382c94 100644 --- a/examples/api/lib/material/material_state/material_state_border_side.0.dart +++ b/examples/api/lib/material/material_state/material_state_border_side.0.dart @@ -49,7 +49,7 @@ class _MyStatefulWidgetState extends State { }, side: MaterialStateBorderSide.resolveWith((Set states) { if (states.contains(MaterialState.selected)) { - return const BorderSide(color: Colors.red); + return const BorderSide(width: 1, color: Colors.red); } return null; // Defer to default value on the theme or widget. }), diff --git a/examples/api/lib/material/radio/radio.toggleable.0.dart b/examples/api/lib/material/radio/radio.toggleable.0.dart index c2263b9ac3..6a0c0c18d2 100644 --- a/examples/api/lib/material/radio/radio.toggleable.0.dart +++ b/examples/api/lib/material/radio/radio.toggleable.0.dart @@ -49,6 +49,7 @@ class _MyStatefulWidgetState extends State { itemBuilder: (BuildContext context, int index) { return Row( mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Radio( value: index, diff --git a/examples/api/lib/material/range_slider/range_slider.0.dart b/examples/api/lib/material/range_slider/range_slider.0.dart index 54af89063d..c4da141b3d 100644 --- a/examples/api/lib/material/range_slider/range_slider.0.dart +++ b/examples/api/lib/material/range_slider/range_slider.0.dart @@ -39,6 +39,7 @@ class _MyStatefulWidgetState extends State { Widget build(BuildContext context) { return RangeSlider( values: _currentRangeValues, + min: 0, max: 100, divisions: 5, labels: RangeLabels( diff --git a/examples/api/lib/material/slider/slider.0.dart b/examples/api/lib/material/slider/slider.0.dart index d963f1c91a..ea17910346 100644 --- a/examples/api/lib/material/slider/slider.0.dart +++ b/examples/api/lib/material/slider/slider.0.dart @@ -39,6 +39,7 @@ class _MyStatefulWidgetState extends State { Widget build(BuildContext context) { return Slider( value: _currentSliderValue, + min: 0, max: 100, divisions: 5, label: _currentSliderValue.round().toString(), diff --git a/examples/api/lib/widgets/actions/action.action_overridable.0.dart b/examples/api/lib/widgets/actions/action.action_overridable.0.dart index 502b72f17b..d46fda69d1 100644 --- a/examples/api/lib/widgets/actions/action.action_overridable.0.dart +++ b/examples/api/lib/widgets/actions/action.action_overridable.0.dart @@ -122,39 +122,42 @@ class _SimpleUSPhoneNumberEntryState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ const Expanded( - child: Text('(', textAlign: TextAlign.center), - ), + child: Text( + '(', + textAlign: TextAlign.center, + ), + flex: 1), Expanded( - flex: 3, - child: DigitInput( - focusNode: areaCodeFocusNode, - controller: areaCodeController, - maxLength: 3, - ), - ), + child: DigitInput( + focusNode: areaCodeFocusNode, + controller: areaCodeController, + maxLength: 3), + flex: 3), const Expanded( - child: Text(')', textAlign: TextAlign.center), - ), + child: Text( + ')', + textAlign: TextAlign.center, + ), + flex: 1), Expanded( - flex: 3, - child: DigitInput( - focusNode: prefixFocusNode, - controller: prefixController, - maxLength: 3, - ), - ), + child: DigitInput( + focusNode: prefixFocusNode, + controller: prefixController, + maxLength: 3), + flex: 3), const Expanded( - child: Text('-', textAlign: TextAlign.center), - ), + child: Text( + '-', + textAlign: TextAlign.center, + ), + flex: 1), Expanded( - flex: 4, - child: DigitInput( - focusNode: lineNumberFocusNode, - controller: lineNumberController, - textInputAction: TextInputAction.done, - maxLength: 4, - ), - ), + child: DigitInput( + focusNode: lineNumberFocusNode, + controller: lineNumberController, + textInputAction: TextInputAction.done, + maxLength: 4), + flex: 4), ], ), ); diff --git a/examples/api/lib/widgets/actions/action_listener.0.dart b/examples/api/lib/widgets/actions/action_listener.0.dart index aa5f5ac0f7..c481a9cec4 100644 --- a/examples/api/lib/widgets/actions/action_listener.0.dart +++ b/examples/api/lib/widgets/actions/action_listener.0.dart @@ -53,6 +53,7 @@ class _ActionListenerExampleState extends State { @override Widget build(BuildContext context) { return Row( + crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Padding( diff --git a/examples/api/lib/widgets/animated_list/animated_list.0.dart b/examples/api/lib/widgets/animated_list/animated_list.0.dart index 56f5701509..390284a9b7 100644 --- a/examples/api/lib/widgets/animated_list/animated_list.0.dart +++ b/examples/api/lib/widgets/animated_list/animated_list.0.dart @@ -62,6 +62,7 @@ class _AnimatedListSampleState extends State { return CardItem( animation: animation, item: item, + selected: false, // No gesture detector here: we don't want removed items to be interactive. ); } @@ -195,6 +196,7 @@ class CardItem extends StatelessWidget { return Padding( padding: const EdgeInsets.all(2.0), child: SizeTransition( + axis: Axis.vertical, sizeFactor: animation, child: GestureDetector( behavior: HitTestBehavior.opaque, diff --git a/examples/api/lib/widgets/animated_list/sliver_animated_list.0.dart b/examples/api/lib/widgets/animated_list/sliver_animated_list.0.dart index 65a2535790..4a07081cb3 100644 --- a/examples/api/lib/widgets/animated_list/sliver_animated_list.0.dart +++ b/examples/api/lib/widgets/animated_list/sliver_animated_list.0.dart @@ -65,6 +65,7 @@ class _SliverAnimatedListSampleState extends State { return CardItem( animation: animation, item: item, + selected: false, ); } @@ -212,8 +213,10 @@ class CardItem extends StatelessWidget { left: 2.0, right: 2.0, top: 2.0, + bottom: 0.0, ), child: SizeTransition( + axis: Axis.vertical, sizeFactor: animation, child: GestureDetector( onTap: onTap, diff --git a/examples/api/lib/widgets/async/future_builder.0.dart b/examples/api/lib/widgets/async/future_builder.0.dart index ab6ea90887..2570893fab 100644 --- a/examples/api/lib/widgets/async/future_builder.0.dart +++ b/examples/api/lib/widgets/async/future_builder.0.dart @@ -84,6 +84,7 @@ class _MyStatefulWidgetState extends State { return Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: children, ), ); diff --git a/examples/api/lib/widgets/async/stream_builder.0.dart b/examples/api/lib/widgets/async/stream_builder.0.dart index 8c7005a624..46f4a23125 100644 --- a/examples/api/lib/widgets/async/stream_builder.0.dart +++ b/examples/api/lib/widgets/async/stream_builder.0.dart @@ -123,6 +123,7 @@ class _MyStatefulWidgetState extends State { return Column( mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: children, ); }, diff --git a/examples/api/lib/widgets/autocomplete/raw_autocomplete.2.dart b/examples/api/lib/widgets/autocomplete/raw_autocomplete.2.dart index babed5fa0e..0a358eaf6c 100644 --- a/examples/api/lib/widgets/autocomplete/raw_autocomplete.2.dart +++ b/examples/api/lib/widgets/autocomplete/raw_autocomplete.2.dart @@ -56,6 +56,7 @@ class AutocompleteFormExampleState extends State { value: _dropdownValue, icon: const Icon(Icons.arrow_downward), hint: const Text('This is a regular DropdownButtonFormField'), + iconSize: 24, elevation: 16, style: const TextStyle(color: Colors.deepPurple), onChanged: (String? newValue) { diff --git a/examples/api/lib/widgets/basic/absorb_pointer.0.dart b/examples/api/lib/widgets/basic/absorb_pointer.0.dart index 12936e3e1c..00e0f9cd84 100644 --- a/examples/api/lib/widgets/basic/absorb_pointer.0.dart +++ b/examples/api/lib/widgets/basic/absorb_pointer.0.dart @@ -47,6 +47,7 @@ class MyStatelessWidget extends StatelessWidget { width: 100.0, height: 200.0, child: AbsorbPointer( + absorbing: true, child: ElevatedButton( style: ElevatedButton.styleFrom( primary: Colors.blue.shade200, diff --git a/examples/api/lib/widgets/basic/expanded.1.dart b/examples/api/lib/widgets/basic/expanded.1.dart index aed0cda8fb..78a8fd75fe 100644 --- a/examples/api/lib/widgets/basic/expanded.1.dart +++ b/examples/api/lib/widgets/basic/expanded.1.dart @@ -47,6 +47,7 @@ class MyStatelessWidget extends StatelessWidget { width: 50, ), Expanded( + flex: 1, child: Container( color: Colors.amber, height: 100, diff --git a/examples/api/lib/widgets/page_view/page_view.0.dart b/examples/api/lib/widgets/page_view/page_view.0.dart index e18fe940fa..9a9952c141 100644 --- a/examples/api/lib/widgets/page_view/page_view.0.dart +++ b/examples/api/lib/widgets/page_view/page_view.0.dart @@ -30,10 +30,11 @@ class MyStatelessWidget extends StatelessWidget { @override Widget build(BuildContext context) { - final PageController controller = PageController(); + final PageController controller = PageController(initialPage: 0); return PageView( /// [PageView.scrollDirection] defaults to [Axis.horizontal]. /// Use [Axis.vertical] to scroll vertically. + scrollDirection: Axis.horizontal, controller: controller, children: const [ Center( diff --git a/examples/api/lib/widgets/transitions/decorated_box_transition.0.dart b/examples/api/lib/widgets/transitions/decorated_box_transition.0.dart index 86fac6523a..4dad636920 100644 --- a/examples/api/lib/widgets/transitions/decorated_box_transition.0.dart +++ b/examples/api/lib/widgets/transitions/decorated_box_transition.0.dart @@ -37,6 +37,7 @@ class _MyStatefulWidgetState extends State color: const Color(0xFFFFFFFF), border: Border.all(style: BorderStyle.none), borderRadius: BorderRadius.circular(60.0), + shape: BoxShape.rectangle, boxShadow: const [ BoxShadow( color: Color(0x66666666), @@ -73,6 +74,7 @@ class _MyStatefulWidgetState extends State color: Colors.white, child: Center( child: DecoratedBoxTransition( + position: DecorationPosition.background, decoration: decorationTween.animate(_controller), child: Container( width: 200, diff --git a/examples/layers/rendering/flex_layout.dart b/examples/layers/rendering/flex_layout.dart index 43c29509fc..e53073159c 100644 --- a/examples/layers/rendering/flex_layout.dart +++ b/examples/layers/rendering/flex_layout.dart @@ -65,7 +65,7 @@ void main() { textDirection: TextDirection.ltr, ); table.add(RenderPadding(child: paragraph, padding: const EdgeInsets.only(top: 20.0))); - final RenderFlex row = RenderFlex(textDirection: TextDirection.ltr); + final RenderFlex row = RenderFlex(direction: Axis.horizontal, textDirection: TextDirection.ltr); row.add(RenderSolidColorBox(const Color(0xFFFFCCCC), desiredSize: const Size(80.0, 60.0))); row.add(RenderSolidColorBox(const Color(0xFFCCFFCC), desiredSize: const Size(64.0, 60.0))); row.add(RenderSolidColorBox(const Color(0xFFCCCCFF), desiredSize: const Size(160.0, 60.0))); diff --git a/examples/layers/rendering/hello_world.dart b/examples/layers/rendering/hello_world.dart index 03b4801e28..800e2ccace 100644 --- a/examples/layers/rendering/hello_world.dart +++ b/examples/layers/rendering/hello_world.dart @@ -13,6 +13,7 @@ void main() { // The root of our render tree is a RenderPositionedBox, which centers its // child both vertically and horizontally. root: RenderPositionedBox( + alignment: Alignment.center, // We use a RenderParagraph to display the text 'Hello, world.' without // any explicit styling. child: RenderParagraph( diff --git a/examples/layers/rendering/spinning_square.dart b/examples/layers/rendering/spinning_square.dart index 68b1359139..b1f0027744 100644 --- a/examples/layers/rendering/spinning_square.dart +++ b/examples/layers/rendering/spinning_square.dart @@ -39,6 +39,7 @@ void main() { ); // Finally, we center the spinning green square... final RenderBox root = RenderPositionedBox( + alignment: Alignment.center, child: spin, ); // and attach it to the window. diff --git a/examples/layers/widgets/sectors.dart b/examples/layers/widgets/sectors.dart index b0dc78b3b5..af96dc7cac 100644 --- a/examples/layers/widgets/sectors.dart +++ b/examples/layers/widgets/sectors.dart @@ -11,7 +11,7 @@ import '../rendering/src/sector_layout.dart'; RenderBoxToRenderSectorAdapter initCircle() { return RenderBoxToRenderSectorAdapter( innerRadius: 25.0, - child: RenderSectorRing(), + child: RenderSectorRing(padding: 0.0), ); } diff --git a/packages/flutter/lib/src/animation/animation_controller.dart b/packages/flutter/lib/src/animation/animation_controller.dart index 56ecbe9b79..bc60e90d80 100644 --- a/packages/flutter/lib/src/animation/animation_controller.dart +++ b/packages/flutter/lib/src/animation/animation_controller.dart @@ -33,6 +33,7 @@ enum _AnimationDirection { final SpringDescription _kFlingSpringDescription = SpringDescription.withDampingRatio( mass: 1.0, stiffness: 500.0, + ratio: 1.0, ); const Tolerance _kFlingTolerance = Tolerance( diff --git a/packages/flutter/lib/src/animation/curves.dart b/packages/flutter/lib/src/animation/curves.dart index 5018f58e8e..e968c25cb7 100644 --- a/packages/flutter/lib/src/animation/curves.dart +++ b/packages/flutter/lib/src/animation/curves.dart @@ -889,7 +889,7 @@ class CatmullRomCurve extends Curve { // and (1, 1), respectively. [Offset.zero, ...controlPoints, const Offset(1.0, 1.0)], tension: tension, - ).generateSamples(tolerance: 1e-12).toList(); + ).generateSamples(start: 0.0, end: 1.0, tolerance: 1e-12).toList(); } /// A static accumulator for assertion failures. Not used in release mode. diff --git a/packages/flutter/lib/src/cupertino/bottom_tab_bar.dart b/packages/flutter/lib/src/cupertino/bottom_tab_bar.dart index e5ca9a0e3a..bdfb3be56c 100644 --- a/packages/flutter/lib/src/cupertino/bottom_tab_bar.dart +++ b/packages/flutter/lib/src/cupertino/bottom_tab_bar.dart @@ -62,7 +62,8 @@ class CupertinoTabBar extends StatelessWidget implements PreferredSizeWidget { this.border = const Border( top: BorderSide( color: _kDefaultTabBarBorderColor, - width: 0.0, // 0.0 means one physical pixel + width: 0.0, // One physical pixel. + style: BorderStyle.solid, ), ), }) : assert(items != null), diff --git a/packages/flutter/lib/src/cupertino/context_menu.dart b/packages/flutter/lib/src/cupertino/context_menu.dart index 788a928b2f..a4bbb96981 100644 --- a/packages/flutter/lib/src/cupertino/context_menu.dart +++ b/packages/flutter/lib/src/cupertino/context_menu.dart @@ -344,6 +344,7 @@ class _CupertinoContextMenuState extends State with Ticker // it expands. This may be solvable by adding a widget to Scaffold that's // underneath the AppBar. _lastOverlayEntry = OverlayEntry( + opaque: false, builder: (BuildContext context) { return _DecoyChild( beginRect: childRect, @@ -1169,23 +1170,33 @@ class _ContextMenuSheet extends StatelessWidget { case _ContextMenuLocation.center: return _orientation == Orientation.portrait ? [ - const Spacer(), + const Spacer( + flex: 1, + ), menu, - const Spacer(), + const Spacer( + flex: 1, + ), ] : [ menu, - const Spacer(), + const Spacer( + flex: 1, + ), ]; case _ContextMenuLocation.right: return [ - const Spacer(), + const Spacer( + flex: 1, + ), menu, ]; case _ContextMenuLocation.left: return [ menu, - const Spacer(), + const Spacer( + flex: 1, + ), ]; } } diff --git a/packages/flutter/lib/src/cupertino/context_menu_action.dart b/packages/flutter/lib/src/cupertino/context_menu_action.dart index 3be99045b0..44813e3dad 100644 --- a/packages/flutter/lib/src/cupertino/context_menu_action.dart +++ b/packages/flutter/lib/src/cupertino/context_menu_action.dart @@ -116,7 +116,7 @@ class _CupertinoContextMenuActionState extends State decoration: BoxDecoration( color: _isPressed ? _kBackgroundColorPressed : _kBackgroundColor, border: const Border( - bottom: BorderSide(color: _kBackgroundColorPressed), + bottom: BorderSide(width: 1.0, color: _kBackgroundColorPressed), ), ), padding: const EdgeInsets.symmetric( diff --git a/packages/flutter/lib/src/cupertino/date_picker.dart b/packages/flutter/lib/src/cupertino/date_picker.dart index f5c1a36227..86ff0f5a8d 100644 --- a/packages/flutter/lib/src/cupertino/date_picker.dart +++ b/packages/flutter/lib/src/cupertino/date_picker.dart @@ -583,7 +583,7 @@ class _CupertinoDatePickerDateTimeState extends State { meridiemController = FixedExtentScrollController(initialItem: selectedAmPm); hourController = FixedExtentScrollController(initialItem: initialDateTime.hour); minuteController = FixedExtentScrollController(initialItem: initialDateTime.minute ~/ widget.minuteInterval); - dateController = FixedExtentScrollController(); + dateController = FixedExtentScrollController(initialItem: 0); PaintingBinding.instance!.systemFonts.addListener(_handleSystemFontsChange); } @@ -740,6 +740,7 @@ class _CupertinoDatePickerDateTimeState extends State { initialDateTime.month, initialDateTime.day + selectedDayFromInitial, _selectedHour(meridiemIndex, hourIndex), + 0, ); // The end value of the range is exclusive, i.e. [rangeStart, rangeEnd). diff --git a/packages/flutter/lib/src/cupertino/desktop_text_selection.dart b/packages/flutter/lib/src/cupertino/desktop_text_selection.dart index c0c76c18d8..694d9a31bf 100644 --- a/packages/flutter/lib/src/cupertino/desktop_text_selection.dart +++ b/packages/flutter/lib/src/cupertino/desktop_text_selection.dart @@ -280,6 +280,7 @@ class _CupertinoDesktopTextSelectionToolbar extends StatelessWidget { ), child: Padding( padding: const EdgeInsets.symmetric( + horizontal: 0.0, // This value was measured from a screenshot of TextEdit on MacOS // 10.15.7 on a Macbook Pro. vertical: 3.0, diff --git a/packages/flutter/lib/src/cupertino/dialog.dart b/packages/flutter/lib/src/cupertino/dialog.dart index 32076a4c5f..5c5fbecbed 100644 --- a/packages/flutter/lib/src/cupertino/dialog.dart +++ b/packages/flutter/lib/src/cupertino/dialog.dart @@ -351,6 +351,7 @@ class CupertinoAlertDialog extends StatelessWidget { if (actions.isNotEmpty) { actionSection = _CupertinoAlertActionSection( scrollController: _effectiveActionScrollController, + isActionSheet: false, children: actions, ); } @@ -1516,6 +1517,7 @@ class _CupertinoAlertContentSection extends StatelessWidget { child: SingleChildScrollView( controller: scrollController, child: Column( + mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.stretch, children: titleContentGroup, ), @@ -2232,7 +2234,7 @@ class _RenderCupertinoDialogActions extends RenderBox @override void performLayout() { - size = _performLayout(constraints: constraints); + size = _performLayout(constraints: constraints, dry: false); } Size _performLayout({required BoxConstraints constraints, bool dry = false}) { @@ -2257,6 +2259,8 @@ class _RenderCupertinoDialogActions extends RenderBox final BoxConstraints perButtonConstraints = BoxConstraints( minWidth: (constraints.minWidth - dividerThickness) / 2.0, maxWidth: (constraints.maxWidth - dividerThickness) / 2.0, + minHeight: 0.0, + maxHeight: double.infinity, ); // Layout the 2 buttons. diff --git a/packages/flutter/lib/src/cupertino/nav_bar.dart b/packages/flutter/lib/src/cupertino/nav_bar.dart index 53e4877672..b863680abe 100644 --- a/packages/flutter/lib/src/cupertino/nav_bar.dart +++ b/packages/flutter/lib/src/cupertino/nav_bar.dart @@ -43,7 +43,8 @@ const Color _kDefaultNavBarBorderColor = Color(0x4D000000); const Border _kDefaultNavBarBorder = Border( bottom: BorderSide( color: _kDefaultNavBarBorderColor, - width: 0.0, // 0.0 means one physical pixel + width: 0.0, // One physical pixel. + style: BorderStyle.solid, ), ); @@ -152,6 +153,7 @@ Widget _wrapWithBackground({ } result = AnnotatedRegion( value: overlayStyle, + sized: true, child: result, ); } @@ -958,6 +960,7 @@ class _PersistentNavigationBar extends StatelessWidget { leading: leading, middle: middle, trailing: components.trailing, + centerMiddle: true, middleSpacing: 6.0, ); @@ -1353,6 +1356,7 @@ class CupertinoNavigationBarBackButton extends StatelessWidget { constraints: const BoxConstraints(minWidth: _kNavBarBackButtonTapWidth), child: Row( mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, children: [ const Padding(padding: EdgeInsetsDirectional.only(start: 8.0)), _backChevron ?? const _BackChevron(), diff --git a/packages/flutter/lib/src/cupertino/picker.dart b/packages/flutter/lib/src/cupertino/picker.dart index 57064f3681..c6516ed1b0 100644 --- a/packages/flutter/lib/src/cupertino/picker.dart +++ b/packages/flutter/lib/src/cupertino/picker.dart @@ -278,7 +278,6 @@ class _CupertinoPickerState extends State { Widget build(BuildContext context) { final Color? resolvedBackgroundColor = CupertinoDynamicColor.maybeResolve(widget.backgroundColor, context); - assert(RenderListWheelViewport.defaultPerspective == _kDefaultPerspective); final Widget result = DefaultTextStyle( style: CupertinoTheme.of(context).textTheme.pickerTextStyle, child: Stack( @@ -290,6 +289,7 @@ class _CupertinoPickerState extends State { controller: widget.scrollController ?? _controller, physics: const FixedExtentScrollPhysics(), diameterRatio: widget.diameterRatio, + perspective: _kDefaultPerspective, offAxisFraction: widget.offAxisFraction, useMagnifier: widget.useMagnifier, magnification: widget.magnification, diff --git a/packages/flutter/lib/src/cupertino/sliding_segmented_control.dart b/packages/flutter/lib/src/cupertino/sliding_segmented_control.dart index eadbcfcca3..308bea803d 100644 --- a/packages/flutter/lib/src/cupertino/sliding_segmented_control.dart +++ b/packages/flutter/lib/src/cupertino/sliding_segmented_control.dart @@ -149,6 +149,7 @@ class _SegmentState extends State<_Segment> with TickerProviderStateMixin< // Expand the hitTest area of this widget. behavior: HitTestBehavior.opaque, child: IndexedStack( + index: 0, alignment: Alignment.center, children: [ AnimatedOpacity( diff --git a/packages/flutter/lib/src/cupertino/text_field.dart b/packages/flutter/lib/src/cupertino/text_field.dart index 663e5a1acb..75b5de9957 100644 --- a/packages/flutter/lib/src/cupertino/text_field.dart +++ b/packages/flutter/lib/src/cupertino/text_field.dart @@ -29,6 +29,7 @@ const BorderSide _kDefaultRoundedBorderSide = BorderSide( color: Color(0x33000000), darkColor: Color(0x33FFFFFF), ), + style: BorderStyle.solid, width: 0.0, ); const Border _kDefaultRoundedBorder = Border( diff --git a/packages/flutter/lib/src/foundation/assertions.dart b/packages/flutter/lib/src/foundation/assertions.dart index 827188c2a6..cebd69d6de 100644 --- a/packages/flutter/lib/src/foundation/assertions.dart +++ b/packages/flutter/lib/src/foundation/assertions.dart @@ -228,7 +228,7 @@ abstract class _ErrorDiagnostic extends DiagnosticsProperty> { @override String valueToString({ TextTreeConfiguration? parentConfiguration }) { - return value.join(); + return value.join(''); } } @@ -969,6 +969,7 @@ class FlutterError extends Error with DiagnosticableTreeMixin implements Asserti if (isInDebugMode) { debugPrint( TextTreeRenderer( + wrapWidth: wrapWidth, wrapWidthProperties: wrapWidth, maxDescendentsTruncatableNode: 5, ).render(details.toDiagnosticsNode(style: DiagnosticsTreeStyle.error)).trimRight(), @@ -1041,7 +1042,7 @@ class FlutterError extends Error with DiagnosticableTreeMixin implements Asserti index -= 1; } } - final List reasons = List.filled(parsedFrames.length, null); + final List reasons = List.filled(parsedFrames.length, null, growable: false); for (final StackFilter filter in _stackFilters) { filter.filter(parsedFrames, reasons); } diff --git a/packages/flutter/lib/src/foundation/constants.dart b/packages/flutter/lib/src/foundation/constants.dart index fb60b60e3b..563ad477f8 100644 --- a/packages/flutter/lib/src/foundation/constants.dart +++ b/packages/flutter/lib/src/foundation/constants.dart @@ -19,7 +19,7 @@ /// /// * [kDebugMode], which is true in debug builds. /// * [kProfileMode], which is true in profile builds. -const bool kReleaseMode = bool.fromEnvironment('dart.vm.product'); +const bool kReleaseMode = bool.fromEnvironment('dart.vm.product', defaultValue: false); /// A constant that is true if the application was compiled in profile mode. /// @@ -34,7 +34,7 @@ const bool kReleaseMode = bool.fromEnvironment('dart.vm.product'); /// /// * [kDebugMode], which is true in debug builds. /// * [kReleaseMode], which is true in release builds. -const bool kProfileMode = bool.fromEnvironment('dart.vm.profile'); +const bool kProfileMode = bool.fromEnvironment('dart.vm.profile', defaultValue: false); /// A constant that is true if the application was compiled in debug mode. /// diff --git a/packages/flutter/lib/src/foundation/diagnostics.dart b/packages/flutter/lib/src/foundation/diagnostics.dart index 928e453bf4..b40277fa65 100644 --- a/packages/flutter/lib/src/foundation/diagnostics.dart +++ b/packages/flutter/lib/src/foundation/diagnostics.dart @@ -643,6 +643,7 @@ final TextTreeConfiguration whitespaceTextConfiguration = TextTreeConfiguration( prefixLastChildLineOne: '', prefixOtherLines: ' ', prefixOtherLinesRootNode: ' ', + bodyIndent: '', propertyPrefixIfChildren: '', propertyPrefixNoChildren: '', linkCharacter: ' ', @@ -677,6 +678,7 @@ final TextTreeConfiguration flatTextConfiguration = TextTreeConfiguration( prefixLastChildLineOne: '', prefixOtherLines: '', prefixOtherLinesRootNode: '', + bodyIndent: '', propertyPrefixIfChildren: '', propertyPrefixNoChildren: '', linkCharacter: '', @@ -731,6 +733,7 @@ final TextTreeConfiguration errorPropertyTextConfiguration = TextTreeConfigurati prefixLineOne: '', prefixOtherLines: '', prefixLastChildLineOne: '', + lineBreak: '\n', lineBreakProperties: false, addBlankLineIfNoChildren: false, showChildren: false, @@ -738,6 +741,7 @@ final TextTreeConfiguration errorPropertyTextConfiguration = TextTreeConfigurati propertyPrefixNoChildren: ' ', linkCharacter: '', prefixOtherLinesRootNode: '', + afterName: ':', isNameOnOwnLine: true, ); @@ -757,6 +761,7 @@ final TextTreeConfiguration shallowTextConfiguration = TextTreeConfiguration( prefixLastChildLineOne: '', prefixOtherLines: ' ', prefixOtherLinesRootNode: ' ', + bodyIndent: '', propertyPrefixIfChildren: '', propertyPrefixNoChildren: '', linkCharacter: ' ', @@ -1305,7 +1310,7 @@ class TextTreeRenderer { if (propertyLines.length == 1 && !config.lineBreakProperties) { builder.write(propertyLines.first); } else { - builder.write(propertyRender); + builder.write(propertyRender, allowWrap: false); if (!propertyRender.endsWith('\n')) builder.write('\n'); } @@ -1735,6 +1740,7 @@ abstract class DiagnosticsNode { result = TextTreeRenderer( minLevel: minLevel, wrapWidth: 65, + wrapWidthProperties: 65, ).render( this, prefixLineOne: prefixLineOne, diff --git a/packages/flutter/lib/src/gestures/binding.dart b/packages/flutter/lib/src/gestures/binding.dart index 241eb10538..3689aef450 100644 --- a/packages/flutter/lib/src/gestures/binding.dart +++ b/packages/flutter/lib/src/gestures/binding.dart @@ -407,6 +407,7 @@ mixin GestureBinding on BindingBase implements HitTestable, HitTestDispatcher, H library: 'gesture library', context: ErrorDescription('while dispatching a non-hit-tested pointer event'), event: event, + hitTestEntry: null, informationCollector: () sync* { yield DiagnosticsProperty('Event', event, style: DiagnosticsTreeStyle.errorProperty); }, diff --git a/packages/flutter/lib/src/gestures/monodrag.dart b/packages/flutter/lib/src/gestures/monodrag.dart index a3aaeb3bf2..362548b7b7 100644 --- a/packages/flutter/lib/src/gestures/monodrag.dart +++ b/packages/flutter/lib/src/gestures/monodrag.dart @@ -474,6 +474,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer { }; } else { details = DragEndDetails( + velocity: Velocity.zero, primaryVelocity: 0.0, ); debugReport = () { diff --git a/packages/flutter/lib/src/gestures/scale.dart b/packages/flutter/lib/src/gestures/scale.dart index 1671c81c48..f3c9d98bf8 100644 --- a/packages/flutter/lib/src/gestures/scale.dart +++ b/packages/flutter/lib/src/gestures/scale.dart @@ -499,7 +499,7 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer { velocity = Velocity(pixelsPerSecond: (pixelsPerSecond / pixelsPerSecond.distance) * kMaxFlingVelocity); invokeCallback('onEnd', () => onEnd!(ScaleEndDetails(velocity: velocity, pointerCount: _pointerQueue.length))); } else { - invokeCallback('onEnd', () => onEnd!(ScaleEndDetails(pointerCount: _pointerQueue.length))); + invokeCallback('onEnd', () => onEnd!(ScaleEndDetails(velocity: Velocity.zero, pointerCount: _pointerQueue.length))); } } _state = _ScaleState.accepted; diff --git a/packages/flutter/lib/src/gestures/velocity_tracker.dart b/packages/flutter/lib/src/gestures/velocity_tracker.dart index 3c626b9509..78577bccec 100644 --- a/packages/flutter/lib/src/gestures/velocity_tracker.dart +++ b/packages/flutter/lib/src/gestures/velocity_tracker.dart @@ -163,7 +163,7 @@ class VelocityTracker { final PointerDeviceKind kind; // Circular buffer; current sample at _index. - final List<_PointAtTime?> _samples = List<_PointAtTime?>.filled(_historySize, null); + final List<_PointAtTime?> _samples = List<_PointAtTime?>.filled(_historySize, null, growable: false); int _index = 0; /// Adds a position as the given time to the tracker. @@ -292,7 +292,7 @@ class IOSScrollViewFlingVelocityTracker extends VelocityTracker { /// `VerticalDragGestureRecognizer.isFlingGesture`. static const int _sampleSize = 20; - final List<_PointAtTime?> _touchSamples = List<_PointAtTime?>.filled(_sampleSize, null); + final List<_PointAtTime?> _touchSamples = List<_PointAtTime?>.filled(_sampleSize, null, growable: false); @override void addPosition(Duration time, Offset position) { diff --git a/packages/flutter/lib/src/material/about.dart b/packages/flutter/lib/src/material/about.dart index ef9de75d14..e16bf7a84d 100644 --- a/packages/flutter/lib/src/material/about.dart +++ b/packages/flutter/lib/src/material/about.dart @@ -570,6 +570,7 @@ class _PackagesViewState extends State<_PackagesView> { return Material( color: Theme.of(context).cardColor, child: Column( + mainAxisAlignment: MainAxisAlignment.start, children: [ widget.about, const Center(child: CircularProgressIndicator()), @@ -1469,6 +1470,7 @@ class _MasterDetailScaffoldState extends State<_MasterDetailScaffold> bottom: PreferredSize( preferredSize: const Size.fromHeight(kToolbarHeight), child: Row( + mainAxisAlignment: MainAxisAlignment.start, children: [ ConstrainedBox( constraints: BoxConstraints.tightFor(width: masterViewWidth), @@ -1574,6 +1576,7 @@ class _DetailView extends StatelessWidget { return DraggableScrollableSheet( initialChildSize: minHeight, minChildSize: minHeight, + maxChildSize: 1, expand: false, builder: (BuildContext context, ScrollController controller) { return MouseRegion( @@ -1584,7 +1587,7 @@ class _DetailView extends StatelessWidget { clipBehavior: Clip.antiAlias, margin: const EdgeInsets.fromLTRB(_kCardElevation, 0.0, _kCardElevation, 0.0), shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.vertical(top: Radius.circular(3.0)), + borderRadius: BorderRadius.vertical(top: Radius.circular(3.0), bottom: Radius.zero), ), child: _builder( context, diff --git a/packages/flutter/lib/src/material/app.dart b/packages/flutter/lib/src/material/app.dart index e26a49a0cd..1a70eaec39 100644 --- a/packages/flutter/lib/src/material/app.dart +++ b/packages/flutter/lib/src/material/app.dart @@ -948,6 +948,7 @@ class _MaterialAppState extends State { result = GridPaper( color: const Color(0xE0F9BBE0), interval: 8.0, + divisions: 2, subdivisions: 1, child: result, ); diff --git a/packages/flutter/lib/src/material/app_bar.dart b/packages/flutter/lib/src/material/app_bar.dart index 9d530e7e67..cb3eccc8e0 100644 --- a/packages/flutter/lib/src/material/app_bar.dart +++ b/packages/flutter/lib/src/material/app_bar.dart @@ -1011,6 +1011,7 @@ class _AppBarState extends State { if (widget.primary) { appBar = SafeArea( bottom: false, + top: true, child: appBar, ); } diff --git a/packages/flutter/lib/src/material/banner.dart b/packages/flutter/lib/src/material/banner.dart index c2214dbd38..463c55b3b7 100644 --- a/packages/flutter/lib/src/material/banner.dart +++ b/packages/flutter/lib/src/material/banner.dart @@ -337,6 +337,7 @@ class _MaterialBannerState extends State { return materialBanner; materialBanner = SafeArea( + top: true, child: materialBanner, ); diff --git a/packages/flutter/lib/src/material/bottom_navigation_bar.dart b/packages/flutter/lib/src/material/bottom_navigation_bar.dart index 7f0999fd14..f657695099 100644 --- a/packages/flutter/lib/src/material/bottom_navigation_bar.dart +++ b/packages/flutter/lib/src/material/bottom_navigation_bar.dart @@ -578,12 +578,14 @@ class _Tile extends StatelessWidget { return Align( heightFactor: 1, child: Row( + crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: [icon, const SizedBox(width: 8), label], ), ); } return Column( + crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.min, children: [icon, label], diff --git a/packages/flutter/lib/src/material/bottom_sheet.dart b/packages/flutter/lib/src/material/bottom_sheet.dart index 89a2df9433..82a5a24255 100644 --- a/packages/flutter/lib/src/material/bottom_sheet.dart +++ b/packages/flutter/lib/src/material/bottom_sheet.dart @@ -318,6 +318,7 @@ class _ModalBottomSheetLayout extends SingleChildLayoutDelegate { return BoxConstraints( minWidth: constraints.maxWidth, maxWidth: constraints.maxWidth, + minHeight: 0.0, maxHeight: isScrollControlled ? constraints.maxHeight : constraints.maxHeight * 9.0 / 16.0, diff --git a/packages/flutter/lib/src/material/button_bar_theme.dart b/packages/flutter/lib/src/material/button_bar_theme.dart index d1ea3dc5ac..e26c9ba36a 100644 --- a/packages/flutter/lib/src/material/button_bar_theme.dart +++ b/packages/flutter/lib/src/material/button_bar_theme.dart @@ -205,6 +205,7 @@ class ButtonBarThemeData with Diagnosticable { 'buttonAlignedDropdown', value: buttonAlignedDropdown, ifTrue: 'dropdown width matches button', + defaultValue: null, )); properties.add(DiagnosticsProperty('layoutBehavior', layoutBehavior, defaultValue: null)); properties.add(DiagnosticsProperty('overflowDirection', overflowDirection, defaultValue: null)); diff --git a/packages/flutter/lib/src/material/calendar_date_picker.dart b/packages/flutter/lib/src/material/calendar_date_picker.dart index 6fac69d0c0..829a271b4f 100644 --- a/packages/flutter/lib/src/material/calendar_date_picker.dart +++ b/packages/flutter/lib/src/material/calendar_date_picker.dart @@ -789,6 +789,7 @@ class _MonthPickerState extends State<_MonthPicker> { controller: _pageController, itemBuilder: _buildItems, itemCount: DateUtils.monthDelta(widget.firstDate, widget.lastDate) + 1, + scrollDirection: Axis.horizontal, onPageChanged: _handleMonthPageChanged, ), ), @@ -999,7 +1000,7 @@ class _DayPickerState extends State<_DayPicker> { // border. dayColor = todayColor; decoration = BoxDecoration( - border: Border.all(color: todayColor), + border: Border.all(color: todayColor, width: 1), shape: BoxShape.circle, ); } @@ -1206,13 +1207,16 @@ class _YearPickerState extends State { decoration = BoxDecoration( color: colorScheme.primary, borderRadius: BorderRadius.circular(decorationHeight / 2), + shape: BoxShape.rectangle, ); } else if (isCurrentYear && !isDisabled) { decoration = BoxDecoration( border: Border.all( color: colorScheme.primary, + width: 1, ), borderRadius: BorderRadius.circular(decorationHeight / 2), + shape: BoxShape.rectangle, ); } @@ -1237,7 +1241,7 @@ class _YearPickerState extends State { } else { yearItem = InkWell( key: ValueKey(year), - onTap: () => widget.onChanged(DateTime(year, widget.initialDate.month)), + onTap: () => widget.onChanged(DateTime(year, widget.initialDate.month, 1)), child: yearItem, ); } diff --git a/packages/flutter/lib/src/material/chip.dart b/packages/flutter/lib/src/material/chip.dart index 296adb6b26..a622703464 100644 --- a/packages/flutter/lib/src/material/chip.dart +++ b/packages/flutter/lib/src/material/chip.dart @@ -634,6 +634,7 @@ class Chip extends StatelessWidget implements ChipAttributes, DeletableChipAttri materialTapTargetSize: materialTapTargetSize, elevation: elevation, shadowColor: shadowColor, + isEnabled: true, ); } } @@ -826,6 +827,7 @@ class InputChip extends StatelessWidget onPressed: onPressed, pressElevation: pressElevation, selected: selected, + tapEnabled: true, disabledColor: disabledColor, selectedColor: selectedColor, tooltip: tooltip, @@ -1011,6 +1013,7 @@ class ChoiceChip extends StatelessWidget pressElevation: pressElevation, selected: selected, showCheckmark: false, + onDeleted: null, tooltip: tooltip, side: side, shape: shape, @@ -1395,6 +1398,7 @@ class ActionChip extends StatelessWidget implements ChipAttributes, TappableChip padding: padding, visualDensity: visualDensity, labelPadding: labelPadding, + isEnabled: true, materialTapTargetSize: materialTapTargetSize, elevation: elevation, shadowColor: shadowColor, @@ -2443,6 +2447,7 @@ class _RenderChip extends RenderBox { final Size updatedSize = layoutChild( label!, BoxConstraints( + minWidth: 0.0, maxWidth: maxWidth, minHeight: rawSize.height, maxHeight: size.height, @@ -2460,6 +2465,7 @@ class _RenderChip extends RenderBox { BoxConstraints( minHeight: rawSize.height, maxHeight: size.height, + minWidth: 0.0, maxWidth: size.width, ), ); @@ -2931,6 +2937,7 @@ class _UnconstrainedInkSplashFactory extends InteractiveInkFeatureFactory { referenceBox: referenceBox, position: position, color: color, + containedInkWell: false, rectCallback: rectCallback, borderRadius: borderRadius, customBorder: customBorder, diff --git a/packages/flutter/lib/src/material/date_picker.dart b/packages/flutter/lib/src/material/date_picker.dart index c219437ced..ddf85c39ea 100644 --- a/packages/flutter/lib/src/material/date_picker.dart +++ b/packages/flutter/lib/src/material/date_picker.dart @@ -1310,7 +1310,7 @@ class _DateRangePickerDialogState extends State with Rest ); size = mediaQuery.size; insetPadding = EdgeInsets.zero; - shape = const RoundedRectangleBorder(); + shape = const RoundedRectangleBorder(borderRadius: BorderRadius.zero); elevation = 0; break; @@ -2271,7 +2271,7 @@ class _MonthItemState extends State<_MonthItem> { // border. itemStyle = textTheme.bodyText2?.apply(color: colorScheme.primary); decoration = BoxDecoration( - border: Border.all(color: colorScheme.primary), + border: Border.all(color: colorScheme.primary, width: 1), shape: BoxShape.circle, ); } diff --git a/packages/flutter/lib/src/material/date_picker_deprecated.dart b/packages/flutter/lib/src/material/date_picker_deprecated.dart index 09c3b6ffb7..488c4d3c3f 100644 --- a/packages/flutter/lib/src/material/date_picker_deprecated.dart +++ b/packages/flutter/lib/src/material/date_picker_deprecated.dart @@ -547,6 +547,7 @@ class _MonthPickerState extends State with SingleTickerProviderStat dragStartBehavior: widget.dragStartBehavior, key: ValueKey(widget.selectedDate), controller: _dayPickerController, + scrollDirection: Axis.horizontal, itemCount: _monthDelta(widget.firstDate, widget.lastDate) + 1, itemBuilder: _buildItems, onPageChanged: _handleMonthPageChanged, diff --git a/packages/flutter/lib/src/material/drawer.dart b/packages/flutter/lib/src/material/drawer.dart index 98f7bea15c..727221bed1 100644 --- a/packages/flutter/lib/src/material/drawer.dart +++ b/packages/flutter/lib/src/material/drawer.dart @@ -506,7 +506,7 @@ class DrawerControllerState extends State with SingleTickerPro /// /// Typically called by [ScaffoldState.openDrawer]. void open() { - _controller.fling(); + _controller.fling(velocity: 1.0); widget.drawerCallback?.call(true); } @@ -619,6 +619,7 @@ class DrawerControllerState extends State with SingleTickerPro child: Semantics( label: MaterialLocalizations.of(context).modalBarrierDismissLabel, child: MouseRegion( + opaque: true, child: Container( // The drawer's "scrim" color: _scrimColorTween.evaluate(_controller), ), diff --git a/packages/flutter/lib/src/material/dropdown.dart b/packages/flutter/lib/src/material/dropdown.dart index b26a5257da..974ed765a8 100644 --- a/packages/flutter/lib/src/material/dropdown.dart +++ b/packages/flutter/lib/src/material/dropdown.dart @@ -360,6 +360,7 @@ class _DropdownMenuRouteLayout extends SingleChildLayoutDelegate { return BoxConstraints( minWidth: width, maxWidth: width, + minHeight: 0.0, maxHeight: maxHeight, ); } @@ -869,7 +870,7 @@ class DropdownButton extends StatefulWidget { this.value, this.hint, this.disabledHint, - required this.onChanged, + this.onChanged, this.onTap, this.elevation = 8, this.style, @@ -1517,7 +1518,7 @@ class DropdownButtonFormField extends FormField { T? value, Widget? hint, Widget? disabledHint, - required this.onChanged, + this.onChanged, VoidCallback? onTap, int elevation = 8, TextStyle? style, diff --git a/packages/flutter/lib/src/material/elevated_button.dart b/packages/flutter/lib/src/material/elevated_button.dart index 7afb26a158..cd9b2b6f54 100644 --- a/packages/flutter/lib/src/material/elevated_button.dart +++ b/packages/flutter/lib/src/material/elevated_button.dart @@ -298,6 +298,7 @@ class ElevatedButton extends ButtonStyleButton { padding: scaledPadding, minimumSize: const Size(64, 36), maximumSize: Size.infinite, + side: null, shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(4))), enabledMouseCursor: SystemMouseCursors.click, disabledMouseCursor: SystemMouseCursors.forbidden, diff --git a/packages/flutter/lib/src/material/grid_tile_bar.dart b/packages/flutter/lib/src/material/grid_tile_bar.dart index 7df46a5cc8..58ddb19766 100644 --- a/packages/flutter/lib/src/material/grid_tile_bar.dart +++ b/packages/flutter/lib/src/material/grid_tile_bar.dart @@ -77,6 +77,7 @@ class GridTileBar extends StatelessWidget { child: IconTheme.merge( data: const IconThemeData(color: Colors.white), child: Row( + crossAxisAlignment: CrossAxisAlignment.center, children: [ if (leading != null) Padding(padding: const EdgeInsetsDirectional.only(end: 8.0), child: leading), diff --git a/packages/flutter/lib/src/material/material.dart b/packages/flutter/lib/src/material/material.dart index 2054e2630f..a32419928e 100644 --- a/packages/flutter/lib/src/material/material.dart +++ b/packages/flutter/lib/src/material/material.dart @@ -405,6 +405,7 @@ class _MaterialState extends State with TickerProviderStateMixin { duration: widget.animationDuration, shape: BoxShape.rectangle, clipBehavior: widget.clipBehavior, + borderRadius: BorderRadius.zero, elevation: widget.elevation, color: ElevationOverlay.applyOverlay(context, backgroundColor!, widget.elevation), shadowColor: widget.shadowColor ?? Theme.of(context).shadowColor, diff --git a/packages/flutter/lib/src/material/mergeable_material.dart b/packages/flutter/lib/src/material/mergeable_material.dart index 0e32e8e694..6efe962845 100644 --- a/packages/flutter/lib/src/material/mergeable_material.dart +++ b/packages/flutter/lib/src/material/mergeable_material.dart @@ -592,6 +592,7 @@ class _MergeableMaterialState extends State with TickerProvid decoration: BoxDecoration( color: (_children[i] as MaterialSlice).color ?? Theme.of(context).cardColor, borderRadius: _borderRadius(i, i == 0, i == _children.length - 1), + shape: BoxShape.rectangle, ), child: Material( type: MaterialType.transparency, diff --git a/packages/flutter/lib/src/material/navigation_rail.dart b/packages/flutter/lib/src/material/navigation_rail.dart index 99ae67dc8d..21031365c0 100644 --- a/packages/flutter/lib/src/material/navigation_rail.dart +++ b/packages/flutter/lib/src/material/navigation_rail.dart @@ -549,6 +549,7 @@ class _RailDestination extends StatelessWidget { width: minWidth, height: minWidth, child: Align( + alignment: Alignment.center, child: themedIcon, ), ); @@ -662,6 +663,7 @@ class _RailDestination extends StatelessWidget { children: [ Material( type: MaterialType.transparency, + clipBehavior: Clip.none, child: InkResponse( onTap: onTap, onHover: (_) {}, diff --git a/packages/flutter/lib/src/material/outlined_button.dart b/packages/flutter/lib/src/material/outlined_button.dart index 8fe0db4c3a..5e7b8f3a2d 100644 --- a/packages/flutter/lib/src/material/outlined_button.dart +++ b/packages/flutter/lib/src/material/outlined_button.dart @@ -272,6 +272,7 @@ class OutlinedButton extends ButtonStyleButton { maximumSize: Size.infinite, side: BorderSide( color: Theme.of(context).colorScheme.onSurface.withOpacity(0.12), + width: 1, ), shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(4))), enabledMouseCursor: SystemMouseCursors.click, diff --git a/packages/flutter/lib/src/material/paginated_data_table.dart b/packages/flutter/lib/src/material/paginated_data_table.dart index c0b36e25f1..42dd4b9a57 100644 --- a/packages/flutter/lib/src/material/paginated_data_table.dart +++ b/packages/flutter/lib/src/material/paginated_data_table.dart @@ -416,6 +416,7 @@ class PaginatedDataTableState extends State { value: widget.rowsPerPage, onChanged: widget.onRowsPerPageChanged, style: footerTextStyle, + iconSize: 24.0, ), ), ), diff --git a/packages/flutter/lib/src/material/range_slider.dart b/packages/flutter/lib/src/material/range_slider.dart index 660d7615b0..2dcf4d3371 100644 --- a/packages/flutter/lib/src/material/range_slider.dart +++ b/packages/flutter/lib/src/material/range_slider.dart @@ -814,6 +814,7 @@ class _RenderRangeSlider extends RenderBox with RelayoutWhenSystemFontsChangeMix // (0,0). Rect get _trackRect => _sliderTheme.rangeTrackShape!.getPreferredRect( parentBox: this, + offset: Offset.zero, sliderTheme: _sliderTheme, isDiscrete: false, ); diff --git a/packages/flutter/lib/src/material/scaffold.dart b/packages/flutter/lib/src/material/scaffold.dart index 6c7d9f66d8..d661125b8a 100644 --- a/packages/flutter/lib/src/material/scaffold.dart +++ b/packages/flutter/lib/src/material/scaffold.dart @@ -279,7 +279,7 @@ class ScaffoldMessengerState extends State with TickerProvide Completer(), () { assert(_snackBars.first == controller); - hideCurrentSnackBar(); + hideCurrentSnackBar(reason: SnackBarClosedReason.hide); }, null, // SnackBar doesn't use a builder function so setState() wouldn't rebuild it ); @@ -405,7 +405,7 @@ class ScaffoldMessengerState extends State with TickerProvide Completer(), () { assert(_materialBanners.first == controller); - hideCurrentMaterialBanner(); + hideCurrentMaterialBanner(reason: MaterialBannerClosedReason.hide); }, null, // MaterialBanner doesn't use a builder function so setState() wouldn't rebuild it ); @@ -2067,7 +2067,7 @@ class ScaffoldState extends State with TickerProviderStateMixin, Resto Completer(), () { assert(_snackBars.first == controller); - hideCurrentSnackBar(); + hideCurrentSnackBar(reason: SnackBarClosedReason.hide); }, null, // SnackBar doesn't use a builder function so setState() wouldn't rebuild it ); @@ -2577,6 +2577,8 @@ class ScaffoldState extends State with TickerProviderStateMixin, Resto _previousFloatingActionButtonLocation = _floatingActionButtonLocation; _floatingActionButtonMoveController = AnimationController( vsync: this, + lowerBound: 0.0, + upperBound: 1.0, value: 1.0, duration: kFloatingActionButtonSegue * 2, ); diff --git a/packages/flutter/lib/src/material/shadows.dart b/packages/flutter/lib/src/material/shadows.dart index 523dfb6eb6..8825968704 100644 --- a/packages/flutter/lib/src/material/shadows.dart +++ b/packages/flutter/lib/src/material/shadows.dart @@ -34,32 +34,32 @@ const Map> _elevationToShadow = >{ 1: [ BoxShadow(offset: Offset(0.0, 2.0), blurRadius: 1.0, spreadRadius: -1.0, color: _kKeyUmbraOpacity), - BoxShadow(offset: Offset(0.0, 1.0), blurRadius: 1.0, color: _kKeyPenumbraOpacity), - BoxShadow(offset: Offset(0.0, 1.0), blurRadius: 3.0, color: _kAmbientShadowOpacity), + BoxShadow(offset: Offset(0.0, 1.0), blurRadius: 1.0, spreadRadius: 0.0, color: _kKeyPenumbraOpacity), + BoxShadow(offset: Offset(0.0, 1.0), blurRadius: 3.0, spreadRadius: 0.0, color: _kAmbientShadowOpacity), ], 2: [ BoxShadow(offset: Offset(0.0, 3.0), blurRadius: 1.0, spreadRadius: -2.0, color: _kKeyUmbraOpacity), - BoxShadow(offset: Offset(0.0, 2.0), blurRadius: 2.0, color: _kKeyPenumbraOpacity), - BoxShadow(offset: Offset(0.0, 1.0), blurRadius: 5.0, color: _kAmbientShadowOpacity), + BoxShadow(offset: Offset(0.0, 2.0), blurRadius: 2.0, spreadRadius: 0.0, color: _kKeyPenumbraOpacity), + BoxShadow(offset: Offset(0.0, 1.0), blurRadius: 5.0, spreadRadius: 0.0, color: _kAmbientShadowOpacity), ], 3: [ BoxShadow(offset: Offset(0.0, 3.0), blurRadius: 3.0, spreadRadius: -2.0, color: _kKeyUmbraOpacity), - BoxShadow(offset: Offset(0.0, 3.0), blurRadius: 4.0, color: _kKeyPenumbraOpacity), - BoxShadow(offset: Offset(0.0, 1.0), blurRadius: 8.0, color: _kAmbientShadowOpacity), + BoxShadow(offset: Offset(0.0, 3.0), blurRadius: 4.0, spreadRadius: 0.0, color: _kKeyPenumbraOpacity), + BoxShadow(offset: Offset(0.0, 1.0), blurRadius: 8.0, spreadRadius: 0.0, color: _kAmbientShadowOpacity), ], 4: [ BoxShadow(offset: Offset(0.0, 2.0), blurRadius: 4.0, spreadRadius: -1.0, color: _kKeyUmbraOpacity), - BoxShadow(offset: Offset(0.0, 4.0), blurRadius: 5.0, color: _kKeyPenumbraOpacity), - BoxShadow(offset: Offset(0.0, 1.0), blurRadius: 10.0, color: _kAmbientShadowOpacity), + BoxShadow(offset: Offset(0.0, 4.0), blurRadius: 5.0, spreadRadius: 0.0, color: _kKeyPenumbraOpacity), + BoxShadow(offset: Offset(0.0, 1.0), blurRadius: 10.0, spreadRadius: 0.0, color: _kAmbientShadowOpacity), ], 6: [ BoxShadow(offset: Offset(0.0, 3.0), blurRadius: 5.0, spreadRadius: -1.0, color: _kKeyUmbraOpacity), - BoxShadow(offset: Offset(0.0, 6.0), blurRadius: 10.0, color: _kKeyPenumbraOpacity), - BoxShadow(offset: Offset(0.0, 1.0), blurRadius: 18.0, color: _kAmbientShadowOpacity), + BoxShadow(offset: Offset(0.0, 6.0), blurRadius: 10.0, spreadRadius: 0.0, color: _kKeyPenumbraOpacity), + BoxShadow(offset: Offset(0.0, 1.0), blurRadius: 18.0, spreadRadius: 0.0, color: _kAmbientShadowOpacity), ], 8: [ diff --git a/packages/flutter/lib/src/material/slider.dart b/packages/flutter/lib/src/material/slider.dart index 515cc49d3c..5c19812dfb 100644 --- a/packages/flutter/lib/src/material/slider.dart +++ b/packages/flutter/lib/src/material/slider.dart @@ -947,6 +947,7 @@ class _RenderSlider extends RenderBox with RelayoutWhenSystemFontsChangeMixin { // (0,0). Rect get _trackRect => _sliderTheme.trackShape!.getPreferredRect( parentBox: this, + offset: Offset.zero, sliderTheme: _sliderTheme, isDiscrete: false, ); diff --git a/packages/flutter/lib/src/material/snack_bar.dart b/packages/flutter/lib/src/material/snack_bar.dart index 8b860e766b..a88ee9d8bc 100644 --- a/packages/flutter/lib/src/material/snack_bar.dart +++ b/packages/flutter/lib/src/material/snack_bar.dart @@ -489,6 +489,7 @@ class _SnackBarState extends State { Widget snackBar = Padding( padding: padding, child: Row( + crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( child: Container( diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart index 34023dfd53..7ff22a687e 100644 --- a/packages/flutter/lib/src/material/tabs.dart +++ b/packages/flutter/lib/src/material/tabs.dart @@ -124,6 +124,7 @@ class Tab extends StatelessWidget implements PreferredSizeWidget { calculatedHeight = _kTextAndIconTabHeight; label = Column( mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( margin: iconMargin, diff --git a/packages/flutter/lib/src/material/text_button.dart b/packages/flutter/lib/src/material/text_button.dart index fb3aa74024..8b5cdab64e 100644 --- a/packages/flutter/lib/src/material/text_button.dart +++ b/packages/flutter/lib/src/material/text_button.dart @@ -286,6 +286,7 @@ class TextButton extends ButtonStyleButton { padding: scaledPadding, minimumSize: const Size(64, 36), maximumSize: Size.infinite, + side: null, shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(4))), enabledMouseCursor: SystemMouseCursors.click, disabledMouseCursor: SystemMouseCursors.forbidden, diff --git a/packages/flutter/lib/src/material/tooltip.dart b/packages/flutter/lib/src/material/tooltip.dart index a7839c0cac..e755bda89a 100644 --- a/packages/flutter/lib/src/material/tooltip.dart +++ b/packages/flutter/lib/src/material/tooltip.dart @@ -284,12 +284,12 @@ class Tooltip extends StatefulWidget { properties.add(DiagnosticsProperty('padding', padding, defaultValue: null)); properties.add(DiagnosticsProperty('margin', margin, defaultValue: null)); properties.add(DoubleProperty('vertical offset', verticalOffset, defaultValue: null)); - properties.add(FlagProperty('position', value: preferBelow, ifTrue: 'below', ifFalse: 'above', showName: true)); - properties.add(FlagProperty('semantics', value: excludeFromSemantics, ifTrue: 'excluded', showName: true)); + properties.add(FlagProperty('position', value: preferBelow, ifTrue: 'below', ifFalse: 'above', showName: true, defaultValue: null)); + properties.add(FlagProperty('semantics', value: excludeFromSemantics, ifTrue: 'excluded', showName: true, defaultValue: null)); properties.add(DiagnosticsProperty('wait duration', waitDuration, defaultValue: null)); properties.add(DiagnosticsProperty('show duration', showDuration, defaultValue: null)); properties.add(DiagnosticsProperty('triggerMode', triggerMode, defaultValue: null)); - properties.add(FlagProperty('enableFeedback', value: enableFeedback, ifTrue: 'true', showName: true)); + properties.add(FlagProperty('enableFeedback', value: enableFeedback, ifTrue: 'true', showName: true, defaultValue: null)); } } diff --git a/packages/flutter/lib/src/material/tooltip_theme.dart b/packages/flutter/lib/src/material/tooltip_theme.dart index dfb5a61a8b..5fb34ea8a6 100644 --- a/packages/flutter/lib/src/material/tooltip_theme.dart +++ b/packages/flutter/lib/src/material/tooltip_theme.dart @@ -201,14 +201,14 @@ class TooltipThemeData with Diagnosticable { properties.add(DiagnosticsProperty('padding', padding, defaultValue: null)); properties.add(DiagnosticsProperty('margin', margin, defaultValue: null)); properties.add(DoubleProperty('vertical offset', verticalOffset, defaultValue: null)); - properties.add(FlagProperty('position', value: preferBelow, ifTrue: 'below', ifFalse: 'above', showName: true)); - properties.add(FlagProperty('semantics', value: excludeFromSemantics, ifTrue: 'excluded', showName: true)); + properties.add(FlagProperty('position', value: preferBelow, ifTrue: 'below', ifFalse: 'above', showName: true, defaultValue: null)); + properties.add(FlagProperty('semantics', value: excludeFromSemantics, ifTrue: 'excluded', showName: true, defaultValue: null)); properties.add(DiagnosticsProperty('decoration', decoration, defaultValue: null)); properties.add(DiagnosticsProperty('textStyle', textStyle, defaultValue: null)); properties.add(DiagnosticsProperty('wait duration', waitDuration, defaultValue: null)); properties.add(DiagnosticsProperty('show duration', showDuration, defaultValue: null)); properties.add(DiagnosticsProperty('triggerMode', triggerMode, defaultValue: null)); - properties.add(FlagProperty('enableFeedback', value: enableFeedback, ifTrue: 'true', showName: true)); + properties.add(FlagProperty('enableFeedback', value: enableFeedback, ifTrue: 'true', showName: true, defaultValue: null)); } } diff --git a/packages/flutter/lib/src/material/typography.dart b/packages/flutter/lib/src/material/typography.dart index cf44598e70..f3dd903dab 100644 --- a/packages/flutter/lib/src/material/typography.dart +++ b/packages/flutter/lib/src/material/typography.dart @@ -332,76 +332,76 @@ class Typography with Diagnosticable { /// /// This [TextTheme] provides color but not geometry (font size, weight, etc). static const TextTheme blackMountainView = TextTheme( - headline1 : TextStyle(debugLabel: 'blackMountainView headline1', fontFamily: 'Roboto', color: Colors.black54, decoration: TextDecoration.none), - headline2 : TextStyle(debugLabel: 'blackMountainView headline2', fontFamily: 'Roboto', color: Colors.black54, decoration: TextDecoration.none), - headline3 : TextStyle(debugLabel: 'blackMountainView headline3', fontFamily: 'Roboto', color: Colors.black54, decoration: TextDecoration.none), - headline4 : TextStyle(debugLabel: 'blackMountainView headline4', fontFamily: 'Roboto', color: Colors.black54, decoration: TextDecoration.none), - headline5 : TextStyle(debugLabel: 'blackMountainView headline5', fontFamily: 'Roboto', color: Colors.black87, decoration: TextDecoration.none), - headline6 : TextStyle(debugLabel: 'blackMountainView headline6', fontFamily: 'Roboto', color: Colors.black87, decoration: TextDecoration.none), - bodyText1 : TextStyle(debugLabel: 'blackMountainView bodyText1', fontFamily: 'Roboto', color: Colors.black87, decoration: TextDecoration.none), - bodyText2 : TextStyle(debugLabel: 'blackMountainView bodyText2', fontFamily: 'Roboto', color: Colors.black87, decoration: TextDecoration.none), - subtitle1 : TextStyle(debugLabel: 'blackMountainView subtitle1', fontFamily: 'Roboto', color: Colors.black87, decoration: TextDecoration.none), - subtitle2 : TextStyle(debugLabel: 'blackMountainView subtitle2', fontFamily: 'Roboto', color: Colors.black, decoration: TextDecoration.none), - caption : TextStyle(debugLabel: 'blackMountainView caption', fontFamily: 'Roboto', color: Colors.black54, decoration: TextDecoration.none), - button : TextStyle(debugLabel: 'blackMountainView button', fontFamily: 'Roboto', color: Colors.black87, decoration: TextDecoration.none), - overline : TextStyle(debugLabel: 'blackMountainView overline', fontFamily: 'Roboto', color: Colors.black, decoration: TextDecoration.none), + headline1 : TextStyle(debugLabel: 'blackMountainView headline1', fontFamily: 'Roboto', inherit: true, color: Colors.black54, decoration: TextDecoration.none), + headline2 : TextStyle(debugLabel: 'blackMountainView headline2', fontFamily: 'Roboto', inherit: true, color: Colors.black54, decoration: TextDecoration.none), + headline3 : TextStyle(debugLabel: 'blackMountainView headline3', fontFamily: 'Roboto', inherit: true, color: Colors.black54, decoration: TextDecoration.none), + headline4 : TextStyle(debugLabel: 'blackMountainView headline4', fontFamily: 'Roboto', inherit: true, color: Colors.black54, decoration: TextDecoration.none), + headline5 : TextStyle(debugLabel: 'blackMountainView headline5', fontFamily: 'Roboto', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + headline6 : TextStyle(debugLabel: 'blackMountainView headline6', fontFamily: 'Roboto', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + bodyText1 : TextStyle(debugLabel: 'blackMountainView bodyText1', fontFamily: 'Roboto', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + bodyText2 : TextStyle(debugLabel: 'blackMountainView bodyText2', fontFamily: 'Roboto', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + subtitle1 : TextStyle(debugLabel: 'blackMountainView subtitle1', fontFamily: 'Roboto', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + subtitle2 : TextStyle(debugLabel: 'blackMountainView subtitle2', fontFamily: 'Roboto', inherit: true, color: Colors.black, decoration: TextDecoration.none), + caption : TextStyle(debugLabel: 'blackMountainView caption', fontFamily: 'Roboto', inherit: true, color: Colors.black54, decoration: TextDecoration.none), + button : TextStyle(debugLabel: 'blackMountainView button', fontFamily: 'Roboto', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + overline : TextStyle(debugLabel: 'blackMountainView overline', fontFamily: 'Roboto', inherit: true, color: Colors.black, decoration: TextDecoration.none), ); /// A material design text theme with light glyphs based on Roboto. /// /// This [TextTheme] provides color but not geometry (font size, weight, etc). static const TextTheme whiteMountainView = TextTheme( - headline1 : TextStyle(debugLabel: 'whiteMountainView headline1', fontFamily: 'Roboto', color: Colors.white70, decoration: TextDecoration.none), - headline2 : TextStyle(debugLabel: 'whiteMountainView headline2', fontFamily: 'Roboto', color: Colors.white70, decoration: TextDecoration.none), - headline3 : TextStyle(debugLabel: 'whiteMountainView headline3', fontFamily: 'Roboto', color: Colors.white70, decoration: TextDecoration.none), - headline4 : TextStyle(debugLabel: 'whiteMountainView headline4', fontFamily: 'Roboto', color: Colors.white70, decoration: TextDecoration.none), - headline5 : TextStyle(debugLabel: 'whiteMountainView headline5', fontFamily: 'Roboto', color: Colors.white, decoration: TextDecoration.none), - headline6 : TextStyle(debugLabel: 'whiteMountainView headline6', fontFamily: 'Roboto', color: Colors.white, decoration: TextDecoration.none), - bodyText1 : TextStyle(debugLabel: 'whiteMountainView bodyText1', fontFamily: 'Roboto', color: Colors.white, decoration: TextDecoration.none), - bodyText2 : TextStyle(debugLabel: 'whiteMountainView bodyText2', fontFamily: 'Roboto', color: Colors.white, decoration: TextDecoration.none), - subtitle1 : TextStyle(debugLabel: 'whiteMountainView subtitle1', fontFamily: 'Roboto', color: Colors.white, decoration: TextDecoration.none), - subtitle2 : TextStyle(debugLabel: 'whiteMountainView subtitle2', fontFamily: 'Roboto', color: Colors.white, decoration: TextDecoration.none), - caption : TextStyle(debugLabel: 'whiteMountainView caption', fontFamily: 'Roboto', color: Colors.white70, decoration: TextDecoration.none), - button : TextStyle(debugLabel: 'whiteMountainView button', fontFamily: 'Roboto', color: Colors.white, decoration: TextDecoration.none), - overline : TextStyle(debugLabel: 'whiteMountainView overline', fontFamily: 'Roboto', color: Colors.white, decoration: TextDecoration.none), + headline1 : TextStyle(debugLabel: 'whiteMountainView headline1', fontFamily: 'Roboto', inherit: true, color: Colors.white70, decoration: TextDecoration.none), + headline2 : TextStyle(debugLabel: 'whiteMountainView headline2', fontFamily: 'Roboto', inherit: true, color: Colors.white70, decoration: TextDecoration.none), + headline3 : TextStyle(debugLabel: 'whiteMountainView headline3', fontFamily: 'Roboto', inherit: true, color: Colors.white70, decoration: TextDecoration.none), + headline4 : TextStyle(debugLabel: 'whiteMountainView headline4', fontFamily: 'Roboto', inherit: true, color: Colors.white70, decoration: TextDecoration.none), + headline5 : TextStyle(debugLabel: 'whiteMountainView headline5', fontFamily: 'Roboto', inherit: true, color: Colors.white, decoration: TextDecoration.none), + headline6 : TextStyle(debugLabel: 'whiteMountainView headline6', fontFamily: 'Roboto', inherit: true, color: Colors.white, decoration: TextDecoration.none), + bodyText1 : TextStyle(debugLabel: 'whiteMountainView bodyText1', fontFamily: 'Roboto', inherit: true, color: Colors.white, decoration: TextDecoration.none), + bodyText2 : TextStyle(debugLabel: 'whiteMountainView bodyText2', fontFamily: 'Roboto', inherit: true, color: Colors.white, decoration: TextDecoration.none), + subtitle1 : TextStyle(debugLabel: 'whiteMountainView subtitle1', fontFamily: 'Roboto', inherit: true, color: Colors.white, decoration: TextDecoration.none), + subtitle2 : TextStyle(debugLabel: 'whiteMountainView subtitle2', fontFamily: 'Roboto', inherit: true, color: Colors.white, decoration: TextDecoration.none), + caption : TextStyle(debugLabel: 'whiteMountainView caption', fontFamily: 'Roboto', inherit: true, color: Colors.white70, decoration: TextDecoration.none), + button : TextStyle(debugLabel: 'whiteMountainView button', fontFamily: 'Roboto', inherit: true, color: Colors.white, decoration: TextDecoration.none), + overline : TextStyle(debugLabel: 'whiteMountainView overline', fontFamily: 'Roboto', inherit: true, color: Colors.white, decoration: TextDecoration.none), ); /// A material design text theme with dark glyphs based on Segoe UI. /// /// This [TextTheme] provides color but not geometry (font size, weight, etc). static const TextTheme blackRedmond = TextTheme( - headline1 : TextStyle(debugLabel: 'blackRedmond headline1', fontFamily: 'Segoe UI', color: Colors.black54, decoration: TextDecoration.none), - headline2 : TextStyle(debugLabel: 'blackRedmond headline2', fontFamily: 'Segoe UI', color: Colors.black54, decoration: TextDecoration.none), - headline3 : TextStyle(debugLabel: 'blackRedmond headline3', fontFamily: 'Segoe UI', color: Colors.black54, decoration: TextDecoration.none), - headline4 : TextStyle(debugLabel: 'blackRedmond headline4', fontFamily: 'Segoe UI', color: Colors.black54, decoration: TextDecoration.none), - headline5 : TextStyle(debugLabel: 'blackRedmond headline5', fontFamily: 'Segoe UI', color: Colors.black87, decoration: TextDecoration.none), - headline6 : TextStyle(debugLabel: 'blackRedmond headline6', fontFamily: 'Segoe UI', color: Colors.black87, decoration: TextDecoration.none), - bodyText1 : TextStyle(debugLabel: 'blackRedmond bodyText1', fontFamily: 'Segoe UI', color: Colors.black87, decoration: TextDecoration.none), - bodyText2 : TextStyle(debugLabel: 'blackRedmond bodyText2', fontFamily: 'Segoe UI', color: Colors.black87, decoration: TextDecoration.none), - subtitle1 : TextStyle(debugLabel: 'blackRedmond subtitle1', fontFamily: 'Segoe UI', color: Colors.black87, decoration: TextDecoration.none), - subtitle2 : TextStyle(debugLabel: 'blackRedmond subtitle2', fontFamily: 'Segoe UI', color: Colors.black, decoration: TextDecoration.none), - caption : TextStyle(debugLabel: 'blackRedmond caption', fontFamily: 'Segoe UI', color: Colors.black54, decoration: TextDecoration.none), - button : TextStyle(debugLabel: 'blackRedmond button', fontFamily: 'Segoe UI', color: Colors.black87, decoration: TextDecoration.none), - overline : TextStyle(debugLabel: 'blackRedmond overline', fontFamily: 'Segoe UI', color: Colors.black, decoration: TextDecoration.none), + headline1 : TextStyle(debugLabel: 'blackRedmond headline1', fontFamily: 'Segoe UI', inherit: true, color: Colors.black54, decoration: TextDecoration.none), + headline2 : TextStyle(debugLabel: 'blackRedmond headline2', fontFamily: 'Segoe UI', inherit: true, color: Colors.black54, decoration: TextDecoration.none), + headline3 : TextStyle(debugLabel: 'blackRedmond headline3', fontFamily: 'Segoe UI', inherit: true, color: Colors.black54, decoration: TextDecoration.none), + headline4 : TextStyle(debugLabel: 'blackRedmond headline4', fontFamily: 'Segoe UI', inherit: true, color: Colors.black54, decoration: TextDecoration.none), + headline5 : TextStyle(debugLabel: 'blackRedmond headline5', fontFamily: 'Segoe UI', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + headline6 : TextStyle(debugLabel: 'blackRedmond headline6', fontFamily: 'Segoe UI', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + bodyText1 : TextStyle(debugLabel: 'blackRedmond bodyText1', fontFamily: 'Segoe UI', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + bodyText2 : TextStyle(debugLabel: 'blackRedmond bodyText2', fontFamily: 'Segoe UI', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + subtitle1 : TextStyle(debugLabel: 'blackRedmond subtitle1', fontFamily: 'Segoe UI', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + subtitle2 : TextStyle(debugLabel: 'blackRedmond subtitle2', fontFamily: 'Segoe UI', inherit: true, color: Colors.black, decoration: TextDecoration.none), + caption : TextStyle(debugLabel: 'blackRedmond caption', fontFamily: 'Segoe UI', inherit: true, color: Colors.black54, decoration: TextDecoration.none), + button : TextStyle(debugLabel: 'blackRedmond button', fontFamily: 'Segoe UI', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + overline : TextStyle(debugLabel: 'blackRedmond overline', fontFamily: 'Segoe UI', inherit: true, color: Colors.black, decoration: TextDecoration.none), ); /// A material design text theme with light glyphs based on Segoe UI. /// /// This [TextTheme] provides color but not geometry (font size, weight, etc). static const TextTheme whiteRedmond = TextTheme( - headline1 : TextStyle(debugLabel: 'whiteRedmond headline1', fontFamily: 'Segoe UI', color: Colors.white70, decoration: TextDecoration.none), - headline2 : TextStyle(debugLabel: 'whiteRedmond headline2', fontFamily: 'Segoe UI', color: Colors.white70, decoration: TextDecoration.none), - headline3 : TextStyle(debugLabel: 'whiteRedmond headline3', fontFamily: 'Segoe UI', color: Colors.white70, decoration: TextDecoration.none), - headline4 : TextStyle(debugLabel: 'whiteRedmond headline4', fontFamily: 'Segoe UI', color: Colors.white70, decoration: TextDecoration.none), - headline5 : TextStyle(debugLabel: 'whiteRedmond headline5', fontFamily: 'Segoe UI', color: Colors.white, decoration: TextDecoration.none), - headline6 : TextStyle(debugLabel: 'whiteRedmond headline6', fontFamily: 'Segoe UI', color: Colors.white, decoration: TextDecoration.none), - bodyText1 : TextStyle(debugLabel: 'whiteRedmond bodyText1', fontFamily: 'Segoe UI', color: Colors.white, decoration: TextDecoration.none), - bodyText2 : TextStyle(debugLabel: 'whiteRedmond bodyText2', fontFamily: 'Segoe UI', color: Colors.white, decoration: TextDecoration.none), - subtitle1 : TextStyle(debugLabel: 'whiteRedmond subtitle1', fontFamily: 'Segoe UI', color: Colors.white, decoration: TextDecoration.none), - subtitle2 : TextStyle(debugLabel: 'whiteRedmond subtitle2', fontFamily: 'Segoe UI', color: Colors.white, decoration: TextDecoration.none), - caption : TextStyle(debugLabel: 'whiteRedmond caption', fontFamily: 'Segoe UI', color: Colors.white70, decoration: TextDecoration.none), - button : TextStyle(debugLabel: 'whiteRedmond button', fontFamily: 'Segoe UI', color: Colors.white, decoration: TextDecoration.none), - overline : TextStyle(debugLabel: 'whiteRedmond overline', fontFamily: 'Segoe UI', color: Colors.white, decoration: TextDecoration.none), + headline1 : TextStyle(debugLabel: 'whiteRedmond headline1', fontFamily: 'Segoe UI', inherit: true, color: Colors.white70, decoration: TextDecoration.none), + headline2 : TextStyle(debugLabel: 'whiteRedmond headline2', fontFamily: 'Segoe UI', inherit: true, color: Colors.white70, decoration: TextDecoration.none), + headline3 : TextStyle(debugLabel: 'whiteRedmond headline3', fontFamily: 'Segoe UI', inherit: true, color: Colors.white70, decoration: TextDecoration.none), + headline4 : TextStyle(debugLabel: 'whiteRedmond headline4', fontFamily: 'Segoe UI', inherit: true, color: Colors.white70, decoration: TextDecoration.none), + headline5 : TextStyle(debugLabel: 'whiteRedmond headline5', fontFamily: 'Segoe UI', inherit: true, color: Colors.white, decoration: TextDecoration.none), + headline6 : TextStyle(debugLabel: 'whiteRedmond headline6', fontFamily: 'Segoe UI', inherit: true, color: Colors.white, decoration: TextDecoration.none), + bodyText1 : TextStyle(debugLabel: 'whiteRedmond bodyText1', fontFamily: 'Segoe UI', inherit: true, color: Colors.white, decoration: TextDecoration.none), + bodyText2 : TextStyle(debugLabel: 'whiteRedmond bodyText2', fontFamily: 'Segoe UI', inherit: true, color: Colors.white, decoration: TextDecoration.none), + subtitle1 : TextStyle(debugLabel: 'whiteRedmond subtitle1', fontFamily: 'Segoe UI', inherit: true, color: Colors.white, decoration: TextDecoration.none), + subtitle2 : TextStyle(debugLabel: 'whiteRedmond subtitle2', fontFamily: 'Segoe UI', inherit: true, color: Colors.white, decoration: TextDecoration.none), + caption : TextStyle(debugLabel: 'whiteRedmond caption', fontFamily: 'Segoe UI', inherit: true, color: Colors.white70, decoration: TextDecoration.none), + button : TextStyle(debugLabel: 'whiteRedmond button', fontFamily: 'Segoe UI', inherit: true, color: Colors.white, decoration: TextDecoration.none), + overline : TextStyle(debugLabel: 'whiteRedmond overline', fontFamily: 'Segoe UI', inherit: true, color: Colors.white, decoration: TextDecoration.none), ); static const List _helsinkiFontFallbacks = ['Ubuntu', 'Cantarell', 'DejaVu Sans', 'Liberation Sans', 'Arial']; @@ -411,38 +411,38 @@ class Typography with Diagnosticable { /// /// This [TextTheme] provides color but not geometry (font size, weight, etc). static const TextTheme blackHelsinki = TextTheme( - headline1 : TextStyle(debugLabel: 'blackHelsinki headline1', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.black54, decoration: TextDecoration.none), - headline2 : TextStyle(debugLabel: 'blackHelsinki headline2', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.black54, decoration: TextDecoration.none), - headline3 : TextStyle(debugLabel: 'blackHelsinki headline3', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.black54, decoration: TextDecoration.none), - headline4 : TextStyle(debugLabel: 'blackHelsinki headline4', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.black54, decoration: TextDecoration.none), - headline5 : TextStyle(debugLabel: 'blackHelsinki headline5', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.black87, decoration: TextDecoration.none), - headline6 : TextStyle(debugLabel: 'blackHelsinki headline6', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.black87, decoration: TextDecoration.none), - bodyText1 : TextStyle(debugLabel: 'blackHelsinki bodyText1', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.black87, decoration: TextDecoration.none), - bodyText2 : TextStyle(debugLabel: 'blackHelsinki bodyText2', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.black87, decoration: TextDecoration.none), - subtitle1 : TextStyle(debugLabel: 'blackHelsinki subtitle1', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.black87, decoration: TextDecoration.none), - subtitle2 : TextStyle(debugLabel: 'blackHelsinki subtitle2', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.black, decoration: TextDecoration.none), - caption : TextStyle(debugLabel: 'blackHelsinki caption', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.black54, decoration: TextDecoration.none), - button : TextStyle(debugLabel: 'blackHelsinki button', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.black87, decoration: TextDecoration.none), - overline : TextStyle(debugLabel: 'blackHelsinki overline', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.black, decoration: TextDecoration.none), + headline1 : TextStyle(debugLabel: 'blackHelsinki headline1', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.black54, decoration: TextDecoration.none), + headline2 : TextStyle(debugLabel: 'blackHelsinki headline2', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.black54, decoration: TextDecoration.none), + headline3 : TextStyle(debugLabel: 'blackHelsinki headline3', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.black54, decoration: TextDecoration.none), + headline4 : TextStyle(debugLabel: 'blackHelsinki headline4', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.black54, decoration: TextDecoration.none), + headline5 : TextStyle(debugLabel: 'blackHelsinki headline5', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.black87, decoration: TextDecoration.none), + headline6 : TextStyle(debugLabel: 'blackHelsinki headline6', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.black87, decoration: TextDecoration.none), + bodyText1 : TextStyle(debugLabel: 'blackHelsinki bodyText1', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.black87, decoration: TextDecoration.none), + bodyText2 : TextStyle(debugLabel: 'blackHelsinki bodyText2', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.black87, decoration: TextDecoration.none), + subtitle1 : TextStyle(debugLabel: 'blackHelsinki subtitle1', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.black87, decoration: TextDecoration.none), + subtitle2 : TextStyle(debugLabel: 'blackHelsinki subtitle2', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.black, decoration: TextDecoration.none), + caption : TextStyle(debugLabel: 'blackHelsinki caption', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.black54, decoration: TextDecoration.none), + button : TextStyle(debugLabel: 'blackHelsinki button', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.black87, decoration: TextDecoration.none), + overline : TextStyle(debugLabel: 'blackHelsinki overline', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.black, decoration: TextDecoration.none), ); /// A material design text theme with light glyphs based on Roboto, with fallbacks of DejaVu Sans, Liberation Sans and Arial. /// /// This [TextTheme] provides color but not geometry (font size, weight, etc). static const TextTheme whiteHelsinki = TextTheme( - headline1 : TextStyle(debugLabel: 'whiteHelsinki headline1', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.white70, decoration: TextDecoration.none), - headline2 : TextStyle(debugLabel: 'whiteHelsinki headline2', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.white70, decoration: TextDecoration.none), - headline3 : TextStyle(debugLabel: 'whiteHelsinki headline3', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.white70, decoration: TextDecoration.none), - headline4 : TextStyle(debugLabel: 'whiteHelsinki headline4', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.white70, decoration: TextDecoration.none), - headline5 : TextStyle(debugLabel: 'whiteHelsinki headline5', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.white, decoration: TextDecoration.none), - headline6 : TextStyle(debugLabel: 'whiteHelsinki headline6', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.white, decoration: TextDecoration.none), - bodyText1 : TextStyle(debugLabel: 'whiteHelsinki bodyText1', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.white, decoration: TextDecoration.none), - bodyText2 : TextStyle(debugLabel: 'whiteHelsinki bodyText2', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.white, decoration: TextDecoration.none), - subtitle1 : TextStyle(debugLabel: 'whiteHelsinki subtitle1', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.white, decoration: TextDecoration.none), - subtitle2 : TextStyle(debugLabel: 'whiteHelsinki subtitle2', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.white, decoration: TextDecoration.none), - caption : TextStyle(debugLabel: 'whiteHelsinki caption', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.white70, decoration: TextDecoration.none), - button : TextStyle(debugLabel: 'whiteHelsinki button', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.white, decoration: TextDecoration.none), - overline : TextStyle(debugLabel: 'whiteHelsinki overline', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, color: Colors.white, decoration: TextDecoration.none), + headline1 : TextStyle(debugLabel: 'whiteHelsinki headline1', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.white70, decoration: TextDecoration.none), + headline2 : TextStyle(debugLabel: 'whiteHelsinki headline2', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.white70, decoration: TextDecoration.none), + headline3 : TextStyle(debugLabel: 'whiteHelsinki headline3', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.white70, decoration: TextDecoration.none), + headline4 : TextStyle(debugLabel: 'whiteHelsinki headline4', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.white70, decoration: TextDecoration.none), + headline5 : TextStyle(debugLabel: 'whiteHelsinki headline5', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.white, decoration: TextDecoration.none), + headline6 : TextStyle(debugLabel: 'whiteHelsinki headline6', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.white, decoration: TextDecoration.none), + bodyText1 : TextStyle(debugLabel: 'whiteHelsinki bodyText1', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.white, decoration: TextDecoration.none), + bodyText2 : TextStyle(debugLabel: 'whiteHelsinki bodyText2', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.white, decoration: TextDecoration.none), + subtitle1 : TextStyle(debugLabel: 'whiteHelsinki subtitle1', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.white, decoration: TextDecoration.none), + subtitle2 : TextStyle(debugLabel: 'whiteHelsinki subtitle2', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.white, decoration: TextDecoration.none), + caption : TextStyle(debugLabel: 'whiteHelsinki caption', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.white70, decoration: TextDecoration.none), + button : TextStyle(debugLabel: 'whiteHelsinki button', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.white, decoration: TextDecoration.none), + overline : TextStyle(debugLabel: 'whiteHelsinki overline', fontFamily: 'Roboto', fontFamilyFallback: _helsinkiFontFallbacks, inherit: true, color: Colors.white, decoration: TextDecoration.none), ); /// A material design text theme with dark glyphs based on San Francisco. @@ -451,19 +451,19 @@ class Typography with Diagnosticable { /// /// This theme uses the iOS version of the font names. static const TextTheme blackCupertino = TextTheme( - headline1 : TextStyle(debugLabel: 'blackCupertino headline1', fontFamily: '.SF UI Display', color: Colors.black54, decoration: TextDecoration.none), - headline2 : TextStyle(debugLabel: 'blackCupertino headline2', fontFamily: '.SF UI Display', color: Colors.black54, decoration: TextDecoration.none), - headline3 : TextStyle(debugLabel: 'blackCupertino headline3', fontFamily: '.SF UI Display', color: Colors.black54, decoration: TextDecoration.none), - headline4 : TextStyle(debugLabel: 'blackCupertino headline4', fontFamily: '.SF UI Display', color: Colors.black54, decoration: TextDecoration.none), - headline5 : TextStyle(debugLabel: 'blackCupertino headline5', fontFamily: '.SF UI Display', color: Colors.black87, decoration: TextDecoration.none), - headline6 : TextStyle(debugLabel: 'blackCupertino headline6', fontFamily: '.SF UI Display', color: Colors.black87, decoration: TextDecoration.none), - bodyText1 : TextStyle(debugLabel: 'blackCupertino bodyText1', fontFamily: '.SF UI Text', color: Colors.black87, decoration: TextDecoration.none), - bodyText2 : TextStyle(debugLabel: 'blackCupertino bodyText2', fontFamily: '.SF UI Text', color: Colors.black87, decoration: TextDecoration.none), - subtitle1 : TextStyle(debugLabel: 'blackCupertino subtitle1', fontFamily: '.SF UI Text', color: Colors.black87, decoration: TextDecoration.none), - subtitle2 : TextStyle(debugLabel: 'blackCupertino subtitle2', fontFamily: '.SF UI Text', color: Colors.black, decoration: TextDecoration.none), - caption : TextStyle(debugLabel: 'blackCupertino caption', fontFamily: '.SF UI Text', color: Colors.black54, decoration: TextDecoration.none), - button : TextStyle(debugLabel: 'blackCupertino button', fontFamily: '.SF UI Text', color: Colors.black87, decoration: TextDecoration.none), - overline : TextStyle(debugLabel: 'blackCupertino overline', fontFamily: '.SF UI Text', color: Colors.black, decoration: TextDecoration.none), + headline1 : TextStyle(debugLabel: 'blackCupertino headline1', fontFamily: '.SF UI Display', inherit: true, color: Colors.black54, decoration: TextDecoration.none), + headline2 : TextStyle(debugLabel: 'blackCupertino headline2', fontFamily: '.SF UI Display', inherit: true, color: Colors.black54, decoration: TextDecoration.none), + headline3 : TextStyle(debugLabel: 'blackCupertino headline3', fontFamily: '.SF UI Display', inherit: true, color: Colors.black54, decoration: TextDecoration.none), + headline4 : TextStyle(debugLabel: 'blackCupertino headline4', fontFamily: '.SF UI Display', inherit: true, color: Colors.black54, decoration: TextDecoration.none), + headline5 : TextStyle(debugLabel: 'blackCupertino headline5', fontFamily: '.SF UI Display', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + headline6 : TextStyle(debugLabel: 'blackCupertino headline6', fontFamily: '.SF UI Display', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + bodyText1 : TextStyle(debugLabel: 'blackCupertino bodyText1', fontFamily: '.SF UI Text', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + bodyText2 : TextStyle(debugLabel: 'blackCupertino bodyText2', fontFamily: '.SF UI Text', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + subtitle1 : TextStyle(debugLabel: 'blackCupertino subtitle1', fontFamily: '.SF UI Text', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + subtitle2 : TextStyle(debugLabel: 'blackCupertino subtitle2', fontFamily: '.SF UI Text', inherit: true, color: Colors.black, decoration: TextDecoration.none), + caption : TextStyle(debugLabel: 'blackCupertino caption', fontFamily: '.SF UI Text', inherit: true, color: Colors.black54, decoration: TextDecoration.none), + button : TextStyle(debugLabel: 'blackCupertino button', fontFamily: '.SF UI Text', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + overline : TextStyle(debugLabel: 'blackCupertino overline', fontFamily: '.SF UI Text', inherit: true, color: Colors.black, decoration: TextDecoration.none), ); /// A material design text theme with light glyphs based on San Francisco. @@ -472,19 +472,19 @@ class Typography with Diagnosticable { /// /// This theme uses the iOS version of the font names. static const TextTheme whiteCupertino = TextTheme( - headline1 : TextStyle(debugLabel: 'whiteCupertino headline1', fontFamily: '.SF UI Display', color: Colors.white70, decoration: TextDecoration.none), - headline2 : TextStyle(debugLabel: 'whiteCupertino headline2', fontFamily: '.SF UI Display', color: Colors.white70, decoration: TextDecoration.none), - headline3 : TextStyle(debugLabel: 'whiteCupertino headline3', fontFamily: '.SF UI Display', color: Colors.white70, decoration: TextDecoration.none), - headline4 : TextStyle(debugLabel: 'whiteCupertino headline4', fontFamily: '.SF UI Display', color: Colors.white70, decoration: TextDecoration.none), - headline5 : TextStyle(debugLabel: 'whiteCupertino headline5', fontFamily: '.SF UI Display', color: Colors.white, decoration: TextDecoration.none), - headline6 : TextStyle(debugLabel: 'whiteCupertino headline6', fontFamily: '.SF UI Display', color: Colors.white, decoration: TextDecoration.none), - subtitle1 : TextStyle(debugLabel: 'whiteCupertino subtitle1', fontFamily: '.SF UI Text', color: Colors.white, decoration: TextDecoration.none), - bodyText1 : TextStyle(debugLabel: 'whiteCupertino bodyText1', fontFamily: '.SF UI Text', color: Colors.white, decoration: TextDecoration.none), - bodyText2 : TextStyle(debugLabel: 'whiteCupertino bodyText2', fontFamily: '.SF UI Text', color: Colors.white, decoration: TextDecoration.none), - caption : TextStyle(debugLabel: 'whiteCupertino caption', fontFamily: '.SF UI Text', color: Colors.white70, decoration: TextDecoration.none), - button : TextStyle(debugLabel: 'whiteCupertino button', fontFamily: '.SF UI Text', color: Colors.white, decoration: TextDecoration.none), - subtitle2 : TextStyle(debugLabel: 'whiteCupertino subtitle2', fontFamily: '.SF UI Text', color: Colors.white, decoration: TextDecoration.none), - overline : TextStyle(debugLabel: 'whiteCupertino overline', fontFamily: '.SF UI Text', color: Colors.white, decoration: TextDecoration.none), + headline1 : TextStyle(debugLabel: 'whiteCupertino headline1', fontFamily: '.SF UI Display', inherit: true, color: Colors.white70, decoration: TextDecoration.none), + headline2 : TextStyle(debugLabel: 'whiteCupertino headline2', fontFamily: '.SF UI Display', inherit: true, color: Colors.white70, decoration: TextDecoration.none), + headline3 : TextStyle(debugLabel: 'whiteCupertino headline3', fontFamily: '.SF UI Display', inherit: true, color: Colors.white70, decoration: TextDecoration.none), + headline4 : TextStyle(debugLabel: 'whiteCupertino headline4', fontFamily: '.SF UI Display', inherit: true, color: Colors.white70, decoration: TextDecoration.none), + headline5 : TextStyle(debugLabel: 'whiteCupertino headline5', fontFamily: '.SF UI Display', inherit: true, color: Colors.white, decoration: TextDecoration.none), + headline6 : TextStyle(debugLabel: 'whiteCupertino headline6', fontFamily: '.SF UI Display', inherit: true, color: Colors.white, decoration: TextDecoration.none), + subtitle1 : TextStyle(debugLabel: 'whiteCupertino subtitle1', fontFamily: '.SF UI Text', inherit: true, color: Colors.white, decoration: TextDecoration.none), + bodyText1 : TextStyle(debugLabel: 'whiteCupertino bodyText1', fontFamily: '.SF UI Text', inherit: true, color: Colors.white, decoration: TextDecoration.none), + bodyText2 : TextStyle(debugLabel: 'whiteCupertino bodyText2', fontFamily: '.SF UI Text', inherit: true, color: Colors.white, decoration: TextDecoration.none), + caption : TextStyle(debugLabel: 'whiteCupertino caption', fontFamily: '.SF UI Text', inherit: true, color: Colors.white70, decoration: TextDecoration.none), + button : TextStyle(debugLabel: 'whiteCupertino button', fontFamily: '.SF UI Text', inherit: true, color: Colors.white, decoration: TextDecoration.none), + subtitle2 : TextStyle(debugLabel: 'whiteCupertino subtitle2', fontFamily: '.SF UI Text', inherit: true, color: Colors.white, decoration: TextDecoration.none), + overline : TextStyle(debugLabel: 'whiteCupertino overline', fontFamily: '.SF UI Text', inherit: true, color: Colors.white, decoration: TextDecoration.none), ); /// A material design text theme with dark glyphs based on San Francisco. @@ -493,19 +493,19 @@ class Typography with Diagnosticable { /// /// This theme uses the macOS version of the font names. static const TextTheme blackRedwoodCity = TextTheme( - headline1 : TextStyle(debugLabel: 'blackRedwoodCity headline1', fontFamily: '.AppleSystemUIFont', color: Colors.black54, decoration: TextDecoration.none), - headline2 : TextStyle(debugLabel: 'blackRedwoodCity headline2', fontFamily: '.AppleSystemUIFont', color: Colors.black54, decoration: TextDecoration.none), - headline3 : TextStyle(debugLabel: 'blackRedwoodCity headline3', fontFamily: '.AppleSystemUIFont', color: Colors.black54, decoration: TextDecoration.none), - headline4 : TextStyle(debugLabel: 'blackRedwoodCity headline4', fontFamily: '.AppleSystemUIFont', color: Colors.black54, decoration: TextDecoration.none), - headline5 : TextStyle(debugLabel: 'blackRedwoodCity headline5', fontFamily: '.AppleSystemUIFont', color: Colors.black87, decoration: TextDecoration.none), - headline6 : TextStyle(debugLabel: 'blackRedwoodCity headline6', fontFamily: '.AppleSystemUIFont', color: Colors.black87, decoration: TextDecoration.none), - bodyText1 : TextStyle(debugLabel: 'blackRedwoodCity bodyText1', fontFamily: '.AppleSystemUIFont', color: Colors.black87, decoration: TextDecoration.none), - bodyText2 : TextStyle(debugLabel: 'blackRedwoodCity bodyText2', fontFamily: '.AppleSystemUIFont', color: Colors.black87, decoration: TextDecoration.none), - subtitle1 : TextStyle(debugLabel: 'blackRedwoodCity subtitle1', fontFamily: '.AppleSystemUIFont', color: Colors.black87, decoration: TextDecoration.none), - subtitle2 : TextStyle(debugLabel: 'blackRedwoodCity subtitle2', fontFamily: '.AppleSystemUIFont', color: Colors.black, decoration: TextDecoration.none), - caption : TextStyle(debugLabel: 'blackRedwoodCity caption', fontFamily: '.AppleSystemUIFont', color: Colors.black54, decoration: TextDecoration.none), - button : TextStyle(debugLabel: 'blackRedwoodCity button', fontFamily: '.AppleSystemUIFont', color: Colors.black87, decoration: TextDecoration.none), - overline : TextStyle(debugLabel: 'blackRedwoodCity overline', fontFamily: '.AppleSystemUIFont', color: Colors.black, decoration: TextDecoration.none), + headline1 : TextStyle(debugLabel: 'blackRedwoodCity headline1', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.black54, decoration: TextDecoration.none), + headline2 : TextStyle(debugLabel: 'blackRedwoodCity headline2', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.black54, decoration: TextDecoration.none), + headline3 : TextStyle(debugLabel: 'blackRedwoodCity headline3', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.black54, decoration: TextDecoration.none), + headline4 : TextStyle(debugLabel: 'blackRedwoodCity headline4', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.black54, decoration: TextDecoration.none), + headline5 : TextStyle(debugLabel: 'blackRedwoodCity headline5', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + headline6 : TextStyle(debugLabel: 'blackRedwoodCity headline6', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + bodyText1 : TextStyle(debugLabel: 'blackRedwoodCity bodyText1', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + bodyText2 : TextStyle(debugLabel: 'blackRedwoodCity bodyText2', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + subtitle1 : TextStyle(debugLabel: 'blackRedwoodCity subtitle1', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + subtitle2 : TextStyle(debugLabel: 'blackRedwoodCity subtitle2', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.black, decoration: TextDecoration.none), + caption : TextStyle(debugLabel: 'blackRedwoodCity caption', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.black54, decoration: TextDecoration.none), + button : TextStyle(debugLabel: 'blackRedwoodCity button', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.black87, decoration: TextDecoration.none), + overline : TextStyle(debugLabel: 'blackRedwoodCity overline', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.black, decoration: TextDecoration.none), ); /// A material design text theme with light glyphs based on San Francisco. @@ -514,19 +514,19 @@ class Typography with Diagnosticable { /// /// This theme uses the macOS version of the font names. static const TextTheme whiteRedwoodCity = TextTheme( - headline1 : TextStyle(debugLabel: 'whiteRedwoodCity headline1', fontFamily: '.AppleSystemUIFont', color: Colors.white70, decoration: TextDecoration.none), - headline2 : TextStyle(debugLabel: 'whiteRedwoodCity headline2', fontFamily: '.AppleSystemUIFont', color: Colors.white70, decoration: TextDecoration.none), - headline3 : TextStyle(debugLabel: 'whiteRedwoodCity headline3', fontFamily: '.AppleSystemUIFont', color: Colors.white70, decoration: TextDecoration.none), - headline4 : TextStyle(debugLabel: 'whiteRedwoodCity headline4', fontFamily: '.AppleSystemUIFont', color: Colors.white70, decoration: TextDecoration.none), - headline5 : TextStyle(debugLabel: 'whiteRedwoodCity headline5', fontFamily: '.AppleSystemUIFont', color: Colors.white, decoration: TextDecoration.none), - headline6 : TextStyle(debugLabel: 'whiteRedwoodCity headline6', fontFamily: '.AppleSystemUIFont', color: Colors.white, decoration: TextDecoration.none), - subtitle1 : TextStyle(debugLabel: 'whiteRedwoodCity subtitle1', fontFamily: '.AppleSystemUIFont', color: Colors.white, decoration: TextDecoration.none), - bodyText1 : TextStyle(debugLabel: 'whiteRedwoodCity bodyText1', fontFamily: '.AppleSystemUIFont', color: Colors.white, decoration: TextDecoration.none), - bodyText2 : TextStyle(debugLabel: 'whiteRedwoodCity bodyText2', fontFamily: '.AppleSystemUIFont', color: Colors.white, decoration: TextDecoration.none), - caption : TextStyle(debugLabel: 'whiteRedwoodCity caption', fontFamily: '.AppleSystemUIFont', color: Colors.white70, decoration: TextDecoration.none), - button : TextStyle(debugLabel: 'whiteRedwoodCity button', fontFamily: '.AppleSystemUIFont', color: Colors.white, decoration: TextDecoration.none), - subtitle2 : TextStyle(debugLabel: 'whiteRedwoodCity subtitle2', fontFamily: '.AppleSystemUIFont', color: Colors.white, decoration: TextDecoration.none), - overline : TextStyle(debugLabel: 'whiteRedwoodCity overline', fontFamily: '.AppleSystemUIFont', color: Colors.white, decoration: TextDecoration.none), + headline1 : TextStyle(debugLabel: 'whiteRedwoodCity headline1', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.white70, decoration: TextDecoration.none), + headline2 : TextStyle(debugLabel: 'whiteRedwoodCity headline2', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.white70, decoration: TextDecoration.none), + headline3 : TextStyle(debugLabel: 'whiteRedwoodCity headline3', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.white70, decoration: TextDecoration.none), + headline4 : TextStyle(debugLabel: 'whiteRedwoodCity headline4', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.white70, decoration: TextDecoration.none), + headline5 : TextStyle(debugLabel: 'whiteRedwoodCity headline5', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.white, decoration: TextDecoration.none), + headline6 : TextStyle(debugLabel: 'whiteRedwoodCity headline6', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.white, decoration: TextDecoration.none), + subtitle1 : TextStyle(debugLabel: 'whiteRedwoodCity subtitle1', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.white, decoration: TextDecoration.none), + bodyText1 : TextStyle(debugLabel: 'whiteRedwoodCity bodyText1', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.white, decoration: TextDecoration.none), + bodyText2 : TextStyle(debugLabel: 'whiteRedwoodCity bodyText2', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.white, decoration: TextDecoration.none), + caption : TextStyle(debugLabel: 'whiteRedwoodCity caption', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.white70, decoration: TextDecoration.none), + button : TextStyle(debugLabel: 'whiteRedwoodCity button', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.white, decoration: TextDecoration.none), + subtitle2 : TextStyle(debugLabel: 'whiteRedwoodCity subtitle2', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.white, decoration: TextDecoration.none), + overline : TextStyle(debugLabel: 'whiteRedwoodCity overline', fontFamily: '.AppleSystemUIFont', inherit: true, color: Colors.white, decoration: TextDecoration.none), ); /// Defines text geometry for [ScriptCategory.englishLike] scripts, such as diff --git a/packages/flutter/lib/src/painting/borders.dart b/packages/flutter/lib/src/painting/borders.dart index a51ebda0f3..df016a24d9 100644 --- a/packages/flutter/lib/src/painting/borders.dart +++ b/packages/flutter/lib/src/painting/borders.dart @@ -246,6 +246,7 @@ class BorderSide { return BorderSide( color: Color.lerp(colorA, colorB, t)!, width: width, + style: BorderStyle.solid, ); } diff --git a/packages/flutter/lib/src/painting/notched_shapes.dart b/packages/flutter/lib/src/painting/notched_shapes.dart index e70c898e31..3f17c7f76e 100644 --- a/packages/flutter/lib/src/painting/notched_shapes.dart +++ b/packages/flutter/lib/src/painting/notched_shapes.dart @@ -85,7 +85,7 @@ class CircularNotchedRectangle extends NotchedShape { final double p2yA = math.sqrt(r * r - p2xA * p2xA); final double p2yB = math.sqrt(r * r - p2xB * p2xB); - final List p = List.filled(6, null); + final List p = List.filled(6, null, growable: false); // p0, p1, and p2 are the control points for segment A. p[0] = Offset(a - s1, b); diff --git a/packages/flutter/lib/src/painting/strut_style.dart b/packages/flutter/lib/src/painting/strut_style.dart index df675ba046..72233480ae 100644 --- a/packages/flutter/lib/src/painting/strut_style.dart +++ b/packages/flutter/lib/src/painting/strut_style.dart @@ -616,7 +616,7 @@ class StrutStyle with Diagnosticable { )); styles.add(EnumProperty('${prefix}style', fontStyle, defaultValue: null)); styles.add(DoubleProperty('${prefix}height', height, unit: 'x', defaultValue: null)); - styles.add(FlagProperty('${prefix}forceStrutHeight', value: forceStrutHeight, ifTrue: '$prefix', ifFalse: '$prefix')); + styles.add(FlagProperty('${prefix}forceStrutHeight', value: forceStrutHeight, defaultValue: null, ifTrue: '$prefix', ifFalse: '$prefix')); final bool styleSpecified = styles.any((DiagnosticsNode n) => !n.isFiltered(DiagnosticLevel.info)); styles.forEach(properties.add); diff --git a/packages/flutter/lib/src/rendering/binding.dart b/packages/flutter/lib/src/rendering/binding.dart index 347f25a5f9..f627960b84 100644 --- a/packages/flutter/lib/src/rendering/binding.dart +++ b/packages/flutter/lib/src/rendering/binding.dart @@ -128,7 +128,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture name: 'debugDumpSemanticsTreeInTraversalOrder', callback: (Map parameters) async { final String data = RendererBinding.instance?.renderView.debugSemantics - ?.toStringDeep() ?? 'Semantics not collected.'; + ?.toStringDeep(childOrder: DebugSemanticsDumpOrder.traversalOrder) ?? 'Semantics not collected.'; return { 'data': data, }; diff --git a/packages/flutter/lib/src/rendering/box.dart b/packages/flutter/lib/src/rendering/box.dart index 6b82436270..84c6dcf6ba 100644 --- a/packages/flutter/lib/src/rendering/box.dart +++ b/packages/flutter/lib/src/rendering/box.dart @@ -202,7 +202,9 @@ class BoxConstraints extends Constraints { BoxConstraints loosen() { assert(debugAssertIsValid()); return BoxConstraints( + minWidth: 0.0, maxWidth: maxWidth, + minHeight: 0.0, maxHeight: maxHeight, ); } diff --git a/packages/flutter/lib/src/rendering/custom_layout.dart b/packages/flutter/lib/src/rendering/custom_layout.dart index a8ee908128..2cec520e98 100644 --- a/packages/flutter/lib/src/rendering/custom_layout.dart +++ b/packages/flutter/lib/src/rendering/custom_layout.dart @@ -248,6 +248,7 @@ abstract class MultiChildLayoutDelegate { 'to lay out the following ' '${_debugChildrenNeedingLayout!.length > 1 ? 'children' : 'child'}', properties: _debugChildrenNeedingLayout!.map(_debugDescribeChild).toList(), + style: DiagnosticsTreeStyle.whitespace, ), ]); } diff --git a/packages/flutter/lib/src/rendering/custom_paint.dart b/packages/flutter/lib/src/rendering/custom_paint.dart index 0339fc2585..9eb1b71cf3 100644 --- a/packages/flutter/lib/src/rendering/custom_paint.dart +++ b/packages/flutter/lib/src/rendering/custom_paint.dart @@ -739,7 +739,7 @@ class RenderCustomPaint extends RenderProxyBox { int newChildrenBottom = newChildSemantics.length - 1; int oldChildrenBottom = oldSemantics.length - 1; - final List newChildren = List.filled(newChildSemantics.length, null); + final List newChildren = List.filled(newChildSemantics.length, null, growable: false); // Update the top of the list. while ((oldChildrenTop <= oldChildrenBottom) && (newChildrenTop <= newChildrenBottom)) { diff --git a/packages/flutter/lib/src/rendering/debug_overflow_indicator.dart b/packages/flutter/lib/src/rendering/debug_overflow_indicator.dart index e6fbde2012..1ba09530d1 100644 --- a/packages/flutter/lib/src/rendering/debug_overflow_indicator.dart +++ b/packages/flutter/lib/src/rendering/debug_overflow_indicator.dart @@ -176,6 +176,7 @@ mixin DebugOverflowIndicatorMixin on RenderObject { rect: markerRect, label: 'TOP OVERFLOWED BY ${_formatPixels(overflow.top)} PIXELS', labelOffset: markerRect.topCenter + const Offset(0.0, _indicatorLabelPaddingPixels), + rotation: 0.0, side: _OverflowSide.top, )); } @@ -191,6 +192,7 @@ mixin DebugOverflowIndicatorMixin on RenderObject { label: 'BOTTOM OVERFLOWED BY ${_formatPixels(overflow.bottom)} PIXELS', labelOffset: markerRect.bottomCenter - const Offset(0.0, _indicatorFontSizePixels + _indicatorLabelPaddingPixels), + rotation: 0.0, side: _OverflowSide.bottom, )); } diff --git a/packages/flutter/lib/src/rendering/editable.dart b/packages/flutter/lib/src/rendering/editable.dart index 17d7414894..99ab8ab07d 100644 --- a/packages/flutter/lib/src/rendering/editable.dart +++ b/packages/flutter/lib/src/rendering/editable.dart @@ -1598,13 +1598,13 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin, @override double computeMinIntrinsicWidth(double height) { - _layoutText(); + _layoutText(maxWidth: double.infinity); return _textPainter.minIntrinsicWidth; } @override double computeMaxIntrinsicWidth(double height) { - _layoutText(); + _layoutText(maxWidth: double.infinity); return _textPainter.maxIntrinsicWidth + _caretMargin; } @@ -1881,7 +1881,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin, final TextRange word = _textPainter.getWordBoundary(position); late TextSelection newSelection; if (position.offset - word.start <= 1) { - newSelection = TextSelection.collapsed(offset: word.start); + newSelection = TextSelection.collapsed(offset: word.start, affinity: TextAffinity.downstream); } else { newSelection = TextSelection.collapsed(offset: word.end, affinity: TextAffinity.upstream); } @@ -1966,7 +1966,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin, return []; } RenderBox? child = firstChild; - final List placeholderDimensions = List.filled(childCount, PlaceholderDimensions.empty); + final List placeholderDimensions = List.filled(childCount, PlaceholderDimensions.empty, growable: false); int childIndex = 0; // Only constrain the width to the maximum width of the paragraph. // Leave height unconstrained, which will overflow if expanded past. diff --git a/packages/flutter/lib/src/rendering/object.dart b/packages/flutter/lib/src/rendering/object.dart index da3929a197..d60c8b684c 100644 --- a/packages/flutter/lib/src/rendering/object.dart +++ b/packages/flutter/lib/src/rendering/object.dart @@ -207,7 +207,10 @@ class PaintingContext extends ClipContext { } else { assert(() { // register the call for RepaintBoundary metrics - child.debugRegisterRepaintBoundaryPaint(); + child.debugRegisterRepaintBoundaryPaint( + includedParent: true, + includedChild: false, + ); child._layerHandle.layer!.debugCreator = child.debugCreator ?? child; return true; }()); diff --git a/packages/flutter/lib/src/rendering/paragraph.dart b/packages/flutter/lib/src/rendering/paragraph.dart index 493b397630..69a519bb77 100644 --- a/packages/flutter/lib/src/rendering/paragraph.dart +++ b/packages/flutter/lib/src/rendering/paragraph.dart @@ -380,7 +380,7 @@ class RenderParagraph extends RenderBox void _computeChildrenWidthWithMaxIntrinsics(double height) { RenderBox? child = firstChild; - final List placeholderDimensions = List.filled(childCount, PlaceholderDimensions.empty); + final List placeholderDimensions = List.filled(childCount, PlaceholderDimensions.empty, growable: false); int childIndex = 0; while (child != null) { // Height and baseline is irrelevant as all text will be laid @@ -398,7 +398,7 @@ class RenderParagraph extends RenderBox void _computeChildrenWidthWithMinIntrinsics(double height) { RenderBox? child = firstChild; - final List placeholderDimensions = List.filled(childCount, PlaceholderDimensions.empty); + final List placeholderDimensions = List.filled(childCount, PlaceholderDimensions.empty, growable: false); int childIndex = 0; while (child != null) { // Height and baseline is irrelevant; only looking for the widest word or @@ -416,7 +416,7 @@ class RenderParagraph extends RenderBox void _computeChildrenHeightWithMinIntrinsics(double width) { RenderBox? child = firstChild; - final List placeholderDimensions = List.filled(childCount, PlaceholderDimensions.empty); + final List placeholderDimensions = List.filled(childCount, PlaceholderDimensions.empty, growable: false); int childIndex = 0; // Takes textScaleFactor into account because the content of the placeholder // span will be scaled up when it paints. @@ -530,7 +530,7 @@ class RenderParagraph extends RenderBox return []; } RenderBox? child = firstChild; - final List placeholderDimensions = List.filled(childCount, PlaceholderDimensions.empty); + final List placeholderDimensions = List.filled(childCount, PlaceholderDimensions.empty, growable: false); int childIndex = 0; // Only constrain the width to the maximum width of the paragraph. // Leave height unconstrained, which will overflow if expanded past. diff --git a/packages/flutter/lib/src/rendering/sliver_list.dart b/packages/flutter/lib/src/rendering/sliver_list.dart index 921c436b50..9c0533e03c 100644 --- a/packages/flutter/lib/src/rendering/sliver_list.dart +++ b/packages/flutter/lib/src/rendering/sliver_list.dart @@ -270,6 +270,7 @@ class RenderSliverList extends RenderSliverMultiBoxAdaptor { final double extent = childScrollOffset(lastChild!)! + paintExtentOf(lastChild!); geometry = SliverGeometry( scrollExtent: extent, + paintExtent: 0.0, maxPaintExtent: extent, ); return; diff --git a/packages/flutter/lib/src/rendering/table.dart b/packages/flutter/lib/src/rendering/table.dart index 7104a82602..ec6f148999 100644 --- a/packages/flutter/lib/src/rendering/table.dart +++ b/packages/flutter/lib/src/rendering/table.dart @@ -369,7 +369,7 @@ class RenderTable extends RenderBox { int? columns, int? rows, Map? columnWidths, - TableColumnWidth defaultColumnWidth = const FlexColumnWidth(), + TableColumnWidth defaultColumnWidth = const FlexColumnWidth(1.0), required TextDirection textDirection, TableBorder? border, List? rowDecorations, @@ -418,7 +418,7 @@ class RenderTable extends RenderBox { final int oldColumns = columns; final List oldChildren = _children; _columns = value; - _children = List.filled(columns * rows, null); + _children = List.filled(columns * rows, null, growable: false); final int columnsToCopy = math.min(columns, oldColumns); for (int y = 0; y < rows; y += 1) { for (int x = 0; x < columnsToCopy; x += 1) @@ -543,7 +543,7 @@ class RenderTable extends RenderBox { for (final BoxPainter? painter in _rowDecorationPainters!) painter?.dispose(); } - _rowDecorationPainters = _rowDecorations != null ? List.filled(_rowDecorations!.length, null) : null; + _rowDecorationPainters = _rowDecorations != null ? List.filled(_rowDecorations!.length, null, growable: false) : null; } /// The settings to pass to the [rowDecorations] when painting, so that they @@ -719,7 +719,7 @@ class RenderTable extends RenderBox { if (_rowDecorationPainters != null) { for (final BoxPainter? painter in _rowDecorationPainters!) painter?.dispose(); - _rowDecorationPainters = List.filled(_rowDecorations!.length, null); + _rowDecorationPainters = List.filled(_rowDecorations!.length, null, growable: false); } for (final RenderBox? child in _children) child?.detach(); @@ -832,9 +832,9 @@ class RenderTable extends RenderBox { // necessary, applying minimum column widths as we go // 1. apply ideal widths, and collect information we'll need later - final List widths = List.filled(columns, 0.0); - final List minWidths = List.filled(columns, 0.0); - final List flexes = List.filled(columns, null); + final List widths = List.filled(columns, 0.0, growable: false); + final List minWidths = List.filled(columns, 0.0, growable: false); + final List flexes = List.filled(columns, null, growable: false); double tableWidth = 0.0; // running tally of the sum of widths[x] for all x double unflexedTableWidth = 0.0; // sum of the maxIntrinsicWidths of any column that has null flex double totalFlex = 0.0; @@ -1050,7 +1050,7 @@ class RenderTable extends RenderBox { return; } final List widths = _computeColumnWidths(constraints); - final List positions = List.filled(columns, 0.0); + final List positions = List.filled(columns, 0.0, growable: false); final double tableWidth; switch (textDirection) { case TextDirection.rtl: @@ -1078,7 +1078,7 @@ class RenderTable extends RenderBox { bool haveBaseline = false; double beforeBaselineDistance = 0.0; double afterBaselineDistance = 0.0; - final List baselines = List.filled(columns, 0.0); + final List baselines = List.filled(columns, 0.0, growable: false); for (int x = 0; x < columns; x += 1) { final int xy = x + y * columns; final RenderBox? child = _children[xy]; diff --git a/packages/flutter/lib/src/services/keyboard_key.dart b/packages/flutter/lib/src/services/keyboard_key.dart index c95e997cc4..006b5acb86 100644 --- a/packages/flutter/lib/src/services/keyboard_key.dart +++ b/packages/flutter/lib/src/services/keyboard_key.dart @@ -254,9 +254,9 @@ class LogicalKeyboardKey extends KeyboardKey { @override void debugFillProperties(DiagnosticPropertiesBuilder properties) { super.debugFillProperties(properties); - properties.add(StringProperty('keyId', '0x${keyId.toRadixString(16).padLeft(8, '0')}')); - properties.add(StringProperty('keyLabel', keyLabel)); - properties.add(StringProperty('debugName', debugName, defaultValue: null)); + properties.add(StringProperty('keyId', '0x${keyId.toRadixString(16).padLeft(8, '0')}', showName: true)); + properties.add(StringProperty('keyLabel', keyLabel, showName: true)); + properties.add(StringProperty('debugName', debugName, showName: true, defaultValue: null)); } /// Mask for the 32-bit value portion of the key code. @@ -3552,8 +3552,8 @@ class PhysicalKeyboardKey extends KeyboardKey { @override void debugFillProperties(DiagnosticPropertiesBuilder properties) { super.debugFillProperties(properties); - properties.add(StringProperty('usbHidUsage', '0x${usbHidUsage.toRadixString(16).padLeft(8, '0')}')); - properties.add(StringProperty('debugName', debugName, defaultValue: null)); + properties.add(StringProperty('usbHidUsage', '0x${usbHidUsage.toRadixString(16).padLeft(8, '0')}', showName: true)); + properties.add(StringProperty('debugName', debugName, showName: true, defaultValue: null)); } // Key constants for all keyboard keys in the USB HID specification at the diff --git a/packages/flutter/lib/src/services/message_codecs.dart b/packages/flutter/lib/src/services/message_codecs.dart index d1b2522fbb..e9399995cf 100644 --- a/packages/flutter/lib/src/services/message_codecs.dart +++ b/packages/flutter/lib/src/services/message_codecs.dart @@ -478,7 +478,7 @@ class StandardMessageCodec implements MessageCodec { return buffer.getFloat64List(length); case _valueList: final int length = readSize(buffer); - final List result = List.filled(length, null); + final List result = List.filled(length, null, growable: false); for (int i = 0; i < length; i++) result[i] = readValue(buffer); return result; diff --git a/packages/flutter/lib/src/services/platform_channel.dart b/packages/flutter/lib/src/services/platform_channel.dart index 9176c31df3..f6a4d792b5 100644 --- a/packages/flutter/lib/src/services/platform_channel.dart +++ b/packages/flutter/lib/src/services/platform_channel.dart @@ -411,7 +411,7 @@ class MethodChannel { } on MissingPluginException { return null; } catch (e) { - return codec.encodeErrorEnvelope(code: 'error', message: e.toString()); + return codec.encodeErrorEnvelope(code: 'error', message: e.toString(), details: null); } } diff --git a/packages/flutter/lib/src/services/raw_keyboard.dart b/packages/flutter/lib/src/services/raw_keyboard.dart index d04e592dd4..e99f28b464 100644 --- a/packages/flutter/lib/src/services/raw_keyboard.dart +++ b/packages/flutter/lib/src/services/raw_keyboard.dart @@ -142,25 +142,25 @@ abstract class RawKeyEventData with Diagnosticable { /// regardless of which side of the keyboard it is on. /// /// Use [isModifierPressed] if you need to know which control key was pressed. - bool get isControlPressed => isModifierPressed(ModifierKey.controlModifier); + bool get isControlPressed => isModifierPressed(ModifierKey.controlModifier, side: KeyboardSide.any); /// Returns true if a SHIFT modifier key was pressed at the time of this /// event, regardless of which side of the keyboard it is on. /// /// Use [isModifierPressed] if you need to know which shift key was pressed. - bool get isShiftPressed => isModifierPressed(ModifierKey.shiftModifier); + bool get isShiftPressed => isModifierPressed(ModifierKey.shiftModifier, side: KeyboardSide.any); /// Returns true if a ALT modifier key was pressed at the time of this event, /// regardless of which side of the keyboard it is on. /// /// Use [isModifierPressed] if you need to know which alt key was pressed. - bool get isAltPressed => isModifierPressed(ModifierKey.altModifier); + bool get isAltPressed => isModifierPressed(ModifierKey.altModifier, side: KeyboardSide.any); /// Returns true if a META modifier key was pressed at the time of this event, /// regardless of which side of the keyboard it is on. /// /// Use [isModifierPressed] if you need to know which meta key was pressed. - bool get isMetaPressed => isModifierPressed(ModifierKey.metaModifier); + bool get isMetaPressed => isModifierPressed(ModifierKey.metaModifier, side: KeyboardSide.any); /// Returns a map of modifier keys that were pressed at the time of this /// event, and the keyboard side or sides that the key was on. diff --git a/packages/flutter/lib/src/services/system_channels.dart b/packages/flutter/lib/src/services/system_channels.dart index 49af63f230..2e25ebfba1 100644 --- a/packages/flutter/lib/src/services/system_channels.dart +++ b/packages/flutter/lib/src/services/system_channels.dart @@ -295,6 +295,7 @@ class SystemChannels { /// * [PlatformViewsService] for the available operations on this channel. static const MethodChannel platform_views = MethodChannel( 'flutter/platform_views', + StandardMethodCodec(), ); /// A [MethodChannel] for configuring the Skia graphics library. @@ -320,6 +321,7 @@ class SystemChannels { /// integer `device`, and string `kind`. static const MethodChannel mouseCursor = OptionalMethodChannel( 'flutter/mousecursor', + StandardMethodCodec(), ); /// A [MethodChannel] for synchronizing restoration data with the engine. @@ -350,6 +352,7 @@ class SystemChannels { /// restoration data is used in Flutter. static const MethodChannel restoration = OptionalMethodChannel( 'flutter/restoration', + StandardMethodCodec(), ); /// A [MethodChannel] for installing and managing deferred components. @@ -375,6 +378,7 @@ class SystemChannels { /// `installDeferredComponent` or `loadLibrary` is called again. static const MethodChannel deferredComponent = OptionalMethodChannel( 'flutter/deferredcomponent', + StandardMethodCodec(), ); /// A JSON [MethodChannel] for localization. diff --git a/packages/flutter/lib/src/services/system_chrome.dart b/packages/flutter/lib/src/services/system_chrome.dart index 8a16af5021..ba684b2839 100644 --- a/packages/flutter/lib/src/services/system_chrome.dart +++ b/packages/flutter/lib/src/services/system_chrome.dart @@ -266,6 +266,8 @@ class SystemUiOverlayStyle { /// applications with a dark background. static const SystemUiOverlayStyle light = SystemUiOverlayStyle( systemNavigationBarColor: Color(0xFF000000), + systemNavigationBarDividerColor: null, + statusBarColor: null, systemNavigationBarIconBrightness: Brightness.light, statusBarIconBrightness: Brightness.light, statusBarBrightness: Brightness.dark, @@ -275,6 +277,8 @@ class SystemUiOverlayStyle { /// applications with a light background. static const SystemUiOverlayStyle dark = SystemUiOverlayStyle( systemNavigationBarColor: Color(0xFF000000), + systemNavigationBarDividerColor: null, + statusBarColor: null, systemNavigationBarIconBrightness: Brightness.light, statusBarIconBrightness: Brightness.dark, statusBarBrightness: Brightness.light, diff --git a/packages/flutter/lib/src/widgets/animated_cross_fade.dart b/packages/flutter/lib/src/widgets/animated_cross_fade.dart index c999be4d38..8561ffb5dd 100644 --- a/packages/flutter/lib/src/widgets/animated_cross_fade.dart +++ b/packages/flutter/lib/src/widgets/animated_cross_fade.dart @@ -342,7 +342,8 @@ class _AnimatedCrossFadeState extends State with TickerProvid bottomChild = TickerMode( key: bottomKey, enabled: _isTransitioning, - child: ExcludeSemantics( // Always exclude the semantics of the widget that's fading out. + child: ExcludeSemantics( + excluding: true, // Always exclude the semantics of the widget that's fading out. child: ExcludeFocus( child: FadeTransition( opacity: bottomAnimation, diff --git a/packages/flutter/lib/src/widgets/autofill.dart b/packages/flutter/lib/src/widgets/autofill.dart index 4d2b3b3060..31569f27bf 100644 --- a/packages/flutter/lib/src/widgets/autofill.dart +++ b/packages/flutter/lib/src/widgets/autofill.dart @@ -195,7 +195,7 @@ class AutofillGroupState extends State with AutofillScopeMixin { TextInput.finishAutofillContext(shouldSave: false); break; case AutofillContextAction.commit: - TextInput.finishAutofillContext(); + TextInput.finishAutofillContext(shouldSave: true); break; } } diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index df2e9875ff..3104e4eb9e 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -5607,7 +5607,7 @@ abstract class RenderObjectElement extends Element { int oldChildrenBottom = oldChildren.length - 1; final List newChildren = oldChildren.length == newWidgets.length ? - oldChildren : List.filled(newWidgets.length, _NullElement.instance); + oldChildren : List.filled(newWidgets.length, _NullElement.instance, growable: false); Element? previousChild; @@ -6259,7 +6259,7 @@ class MultiChildRenderObjectElement extends RenderObjectElement { @override void mount(Element? parent, Object? newSlot) { super.mount(parent, newSlot); - final List children = List.filled(widget.children.length, _NullElement.instance); + final List children = List.filled(widget.children.length, _NullElement.instance, growable: false); Element? previousChild; for (int i = 0; i < children.length; i += 1) { final Element newChild = inflateWidget(widget.children[i], IndexedSlot(i, previousChild)); diff --git a/packages/flutter/lib/src/widgets/image_icon.dart b/packages/flutter/lib/src/widgets/image_icon.dart index 80e8ba57d2..3eb9746124 100644 --- a/packages/flutter/lib/src/widgets/image_icon.dart +++ b/packages/flutter/lib/src/widgets/image_icon.dart @@ -89,6 +89,7 @@ class ImageIcon extends StatelessWidget { height: iconSize, color: iconColor, fit: BoxFit.scaleDown, + alignment: Alignment.center, excludeFromSemantics: true, ), ); diff --git a/packages/flutter/lib/src/widgets/interactive_viewer.dart b/packages/flutter/lib/src/widgets/interactive_viewer.dart index 02bda6fa7c..fa7ed17db9 100644 --- a/packages/flutter/lib/src/widgets/interactive_viewer.dart +++ b/packages/flutter/lib/src/widgets/interactive_viewer.dart @@ -892,7 +892,10 @@ class _InteractiveViewerState extends State with TickerProvid widget.onInteractionUpdate?.call(ScaleUpdateDetails( focalPoint: event.position, localFocalPoint: event.localPosition, + rotation: 0.0, scale: scaleChange, + horizontalScale: 1.0, + verticalScale: 1.0, )); widget.onInteractionEnd?.call(ScaleEndDetails()); return; @@ -920,7 +923,10 @@ class _InteractiveViewerState extends State with TickerProvid widget.onInteractionUpdate?.call(ScaleUpdateDetails( focalPoint: event.position, localFocalPoint: event.localPosition, + rotation: 0.0, scale: scaleChange, + horizontalScale: 1.0, + verticalScale: 1.0, )); widget.onInteractionEnd?.call(ScaleEndDetails()); } @@ -1042,6 +1048,7 @@ class _InteractiveViewerState extends State with TickerProvid onPointerSignal: _receivedPointerSignal, child: GestureDetector( behavior: HitTestBehavior.opaque, // Necessary when panning off screen. + dragStartBehavior: DragStartBehavior.start, onScaleEnd: _onScaleEnd, onScaleStart: _onScaleStart, onScaleUpdate: _onScaleUpdate, diff --git a/packages/flutter/lib/src/widgets/modal_barrier.dart b/packages/flutter/lib/src/widgets/modal_barrier.dart index 7e77ef95ae..fea4a7c760 100644 --- a/packages/flutter/lib/src/widgets/modal_barrier.dart +++ b/packages/flutter/lib/src/widgets/modal_barrier.dart @@ -115,6 +115,7 @@ class ModalBarrier extends StatelessWidget { textDirection: semanticsDismissible && semanticsLabel != null ? Directionality.of(context) : null, child: MouseRegion( cursor: SystemMouseCursors.basic, + opaque: true, child: ConstrainedBox( constraints: const BoxConstraints.expand(), child: color == null ? null : ColoredBox( diff --git a/packages/flutter/lib/src/widgets/navigation_toolbar.dart b/packages/flutter/lib/src/widgets/navigation_toolbar.dart index e6a0a19306..e2b398a5b8 100644 --- a/packages/flutter/lib/src/widgets/navigation_toolbar.dart +++ b/packages/flutter/lib/src/widgets/navigation_toolbar.dart @@ -107,6 +107,7 @@ class _ToolbarLayout extends MultiChildLayoutDelegate { if (hasChild(_ToolbarSlot.leading)) { final BoxConstraints constraints = BoxConstraints( + minWidth: 0.0, maxWidth: size.width / 3.0, // The leading widget shouldn't take up more than 1/3 of the space. minHeight: size.height, // The height should be exactly the height of the bar. maxHeight: size.height, diff --git a/packages/flutter/lib/src/widgets/navigator.dart b/packages/flutter/lib/src/widgets/navigator.dart index d608197a4d..6aaed4959a 100644 --- a/packages/flutter/lib/src/widgets/navigator.dart +++ b/packages/flutter/lib/src/widgets/navigator.dart @@ -5398,7 +5398,7 @@ class _HistoryProperty extends RestorableProperty>?> { final Map casted = data! as Map; return casted.map>((dynamic key, dynamic value) => MapEntry>( key as String?, - List.from(value as List), + List.from(value as List, growable: true), )); } diff --git a/packages/flutter/lib/src/widgets/nested_scroll_view.dart b/packages/flutter/lib/src/widgets/nested_scroll_view.dart index f951b6c47c..2c0b5cf2eb 100644 --- a/packages/flutter/lib/src/widgets/nested_scroll_view.dart +++ b/packages/flutter/lib/src/widgets/nested_scroll_view.dart @@ -583,6 +583,7 @@ class _NestedScrollCoordinator implements ScrollActivityDelegate, ScrollHoldCont ); _innerController = _NestedScrollController( this, + initialScrollOffset: 0.0, debugLabel: 'inner', ); } diff --git a/packages/flutter/lib/src/widgets/page_view.dart b/packages/flutter/lib/src/widgets/page_view.dart index c804607902..e6bbe784f7 100644 --- a/packages/flutter/lib/src/widgets/page_view.dart +++ b/packages/flutter/lib/src/widgets/page_view.dart @@ -359,6 +359,7 @@ class _PagePosition extends ScrollPositionWithSingleContext implements PageMetri duration: duration, curve: curve, alignmentPolicy: alignmentPolicy, + targetRenderObject: null, ); } diff --git a/packages/flutter/lib/src/widgets/routes.dart b/packages/flutter/lib/src/widgets/routes.dart index f019d29b17..69ba3f6ea4 100644 --- a/packages/flutter/lib/src/widgets/routes.dart +++ b/packages/flutter/lib/src/widgets/routes.dart @@ -2190,6 +2190,6 @@ class _RenderFocusTrap extends RenderProxyBoxWithHitTestBehavior { } } if (!hitCurrentFocus) - focusNode.unfocus(); + focusNode.unfocus(disposition: UnfocusDisposition.scope); } } diff --git a/packages/flutter/lib/src/widgets/table.dart b/packages/flutter/lib/src/widgets/table.dart index 642049f51b..19199973de 100644 --- a/packages/flutter/lib/src/widgets/table.dart +++ b/packages/flutter/lib/src/widgets/table.dart @@ -118,7 +118,7 @@ class Table extends RenderObjectWidget { Key? key, this.children = const [], this.columnWidths, - this.defaultColumnWidth = const FlexColumnWidth(), + this.defaultColumnWidth = const FlexColumnWidth(1.0), this.textDirection, this.border, this.defaultVerticalAlignment = TableCellVerticalAlignment.top, diff --git a/packages/flutter/lib/src/widgets/text_editing_action_target.dart b/packages/flutter/lib/src/widgets/text_editing_action_target.dart index e08f959b86..67a790d7fb 100644 --- a/packages/flutter/lib/src/widgets/text_editing_action_target.dart +++ b/packages/flutter/lib/src/widgets/text_editing_action_target.dart @@ -620,6 +620,7 @@ abstract class TextEditingActionTarget { final TextPosition nextPosition = TextPosition( offset: textEditingValue.text.length, + affinity: TextAffinity.downstream, ); setSelection(textEditingValue.selection.expandTo(nextPosition, true), cause); } @@ -883,6 +884,7 @@ abstract class TextEditingActionTarget { } else { nextSelection = textEditingValue.selection.extendTo(TextPosition( offset: selectedLine.baseOffset, + affinity: TextAffinity.downstream, )); } @@ -1166,6 +1168,7 @@ abstract class TextEditingActionTarget { ); final TextSelection nextSelection = TextSelection.fromPosition(TextPosition( offset: selectedLine.baseOffset, + affinity: TextAffinity.downstream, )); setSelection(nextSelection, cause); @@ -1426,6 +1429,7 @@ abstract class TextEditingActionTarget { void moveSelectionToEnd(SelectionChangedCause cause) { final TextPosition nextPosition = TextPosition( offset: textEditingValue.text.length, + affinity: TextAffinity.downstream, ); setSelection(TextSelection.fromPosition(nextPosition), cause); } diff --git a/packages/flutter/lib/src/widgets/widget_inspector.dart b/packages/flutter/lib/src/widgets/widget_inspector.dart index dca6533810..1b211afe8c 100644 --- a/packages/flutter/lib/src/widgets/widget_inspector.dart +++ b/packages/flutter/lib/src/widgets/widget_inspector.dart @@ -707,7 +707,7 @@ class _WidgetInspectorService = Object with WidgetInspectorService; mixin WidgetInspectorService { /// Ring of cached JSON values to prevent JSON from being garbage /// collected before it can be requested over the Observatory protocol. - final List _serializeRing = List.filled(20, null); + final List _serializeRing = List.filled(20, null, growable: false); int _serializeRingIndex = 0; /// The current [WidgetInspectorService]. @@ -925,6 +925,7 @@ mixin WidgetInspectorService { groupName: _consoleObjectGroup, subtreeDepth: 5, includeProperties: true, + expandPropertyValues: true, maxDescendentsTruncatableNode: 5, service: this, ), @@ -933,6 +934,7 @@ mixin WidgetInspectorService { errorJson['errorsSinceReload'] = _errorsSinceReload; if (_errorsSinceReload == 0) { errorJson['renderedErrorText'] = TextTreeRenderer( + wrapWidth: FlutterError.wrapWidth, wrapWidthProperties: FlutterError.wrapWidth, maxDescendentsTruncatableNode: 5, ).render(details.toDiagnosticsNode(style: DiagnosticsTreeStyle.error)).trimRight(); @@ -963,7 +965,7 @@ mixin WidgetInspectorService { bool enabled = false; assert(() { // TODO(kenz): add support for structured errors on the web. - enabled = const bool.fromEnvironment('flutter.inspector.structuredErrors', defaultValue: !kIsWeb); // ignore: avoid_redundant_argument_values + enabled = const bool.fromEnvironment('flutter.inspector.structuredErrors', defaultValue: !kIsWeb); return true; }()); return enabled; @@ -1637,7 +1639,7 @@ mixin WidgetInspectorService { List _getChildrenDetailsSubtree(String? diagnosticsNodeId, String groupName) { final DiagnosticsNode? node = toObject(diagnosticsNodeId) as DiagnosticsNode?; // With this value of minDepth we only expand one extra level of important nodes. - final InspectorSerializationDelegate delegate = InspectorSerializationDelegate(groupName: groupName, includeProperties: true, service: this); + final InspectorSerializationDelegate delegate = InspectorSerializationDelegate(groupName: groupName, subtreeDepth: 1, includeProperties: true, service: this); return _nodesToJson(node == null ? const [] : _getChildrenFiltered(node, delegate), delegate, parent: node); } @@ -1745,6 +1747,7 @@ mixin WidgetInspectorService { root, InspectorSerializationDelegate( groupName: groupName, + summaryTree: false, subtreeDepth: subtreeDepth, includeProperties: true, service: this, diff --git a/packages/flutter/test/animation/animation_controller_test.dart b/packages/flutter/test/animation/animation_controller_test.dart index 3efa93f2c8..265aee9d81 100644 --- a/packages/flutter/test/animation/animation_controller_test.dart +++ b/packages/flutter/test/animation/animation_controller_test.dart @@ -412,7 +412,7 @@ void main() { vsync: const TestVSync(), ); expect(() { controller.repeat(); }, throwsFlutterError); - expect(() { controller.repeat(); }, throwsFlutterError); + expect(() { controller.repeat(period: null); }, throwsFlutterError); controller.dispose(); }); @@ -436,6 +436,8 @@ void main() { final AnimationController controller = AnimationController( value: 1.0, + upperBound: 1.0, + lowerBound: 0.0, vsync: const TestVSync(), )..addStatusListener(statusLog.add); @@ -451,6 +453,8 @@ void main() { final AnimationController controller = AnimationController( value: 0.0, + upperBound: 1.0, + lowerBound: 0.0, vsync: const TestVSync(), )..addStatusListener(statusLog.add); @@ -526,6 +530,8 @@ void main() { final AnimationController controller = AnimationController( duration: const Duration(milliseconds: 100), value: 0.0, + lowerBound: 0.0, + upperBound: 1.0, vsync: const TestVSync(), )..addStatusListener(statusLog.add); @@ -576,6 +582,8 @@ void main() { test('setting value directly sets correct status', () { final AnimationController controller = AnimationController( value: 0.0, + lowerBound: 0.0, + upperBound: 1.0, vsync: const TestVSync(), ); @@ -605,6 +613,8 @@ void main() { final AnimationController controller = AnimationController( duration: const Duration(milliseconds: 100), value: 0.0, + lowerBound: 0.0, + upperBound: 1.0, vsync: const TestVSync(), )..addStatusListener(statusLog.add); @@ -650,6 +660,8 @@ void main() { final AnimationController controller = AnimationController( duration: const Duration(milliseconds: 100), value: 1.0, + lowerBound: 0.0, + upperBound: 1.0, vsync: const TestVSync(), )..addStatusListener(statusLog.add); @@ -677,6 +689,8 @@ void main() { final AnimationController controller = AnimationController( duration: const Duration(milliseconds: 100), value: 0.0, + lowerBound: 0.0, + upperBound: 1.0, vsync: const TestVSync(), )..addStatusListener(statusLog.add); @@ -706,6 +720,8 @@ void main() { final AnimationController controller = AnimationController( duration: const Duration(milliseconds: 100), value: 0.0, + lowerBound: 0.0, + upperBound: 1.0, vsync: const TestVSync(), ); @@ -756,6 +772,8 @@ void main() { final AnimationController controller = AnimationController( duration: const Duration(milliseconds: 100), value: 0.0, + lowerBound: 0.0, + upperBound: 1.0, vsync: const TestVSync(), ); @@ -831,6 +849,7 @@ void main() { debugSemanticsDisableAnimations = true; final AnimationController controller = AnimationController( vsync: const TestVSync(), + animationBehavior: AnimationBehavior.normal, ); expect(controller.value, 0.0); @@ -861,8 +880,8 @@ void main() { vsync: const TestVSync(), ); - controller.fling(animationBehavior: AnimationBehavior.preserve); - fastController.fling(animationBehavior: AnimationBehavior.normal); + controller.fling(velocity: 1.0, animationBehavior: AnimationBehavior.preserve); + fastController.fling(velocity: 1.0, animationBehavior: AnimationBehavior.normal); tick(Duration.zero); tick(const Duration(milliseconds: 50)); diff --git a/packages/flutter/test/animation/animation_sheet_test.dart b/packages/flutter/test/animation/animation_sheet_test.dart index 6550f3d375..59e119a36a 100644 --- a/packages/flutter/test/animation/animation_sheet_test.dart +++ b/packages/flutter/test/animation/animation_sheet_test.dart @@ -38,6 +38,7 @@ void main() { await tester.pumpFrames( builder.record( const _DecuplePixels(Duration(seconds: 1)), + recording: true, ), const Duration(milliseconds: 400), const Duration(milliseconds: 100), @@ -92,6 +93,7 @@ void main() { await tester.pumpFrames( builder.record( const _DecuplePixels(Duration(seconds: 1)), + recording: true, ), const Duration(milliseconds: 400), const Duration(milliseconds: 100), diff --git a/packages/flutter/test/animation/curves_test.dart b/packages/flutter/test/animation/curves_test.dart index b00047af73..e9374f6a8f 100644 --- a/packages/flutter/test/animation/curves_test.dart +++ b/packages/flutter/test/animation/curves_test.dart @@ -270,6 +270,7 @@ void main() { Offset(0.66, 0.75), Offset(1.0, 1.0), ], + tension: 0.0, startHandle: const Offset(0.0, -0.3), endHandle: const Offset(1.3, 1.3), ); @@ -318,6 +319,7 @@ void main() { Offset(0.66, 0.75), Offset(1.0, 1.0), ], + tension: 0.0, startHandle: const Offset(0.0, -0.3), endHandle: const Offset(1.3, 1.3), ); @@ -417,6 +419,7 @@ void main() { Offset(0.2, 0.25), Offset(0.01, 0.25), ], + tension: 0.0, ), isFalse, ); @@ -426,6 +429,7 @@ void main() { Offset(0.2, 0.25), Offset(0.01, 0.25), ], + tension: 0.0, ); }, throwsAssertionError); @@ -436,6 +440,7 @@ void main() { Offset(0.2, 0.25), Offset(1.01, 0.25), ], + tension: 0.0, ), isFalse, ); @@ -445,6 +450,7 @@ void main() { Offset(0.2, 0.25), Offset(1.01, 0.25), ], + tension: 0.0, ); }, throwsAssertionError); @@ -456,6 +462,7 @@ void main() { Offset(0.50, 0.50), Offset(0.75, 0.75), ], + tension: 0.0, ), isFalse, ); @@ -466,6 +473,7 @@ void main() { Offset(0.50, 0.50), Offset(0.75, 0.75), ], + tension: 0.0, ); }, throwsAssertionError); @@ -477,6 +485,7 @@ void main() { Offset(0.50, 0.50), Offset(0.95, 0.51), ], + tension: 0.0, ), isFalse, ); @@ -487,6 +496,7 @@ void main() { Offset(0.50, 0.50), Offset(0.95, 0.51), ], + tension: 0.0, ); }, throwsAssertionError); @@ -497,6 +507,7 @@ void main() { Offset(0.5, 0.05), Offset(0.5, 0.95), ], + tension: 0.0, ), isFalse, ); @@ -506,6 +517,7 @@ void main() { Offset(0.5, 0.05), Offset(0.5, 0.95), ], + tension: 0.0, ); }, throwsAssertionError); }); @@ -528,6 +540,7 @@ void main() { Offset(0.2, 0.25), Offset(0.01, 0.25), ], + tension: 0.0, ); }, throwsAssertionError); @@ -538,6 +551,7 @@ void main() { Offset(0.2, 0.25), Offset(1.01, 0.25), ], + tension: 0.0, ); }, throwsAssertionError); @@ -549,6 +563,7 @@ void main() { Offset(0.50, 0.50), Offset(0.75, 0.75), ], + tension: 0.0, ); }, throwsAssertionError); @@ -560,6 +575,7 @@ void main() { Offset(0.50, 0.50), Offset(0.95, 0.51), ], + tension: 0.0, ); }, throwsAssertionError); @@ -570,6 +586,7 @@ void main() { Offset(0.5, 0.05), Offset(0.5, 0.95), ], + tension: 0.0, ); }, throwsAssertionError); }); diff --git a/packages/flutter/test/animation/live_binding_test.dart b/packages/flutter/test/animation/live_binding_test.dart index e698f2d56a..6fbafb99ad 100644 --- a/packages/flutter/test/animation/live_binding_test.dart +++ b/packages/flutter/test/animation/live_binding_test.dart @@ -27,7 +27,7 @@ void main() { home: Container( decoration: BoxDecoration( color: const Color.fromARGB(255, 128, 128, 128), - border: Border.all(), + border: Border.all(color: const Color.fromARGB(255, 0, 0, 0)), ), child: Center( child: Container( @@ -85,7 +85,7 @@ void main() { home: Container( decoration: BoxDecoration( color: const Color.fromARGB(255, 128, 128, 128), - border: Border.all(), + border: Border.all(color: const Color.fromARGB(255, 0, 0, 0)), ), child: Center( child: Container( diff --git a/packages/flutter/test/animation/tween_test.dart b/packages/flutter/test/animation/tween_test.dart index 7d62a06080..333b4a867f 100644 --- a/packages/flutter/test/animation/tween_test.dart +++ b/packages/flutter/test/animation/tween_test.dart @@ -125,13 +125,13 @@ void main() { test('BorderTween nullable test', () { BorderTween tween = BorderTween(); - expect(tween.lerp(0.0), null); - expect(tween.lerp(1.0), null); + expect(tween.lerp(0.0), null); + expect(tween.lerp(1.0), null); - tween = BorderTween(end: const Border(top: BorderSide())); - expect(tween.lerp(0.0), const Border()); - expect(tween.lerp(0.5), const Border(top: BorderSide(width: 0.5))); - expect(tween.lerp(1.0), const Border(top: BorderSide())); + tween = BorderTween(begin: null, end: const Border(top: BorderSide())); + expect(tween.lerp(0.0), const Border()); + expect(tween.lerp(0.5), const Border(top: BorderSide(width: 0.5))); + expect(tween.lerp(1.0), const Border(top: BorderSide())); }); test('SizeTween', () { @@ -156,13 +156,13 @@ void main() { test('Matrix4Tween', () { final Matrix4 a = Matrix4.identity(); - final Matrix4 b = a.clone()..translate(6.0, -8.0)..scale(0.5, 1.0, 5.0); + final Matrix4 b = a.clone()..translate(6.0, -8.0, 0.0)..scale(0.5, 1.0, 5.0); final Matrix4Tween tween = Matrix4Tween(begin: a, end: b); expect(tween.lerp(0.0), equals(a)); expect(tween.lerp(1.0), equals(b)); expect( tween.lerp(0.5), - equals(a.clone()..translate(3.0, -4.0)..scale(0.75, 1.0, 3.0)), + equals(a.clone()..translate(3.0, -4.0, 0.0)..scale(0.75, 1.0, 3.0)), ); final Matrix4 c = a.clone()..rotateZ(1.0); final Matrix4Tween rotationTween = Matrix4Tween(begin: a, end: c); @@ -214,7 +214,7 @@ void main() { }); test('BorderRadiusTween nullable test', () { - final BorderRadiusTween tween = BorderRadiusTween(); + final BorderRadiusTween tween = BorderRadiusTween(begin: null, end: null); expect(tween.transform(0.0), null); expect(tween.transform(1.0), null); expect(tween.lerp(0.0), null); diff --git a/packages/flutter/test/cupertino/activity_indicator_test.dart b/packages/flutter/test/cupertino/activity_indicator_test.dart index 4ea3902cad..fbcde0b102 100644 --- a/packages/flutter/test/cupertino/activity_indicator_test.dart +++ b/packages/flutter/test/cupertino/activity_indicator_test.dart @@ -34,7 +34,7 @@ void main() { await tester.pumpWidget( Center( child: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(platformBrightness: Brightness.light), child: RepaintBoundary( key: key, child: Container( @@ -86,9 +86,8 @@ void main() { key: key, child: Container( color: CupertinoColors.white, - child: const CupertinoActivityIndicator.partiallyRevealed( - progress: 0, - ), + child: + const CupertinoActivityIndicator.partiallyRevealed(progress: 0), ), ), ), @@ -130,7 +129,8 @@ void main() { key: key, child: Container( color: CupertinoColors.white, - child: const CupertinoActivityIndicator.partiallyRevealed(), + child: + const CupertinoActivityIndicator.partiallyRevealed(progress: 1), ), ), ), @@ -162,7 +162,7 @@ void main() { Widget buildCupertinoActivityIndicator([bool? animating]) { return MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(platformBrightness: Brightness.light), child: CupertinoActivityIndicator( animating: animating ?? true, ), diff --git a/packages/flutter/test/cupertino/button_test.dart b/packages/flutter/test/cupertino/button_test.dart index 6ef4f98a90..5e39bb9734 100644 --- a/packages/flutter/test/cupertino/button_test.dart +++ b/packages/flutter/test/cupertino/button_test.dart @@ -360,7 +360,7 @@ void main() { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(platformBrightness: Brightness.light), child: boilerplate(child: const CupertinoButton( color: bgColor, disabledColor: inactive, diff --git a/packages/flutter/test/cupertino/colors_test.dart b/packages/flutter/test/cupertino/colors_test.dart index 5f76c10514..20fe20ac97 100644 --- a/packages/flutter/test/cupertino/colors_test.dart +++ b/packages/flutter/test/cupertino/colors_test.dart @@ -218,7 +218,7 @@ void main() { (WidgetTester tester) async { await tester.pumpWidget( const MediaQuery( - data: MediaQueryData(), + data: MediaQueryData(platformBrightness: Brightness.light), child: DependentWidget(color: vibrancyDependentColor1), ), ); @@ -262,7 +262,7 @@ void main() { (WidgetTester tester) async { await tester.pumpWidget( const MediaQuery( - data: MediaQueryData(), + data: MediaQueryData(highContrast: false), child: DependentWidget(color: contrastDependentColor1), ), ); @@ -328,7 +328,7 @@ void main() { await tester.pumpWidget( const MediaQuery( - data: MediaQueryData(), + data: MediaQueryData(platformBrightness: Brightness.light, highContrast: false), child: CupertinoUserInterfaceLevel( data: CupertinoUserInterfaceLevelData.base, child: DependentWidget(color: dynamicRainbowColor1), @@ -339,7 +339,7 @@ void main() { await tester.pumpWidget( const MediaQuery( - data: MediaQueryData(platformBrightness: Brightness.dark), + data: MediaQueryData(platformBrightness: Brightness.dark, highContrast: false), child: CupertinoUserInterfaceLevel( data: CupertinoUserInterfaceLevelData.base, child: DependentWidget(color: dynamicRainbowColor1), @@ -350,7 +350,7 @@ void main() { await tester.pumpWidget( const MediaQuery( - data: MediaQueryData(highContrast: true), + data: MediaQueryData(platformBrightness: Brightness.light, highContrast: true), child: CupertinoUserInterfaceLevel( data: CupertinoUserInterfaceLevelData.base, child: DependentWidget(color: dynamicRainbowColor1), @@ -372,7 +372,7 @@ void main() { await tester.pumpWidget( const MediaQuery( - data: MediaQueryData(platformBrightness: Brightness.dark), + data: MediaQueryData(platformBrightness: Brightness.dark, highContrast: false), child: CupertinoUserInterfaceLevel( data: CupertinoUserInterfaceLevelData.elevated, child: DependentWidget(color: dynamicRainbowColor1), @@ -383,7 +383,7 @@ void main() { await tester.pumpWidget( const MediaQuery( - data: MediaQueryData(highContrast: true), + data: MediaQueryData(platformBrightness: Brightness.light, highContrast: true), child: CupertinoUserInterfaceLevel( data: CupertinoUserInterfaceLevelData.elevated, child: DependentWidget(color: dynamicRainbowColor1), @@ -405,7 +405,7 @@ void main() { await tester.pumpWidget( const MediaQuery( - data: MediaQueryData(), + data: MediaQueryData(platformBrightness: Brightness.light, highContrast: false), child: CupertinoUserInterfaceLevel( data: CupertinoUserInterfaceLevelData.elevated, child: DependentWidget(color: dynamicRainbowColor1), @@ -457,7 +457,7 @@ void main() { CupertinoApp( theme: const CupertinoThemeData(primaryColor: dynamicColor), home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(platformBrightness: Brightness.light, highContrast: false), child: CupertinoUserInterfaceLevel( data: CupertinoUserInterfaceLevelData.base, child: Builder( @@ -512,7 +512,7 @@ void main() { ), ), home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(platformBrightness: Brightness.light, highContrast: false), child: CupertinoUserInterfaceLevel( data: CupertinoUserInterfaceLevelData.base, child: Builder( diff --git a/packages/flutter/test/cupertino/context_menu_test.dart b/packages/flutter/test/cupertino/context_menu_test.dart index dc5ed1de57..bd08891e63 100644 --- a/packages/flutter/test/cupertino/context_menu_test.dart +++ b/packages/flutter/test/cupertino/context_menu_test.dart @@ -138,6 +138,7 @@ void main() { onGenerateRoute: (RouteSettings settings) { return CupertinoPageRoute( builder: (BuildContext context) => Align( + alignment: Alignment.center, child: CupertinoContextMenu( actions: const [ CupertinoContextMenuAction( @@ -299,6 +300,7 @@ void main() { // Pump a CupertinoContextMenu in the center of the screen and open it. final Widget child = _getChild(); await tester.pumpWidget(_getContextMenu( + alignment: Alignment.center, screenSize: portraitScreenSize, child: child, )); @@ -368,6 +370,7 @@ void main() { // Pump a CupertinoContextMenu in the center of the screen and open it. final Widget child = _getChild(); await tester.pumpWidget(_getContextMenu( + alignment: Alignment.center, child: child, )); expect(find.byType(CupertinoContextMenuAction), findsNothing); diff --git a/packages/flutter/test/cupertino/date_picker_test.dart b/packages/flutter/test/cupertino/date_picker_test.dart index 2822e7d575..c9bc0457e9 100644 --- a/packages/flutter/test/cupertino/date_picker_test.dart +++ b/packages/flutter/test/cupertino/date_picker_test.dart @@ -127,6 +127,7 @@ void main() { CupertinoApp( home: CupertinoTimerPicker( onTimerDurationChanged: (_) { }, + backgroundColor: null, ), ), ); @@ -254,6 +255,7 @@ void main() { minuteInterval: 10, secondInterval: 12, initialTimerDuration: const Duration(hours: 10, minutes: 40, seconds: 48), + mode: CupertinoTimerPickerMode.hms, onTimerDurationChanged: (Duration d) { duration = d; }, @@ -299,6 +301,7 @@ void main() { CupertinoApp( home: CupertinoDatePicker( onDateTimeChanged: (_) { }, + backgroundColor: null, ), ), ); @@ -378,6 +381,7 @@ void main() { height: 400.0, width: 400.0, child: CupertinoDatePicker( + mode: CupertinoDatePickerMode.dateAndTime, onDateTimeChanged: (DateTime dateTime) => selectedDateTime = dateTime, initialDateTime: DateTime(2018, 1, 1, 10, 30), ), @@ -399,9 +403,10 @@ void main() { height: 400.0, width: 400.0, child: CupertinoDatePicker( + mode: CupertinoDatePickerMode.dateAndTime, onDateTimeChanged: (DateTime dateTime) => selectedDateTime = dateTime, // Change the initial date, but it shouldn't affect the present state. - initialDateTime: DateTime(2016, 4, 5, 15), + initialDateTime: DateTime(2016, 4, 5, 15, 00), ), ), ), @@ -426,7 +431,7 @@ void main() { child: CupertinoDatePicker( mode: CupertinoDatePickerMode.date, onDateTimeChanged: (_) { }, - initialDateTime: DateTime(2018, 9, 15), + initialDateTime: DateTime(2018, 9, 15, 0, 0), ), ), ), @@ -446,6 +451,7 @@ void main() { height: 400.0, width: 400.0, child: CupertinoDatePicker( + mode: CupertinoDatePickerMode.dateAndTime, onDateTimeChanged: (_) { }, initialDateTime: DateTime(2018, 9, 15, 3, 14), ), @@ -466,6 +472,7 @@ void main() { home: Directionality( textDirection: TextDirection.ltr, child: CupertinoDatePicker( + mode: CupertinoDatePickerMode.dateAndTime, onDateTimeChanged: (_) { }, initialDateTime: DateTime(2018, 1, 1, 10, 30), ), @@ -484,6 +491,7 @@ void main() { height: 400.0, width: 800.0, child: CupertinoDatePicker( + mode: CupertinoDatePickerMode.dateAndTime, onDateTimeChanged: (_) { }, initialDateTime: DateTime(2018, 1, 1, 10, 30), ), @@ -710,6 +718,7 @@ void main() { height: 400.0, width: 400.0, child: CupertinoDatePicker( + mode: CupertinoDatePickerMode.dateAndTime, minimumDate: minimum, maximumDate: maximum, onDateTimeChanged: (DateTime newDate) { @@ -948,6 +957,7 @@ void main() { height: 400.0, width: 400.0, child: CupertinoDatePicker( + mode: CupertinoDatePickerMode.dateAndTime, minimumDate: minDate, onDateTimeChanged: (DateTime newDate) { }, initialDateTime: minDate.add(const Duration(days: 1)), @@ -1156,6 +1166,7 @@ void main() { // This is too small to draw the picker out fully. width: 100, child: CupertinoDatePicker( + mode: CupertinoDatePickerMode.dateAndTime, initialDateTime: DateTime(2019, 1, 1, 4), onDateTimeChanged: (_) {}, ), @@ -1259,6 +1270,7 @@ void main() { width: 500, height: 400, child: CupertinoDatePicker( + mode: CupertinoDatePickerMode.dateAndTime, initialDateTime: DateTime(2019, 1, 1, 4), onDateTimeChanged: (_) {}, ), @@ -1389,6 +1401,7 @@ void main() { CupertinoApp( home: CupertinoTimerPicker( key: key, + mode: CupertinoTimerPickerMode.hms, initialTimerDuration: const Duration(hours: 5, minutes: 17, seconds: 19), onTimerDurationChanged: (Duration d) {}, ), @@ -1490,6 +1503,7 @@ void main() { children: [ matchesSemantics( hasIncreaseAction: true, + hasDecreaseAction: false, increasedValue: '1', value: '0', textDirection: TextDirection.ltr, diff --git a/packages/flutter/test/cupertino/dialog_test.dart b/packages/flutter/test/cupertino/dialog_test.dart index da5c538227..84ccbb8ce3 100644 --- a/packages/flutter/test/cupertino/dialog_test.dart +++ b/packages/flutter/test/cupertino/dialog_test.dart @@ -1128,7 +1128,7 @@ void main() { await tester.pumpWidget( const MaterialApp( home: MediaQuery( - data: MediaQueryData(), + data: MediaQueryData(viewInsets: EdgeInsets.zero), child: CupertinoAlertDialog(content: Placeholder(fallbackHeight: 200.0)), ), ), @@ -1297,7 +1297,7 @@ void main() { await tester.pumpWidget( const MaterialApp( home: MediaQuery( - data: MediaQueryData(), + data: MediaQueryData(viewInsets: EdgeInsets.zero), child: CupertinoAlertDialog( actions: [ CupertinoDialogAction(child: Text('OK')), diff --git a/packages/flutter/test/cupertino/material/tab_scaffold_test.dart b/packages/flutter/test/cupertino/material/tab_scaffold_test.dart index ed211846d6..bb924a4881 100644 --- a/packages/flutter/test/cupertino/material/tab_scaffold_test.dart +++ b/packages/flutter/test/cupertino/material/tab_scaffold_test.dart @@ -234,7 +234,9 @@ void main() { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData( + viewInsets: EdgeInsets.zero, + ), child: MaterialApp( home: Material( child: CupertinoTabScaffold( diff --git a/packages/flutter/test/cupertino/nav_bar_test.dart b/packages/flutter/test/cupertino/nav_bar_test.dart index 12ea7cb47d..2d2820f231 100644 --- a/packages/flutter/test/cupertino/nav_bar_test.dart +++ b/packages/flutter/test/cupertino/nav_bar_test.dart @@ -142,6 +142,7 @@ void main() { // the nav bar position it horizontally. middle: Align( key: middleBox, + alignment: Alignment.center, widthFactor: 1.0, child: const Text('Title'), ), @@ -1188,6 +1189,8 @@ void main() { child: CustomScrollView( slivers: [ CupertinoSliverNavigationBar( + automaticallyImplyLeading: true, + automaticallyImplyTitle: true, previousPageTitle: 'previous title', ), ], @@ -1280,6 +1283,7 @@ void main() { const CupertinoSliverNavigationBar( trailing: trailingText, largeTitle: titleText, + stretch: false, ), SliverToBoxAdapter( child: Container( diff --git a/packages/flutter/test/cupertino/route_test.dart b/packages/flutter/test/cupertino/route_test.dart index 1ec00c3a2c..ec0373ead6 100644 --- a/packages/flutter/test/cupertino/route_test.dart +++ b/packages/flutter/test/cupertino/route_test.dart @@ -1595,7 +1595,7 @@ void main() { expect(find.text('second'), findsOneWidget); myPages = >[ - CupertinoPage(key: pageKeyOne, child: const Text('first')), + CupertinoPage(key: pageKeyOne, maintainState: true, child: const Text('first')), CupertinoPage(key: pageKeyTwo, child: const Text('second')), ]; @@ -1670,7 +1670,7 @@ void main() { await tester.pumpAndSettle(); - await gesture.down(const Offset(3, 300)); + await gesture.down(const Offset(3, 300), timeStamp: Duration.zero); // Need 2 events to form a valid drag await tester.pump(const Duration(milliseconds: 100)); diff --git a/packages/flutter/test/cupertino/scaffold_test.dart b/packages/flutter/test/cupertino/scaffold_test.dart index 5a8f91c96d..e649edec06 100644 --- a/packages/flutter/test/cupertino/scaffold_test.dart +++ b/packages/flutter/test/cupertino/scaffold_test.dart @@ -188,6 +188,7 @@ void main() { textDirection: TextDirection.ltr, child: MediaQuery( data: MediaQueryData( + padding: EdgeInsets.zero, viewPadding: EdgeInsets.only(bottom: 20), viewInsets: EdgeInsets.only(bottom: 300), ), @@ -489,10 +490,12 @@ void main() { return CupertinoApp( home: MediaQuery( data: MediaQueryData( + padding: EdgeInsets.zero, viewPadding: const EdgeInsets.only(bottom: 20), viewInsets: EdgeInsets.only(bottom: showKeyboard ? 300 : 20), ), child: CupertinoPageScaffold( + resizeToAvoidBottomInset: true, navigationBar: showNavigationBar ? const CupertinoNavigationBar( middle: Text('Title'), ) : null, diff --git a/packages/flutter/test/cupertino/scrollbar_test.dart b/packages/flutter/test/cupertino/scrollbar_test.dart index cd7711f495..cd5ae8d67d 100644 --- a/packages/flutter/test/cupertino/scrollbar_test.dart +++ b/packages/flutter/test/cupertino/scrollbar_test.dart @@ -482,6 +482,7 @@ void main() { child: PrimaryScrollController( controller: controller, child: CupertinoScrollbar( + isAlwaysShown: false, controller: controller, child: const SingleChildScrollView( child: SizedBox( diff --git a/packages/flutter/test/cupertino/segmented_control_test.dart b/packages/flutter/test/cupertino/segmented_control_test.dart index 05115c9159..5527822156 100644 --- a/packages/flutter/test/cupertino/segmented_control_test.dart +++ b/packages/flutter/test/cupertino/segmented_control_test.dart @@ -687,7 +687,7 @@ void main() { expect(childWidth, 200.0); - expect(childWidth, getSurroundingRect(tester).width); + expect(childWidth, getSurroundingRect(tester, child: 0).width); expect(childWidth, getSurroundingRect(tester, child: 1).width); expect(childWidth, getSurroundingRect(tester, child: 2).width); }); @@ -914,7 +914,7 @@ void main() { expect(sharedValue, 1); - final double childWidth = getChildSize(tester).width; + final double childWidth = getChildSize(tester, child: 0).width; final Offset centerOfSegmentedControl = tester.getCenter(find.text('Child 1')); // Tap just inside segment bounds diff --git a/packages/flutter/test/cupertino/switch_test.dart b/packages/flutter/test/cupertino/switch_test.dart index dd3d5492a6..5eb2a424f0 100644 --- a/packages/flutter/test/cupertino/switch_test.dart +++ b/packages/flutter/test/cupertino/switch_test.dart @@ -331,6 +331,7 @@ void main() { return Center( child: CupertinoSwitch( value: value, + dragStartBehavior: DragStartBehavior.start, onChanged: (bool newValue) { setState(() { value = newValue; diff --git a/packages/flutter/test/cupertino/tab_scaffold_test.dart b/packages/flutter/test/cupertino/tab_scaffold_test.dart index faa35c19ec..fd961cf638 100644 --- a/packages/flutter/test/cupertino/tab_scaffold_test.dart +++ b/packages/flutter/test/cupertino/tab_scaffold_test.dart @@ -472,6 +472,7 @@ void main() { await tester.pumpWidget( MediaQuery( data: const MediaQueryData( + padding: EdgeInsets.zero, viewPadding: EdgeInsets.only(bottom: 20), viewInsets: EdgeInsets.only(bottom: 300), ), @@ -618,7 +619,7 @@ void main() { // Regression test for https://github.com/flutter/flutter/issues/33455 testWidgets('Adding new tabs does not crash the app', (WidgetTester tester) async { final List tabsPainted = []; - final CupertinoTabController controller = CupertinoTabController(); + final CupertinoTabController controller = CupertinoTabController(initialIndex: 0); await tester.pumpWidget( CupertinoApp( @@ -676,7 +677,7 @@ void main() { "while preserving the previous controller's tab index", (WidgetTester tester) async { final List tabsPainted = []; - final CupertinoTabController oldController = CupertinoTabController(); + final CupertinoTabController oldController = CupertinoTabController(initialIndex: 0); await tester.pumpWidget( CupertinoApp( @@ -705,6 +706,7 @@ void main() { tabBar: CupertinoTabBar( items: List.generate(10, tabGenerator), ), + controller: null, tabBuilder: (BuildContext context, int index) { return CustomPaint( @@ -761,6 +763,7 @@ void main() { tabBar: CupertinoTabBar( items: List.generate(2, tabGenerator), ), + controller: null, tabBuilder: (BuildContext context, int index) => const Placeholder(), ), ), @@ -790,7 +793,7 @@ void main() { expect(find.text('Tab 3'), findsOneWidget); controller.dispose(); - controller = CupertinoTabController(); + controller = CupertinoTabController(initialIndex: 0); await tester.pumpWidget( CupertinoApp( home: CupertinoTabScaffold( @@ -1033,7 +1036,9 @@ void main() { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData( + viewInsets: EdgeInsets.zero, + ), child: CupertinoApp( home: CupertinoTabScaffold( tabBar: _buildTabBar(), diff --git a/packages/flutter/test/cupertino/tab_test.dart b/packages/flutter/test/cupertino/tab_test.dart index 63001a64f3..8621c7db12 100644 --- a/packages/flutter/test/cupertino/tab_test.dart +++ b/packages/flutter/test/cupertino/tab_test.dart @@ -179,6 +179,7 @@ void main() { home: CupertinoTabView( navigatorKey: key, builder: (BuildContext context) => const Text('first route'), + onUnknownRoute: null, ), ), ); diff --git a/packages/flutter/test/cupertino/text_field_restoration_test.dart b/packages/flutter/test/cupertino/text_field_restoration_test.dart index ead396fba2..a1a223ccfc 100644 --- a/packages/flutter/test/cupertino/text_field_restoration_test.dart +++ b/packages/flutter/test/cupertino/text_field_restoration_test.dart @@ -100,6 +100,7 @@ class TestWidgetState extends State with RestorationMixin { Widget build(BuildContext context) { return Material( child: Align( + alignment: Alignment.center, child: SizedBox( width: 50, child: CupertinoTextField( diff --git a/packages/flutter/test/cupertino/text_field_test.dart b/packages/flutter/test/cupertino/text_field_test.dart index e37e33d582..53eac3411f 100644 --- a/packages/flutter/test/cupertino/text_field_test.dart +++ b/packages/flutter/test/cupertino/text_field_test.dart @@ -1764,7 +1764,7 @@ void main() { // First tap moved the cursor. expect( controller.selection, - const TextSelection.collapsed(offset: 8), + const TextSelection.collapsed(offset: 8, affinity: TextAffinity.downstream), ); await tester.tapAt(textFieldStart + const Offset(150.0, 5.0)); await tester.pumpAndSettle(); @@ -1848,7 +1848,7 @@ void main() { // First tap moved the cursor. expect( controller.selection, - const TextSelection.collapsed(offset: 8), + const TextSelection.collapsed(offset: 8, affinity: TextAffinity.downstream), ); await tester.tapAt(textFieldStart + const Offset(150.0, 5.0)); await tester.pump(const Duration(milliseconds: 500)); @@ -2337,6 +2337,7 @@ void main() { home: Center( child: CupertinoTextField( controller: controller, + maxLines: 1, ), ), ), @@ -2439,7 +2440,7 @@ void main() { // First tap moved the cursor to the beginning of the second word. expect( controller.selection, - const TextSelection.collapsed(offset: 8), + const TextSelection.collapsed(offset: 8, affinity: TextAffinity.downstream), ); await tester.tapAt(textFieldStart + const Offset(150.0, 5.0)); await tester.pump(const Duration(milliseconds: 500)); @@ -2484,7 +2485,7 @@ void main() { // First tap moved the cursor. expect( controller.selection, - const TextSelection.collapsed(offset: 8), + const TextSelection.collapsed(offset: 8, affinity: TextAffinity.downstream), ); await tester.tapAt(textFieldStart + const Offset(150.0, 5.0)); await tester.pumpAndSettle(); @@ -2552,7 +2553,7 @@ void main() { // First tap moved the cursor. expect( controller.selection, - const TextSelection.collapsed(offset: 8), + const TextSelection.collapsed(offset: 8, affinity: TextAffinity.downstream), ); await tester.tapAt(textFieldStart + const Offset(150.0, 5.0)); await tester.pumpAndSettle(); @@ -3572,6 +3573,7 @@ void main() { debugShowCheckedModeBanner: false, home: CupertinoPageScaffold( child: Align( + alignment: Alignment.center, child: SizedBox( width: 200, height: 200, @@ -3637,6 +3639,7 @@ void main() { debugShowCheckedModeBanner: false, home: CupertinoPageScaffold( child: Align( + alignment: Alignment.center, child: SizedBox( width: 200, height: 200, @@ -3707,6 +3710,7 @@ void main() { debugShowCheckedModeBanner: false, home: CupertinoPageScaffold( child: Align( + alignment: Alignment.center, child: SizedBox( width: 200, height: 200, @@ -3825,6 +3829,7 @@ void main() { debugShowCheckedModeBanner: false, home: CupertinoPageScaffold( child: Align( + alignment: Alignment.center, child: SizedBox( width: size.width, height: size.height, @@ -3871,6 +3876,7 @@ void main() { debugShowCheckedModeBanner: false, home: CupertinoPageScaffold( child: Align( + alignment: Alignment.center, child: SizedBox( width: size.width, height: size.height, @@ -3918,6 +3924,7 @@ void main() { debugShowCheckedModeBanner: false, home: CupertinoPageScaffold( child: Align( + alignment: Alignment.center, child: SizedBox( width: size.width, height: size.height, @@ -3965,6 +3972,7 @@ void main() { debugShowCheckedModeBanner: false, home: CupertinoPageScaffold( child: Align( + alignment: Alignment.center, child: SizedBox( width: size.width, height: size.height, @@ -4014,6 +4022,7 @@ void main() { debugShowCheckedModeBanner: false, home: CupertinoPageScaffold( child: Align( + alignment: Alignment.center, child: SizedBox( width: size.width, height: size.height, @@ -4065,6 +4074,7 @@ void main() { debugShowCheckedModeBanner: false, home: CupertinoPageScaffold( child: Align( + alignment: Alignment.center, child: SizedBox( width: size.width, height: size.height, @@ -4118,6 +4128,7 @@ void main() { debugShowCheckedModeBanner: false, home: CupertinoPageScaffold( child: Align( + alignment: Alignment.center, child: SizedBox( width: size.width, height: size.height, @@ -4171,6 +4182,7 @@ void main() { debugShowCheckedModeBanner: false, home: CupertinoPageScaffold( child: Align( + alignment: Alignment.center, child: SizedBox( width: size.width, height: size.height, @@ -4412,7 +4424,9 @@ void main() { ).first, ), matchesSemantics( + isEnabled: false, hasEnabledState: true, + hasTapAction: false, ), ); }); @@ -4486,6 +4500,7 @@ void main() { style: const TextStyle(height: 4, color: ui.Color.fromARGB(100, 0, 0, 0)), toolbarOptions: const ToolbarOptions(selectAll: true), selectionHeightStyle: ui.BoxHeightStyle.includeLineSpacingBottom, + selectionWidthStyle: ui.BoxWidthStyle.tight, maxLines: 3, ), ], diff --git a/packages/flutter/test/cupertino/text_selection_test.dart b/packages/flutter/test/cupertino/text_selection_test.dart index 3805055615..84a801d3b1 100644 --- a/packages/flutter/test/cupertino/text_selection_test.dart +++ b/packages/flutter/test/cupertino/text_selection_test.dart @@ -173,6 +173,7 @@ void main() { context, TextSelectionHandleType.right, 10.0, + null, ), ), ), diff --git a/packages/flutter/test/foundation/diagnostics_test.dart b/packages/flutter/test/foundation/diagnostics_test.dart index ebc3672e8b..69e3365c44 100644 --- a/packages/flutter/test/foundation/diagnostics_test.dart +++ b/packages/flutter/test/foundation/diagnostics_test.dart @@ -959,6 +959,7 @@ void main() { final StringProperty quoted = StringProperty( 'name', 'value', + quoted: true, ); expect(quoted.toString(), equals('name: "value"')); validateStringPropertyJsonSerialization(quoted); @@ -973,6 +974,7 @@ void main() { 'name', null, showName: false, + quoted: true, ).toString(), equals('null'), ); diff --git a/packages/flutter/test/foundation/stack_frame_test.dart b/packages/flutter/test/foundation/stack_frame_test.dart index 63138c7352..dbfa8554ec 100644 --- a/packages/flutter/test/foundation/stack_frame_test.dart +++ b/packages/flutter/test/foundation/stack_frame_test.dart @@ -118,20 +118,20 @@ const String stackString = ''' #13 main (package:hello_flutter/main.dart:10:4)'''; const List stackFrames = [ - StackFrame(number: 0, className: '_AssertionError', method: '_doThrowNew', packageScheme: 'dart', package: 'core-patch', packagePath: 'errors_patch.dart', line: 42, column: 39, source: '#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:42:39)'), - StackFrame(number: 1, className: '_AssertionError', method: '_throwNew', packageScheme: 'dart', package: 'core-patch', packagePath: 'errors_patch.dart', line: 38, column: 5, source: '#1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:38:5)'), + StackFrame(number: 0, className: '_AssertionError', method: '_doThrowNew', packageScheme: 'dart', package: 'core-patch', packagePath: 'errors_patch.dart', line: 42, column: 39, source: '#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:42:39)'), + StackFrame(number: 1, className: '_AssertionError', method: '_throwNew', packageScheme: 'dart', package: 'core-patch', packagePath: 'errors_patch.dart', line: 38, column: 5, source: '#1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:38:5)'), StackFrame(number: 2, className: 'Text', method: '', packageScheme: 'package', package: 'flutter', packagePath: 'src/widgets/text.dart', line: 287, column: 10, isConstructor: true, source: '#2 new Text (package:flutter/src/widgets/text.dart:287:10)'), - StackFrame(number: 3, className: '_MyHomePageState', method: 'build', packageScheme: 'package', package: 'hello_flutter', packagePath: 'main.dart', line: 72, column: 16, source: '#3 _MyHomePageState.build (package:hello_flutter/main.dart:72:16)'), - StackFrame(number: 4, className: 'StatefulElement', method: 'build', packageScheme: 'package', package: 'flutter', packagePath: 'src/widgets/framework.dart', line: 4414, column: 27, source: '#4 StatefulElement.build (package:flutter/src/widgets/framework.dart:4414:27)'), - StackFrame(number: 5, className: 'ComponentElement', method: 'performRebuild', packageScheme: 'package', package: 'flutter', packagePath: 'src/widgets/framework.dart', line: 4303, column: 15, source: '#5 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4303:15)'), - StackFrame(number: 6, className: 'Element', method: 'rebuild', packageScheme: 'package', package: 'flutter', packagePath: 'src/widgets/framework.dart', line: 4027, column: 5, source: '#6 Element.rebuild (package:flutter/src/widgets/framework.dart:4027:5)'), - StackFrame(number: 7, className: 'ComponentElement', method: '_firstBuild', packageScheme: 'package', package: 'flutter', packagePath: 'src/widgets/framework.dart', line: 4286, column: 5, source: '#7 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4286:5)'), - StackFrame(number: 8, className: 'StatefulElement', method: '_firstBuild', packageScheme: 'package', package: 'flutter', packagePath: 'src/widgets/framework.dart', line: 4461, column: 11, source: '#8 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4461:11)'), - StackFrame(number: 9, className: 'ComponentElement', method: 'mount', packageScheme: 'package', package: 'flutter', packagePath: 'src/widgets/framework.dart', line: 4281, column: 5, source: '#9 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4281:5)'), - StackFrame(number: 10, className: 'Element', method: 'inflateWidget', packageScheme: 'package', package: 'flutter', packagePath: 'src/widgets/framework.dart', line: 3276, column: 14, source: '#10 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3276:14)'), - StackFrame(number: 11, className: 'Element', method: 'updateChild', packageScheme: 'package', package: 'flutter', packagePath: 'src/widgets/framework.dart', line: -1, column: -1, source: '#11 Element.updateChild (package:flutter/src/widgets/framework.dart)'), - StackFrame(number: 12, className: 'SingleChildRenderObjectElement', method: 'mount', packageScheme: 'package', package: 'flutter', packagePath: 'blah.dart', line: 999, column: 9, source: '#12 SingleChildRenderObjectElement.mount (package:flutter/blah.dart:999:9)'), - StackFrame(number: 13, method: 'main', packageScheme: 'package', package: 'hello_flutter', packagePath: 'main.dart', line: 10, column: 4, source: '#13 main (package:hello_flutter/main.dart:10:4)'), + StackFrame(number: 3, className: '_MyHomePageState', method: 'build', packageScheme: 'package', package: 'hello_flutter', packagePath: 'main.dart', line: 72, column: 16, source: '#3 _MyHomePageState.build (package:hello_flutter/main.dart:72:16)'), + StackFrame(number: 4, className: 'StatefulElement', method: 'build', packageScheme: 'package', package: 'flutter', packagePath: 'src/widgets/framework.dart', line: 4414, column: 27, source: '#4 StatefulElement.build (package:flutter/src/widgets/framework.dart:4414:27)'), + StackFrame(number: 5, className: 'ComponentElement', method: 'performRebuild', packageScheme: 'package', package: 'flutter', packagePath: 'src/widgets/framework.dart', line: 4303, column: 15, source: '#5 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4303:15)'), + StackFrame(number: 6, className: 'Element', method: 'rebuild', packageScheme: 'package', package: 'flutter', packagePath: 'src/widgets/framework.dart', line: 4027, column: 5, source: '#6 Element.rebuild (package:flutter/src/widgets/framework.dart:4027:5)'), + StackFrame(number: 7, className: 'ComponentElement', method: '_firstBuild', packageScheme: 'package', package: 'flutter', packagePath: 'src/widgets/framework.dart', line: 4286, column: 5, source: '#7 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4286:5)'), + StackFrame(number: 8, className: 'StatefulElement', method: '_firstBuild', packageScheme: 'package', package: 'flutter', packagePath: 'src/widgets/framework.dart', line: 4461, column: 11, source: '#8 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4461:11)'), + StackFrame(number: 9, className: 'ComponentElement', method: 'mount', packageScheme: 'package', package: 'flutter', packagePath: 'src/widgets/framework.dart', line: 4281, column: 5, source: '#9 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4281:5)'), + StackFrame(number: 10, className: 'Element', method: 'inflateWidget', packageScheme: 'package', package: 'flutter', packagePath: 'src/widgets/framework.dart', line: 3276, column: 14, source: '#10 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3276:14)'), + StackFrame(number: 11, className: 'Element', method: 'updateChild', packageScheme: 'package', package: 'flutter', packagePath: 'src/widgets/framework.dart', line: -1, column: -1, source: '#11 Element.updateChild (package:flutter/src/widgets/framework.dart)'), + StackFrame(number: 12, className: 'SingleChildRenderObjectElement', method: 'mount', packageScheme: 'package', package: 'flutter', packagePath: 'blah.dart', line: 999, column: 9, source: '#12 SingleChildRenderObjectElement.mount (package:flutter/blah.dart:999:9)'), + StackFrame(number: 13, className: '', method: 'main', packageScheme: 'package', package: 'hello_flutter', packagePath: 'main.dart', line: 10, column: 4, source: '#13 main (package:hello_flutter/main.dart:10:4)'), ]; @@ -194,47 +194,47 @@ dart:async/zone.dart 1190:13 _rootRun '''; const List asyncStackFrames = [ - StackFrame(number: 0, method: 'getSampleStack', packageScheme: 'file', package: '', packagePath: '/path/to/flutter/packages/flutter/test/foundation/error_reporting_test.dart', line: 40, column: 57, source: '#0 getSampleStack. (file:///path/to/flutter/packages/flutter/test/foundation/error_reporting_test.dart:40:57)'), + StackFrame(number: 0, className: '', method: 'getSampleStack', packageScheme: 'file', package: '', packagePath: '/path/to/flutter/packages/flutter/test/foundation/error_reporting_test.dart', line: 40, column: 57, source: '#0 getSampleStack. (file:///path/to/flutter/packages/flutter/test/foundation/error_reporting_test.dart:40:57)'), StackFrame(number: 1, className: 'Future', method: 'sync', packageScheme: 'dart', package: 'async', packagePath: 'future.dart', line: 224, column: 31, isConstructor: true, source: '#1 new Future.sync (dart:async/future.dart:224:31)'), - StackFrame(number: 2, method: 'getSampleStack', packageScheme: 'file', package: '', packagePath: '/path/to/flutter/packages/flutter/test/foundation/error_reporting_test.dart', line: 40, column: 10, source: '#2 getSampleStack (file:///path/to/flutter/packages/flutter/test/foundation/error_reporting_test.dart:40:10)'), - StackFrame(number: 3, method: 'main', packageScheme: 'file', package: '', packagePath: '/path/to/flutter/packages/flutter/foundation/error_reporting_test.dart', line: 46, column: 40, source: '#3 main (file:///path/to/flutter/packages/flutter/test/foundation/error_reporting_test.dart:46:40)'), - StackFrame(number: 4, method: 'main', packageScheme: 'package', package: 'flutter_goldens', packagePath: 'flutter_goldens.dart', line: 43, column: 17, source: '#4 main (package:flutter_goldens/flutter_goldens.dart:43:17)'), + StackFrame(number: 2, className: '', method: 'getSampleStack', packageScheme: 'file', package: '', packagePath: '/path/to/flutter/packages/flutter/test/foundation/error_reporting_test.dart', line: 40, column: 10, source: '#2 getSampleStack (file:///path/to/flutter/packages/flutter/test/foundation/error_reporting_test.dart:40:10)'), + StackFrame(number: 3, className: '', method: 'main', packageScheme: 'file', package: '', packagePath: '/path/to/flutter/packages/flutter/foundation/error_reporting_test.dart', line: 46, column: 40, source: '#3 main (file:///path/to/flutter/packages/flutter/test/foundation/error_reporting_test.dart:46:40)'), + StackFrame(number: 4, className: '', method: 'main', packageScheme: 'package', package: 'flutter_goldens', packagePath: 'flutter_goldens.dart', line: 43, column: 17, source: '#4 main (package:flutter_goldens/flutter_goldens.dart:43:17)'), StackFrame.asynchronousSuspension, - StackFrame(number: 5, method: 'main', packageScheme: 'file', package: '', packagePath: '/temp/path.whatever/listener.dart', line: 47, column: 18, source: '#5 main.. (file:///temp/path.whatever/listener.dart:47:18)'), - StackFrame(number: 6, method: '_rootRun', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1126, column: 13, source: '#6 _rootRun (dart:async/zone.dart:1126:13)'), - StackFrame(number: 7, className: '_CustomZone', method: 'run', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1023, column: 19, source: '#7 _CustomZone.run (dart:async/zone.dart:1023:19)'), - StackFrame(number: 8, method: '_runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1518, column: 10, source: '#8 _runZoned (dart:async/zone.dart:1518:10)'), - StackFrame(number: 9, method: 'runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1465, column: 12, source: '#9 runZoned (dart:async/zone.dart:1465:12)'), - StackFrame(number: 10, className: 'Declarer', method: 'declare', packageScheme: 'package', package: 'test_api', packagePath: 'src/backend/declarer.dart', line: 130, column: 22, source: '#10 Declarer.declare (package:test_api/src/backend/declarer.dart:130:22)'), - StackFrame(number: 11, className: 'RemoteListener', method: 'start', packageScheme: 'package', package: 'test_api', packagePath: 'src/remote_listener.dart', line: 124, column: 26, source: '#11 RemoteListener.start... (package:test_api/src/remote_listener.dart:124:26)'), + StackFrame(number: 5, className: '', method: 'main', packageScheme: 'file', package: '', packagePath: '/temp/path.whatever/listener.dart', line: 47, column: 18, source: '#5 main.. (file:///temp/path.whatever/listener.dart:47:18)'), + StackFrame(number: 6, className: '', method: '_rootRun', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1126, column: 13, source: '#6 _rootRun (dart:async/zone.dart:1126:13)'), + StackFrame(number: 7, className: '_CustomZone', method: 'run', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1023, column: 19, source: '#7 _CustomZone.run (dart:async/zone.dart:1023:19)'), + StackFrame(number: 8, className: '', method: '_runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1518, column: 10, source: '#8 _runZoned (dart:async/zone.dart:1518:10)'), + StackFrame(number: 9, className: '', method: 'runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1465, column: 12, source: '#9 runZoned (dart:async/zone.dart:1465:12)'), + StackFrame(number: 10, className: 'Declarer', method: 'declare', packageScheme: 'package', package: 'test_api', packagePath: 'src/backend/declarer.dart', line: 130, column: 22, source: '#10 Declarer.declare (package:test_api/src/backend/declarer.dart:130:22)'), + StackFrame(number: 11, className: 'RemoteListener', method: 'start', packageScheme: 'package', package: 'test_api', packagePath: 'src/remote_listener.dart', line: 124, column: 26, source: '#11 RemoteListener.start... (package:test_api/src/remote_listener.dart:124:26)'), StackFrame.asynchronousSuspension, - StackFrame(number: 12, method: '_rootRun', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1126, column: 13, source: '#12 _rootRun (dart:async/zone.dart:1126:13)'), - StackFrame(number: 13, className: '_CustomZone', method: 'run' , packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1023, column: 19, source: '#13 _CustomZone.run (dart:async/zone.dart:1023:19)'), - StackFrame(number: 14, method: '_runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1518, column: 10, source: '#14 _runZoned (dart:async/zone.dart:1518:10)'), - StackFrame(number: 15, method: 'runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1502, column: 12, source: '#15 runZoned (dart:async/zone.dart:1502:12)'), - StackFrame(number: 16, className: 'RemoteListener', method: 'start', packageScheme: 'package', package: 'test_api', packagePath: 'src/remote_listener.dart', line: 70, column: 9, source: '#16 RemoteListener.start.. (package:test_api/src/remote_listener.dart:70:9)'), - StackFrame(number: 17, method: '_rootRun', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1126, column: 13, source: '#17 _rootRun (dart:async/zone.dart:1126:13)'), - StackFrame(number: 18, className: '_CustomZone', method: 'run', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1023, column: 19, source: '#18 _CustomZone.run (dart:async/zone.dart:1023:19)'), - StackFrame(number: 19, method: '_runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1518, column: 10, source: '#19 _runZoned (dart:async/zone.dart:1518:10)'), - StackFrame(number: 20, method: 'runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1465, column: 12, source: '#20 runZoned (dart:async/zone.dart:1465:12)'), - StackFrame(number: 21, className: 'StackTraceFormatter', method: 'asCurrent', packageScheme: 'package', package: 'test_api', packagePath: 'src/backend/stack_trace_formatter.dart', line: 41, column: 31, source: '#21 StackTraceFormatter.asCurrent (package:test_api/src/backend/stack_trace_formatter.dart:41:31)'), - StackFrame(number: 22, className: 'RemoteListener', method: 'start', packageScheme: 'package', package: 'test_api', packagePath: 'src/remote_listener.dart', line: 69, column: 29, source: '#22 RemoteListener.start. (package:test_api/src/remote_listener.dart:69:29)'), - StackFrame(number: 23, method: '_rootRun', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1126, column: 13, source: '#23 _rootRun (dart:async/zone.dart:1126:13)'), - StackFrame(number: 24, className: '_CustomZone', method: 'run', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1023, column: 19, source: '#24 _CustomZone.run (dart:async/zone.dart:1023:19)'), - StackFrame(number: 25, method: '_runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1518, column: 10, source: '#25 _runZoned (dart:async/zone.dart:1518:10)'), - StackFrame(number: 26, method: 'runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1465, column: 12, source: '#26 runZoned (dart:async/zone.dart:1465:12)'), - StackFrame(number: 27, className: 'SuiteChannelManager', method: 'asCurrent', packageScheme: 'package', package: 'test_api', packagePath: 'src/suite_channel_manager.dart', line: 34, column: 31, source: '#27 SuiteChannelManager.asCurrent (package:test_api/src/suite_channel_manager.dart:34:31)'), - StackFrame(number: 28, className: 'RemoteListener', method: 'start', packageScheme: 'package', package: 'test_api', packagePath: 'src/remote_listener.dart', line: 68, column: 27, source: '#28 RemoteListener.start (package:test_api/src/remote_listener.dart:68:27)'), - StackFrame(number: 29, method: 'serializeSuite', packageScheme: 'file', package: '', packagePath: '/temp/path.whatever/listener.dart', line: 17, column: 25, source: '#29 serializeSuite (file:///temp/path.whatever/listener.dart:17:25)'), - StackFrame(number: 30, method: 'main', packageScheme: 'file', package: '', packagePath: '/temp/path.whatever/listener.dart', line: 43, column: 36, source: '#30 main (file:///temp/path.whatever/listener.dart:43:36)'), - StackFrame(number: 31, method: '_runMainZoned', packageScheme: 'dart', package: 'ui', packagePath: 'hooks.dart', line:239, column: 25, source: '#31 _runMainZoned.. (dart:ui/hooks.dart:239:25)'), - StackFrame(number: 32, method: '_rootRun', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1126, column: 13, source: '#32 _rootRun (dart:async/zone.dart:1126:13)'), - StackFrame(number: 33, className: '_CustomZone', method: 'run' , packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1023, column: 19, source: '#33 _CustomZone.run (dart:async/zone.dart:1023:19)'), - StackFrame(number: 34, method: '_runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1518, column: 10, source: '#34 _runZoned (dart:async/zone.dart:1518:10)'), - StackFrame(number: 35, method: 'runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1502, column: 12, source: '#35 runZoned (dart:async/zone.dart:1502:12)'), - StackFrame(number: 36, method: '_runMainZoned', packageScheme: 'dart', package: 'ui', packagePath: 'hooks.dart', line: 231, column: 5, source: '#36 _runMainZoned. (dart:ui/hooks.dart:231:5)'), - StackFrame(number: 37, method: '_startIsolate', packageScheme: 'dart', package: 'isolate-patch', packagePath: 'isolate_patch.dart', line: 307, column: 19, source: '#37 _startIsolate. (dart:isolate-patch/isolate_patch.dart:307:19)'), - StackFrame(number: 38, className: '_RawReceivePortImpl', method: '_handleMessage', packageScheme: 'dart', package: 'isolate-patch', packagePath: 'isolate_patch.dart', line: 174, column: 12, source: '#38 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)'), + StackFrame(number: 12, className: '', method: '_rootRun', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1126, column: 13, source: '#12 _rootRun (dart:async/zone.dart:1126:13)'), + StackFrame(number: 13, className: '_CustomZone', method: 'run' , packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1023, column: 19, source: '#13 _CustomZone.run (dart:async/zone.dart:1023:19)'), + StackFrame(number: 14, className: '', method: '_runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1518, column: 10, source: '#14 _runZoned (dart:async/zone.dart:1518:10)'), + StackFrame(number: 15, className: '', method: 'runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1502, column: 12, source: '#15 runZoned (dart:async/zone.dart:1502:12)'), + StackFrame(number: 16, className: 'RemoteListener', method: 'start', packageScheme: 'package', package: 'test_api', packagePath: 'src/remote_listener.dart', line: 70, column: 9, source: '#16 RemoteListener.start.. (package:test_api/src/remote_listener.dart:70:9)'), + StackFrame(number: 17, className: '', method: '_rootRun', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1126, column: 13, source: '#17 _rootRun (dart:async/zone.dart:1126:13)'), + StackFrame(number: 18, className: '_CustomZone', method: 'run', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1023, column: 19, source: '#18 _CustomZone.run (dart:async/zone.dart:1023:19)'), + StackFrame(number: 19, className: '', method: '_runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1518, column: 10, source: '#19 _runZoned (dart:async/zone.dart:1518:10)'), + StackFrame(number: 20, className: '', method: 'runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1465, column: 12, source: '#20 runZoned (dart:async/zone.dart:1465:12)'), + StackFrame(number: 21, className: 'StackTraceFormatter', method: 'asCurrent', packageScheme: 'package', package: 'test_api', packagePath: 'src/backend/stack_trace_formatter.dart', line: 41, column: 31, source: '#21 StackTraceFormatter.asCurrent (package:test_api/src/backend/stack_trace_formatter.dart:41:31)'), + StackFrame(number: 22, className: 'RemoteListener', method: 'start', packageScheme: 'package', package: 'test_api', packagePath: 'src/remote_listener.dart', line: 69, column: 29, source: '#22 RemoteListener.start. (package:test_api/src/remote_listener.dart:69:29)'), + StackFrame(number: 23, className: '', method: '_rootRun', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1126, column: 13, source: '#23 _rootRun (dart:async/zone.dart:1126:13)'), + StackFrame(number: 24, className: '_CustomZone', method: 'run', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1023, column: 19, source: '#24 _CustomZone.run (dart:async/zone.dart:1023:19)'), + StackFrame(number: 25, className: '', method: '_runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1518, column: 10, source: '#25 _runZoned (dart:async/zone.dart:1518:10)'), + StackFrame(number: 26, className: '', method: 'runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1465, column: 12, source: '#26 runZoned (dart:async/zone.dart:1465:12)'), + StackFrame(number: 27, className: 'SuiteChannelManager', method: 'asCurrent', packageScheme: 'package', package: 'test_api', packagePath: 'src/suite_channel_manager.dart', line: 34, column: 31, source: '#27 SuiteChannelManager.asCurrent (package:test_api/src/suite_channel_manager.dart:34:31)'), + StackFrame(number: 28, className: 'RemoteListener', method: 'start', packageScheme: 'package', package: 'test_api', packagePath: 'src/remote_listener.dart', line: 68, column: 27, source: '#28 RemoteListener.start (package:test_api/src/remote_listener.dart:68:27)'), + StackFrame(number: 29, className: '', method: 'serializeSuite', packageScheme: 'file', package: '', packagePath: '/temp/path.whatever/listener.dart', line: 17, column: 25, source: '#29 serializeSuite (file:///temp/path.whatever/listener.dart:17:25)'), + StackFrame(number: 30, className: '', method: 'main', packageScheme: 'file', package: '', packagePath: '/temp/path.whatever/listener.dart', line: 43, column: 36, source: '#30 main (file:///temp/path.whatever/listener.dart:43:36)'), + StackFrame(number: 31, className: '', method: '_runMainZoned', packageScheme: 'dart', package: 'ui', packagePath: 'hooks.dart', line:239, column: 25, source: '#31 _runMainZoned.. (dart:ui/hooks.dart:239:25)'), + StackFrame(number: 32, className: '', method: '_rootRun', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1126, column: 13, source: '#32 _rootRun (dart:async/zone.dart:1126:13)'), + StackFrame(number: 33, className: '_CustomZone', method: 'run' , packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1023, column: 19, source: '#33 _CustomZone.run (dart:async/zone.dart:1023:19)'), + StackFrame(number: 34, className: '', method: '_runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1518, column: 10, source: '#34 _runZoned (dart:async/zone.dart:1518:10)'), + StackFrame(number: 35, className: '', method: 'runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1502, column: 12, source: '#35 runZoned (dart:async/zone.dart:1502:12)'), + StackFrame(number: 36, className: '', method: '_runMainZoned', packageScheme: 'dart', package: 'ui', packagePath: 'hooks.dart', line: 231, column: 5, source: '#36 _runMainZoned. (dart:ui/hooks.dart:231:5)'), + StackFrame(number: 37, className: '', method: '_startIsolate', packageScheme: 'dart', package: 'isolate-patch', packagePath: 'isolate_patch.dart', line: 307, column: 19, source: '#37 _startIsolate. (dart:isolate-patch/isolate_patch.dart:307:19)'), + StackFrame(number: 38, className: '_RawReceivePortImpl', method: '_handleMessage', packageScheme: 'dart', package: 'isolate-patch', packagePath: 'isolate_patch.dart', line: 174, column: 12, source: '#38 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)'), ]; const String stackFrameNoCols = ''' @@ -250,15 +250,15 @@ const String stackFrameNoCols = ''' #9 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174)'''; const List stackFrameNoColsFrames = [ - StackFrame(number: 0, method: 'blah', packageScheme: 'package', package: 'assertions', packagePath: 'main.dart', line: 4, column: -1, source: '#0 blah (package:assertions/main.dart:4)'), - StackFrame(number: 1, method: 'main', packageScheme: 'package', package: 'assertions', packagePath: 'main.dart', line: 8, column: -1, source: '#1 main (package:assertions/main.dart:8)'), - StackFrame(number: 2, method: '_runMainZoned', packageScheme: 'dart', package: 'ui', packagePath: 'hooks.dart', line: 239, column: -1, source: '#2 _runMainZoned.. (dart:ui/hooks.dart:239)'), - StackFrame(number: 3, method: '_rootRun', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1126, column: -1, source: '#3 _rootRun (dart:async/zone.dart:1126)'), + StackFrame(number: 0, className: '', method: 'blah', packageScheme: 'package', package: 'assertions', packagePath: 'main.dart', line: 4, column: -1, source: '#0 blah (package:assertions/main.dart:4)'), + StackFrame(number: 1, className: '', method: 'main', packageScheme: 'package', package: 'assertions', packagePath: 'main.dart', line: 8, column: -1, source: '#1 main (package:assertions/main.dart:8)'), + StackFrame(number: 2, className: '', method: '_runMainZoned', packageScheme: 'dart', package: 'ui', packagePath: 'hooks.dart', line: 239, column: -1, source: '#2 _runMainZoned.. (dart:ui/hooks.dart:239)'), + StackFrame(number: 3, className: '', method: '_rootRun', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1126, column: -1, source: '#3 _rootRun (dart:async/zone.dart:1126)'), StackFrame(number: 4, className: '_CustomZone', method: 'run', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1023, column: -1, source: '#4 _CustomZone.run (dart:async/zone.dart:1023)'), - StackFrame(number: 5, method: '_runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1518, column: -1, source: '#5 _runZoned (dart:async/zone.dart:1518)'), - StackFrame(number: 6, method: 'runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1502, column: -1, source: '#6 runZoned (dart:async/zone.dart:1502)'), - StackFrame(number: 7, method: '_runMainZoned', packageScheme: 'dart', package: 'ui', packagePath: 'hooks.dart', line: 231, column: -1, source: '#7 _runMainZoned. (dart:ui/hooks.dart:231)'), - StackFrame(number: 8, method: '_startIsolate', packageScheme: 'dart', package: 'isolate-patch', packagePath: 'isolate-patch.dart', line: 307, column: -1, source: '#8 _startIsolate. (dart:isolate-patch/isolate_patch.dart:307)'), + StackFrame(number: 5, className: '', method: '_runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1518, column: -1, source: '#5 _runZoned (dart:async/zone.dart:1518)'), + StackFrame(number: 6, className: '', method: 'runZoned', packageScheme: 'dart', package: 'async', packagePath: 'zone.dart', line: 1502, column: -1, source: '#6 runZoned (dart:async/zone.dart:1502)'), + StackFrame(number: 7, className: '', method: '_runMainZoned', packageScheme: 'dart', package: 'ui', packagePath: 'hooks.dart', line: 231, column: -1, source: '#7 _runMainZoned. (dart:ui/hooks.dart:231)'), + StackFrame(number: 8, className: '', method: '_startIsolate', packageScheme: 'dart', package: 'isolate-patch', packagePath: 'isolate-patch.dart', line: 307, column: -1, source: '#8 _startIsolate. (dart:isolate-patch/isolate_patch.dart:307)'), StackFrame(number: 9, className: '_RawReceivePortImpl', method: '_handleMessage', packageScheme: 'dart', package: 'isolate-patch', packagePath: 'isolate-patch.dart', line: 174, column: -1, source: '#9 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174)'), ]; @@ -280,17 +280,17 @@ package:dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 168:15 const List webStackTraceFrames = [ StackFrame(number: -1, className: '', method: 'throw_', packageScheme: 'package', package: 'dart-sdk', packagePath: 'lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart', line: 196, column: 49, source: 'package:dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 196:49 throw_'), - StackFrame(number: -1, className: '', method: 'blah', packageScheme: 'package', package: 'assertions', packagePath: 'main.dart', line: 4, column: 3, source: 'package:assertions/main.dart 4:3 blah'), - StackFrame(number: -1, className: '', method: r'main$', packageScheme: 'package', package: 'assertions', packagePath: 'main.dart', line: 8, column: 5, source: r'package:assertions/main.dart 8:5 main$'), - StackFrame(number: -1, className: '', method: r'main$', packageScheme: 'package', package: 'assertions', packagePath: 'main_web_entrypoint.dart', line: 9, column: 3, source: r'package:assertions/main_web_entrypoint.dart 9:3 main$'), + StackFrame(number: -1, className: '', method: 'blah', packageScheme: 'package', package: 'assertions', packagePath: 'main.dart', line: 4, column: 3, source: 'package:assertions/main.dart 4:3 blah'), + StackFrame(number: -1, className: '', method: r'main$', packageScheme: 'package', package: 'assertions', packagePath: 'main.dart', line: 8, column: 5, source: r'package:assertions/main.dart 8:5 main$'), + StackFrame(number: -1, className: '', method: r'main$', packageScheme: 'package', package: 'assertions', packagePath: 'main_web_entrypoint.dart', line: 9, column: 3, source: r'package:assertions/main_web_entrypoint.dart 9:3 main$'), StackFrame(number: -1, className: '', method: 'onValue', packageScheme: 'package', package: 'dart-sdk', packagePath: 'lib/_internal/js_dev_runtime/patch/async_patch.dart', line: 47, column: 50, source: 'package:dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 47:50 onValue'), StackFrame(number: -1, className: '', method: 'runUnary', packageScheme: 'package', package: 'dart-sdk', packagePath: 'lib/async/zone.dart', line: 1381, column: 54, source: 'package:dart-sdk/lib/async/zone.dart 1381:54 runUnary'), - StackFrame(number: -1, className: '', method: 'performLayout', packageScheme: '', package: '', packagePath: '', line: 210, column: 5, source: 'object_test.dart 210:5 performLayout'), + StackFrame(number: -1, className: '', method: 'performLayout', packageScheme: '', package: '', packagePath: '', line: 210, column: 5, source: 'object_test.dart 210:5 performLayout'), StackFrame(number: -1, className: '', method: 'handleValue', packageScheme: 'package', package: 'dart-sdk', packagePath: 'lib/async/future_impl.dart', line: 140, column: 18, source: 'package:dart-sdk/lib/async/future_impl.dart 140:18 handleValue'), StackFrame(number: -1, className: '', method: 'handleValueCallback', packageScheme: 'package', package: 'dart-sdk', packagePath: 'lib/async/future_impl.dart', line: 682, column: 44, source: 'package:dart-sdk/lib/async/future_impl.dart 682:44 handleValueCallback'), StackFrame(number: -1, className: '', method: '_propagateToListeners', packageScheme: 'package', package: 'dart-sdk', packagePath: 'lib/async/future_impl.dart', line: 711, column: 32, source: 'package:dart-sdk/lib/async/future_impl.dart 711:32 _propagateToListeners'), - StackFrame(number: -1, className: '', method: 'callback', packageScheme: 'package', package: 'dart-sdk', packagePath: 'lib/async/future_impl.dart', line: 391, column: 9, source: 'package:dart-sdk/lib/async/future_impl.dart 391:9 callback'), + StackFrame(number: -1, className: '', method: 'callback', packageScheme: 'package', package: 'dart-sdk', packagePath: 'lib/async/future_impl.dart', line: 391, column: 9, source: 'package:dart-sdk/lib/async/future_impl.dart 391:9 callback'), StackFrame(number: -1, className: '', method: '_microtaskLoop', packageScheme: 'package', package: 'dart-sdk', packagePath: 'lib/async/schedule_microtask.dart', line: 43, column: 11, source: 'package:dart-sdk/lib/async/schedule_microtask.dart 43:11 _microtaskLoop'), - StackFrame(number: -1, className: '', method: '_startMicrotaskLoop', packageScheme: 'package', package: 'dart-sdk', packagePath: 'lib/async/schedule_microtask.dart', line: 52, column: 5, source: 'package:dart-sdk/lib/async/schedule_microtask.dart 52:5 _startMicrotaskLoop'), + StackFrame(number: -1, className: '', method: '_startMicrotaskLoop', packageScheme: 'package', package: 'dart-sdk', packagePath: 'lib/async/schedule_microtask.dart', line: 52, column: 5, source: 'package:dart-sdk/lib/async/schedule_microtask.dart 52:5 _startMicrotaskLoop'), StackFrame(number: -1, className: '', method: '', packageScheme: 'package', package: 'dart-sdk', packagePath: 'lib/_internal/js_dev_runtime/patch/async_patch.dart', line: 168, column: 15, source: 'package:dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 168:15 '), ]; diff --git a/packages/flutter/test/gestures/drag_test.dart b/packages/flutter/test/gestures/drag_test.dart index 73ab1ea9b8..f97e1b495d 100644 --- a/packages/flutter/test/gestures/drag_test.dart +++ b/packages/flutter/test/gestures/drag_test.dart @@ -578,7 +578,7 @@ void main() { velocity = details.velocity; }; - final TestPointer pointer = TestPointer(); + final TestPointer pointer = TestPointer(1); final PointerDownEvent down = pointer.down(const Offset(10.0, 25.0), timeStamp: const Duration(milliseconds: 10)); drag.addPointer(down); tester.closeArena(1); @@ -611,7 +611,7 @@ void main() { velocity = details.velocity; }; - final TestPointer pointer = TestPointer(); + final TestPointer pointer = TestPointer(1); final PointerDownEvent down = pointer.down(const Offset(10.0, 25.0), timeStamp: const Duration(milliseconds: 10)); drag.addPointer(down); tester.closeArena(1); @@ -751,7 +751,7 @@ void main() { }; // Using a touch pointer to drag shouldn't be recognized. - final TestPointer touchPointer = TestPointer(5); + final TestPointer touchPointer = TestPointer(5, PointerDeviceKind.touch); final PointerDownEvent touchDown = touchPointer.down(const Offset(10.0, 10.0)); drag.addPointer(touchDown); tester.closeArena(5); @@ -1114,8 +1114,8 @@ void main() { addTearDown(hori.dispose); addTearDown(vert.dispose); - final TestPointer pointer1 = TestPointer(4); - final TestPointer pointer2 = TestPointer(5); + final TestPointer pointer1 = TestPointer(4, PointerDeviceKind.touch); + final TestPointer pointer2 = TestPointer(5, PointerDeviceKind.touch); final PointerDownEvent down1 = pointer1.down(const Offset(10.0, 10.0)); final PointerDownEvent down2 = pointer2.down(const Offset(11.0, 10.0)); @@ -1167,8 +1167,8 @@ void main() { addTearDown(hori.dispose); addTearDown(vert.dispose); - final TestPointer pointer1 = TestPointer(4); - final TestPointer pointer2 = TestPointer(5); + final TestPointer pointer1 = TestPointer(4, PointerDeviceKind.touch); + final TestPointer pointer2 = TestPointer(5, PointerDeviceKind.touch); final PointerDownEvent down1 = pointer1.down(const Offset(10.0, 10.0)); final PointerDownEvent down2 = pointer2.down(const Offset(11.0, 10.0)); @@ -1221,8 +1221,8 @@ void main() { addTearDown(hori.dispose); addTearDown(vert.dispose); - final TestPointer pointer1 = TestPointer(4); - final TestPointer pointer2 = TestPointer(5); + final TestPointer pointer1 = TestPointer(4, PointerDeviceKind.touch); + final TestPointer pointer2 = TestPointer(5, PointerDeviceKind.touch); final PointerDownEvent down1 = pointer1.down(const Offset(10.0, 10.0)); final PointerDownEvent down2 = pointer2.down(const Offset(11.0, 10.0)); @@ -1278,8 +1278,8 @@ void main() { addTearDown(hori.dispose); addTearDown(vert.dispose); - final TestPointer pointer1 = TestPointer(4); - final TestPointer pointer2 = TestPointer(5); + final TestPointer pointer1 = TestPointer(4, PointerDeviceKind.touch); + final TestPointer pointer2 = TestPointer(5, PointerDeviceKind.touch); final PointerDownEvent down1 = pointer1.down(const Offset(10.0, 10.0)); final PointerDownEvent down2 = pointer2.down(const Offset(11.0, 10.0)); @@ -1335,8 +1335,8 @@ void main() { addTearDown(hori.dispose); addTearDown(vert.dispose); - final TestPointer pointer1 = TestPointer(); - final TestPointer pointer2 = TestPointer(2); + final TestPointer pointer1 = TestPointer(1, PointerDeviceKind.touch); + final TestPointer pointer2 = TestPointer(2, PointerDeviceKind.touch); final PointerDownEvent down1 = pointer1.down(const Offset(10.0, 10.0)); final PointerDownEvent down2 = pointer2.down(const Offset(11.0, 10.0)); @@ -1390,10 +1390,10 @@ void main() { addTearDown(tap.dispose); addTearDown(drag.dispose); - final TestPointer pointer1 = TestPointer(); - final TestPointer pointer2 = TestPointer(2); - final TestPointer pointer3 = TestPointer(3); - final TestPointer pointer4 = TestPointer(4); + final TestPointer pointer1 = TestPointer(1, PointerDeviceKind.touch); + final TestPointer pointer2 = TestPointer(2, PointerDeviceKind.touch); + final TestPointer pointer3 = TestPointer(3, PointerDeviceKind.touch); + final TestPointer pointer4 = TestPointer(4, PointerDeviceKind.touch); final PointerDownEvent down1 = pointer1.down(const Offset(10.0, 10.0)); final PointerDownEvent down2 = pointer2.down(const Offset(11.0, 11.0)); diff --git a/packages/flutter/test/gestures/events_test.dart b/packages/flutter/test/gestures/events_test.dart index 81d5a02220..9c59703458 100644 --- a/packages/flutter/test/gestures/events_test.dart +++ b/packages/flutter/test/gestures/events_test.dart @@ -496,6 +496,7 @@ void main() { const PointerScrollEvent scroll = PointerScrollEvent( timeStamp: Duration(seconds: 2), + kind: PointerDeviceKind.mouse, device: 1, position: Offset(20, 30), ); diff --git a/packages/flutter/test/gestures/force_press_test.dart b/packages/flutter/test/gestures/force_press_test.dart index 191dbe07bb..d3f5a19c46 100644 --- a/packages/flutter/test/gestures/force_press_test.dart +++ b/packages/flutter/test/gestures/force_press_test.dart @@ -17,6 +17,10 @@ void main() { const double pressureMin = 0; const double pressureMax = 6.66; + // Interpolated Flutter pressure values. + const double startPressure = 0.4; // = Device pressure of 2.66. + const double peakPressure = 0.85; // = Device pressure of 5.66. + int started = 0; int peaked = 0; int updated = 0; @@ -29,7 +33,7 @@ void main() { started += 1; } - final ForcePressGestureRecognizer force = ForcePressGestureRecognizer(); + final ForcePressGestureRecognizer force = ForcePressGestureRecognizer(startPressure: startPressure, peakPressure: peakPressure); force.onStart = onStart; force.onPeak = (ForcePressDetails details) => peaked += 1; @@ -37,7 +41,7 @@ void main() { force.onEnd = (ForcePressDetails details) => ended += 1; const int pointerValue = 1; - final TestPointer pointer = TestPointer(); + final TestPointer pointer = TestPointer(pointerValue); const PointerDownEvent down = PointerDownEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 0, pressureMin: pressureMin, pressureMax: pressureMax); pointer.setDownInfo(down, const Offset(10.0, 10.0)); force.addPointer(down); @@ -68,7 +72,7 @@ void main() { tester.route(const PointerMoveEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 3.3, pressureMin: pressureMin, pressureMax: pressureMax)); tester.route(const PointerMoveEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 4.0, pressureMin: pressureMin, pressureMax: pressureMax)); tester.route(const PointerMoveEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 5.0, pressureMin: pressureMin, pressureMax: pressureMax)); - tester.route(const PointerMoveEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressureMin: pressureMin, pressureMax: pressureMax)); + tester.route(const PointerMoveEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 1.0, pressureMin: pressureMin, pressureMax: pressureMax)); // We have exceeded the start pressure so update should be greater than 0. expect(started, 1); @@ -88,7 +92,7 @@ void main() { tester.route(const PointerMoveEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 3.3, pressureMin: pressureMin, pressureMax: pressureMax)); tester.route(const PointerMoveEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 4.0, pressureMin: pressureMin, pressureMax: pressureMax)); tester.route(const PointerMoveEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 5.0, pressureMin: pressureMin, pressureMax: pressureMax)); - tester.route(const PointerMoveEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressureMin: pressureMin, pressureMax: pressureMax)); + tester.route(const PointerMoveEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 1.0, pressureMin: pressureMin, pressureMax: pressureMax)); // Update is still called. expect(started, 1); @@ -120,7 +124,7 @@ void main() { force.onEnd = (ForcePressDetails details) => ended += 1; const int pointerValue = 1; - final TestPointer pointer = TestPointer(); + final TestPointer pointer = TestPointer(pointerValue); final PointerDownEvent down = PointerDownEvent(pointer: pointerValue, position: const Offset(10.0, 10.0), pressure: 0, pressureMin: 0, pressureMax: pressureMax); pointer.setDownInfo(down, const Offset(10.0, 10.0)); force.addPointer(down); @@ -161,12 +165,16 @@ void main() { const double pressureMin = 0; const double pressureMax = 6.66; + // Interpolated Flutter pressure values. + const double startPressure = 0.4; // = Device pressure of 2.66. + const double peakPressure = 0.85; // = Device pressure of 5.66. + int started = 0; int peaked = 0; int updated = 0; int ended = 0; - final ForcePressGestureRecognizer force = ForcePressGestureRecognizer(); + final ForcePressGestureRecognizer force = ForcePressGestureRecognizer(startPressure: startPressure, peakPressure: peakPressure); force.onStart = (_) => started += 1; force.onPeak = (_) => peaked += 1; @@ -174,7 +182,7 @@ void main() { force.onEnd = (_) => ended += 1; const int pointerValue = 1; - final TestPointer pointer = TestPointer(); + final TestPointer pointer = TestPointer(pointerValue); const PointerDownEvent down = PointerDownEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 0, pressureMin: pressureMin, pressureMax: pressureMax); pointer.setDownInfo(down, const Offset(10.0, 10.0)); force.addPointer(down); @@ -209,12 +217,16 @@ void main() { const double pressureMin = 0; const double pressureMax = 6.66; + // Interpolated Flutter pressure values. + const double startPressure = 0.4; // = Device pressure of 2.66. + const double peakPressure = 0.85; // = Device pressure of 5.66. + int started = 0; int peaked = 0; int updated = 0; int ended = 0; - final ForcePressGestureRecognizer force = ForcePressGestureRecognizer(); + final ForcePressGestureRecognizer force = ForcePressGestureRecognizer(startPressure: startPressure, peakPressure: peakPressure); force.onStart = (_) => started += 1; force.onPeak = (_) => peaked += 1; @@ -225,8 +237,8 @@ void main() { drag.onStart = (_) => didStartPan += 1; const int pointerValue = 1; - final TestPointer pointer = TestPointer(); - const PointerDownEvent down = PointerDownEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressureMin: pressureMin, pressureMax: pressureMax); + final TestPointer pointer = TestPointer(pointerValue); + const PointerDownEvent down = PointerDownEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 1.0, pressureMin: pressureMin, pressureMax: pressureMax); pointer.setDownInfo(down, const Offset(10.0, 10.0)); force.addPointer(down); drag.addPointer(down); @@ -277,6 +289,10 @@ void main() { testGesture('Should not call ended on pointer up if the gesture was never accepted', (GestureTester tester) { final PanGestureRecognizer drag = PanGestureRecognizer(); + // Interpolated Flutter pressure values. + const double startPressure = 0.4; // = Device pressure of 2.66. + const double peakPressure = 0.85; // = Device pressure of 5.66. + // Device specific constants that represent those from the iPhone X const double pressureMin = 0; const double pressureMax = 6.66; @@ -286,7 +302,7 @@ void main() { int updated = 0; int ended = 0; - final ForcePressGestureRecognizer force = ForcePressGestureRecognizer(); + final ForcePressGestureRecognizer force = ForcePressGestureRecognizer(startPressure: startPressure, peakPressure: peakPressure); force.onStart = (_) => started += 1; force.onPeak = (_) => peaked += 1; @@ -297,8 +313,8 @@ void main() { drag.onStart = (_) => didStartPan += 1; const int pointerValue = 1; - final TestPointer pointer = TestPointer(); - const PointerDownEvent down = PointerDownEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressureMin: pressureMin, pressureMax: pressureMax); + final TestPointer pointer = TestPointer(pointerValue); + const PointerDownEvent down = PointerDownEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 1.0, pressureMin: pressureMin, pressureMax: pressureMax); pointer.setDownInfo(down, const Offset(10.0, 10.0)); force.addPointer(down); drag.addPointer(down); @@ -322,6 +338,10 @@ void main() { testGesture('Should call start only once if there is a competing gesture recognizer', (GestureTester tester) { final PanGestureRecognizer drag = PanGestureRecognizer(); + // Interpolated Flutter pressure values. + const double startPressure = 0.4; // = Device pressure of 2.66. + const double peakPressure = 0.85; // = Device pressure of 5.66. + // Device specific constants that represent those from the iPhone X const double pressureMin = 0; const double pressureMax = 6.66; @@ -331,7 +351,7 @@ void main() { int updated = 0; int ended = 0; - final ForcePressGestureRecognizer force = ForcePressGestureRecognizer(); + final ForcePressGestureRecognizer force = ForcePressGestureRecognizer(startPressure: startPressure, peakPressure: peakPressure); force.onStart = (_) => started += 1; force.onPeak = (_) => peaked += 1; @@ -342,8 +362,8 @@ void main() { drag.onStart = (_) => didStartPan += 1; const int pointerValue = 1; - final TestPointer pointer = TestPointer(); - const PointerDownEvent down = PointerDownEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressureMin: pressureMin, pressureMax: pressureMax); + final TestPointer pointer = TestPointer(pointerValue); + const PointerDownEvent down = PointerDownEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 1.0, pressureMin: pressureMin, pressureMax: pressureMax); pointer.setDownInfo(down, const Offset(10.0, 10.0)); force.addPointer(down); drag.addPointer(down); @@ -380,6 +400,10 @@ void main() { const double pressureMin = 0; const double pressureMax = 6.66; + // Interpolated Flutter pressure values. + const double startPressure = 0.4; // = Device pressure of 2.66. + const double peakPressure = 0.85; // = Device pressure of 5.66. + int started = 0; int peaked = 0; int updated = 0; @@ -397,7 +421,7 @@ void main() { return Curves.easeIn.transform(lerp); } - final ForcePressGestureRecognizer force = ForcePressGestureRecognizer(interpolation: interpolateWithEasing); + final ForcePressGestureRecognizer force = ForcePressGestureRecognizer(startPressure: startPressure, peakPressure: peakPressure, interpolation: interpolateWithEasing); force.onStart = onStart; force.onPeak = (ForcePressDetails details) => peaked += 1; @@ -405,7 +429,7 @@ void main() { force.onEnd = (ForcePressDetails details) => ended += 1; const int pointerValue = 1; - final TestPointer pointer = TestPointer(); + final TestPointer pointer = TestPointer(pointerValue); const PointerDownEvent down = PointerDownEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 0, pressureMin: pressureMin, pressureMax: pressureMax); pointer.setDownInfo(down, const Offset(10.0, 10.0)); force.addPointer(down); @@ -440,7 +464,7 @@ void main() { expect(started, 1); tester.route(const PointerMoveEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 5.0, pressureMin: pressureMin, pressureMax: pressureMax)); - tester.route(const PointerMoveEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressureMin: pressureMin, pressureMax: pressureMax)); + tester.route(const PointerMoveEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 1.0, pressureMin: pressureMin, pressureMax: pressureMax)); // We have exceeded the start pressure so update should be greater than 0. expect(started, 1); @@ -460,7 +484,7 @@ void main() { tester.route(const PointerMoveEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 3.3, pressureMin: pressureMin, pressureMax: pressureMax)); tester.route(const PointerMoveEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 4.0, pressureMin: pressureMin, pressureMax: pressureMax)); tester.route(const PointerMoveEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 6.5, pressureMin: pressureMin, pressureMax: pressureMax)); - tester.route(const PointerMoveEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressureMin: pressureMin, pressureMax: pressureMax)); + tester.route(const PointerMoveEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 1.0, pressureMin: pressureMin, pressureMax: pressureMax)); // Update is still called. expect(started, 1); @@ -482,12 +506,16 @@ void main() { const double pressureMin = 0; const double pressureMax = 6.66; + // Interpolated Flutter pressure values. + const double startPressure = 0.4; // = Device pressure of 2.66. + const double peakPressure = 0.85; // = Device pressure of 5.66. + int started = 0; int peaked = 0; int updated = 0; int ended = 0; - final ForcePressGestureRecognizer force = ForcePressGestureRecognizer(); + final ForcePressGestureRecognizer force = ForcePressGestureRecognizer(startPressure: startPressure, peakPressure: peakPressure); force.onStart = (_) => started += 1; force.onPeak = (_) => peaked += 1; @@ -495,7 +523,7 @@ void main() { force.onEnd = (_) => ended += 1; const int pointerValue = 1; - final TestPointer pointer = TestPointer(); + final TestPointer pointer = TestPointer(pointerValue); const PointerDownEvent down = PointerDownEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 0, pressureMin: pressureMin, pressureMax: pressureMax); pointer.setDownInfo(down, const Offset(10.0, 10.0)); force.addPointer(down); @@ -530,12 +558,16 @@ void main() { const double pressureMin = 0; const double pressureMax = 6.66; + // Interpolated Flutter pressure values. + const double startPressure = 0.4; // = Device pressure of 2.66. + const double peakPressure = 0.85; // = Device pressure of 5.66. + int started = 0; int peaked = 0; int updated = 0; int ended = 0; - final ForcePressGestureRecognizer force = ForcePressGestureRecognizer(); + final ForcePressGestureRecognizer force = ForcePressGestureRecognizer(startPressure: startPressure, peakPressure: peakPressure); force.onStart = (_) => started += 1; force.onPeak = (_) => peaked += 1; @@ -543,7 +575,7 @@ void main() { force.onEnd = (_) => ended += 1; const int pointerValue = 1; - final TestPointer pointer = TestPointer(); + final TestPointer pointer = TestPointer(pointerValue); const PointerDownEvent down = PointerDownEvent(pointer: pointerValue, position: Offset(10.0, 10.0), pressure: 0, pressureMin: pressureMin, pressureMax: pressureMax); pointer.setDownInfo(down, const Offset(10.0, 10.0)); force.addPointer(down); diff --git a/packages/flutter/test/gestures/gesture_binding_resample_event_on_widget_test.dart b/packages/flutter/test/gestures/gesture_binding_resample_event_on_widget_test.dart index a5e272bdd2..0ea6d959bc 100644 --- a/packages/flutter/test/gestures/gesture_binding_resample_event_on_widget_test.dart +++ b/packages/flutter/test/gestures/gesture_binding_resample_event_on_widget_test.dart @@ -38,10 +38,12 @@ void main() { data: [ ui.PointerData( change: ui.PointerChange.add, + physicalX: 0.0, timeStamp: epoch, ), ui.PointerData( change: ui.PointerChange.down, + physicalX: 0.0, timeStamp: epoch, ), ui.PointerData( diff --git a/packages/flutter/test/gestures/gesture_binding_resample_event_test.dart b/packages/flutter/test/gestures/gesture_binding_resample_event_test.dart index eb3a990ab4..ce708f4dfa 100644 --- a/packages/flutter/test/gestures/gesture_binding_resample_event_test.dart +++ b/packages/flutter/test/gestures/gesture_binding_resample_event_test.dart @@ -55,7 +55,7 @@ void testResampleEvent(String description, ResampleEventTest callback) { test(description, () { fakeAsync((FakeAsync async) { callback(async); - }, initialTime: DateTime.utc(2015)); + }, initialTime: DateTime.utc(2015, 1, 1)); }, skip: isBrowser); // https://github.com/flutter/flutter/issues/87067 // Fake clock is not working with the web platform. } @@ -69,10 +69,12 @@ void main() { data: [ ui.PointerData( change: ui.PointerChange.add, + physicalX: 0.0, timeStamp: epoch, ), ui.PointerData( change: ui.PointerChange.down, + physicalX: 0.0, timeStamp: epoch + const Duration(milliseconds: 10), ), ui.PointerData( diff --git a/packages/flutter/test/gestures/gesture_binding_test.dart b/packages/flutter/test/gestures/gesture_binding_test.dart index 94616962e3..fb2ea9a3de 100644 --- a/packages/flutter/test/gestures/gesture_binding_test.dart +++ b/packages/flutter/test/gestures/gesture_binding_test.dart @@ -105,7 +105,7 @@ void main() { const ui.PointerDataPacket packet = ui.PointerDataPacket( data: [ ui.PointerData(change: ui.PointerChange.down), - ui.PointerData(), + ui.PointerData(change: ui.PointerChange.cancel), ], ); @@ -177,13 +177,14 @@ void main() { test('Should synthesize kPrimaryButton for touch when no button is set', () { final Offset location = const Offset(10.0, 10.0) * ui.window.devicePixelRatio; + const PointerDeviceKind kind = PointerDeviceKind.touch; final ui.PointerDataPacket packet = ui.PointerDataPacket( data: [ - ui.PointerData(change: ui.PointerChange.add, physicalX: location.dx, physicalY: location.dy), - ui.PointerData(change: ui.PointerChange.hover, physicalX: location.dx, physicalY: location.dy), - ui.PointerData(change: ui.PointerChange.down, physicalX: location.dx, physicalY: location.dy), - ui.PointerData(change: ui.PointerChange.move, physicalX: location.dx, physicalY: location.dy), - ui.PointerData(change: ui.PointerChange.up, physicalX: location.dx, physicalY: location.dy), + ui.PointerData(change: ui.PointerChange.add, kind: kind, physicalX: location.dx, physicalY: location.dy), + ui.PointerData(change: ui.PointerChange.hover, kind: kind, physicalX: location.dx, physicalY: location.dy), + ui.PointerData(change: ui.PointerChange.down, kind: kind, physicalX: location.dx, physicalY: location.dy), + ui.PointerData(change: ui.PointerChange.move, kind: kind, physicalX: location.dx, physicalY: location.dy), + ui.PointerData(change: ui.PointerChange.up, kind: kind, physicalX: location.dx, physicalY: location.dy), ], ); @@ -204,13 +205,14 @@ void main() { test('Should not synthesize kPrimaryButton for touch when a button is set', () { final Offset location = const Offset(10.0, 10.0) * ui.window.devicePixelRatio; + const PointerDeviceKind kind = PointerDeviceKind.touch; final ui.PointerDataPacket packet = ui.PointerDataPacket( data: [ - ui.PointerData(change: ui.PointerChange.add, physicalX: location.dx, physicalY: location.dy), - ui.PointerData(change: ui.PointerChange.hover, physicalX: location.dx, physicalY: location.dy), - ui.PointerData(change: ui.PointerChange.down, buttons: kSecondaryButton, physicalX: location.dx, physicalY: location.dy), - ui.PointerData(change: ui.PointerChange.move, buttons: kSecondaryButton, physicalX: location.dx, physicalY: location.dy), - ui.PointerData(change: ui.PointerChange.up, physicalX: location.dx, physicalY: location.dy), + ui.PointerData(change: ui.PointerChange.add, kind: kind, physicalX: location.dx, physicalY: location.dy), + ui.PointerData(change: ui.PointerChange.hover, kind: kind, physicalX: location.dx, physicalY: location.dy), + ui.PointerData(change: ui.PointerChange.down, buttons: kSecondaryButton, kind: kind, physicalX: location.dx, physicalY: location.dy), + ui.PointerData(change: ui.PointerChange.move, buttons: kSecondaryButton, kind: kind, physicalX: location.dx, physicalY: location.dy), + ui.PointerData(change: ui.PointerChange.up, kind: kind, physicalX: location.dx, physicalY: location.dy), ], ); diff --git a/packages/flutter/test/gestures/long_press_test.dart b/packages/flutter/test/gestures/long_press_test.dart index 5264dda2af..9dae18658e 100644 --- a/packages/flutter/test/gestures/long_press_test.dart +++ b/packages/flutter/test/gestures/long_press_test.dart @@ -527,6 +527,7 @@ void main() { const PointerDownEvent touchDown = PointerDownEvent( pointer: 5, position: Offset(10, 10), + kind: PointerDeviceKind.touch, ); // Touch events shouldn't be recognized. diff --git a/packages/flutter/test/gestures/multitap_test.dart b/packages/flutter/test/gestures/multitap_test.dart index 643308cc2c..7d0a0449e5 100644 --- a/packages/flutter/test/gestures/multitap_test.dart +++ b/packages/flutter/test/gestures/multitap_test.dart @@ -86,7 +86,7 @@ void main() { tap.onTapCancel = (int pointer) { log.add('tap-cancel $pointer'); }; - final TestPointer touchPointer5 = TestPointer(5); + final TestPointer touchPointer5 = TestPointer(5, PointerDeviceKind.touch); final PointerDownEvent down5 = touchPointer5.down(const Offset(10.0, 10.0)); tap.addPointer(down5); tester.closeArena(5); @@ -102,7 +102,7 @@ void main() { // Mouse down should be ignored by the recognizer. expect(log, isEmpty); - final TestPointer touchPointer7 = TestPointer(7); + final TestPointer touchPointer7 = TestPointer(7, PointerDeviceKind.touch); final PointerDownEvent down7 = touchPointer7.down(const Offset(15.0, 15.0)); tap.addPointer(down7); tester.closeArena(7); diff --git a/packages/flutter/test/gestures/pointer_router_test.dart b/packages/flutter/test/gestures/pointer_router_test.dart index 130b35b358..7e52e6e660 100644 --- a/packages/flutter/test/gestures/pointer_router_test.dart +++ b/packages/flutter/test/gestures/pointer_router_test.dart @@ -176,7 +176,7 @@ void main() { globalEvents.add(event); }, transform); - final TestPointer pointer1 = TestPointer(); + final TestPointer pointer1 = TestPointer(1); const Offset firstPosition = Offset(16, 36); router.route(pointer1.down(firstPosition)); diff --git a/packages/flutter/test/gestures/scale_test.dart b/packages/flutter/test/gestures/scale_test.dart index 2fa31992be..9a64b003de 100644 --- a/packages/flutter/test/gestures/scale_test.dart +++ b/packages/flutter/test/gestures/scale_test.dart @@ -45,7 +45,7 @@ void main() { didTap = true; }; - final TestPointer pointer1 = TestPointer(); + final TestPointer pointer1 = TestPointer(1); final PointerDownEvent down = pointer1.down(Offset.zero); scale.addPointer(down); @@ -302,7 +302,7 @@ void main() { didEndScale = true; }; - final TestPointer touchPointer = TestPointer(); + final TestPointer touchPointer = TestPointer(1, PointerDeviceKind.touch); final PointerDownEvent down = touchPointer.down(Offset.zero); scale.addPointer(down); @@ -357,7 +357,7 @@ void main() { drag.onStart = (DragStartDetails details) { log.add('drag-start'); }; drag.onEnd = (DragEndDetails details) { log.add('drag-end'); }; - final TestPointer pointer1 = TestPointer(); + final TestPointer pointer1 = TestPointer(1); final PointerDownEvent down = pointer1.down(const Offset(10.0, 10.0)); scale.addPointer(down); @@ -455,7 +455,7 @@ void main() { didTap = true; }; - final TestPointer pointer1 = TestPointer(); + final TestPointer pointer1 = TestPointer(1); final PointerDownEvent down = pointer1.down(Offset.zero); scale.addPointer(down); @@ -633,7 +633,7 @@ void main() { updatedRotation = details.rotation; }; - final TestPointer pointer1 = TestPointer(); + final TestPointer pointer1 = TestPointer(1); final PointerDownEvent down = pointer1.down(Offset.zero); scale.addPointer(down); tester.closeArena(1); @@ -664,7 +664,7 @@ void main() { int pointerCountOfEnd = 0; scale.onEnd = (ScaleEndDetails details) => pointerCountOfEnd = details.pointerCount; - final TestPointer pointer1 = TestPointer(); + final TestPointer pointer1 = TestPointer(1); final PointerDownEvent down = pointer1.down(Offset.zero); scale.addPointer(down); tester.closeArena(1); diff --git a/packages/flutter/test/gestures/tap_test.dart b/packages/flutter/test/gestures/tap_test.dart index 89ab65eb48..a2e4612142 100644 --- a/packages/flutter/test/gestures/tap_test.dart +++ b/packages/flutter/test/gestures/tap_test.dart @@ -1020,7 +1020,7 @@ void main() { final HorizontalDragGestureRecognizer drag = HorizontalDragGestureRecognizer() ..onStart = (_) {}; - final TestPointer pointer1 = TestPointer(); + final TestPointer pointer1 = TestPointer(1); final PointerDownEvent down = pointer1.down(Offset.zero); drag.addPointer(down); diff --git a/packages/flutter/test/material/about_test.dart b/packages/flutter/test/material/about_test.dart index 0795865379..4010148873 100644 --- a/packages/flutter/test/material/about_test.dart +++ b/packages/flutter/test/material/about_test.dart @@ -52,7 +52,7 @@ void main() { expect(find.text('About box'), findsNothing); await tester.tap(find.byType(IconButton)); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(const Duration(milliseconds: 100)); expect(find.text('About Pirate app'), findsOneWidget); expect(find.text('0.1.2'), findsNothing); @@ -64,7 +64,7 @@ void main() { expect(find.text('About box'), findsNothing); await tester.tap(find.text('About Pirate app')); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(const Duration(milliseconds: 100)); expect(find.text('About Pirate app'), findsOneWidget); expect(find.text('0.1.2'), findsOneWidget); @@ -82,7 +82,7 @@ void main() { }); await tester.tap(find.text('VIEW LICENSES')); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(const Duration(milliseconds: 100)); expect(find.text('Pirate app'), findsOneWidget); expect(find.text('0.1.2'), findsOneWidget); @@ -92,7 +92,7 @@ void main() { findsOneWidget, ); await tester.tap(find.text('Pirate package ')); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(const Duration(milliseconds: 100)); expect(find.text('Pirate license'), findsOneWidget); }); @@ -143,7 +143,7 @@ void main() { // Check license is displayed after entering into license page for 'AAA'. await tester.tap(find.text('AAA')); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(const Duration(milliseconds: 100)); expect(find.text('BBB'), findsOneWidget); /// Go back to list of packages. @@ -153,7 +153,7 @@ void main() { /// Check license is displayed after entering into license page for /// 'Another package'. await tester.tap(find.text('Another package')); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(const Duration(milliseconds: 100)); expect(find.text('Another license'), findsOneWidget); }); @@ -219,7 +219,7 @@ void main() { // Check license is displayed after entering into license page for 'AAA'. await tester.tap(find.text('AAA')); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(const Duration(milliseconds: 100)); expect(find.text('BBB'), findsOneWidget); /// Go back to list of packages. @@ -229,7 +229,7 @@ void main() { /// Check license is displayed after entering into license page for /// 'Another package'. await tester.tap(find.text('Another package')); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(const Duration(milliseconds: 100)); expect(find.text('Another license'), findsOneWidget); }); @@ -271,7 +271,7 @@ void main() { // Check license is displayed after entering into license page for 'AAA'. await tester.tap(find.text('AAA')); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(const Duration(milliseconds: 100)); // Check for titles style. final Text title = tester.widget(find.text('AAA')); @@ -329,7 +329,7 @@ void main() { // Check license is displayed after entering into license page for 'AAA'. await tester.tap(find.text('AAA')); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(const Duration(milliseconds: 100)); // Check for titles style. final Text title = tester.widget(find.text('AAA')); @@ -728,7 +728,7 @@ void main() { expect(find.text('AAA'), findsOneWidget); // Check license is displayed after entering into license page for 'AAA'. await tester.tap(find.text('AAA')); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(const Duration(milliseconds: 100)); // The inherited ScrollBehavior should not apply Scrollbars since they are // already built in to the widget. diff --git a/packages/flutter/test/material/app_bar_test.dart b/packages/flutter/test/material/app_bar_test.dart index b1ee467560..53009493d4 100644 --- a/packages/flutter/test/material/app_bar_test.dart +++ b/packages/flutter/test/material/app_bar_test.dart @@ -654,7 +654,11 @@ void main() { }); testWidgets('SliverAppBar default configuration', (WidgetTester tester) async { - await tester.pumpWidget(buildSliverAppBarApp()); + await tester.pumpWidget(buildSliverAppBarApp( + floating: false, + pinned: false, + expandedHeight: null, + )); final ScrollController controller = primaryScrollController(tester); expect(controller.offset, 0.0); @@ -688,6 +692,7 @@ void main() { testWidgets('SliverAppBar expandedHeight, pinned', (WidgetTester tester) async { await tester.pumpWidget(buildSliverAppBarApp( + floating: false, pinned: true, expandedHeight: 128.0, )); @@ -753,6 +758,7 @@ void main() { testWidgets('SliverAppBar expandedHeight, floating with snap:true', (WidgetTester tester) async { await tester.pumpWidget(buildSliverAppBarApp( floating: true, + pinned: false, snap: true, expandedHeight: 128.0, )); @@ -921,6 +927,8 @@ void main() { const double collapsedAppBarHeight = 200.0; await tester.pumpWidget(buildSliverAppBarApp( + floating: false, + pinned: false, collapsedHeight: collapsedAppBarHeight, expandedHeight: expandedAppBarHeight, )); @@ -1065,6 +1073,7 @@ void main() { child: MediaQuery( data: topPadding100, child: Scaffold( + primary: true, appBar: AppBar( title: const Text('title'), ), @@ -1116,6 +1125,7 @@ void main() { child: MediaQuery( data: topPadding100, child: Scaffold( + primary: true, appBar: AppBar( bottom: PreferredSize( preferredSize: const Size.fromHeight(200.0), @@ -1167,6 +1177,7 @@ void main() { child: MediaQuery( data: const MediaQueryData(padding: EdgeInsets.symmetric(vertical: 100.0)), child: Scaffold( + primary: true, body: Column( children: [ AppBar( @@ -1429,6 +1440,7 @@ void main() { height: 50.0, padding: const EdgeInsets.all(4.0), child: const Placeholder( + strokeWidth: 2.0, color: Color(0xFFFFFFFF), ), ), @@ -1460,6 +1472,7 @@ void main() { height: 50.0, padding: const EdgeInsets.all(4.0), child: const Placeholder( + strokeWidth: 2.0, color: Color(0xFFFFFFFF), ), ), @@ -2060,6 +2073,7 @@ void main() { slivers: [ SliverAppBar( expandedHeight: appBarHeight, + pinned: false, floating: true, snap: snap, actions: [ @@ -2362,6 +2376,8 @@ void main() { const double toolbarHeight = 100.0; await tester.pumpWidget(buildSliverAppBarApp( + floating: false, + pinned: false, toolbarHeight: toolbarHeight, )); @@ -2382,6 +2398,8 @@ void main() { const double collapsedHeight = 150.0; await tester.pumpWidget(buildSliverAppBarApp( + floating: false, + pinned: false, toolbarHeight: toolbarHeight, collapsedHeight: collapsedHeight, )); @@ -2400,6 +2418,8 @@ void main() { const double collapsedHeight = 56.0; await tester.pumpWidget(buildSliverAppBarApp( + floating: false, + pinned: false, collapsedHeight: collapsedHeight, )); @@ -2478,7 +2498,10 @@ void main() { }); testWidgets('SliverAppBar.titleSpacing defaults to NavigationToolbar.kMiddleSpacing', (WidgetTester tester) async { - await tester.pumpWidget(buildSliverAppBarApp()); + await tester.pumpWidget(buildSliverAppBarApp( + floating: false, + pinned: false, + )); final NavigationToolbar navToolBar = tester.widget(find.byType(NavigationToolbar)); expect(navToolBar.middleSpacing, NavigationToolbar.kMiddleSpacing); diff --git a/packages/flutter/test/material/app_bar_theme_test.dart b/packages/flutter/test/material/app_bar_theme_test.dart index 171dbe5594..5029f645fd 100644 --- a/packages/flutter/test/material/app_bar_theme_test.dart +++ b/packages/flutter/test/material/app_bar_theme_test.dart @@ -343,7 +343,7 @@ void main() { ); } - await tester.pumpWidget(buildFrame(appIconColor: Colors.lime)); + await tester.pumpWidget(buildFrame(appIconColor: Colors.lime, appBarIconColor: null)); expect(getIconText().text.style!.color, Colors.lime); await tester.pumpWidget(buildFrame(appIconColor: Colors.lime, appBarIconColor: Colors.purple)); diff --git a/packages/flutter/test/material/app_test.dart b/packages/flutter/test/material/app_test.dart index d42a42410e..615e18fdeb 100644 --- a/packages/flutter/test/material/app_test.dart +++ b/packages/flutter/test/material/app_test.dart @@ -631,6 +631,7 @@ void main() { darkTheme: ThemeData( brightness: Brightness.dark, ), + themeMode: ThemeMode.system, home: Builder( builder: (BuildContext context) { appliedTheme = Theme.of(context); @@ -656,6 +657,7 @@ void main() { darkTheme: ThemeData( brightness: Brightness.dark, ), + themeMode: ThemeMode.system, home: Builder( builder: (BuildContext context) { appliedTheme = Theme.of(context); diff --git a/packages/flutter/test/material/bottom_app_bar_test.dart b/packages/flutter/test/material/bottom_app_bar_test.dart index 3b409027f5..9b198bfb2d 100644 --- a/packages/flutter/test/material/bottom_app_bar_test.dart +++ b/packages/flutter/test/material/bottom_app_bar_test.dart @@ -172,7 +172,9 @@ void main() { await tester.pumpWidget( const MaterialApp( home: Scaffold( - bottomNavigationBar: BottomAppBar(), + bottomNavigationBar: BottomAppBar( + shape: null, + ), ), ), ); @@ -192,7 +194,9 @@ void main() { await tester.pumpWidget( const MaterialApp( home: Scaffold( - bottomNavigationBar: ShapeListener(BottomAppBar()), + bottomNavigationBar: ShapeListener(BottomAppBar( + shape: null, + )), floatingActionButton: FloatingActionButton( onPressed: null, child: Icon(Icons.add), @@ -350,11 +354,12 @@ void main() { await tester.pumpWidget( const MaterialApp( home: Scaffold( - bottomNavigationBar: BottomAppBar( - shape: RectangularNotch(), - notchMargin: 0.0, - child: SizedBox(height: 100.0), - ), + bottomNavigationBar: + BottomAppBar( + shape: RectangularNotch(), + notchMargin: 0.0, + child: SizedBox(height: 100.0), + ), ), ), ); diff --git a/packages/flutter/test/material/bottom_navigation_bar_test.dart b/packages/flutter/test/material/bottom_navigation_bar_test.dart index 88cf921ec8..5a8bff6432 100644 --- a/packages/flutter/test/material/bottom_navigation_bar_test.dart +++ b/packages/flutter/test/material/bottom_navigation_bar_test.dart @@ -290,6 +290,7 @@ void main() { testWidgets('Padding is calculated properly on items - all labels', (WidgetTester tester) async { const double selectedFontSize = 16.0; + const double unselectedFontSize = 12.0; const double selectedIconSize = 36.0; const double unselectedIconSize = 20.0; const IconThemeData selectedIconTheme = IconThemeData(size: selectedIconSize); @@ -303,6 +304,7 @@ void main() { showSelectedLabels: true, showUnselectedLabels: true, selectedFontSize: selectedFontSize, + unselectedFontSize: unselectedFontSize, selectedIconTheme: selectedIconTheme, unselectedIconTheme: unselectedIconTheme, items: const [ @@ -331,6 +333,7 @@ void main() { testWidgets('Padding is calculated properly on items - selected labels only', (WidgetTester tester) async { const double selectedFontSize = 16.0; + const double unselectedFontSize = 12.0; const double selectedIconSize = 36.0; const double unselectedIconSize = 20.0; const IconThemeData selectedIconTheme = IconThemeData(size: selectedIconSize); @@ -344,6 +347,7 @@ void main() { showSelectedLabels: true, showUnselectedLabels: false, selectedFontSize: selectedFontSize, + unselectedFontSize: unselectedFontSize, selectedIconTheme: selectedIconTheme, unselectedIconTheme: unselectedIconTheme, items: const [ @@ -371,6 +375,7 @@ void main() { testWidgets('Padding is calculated properly on items - no labels', (WidgetTester tester) async { const double selectedFontSize = 16.0; + const double unselectedFontSize = 12.0; const double selectedIconSize = 36.0; const double unselectedIconSize = 20.0; const IconThemeData selectedIconTheme = IconThemeData(size: selectedIconSize); @@ -384,6 +389,7 @@ void main() { showSelectedLabels: false, showUnselectedLabels: false, selectedFontSize: selectedFontSize, + unselectedFontSize: unselectedFontSize, selectedIconTheme: selectedIconTheme, unselectedIconTheme: unselectedIconTheme, items: const [ @@ -1486,6 +1492,7 @@ void main() { home: Scaffold( bottomNavigationBar: BottomNavigationBar( type: BottomNavigationBarType.fixed, + currentIndex: 0, items: List.generate(itemCount, (int itemIndex) { return BottomNavigationBarItem( icon: const Icon(Icons.android), @@ -2025,6 +2032,7 @@ void main() { builder: (BuildContext context) { return Scaffold( bottomNavigationBar: BottomNavigationBar( + currentIndex: 0, items: [ BottomNavigationBarItem( icon: SizedBox(key: icon0, width: 200, height: 10), @@ -2073,6 +2081,7 @@ void main() { builder: (BuildContext context) { return Scaffold( bottomNavigationBar: BottomNavigationBar( + currentIndex: 0, landscapeLayout: BottomNavigationBarLandscapeLayout.centered, items: [ BottomNavigationBarItem( @@ -2117,6 +2126,7 @@ void main() { builder: (BuildContext context) { return Scaffold( bottomNavigationBar: BottomNavigationBar( + currentIndex: 0, landscapeLayout: BottomNavigationBarLandscapeLayout.linear, items: [ BottomNavigationBarItem( diff --git a/packages/flutter/test/material/button_style_test.dart b/packages/flutter/test/material/button_style_test.dart index b9a2640429..998dbc5d47 100644 --- a/packages/flutter/test/material/button_style_test.dart +++ b/packages/flutter/test/material/button_style_test.dart @@ -164,8 +164,8 @@ void main() { expect(ButtonStyle.lerp(null, null, 0.5), null); expect(ButtonStyle.lerp(null, null, 1), null); - const BorderSide blackSide = BorderSide(); - const BorderSide whiteSide = BorderSide(color: Color(0xFFFFFFFF)); + const BorderSide blackSide = BorderSide(width: 1, color: Color(0xFF000000)); + const BorderSide whiteSide = BorderSide(width: 1, color: Color(0xFFFFFFFF)); const BorderSide emptyBlackSide = BorderSide(width: 0, color: Color(0x00000000)); final ButtonStyle blackStyle = ButtonStyle(side: MaterialStateProperty.all(blackSide)); diff --git a/packages/flutter/test/material/button_theme_test.dart b/packages/flutter/test/material/button_theme_test.dart index ff536ab26f..0ff40626cb 100644 --- a/packages/flutter/test/material/button_theme_test.dart +++ b/packages/flutter/test/material/button_theme_test.dart @@ -400,5 +400,6 @@ void main() { await tester.pump(const Duration(milliseconds: 800)); // Wait for splash and highlight to be well under way. expect(textColor(), pressedColor); }, + semanticsEnabled: true, ); } diff --git a/packages/flutter/test/material/calendar_date_picker_test.dart b/packages/flutter/test/material/calendar_date_picker_test.dart index 3a47e27d4b..82c64efdc2 100644 --- a/packages/flutter/test/material/calendar_date_picker_test.dart +++ b/packages/flutter/test/material/calendar_date_picker_test.dart @@ -34,7 +34,7 @@ void main() { child: CalendarDatePicker( key: key, initialDate: initialDate ?? DateTime(2016, DateTime.january, 15), - firstDate: firstDate ?? DateTime(2001), + firstDate: firstDate ?? DateTime(2001, DateTime.january, 1), lastDate: lastDate ?? DateTime(2031, DateTime.december, 31), currentDate: currentDate ?? DateTime(2016, DateTime.january, 3), onDateChanged: onDateChanged ?? (DateTime date) {}, @@ -65,7 +65,7 @@ void main() { key: key, selectedDate: selectedDate ?? DateTime(2016, DateTime.january, 15), initialDate: initialDate ?? DateTime(2016, DateTime.january, 15), - firstDate: firstDate ?? DateTime(2001), + firstDate: firstDate ?? DateTime(2001, DateTime.january, 1), lastDate: lastDate ?? DateTime(2031, DateTime.december, 31), currentDate: currentDate ?? DateTime(2016, DateTime.january, 3), onChanged: onChanged ?? (DateTime date) {}, @@ -96,17 +96,17 @@ void main() { await tester.tap(previousMonthIcon); await tester.pumpAndSettle(); expect(find.text('December 2015'), findsOneWidget); - expect(displayedMonth, equals(DateTime(2015, DateTime.december))); + expect(displayedMonth, equals(DateTime(2015, DateTime.december, 1))); await tester.tap(previousMonthIcon); await tester.pumpAndSettle(); expect(find.text('November 2015'), findsOneWidget); - expect(displayedMonth, equals(DateTime(2015, DateTime.november))); + expect(displayedMonth, equals(DateTime(2015, DateTime.november, 1))); // Go forward a month await tester.tap(nextMonthIcon); await tester.pumpAndSettle(); expect(find.text('December 2015'), findsOneWidget); - expect(displayedMonth, equals(DateTime(2015, DateTime.december))); + expect(displayedMonth, equals(DateTime(2015, DateTime.december, 1))); }); testWidgets('Can select a year', (WidgetTester tester) async { @@ -120,7 +120,7 @@ void main() { await tester.tap(find.text('2018')); await tester.pumpAndSettle(); expect(find.text('January 2018'), findsOneWidget); - expect(displayedMonth, equals(DateTime(2018))); + expect(displayedMonth, equals(DateTime(2018, DateTime.january, 1))); }); testWidgets('Selecting date does not change displayed month', (WidgetTester tester) async { @@ -135,12 +135,12 @@ void main() { await tester.tap(nextMonthIcon); await tester.pumpAndSettle(); expect(find.text('April 2020'), findsOneWidget); - expect(displayedMonth, equals(DateTime(2020, DateTime.april))); + expect(displayedMonth, equals(DateTime(2020, DateTime.april, 1))); await tester.tap(find.text('25')); await tester.pumpAndSettle(); expect(find.text('April 2020'), findsOneWidget); - expect(displayedMonth, equals(DateTime(2020, DateTime.april))); + expect(displayedMonth, equals(DateTime(2020, DateTime.april, 1))); expect(selectedDate, equals(DateTime(2020, DateTime.april, 25))); // There isn't a 31 in April so there shouldn't be one if it is showing April. expect(find.text('31'), findsNothing); @@ -174,7 +174,7 @@ void main() { await tester.tap(find.text('2018')); await tester.pumpAndSettle(); expect(find.text('March 2018'), findsOneWidget); - expect(displayedMonth, equals(DateTime(2018, DateTime.march))); + expect(displayedMonth, equals(DateTime(2018, DateTime.march, 1))); }); testWidgets('Can select a year and then a day', (WidgetTester tester) async { @@ -224,7 +224,7 @@ void main() { await tester.tap(nextMonthIcon); await tester.pumpAndSettle(); - expect(displayedMonth, equals(DateTime(2017, DateTime.february))); + expect(displayedMonth, equals(DateTime(2017, DateTime.february, 1))); // Shouldn't be possible to keep going forward into March. expect(nextMonthIcon, findsNothing); @@ -232,7 +232,7 @@ void main() { await tester.pumpAndSettle(); await tester.tap(previousMonthIcon); await tester.pumpAndSettle(); - expect(displayedMonth, equals(DateTime(2016, DateTime.december))); + expect(displayedMonth, equals(DateTime(2016, DateTime.december, 1))); // Shouldn't be possible to keep going backward into November. expect(previousMonthIcon, findsNothing); }); @@ -272,7 +272,7 @@ void main() { await tester.pumpAndSettle(); // Month should be clamped to June as the range starts at June 2016. expect(find.text('June 2016'), findsOneWidget); - expect(displayedMonth, DateTime(2016, DateTime.june)); + expect(displayedMonth, DateTime(2016, DateTime.june, 1)); }); testWidgets('Selecting lastDate year respects lastDate', (WidgetTester tester) async { @@ -289,7 +289,7 @@ void main() { await tester.pumpAndSettle(); // Month should be clamped to January as the range ends at January 2019. expect(find.text('January 2019'), findsOneWidget); - expect(displayedMonth, DateTime(2019)); + expect(displayedMonth, DateTime(2019, DateTime.january, 1)); }); testWidgets('Only predicate days are selectable', (WidgetTester tester) async { @@ -355,7 +355,7 @@ void main() { final Key pickerKey = UniqueKey(); final DateTime initialDate = DateTime(2020, 1, 21); final DateTime updatedDate = DateTime(1976, 2, 23); - final DateTime firstDate = DateTime(1970); + final DateTime firstDate = DateTime(1970, 1, 1); final DateTime lastDate = DateTime(2099, 31, 12); const Color selectedColor = Color(0xff2196f3); // default primary color @@ -413,6 +413,7 @@ void main() { await tester.pumpWidget(calendarDatePicker( key: pickerKey, + initialCalendarMode: DatePickerMode.day, )); await tester.pumpAndSettle(); @@ -871,7 +872,7 @@ void main() { await tester.pumpAndSettle(); await tester.tap(find.text('2018')); await tester.pumpAndSettle(); - expect(selectedDate, equals(DateTime(2018))); + expect(selectedDate, equals(DateTime(2018, DateTime.january, 1))); }); testWidgets('Cannot select disabled year', (WidgetTester tester) async { @@ -890,7 +891,7 @@ void main() { expect(selectedYear, isNull); await tester.tap(find.text('2018')); await tester.pumpAndSettle(); - expect(selectedYear, equals(DateTime(2018, DateTime.july))); + expect(selectedYear, equals(DateTime(2018, DateTime.july, 1))); }); }); } diff --git a/packages/flutter/test/material/card_test.dart b/packages/flutter/test/material/card_test.dart index 6eb4823d2b..908e14165c 100644 --- a/packages/flutter/test/material/card_test.dart +++ b/packages/flutter/test/material/card_test.dart @@ -87,6 +87,7 @@ void main() { child: Material( child: Center( child: Card( + semanticContainer: true, child: Column( children: const [ Text('First child'), @@ -180,7 +181,7 @@ void main() { clipBehavior: Clip.antiAliasWithSaveLayer, ), ), - child: const Card(), + child: const Card(clipBehavior: null), ); })); expect(tester.widget(find.byType(Material)).clipBehavior, Clip.antiAliasWithSaveLayer); diff --git a/packages/flutter/test/material/checkbox_test.dart b/packages/flutter/test/material/checkbox_test.dart index cc4d9ee5aa..2310376de7 100644 --- a/packages/flutter/test/material/checkbox_test.dart +++ b/packages/flutter/test/material/checkbox_test.dart @@ -978,7 +978,7 @@ void main() { ); } - await tester.pumpWidget(buildCheckbox(useOverlay: false)); + await tester.pumpWidget(buildCheckbox(active: false, useOverlay: false)); await tester.startGesture(tester.getCenter(find.byType(Checkbox))); await tester.pumpAndSettle(); @@ -1006,7 +1006,7 @@ void main() { reason: 'Default active pressed Checkbox should have overlay color from fillColor', ); - await tester.pumpWidget(buildCheckbox()); + await tester.pumpWidget(buildCheckbox(active: false)); await tester.startGesture(tester.getCenter(find.byType(Checkbox))); await tester.pumpAndSettle(); @@ -1252,7 +1252,7 @@ void main() { expect(getCheckboxRenderer(), isNot(paints..drrect())); // no border expect(getCheckboxRenderer(), paints..path(color: activeColor)); // checkbox fill - await tester.pumpWidget(buildApp()); + await tester.pumpWidget(buildApp(value: null)); await tester.pumpAndSettle(); expect(getCheckboxRenderer(), isNot(paints..drrect())); // no border expect(getCheckboxRenderer(), paints..path(color: activeColor)); // checkbox fill @@ -1305,7 +1305,7 @@ void main() { await tester.pumpAndSettle(); expectBorder(); - await tester.pumpWidget(buildApp()); + await tester.pumpWidget(buildApp(value: null)); await tester.pumpAndSettle(); expectBorder(); }); diff --git a/packages/flutter/test/material/chip_test.dart b/packages/flutter/test/material/chip_test.dart index 6fbe965543..7d818fbe48 100644 --- a/packages/flutter/test/material/chip_test.dart +++ b/packages/flutter/test/material/chip_test.dart @@ -618,6 +618,7 @@ void main() { expect(tester.getCenter(find.text('ABC')).dx, greaterThan(tester.getCenter(find.byKey(iconKey)).dx)); await tester.pumpWidget( _wrapForChip( + textDirection: TextDirection.ltr, child: test, ), ); @@ -786,6 +787,7 @@ void main() { final GlobalKey keyB = GlobalKey(); await tester.pumpWidget( _wrapForChip( + textDirection: TextDirection.ltr, child: Overlay( initialEntries: [ OverlayEntry( @@ -1413,6 +1415,9 @@ void main() { selected: selected, label: Text('Long Chip Label', key: labelKey), shape: const StadiumBorder(), + showCheckmark: true, + tapEnabled: true, + isEnabled: true, ); }), ], @@ -1492,6 +1497,9 @@ void main() { selected: selected, label: Text('Long Chip Label', key: labelKey), shape: const StadiumBorder(), + showCheckmark: true, + tapEnabled: true, + isEnabled: true, ); }), ], @@ -1567,6 +1575,8 @@ void main() { label: Text('Long Chip Label', key: labelKey), shape: const StadiumBorder(), showCheckmark: false, + tapEnabled: true, + isEnabled: true, ); }), ], @@ -1610,6 +1620,7 @@ void main() { Widget buildChip(ChipThemeData data) { return _wrapForChip( + textDirection: TextDirection.ltr, child: Theme( data: theme, child: const InputChip( @@ -1639,6 +1650,7 @@ void main() { Widget buildChip() { return _wrapForChip( + textDirection: TextDirection.ltr, child: Theme( data: theme, child: const Chip( @@ -1718,6 +1730,7 @@ void main() { return RawChip( showCheckmark: showCheckmark, onDeleted: isDeletable ? () { } : null, + tapEnabled: true, avatar: avatar, deleteIcon: deleteIcon, isEnabled: isSelectable || isPressable, @@ -1763,7 +1776,7 @@ void main() { await tester.pumpAndSettle(); // Check default theme with disabled widget. - await tester.pumpWidget(buildApp(isSelectable: false)); + await tester.pumpWidget(buildApp(isSelectable: false, isPressable: false, isDeletable: true)); await tester.pumpAndSettle(); materialBox = getMaterialBox(tester); labelStyle = getLabelStyle(tester); @@ -1803,6 +1816,8 @@ void main() { await tester.pumpWidget(buildApp( chipTheme: customTheme, isSelectable: false, + isPressable: false, + isDeletable: true, )); await tester.pumpAndSettle(); materialBox = getMaterialBox(tester); @@ -1981,6 +1996,7 @@ void main() { await tester.pumpWidget(MaterialApp( home: Material( child: RawChip( + isEnabled: true, label: const Text('test'), selected: selected, onSelected: (bool value) { @@ -2032,6 +2048,7 @@ void main() { await tester.pumpWidget(MaterialApp( home: Material( child: RawChip( + isEnabled: true, label: const Text('test'), selected: selected, onSelected: (bool value) { @@ -2191,6 +2208,8 @@ void main() { await tester.pumpWidget(MaterialApp( home: Material( child: RawChip( + isEnabled: true, + tapEnabled: true, onPressed: () {}, label: const Text('test'), ), @@ -2244,6 +2263,8 @@ void main() { await tester.pumpWidget(const MaterialApp( home: Material( child: RawChip( + isEnabled: true, + tapEnabled: true, label: Text('test'), ), ), @@ -2296,7 +2317,7 @@ void main() { children: [ Chip( materialTapTargetSize: MaterialTapTargetSize.padded, - shape: const RoundedRectangleBorder(), + shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), avatar: const CircleAvatar(child: Text('A')), label: const Text('Chip A'), onDeleted: () { @@ -2333,6 +2354,7 @@ void main() { const MaterialApp( home: Material( child: RawChip( + selected: false, label: Text('raw chip'), ), ), @@ -2361,6 +2383,7 @@ void main() { home: Material( child: FilterChip( onSelected: (bool valueChanged) { }, + selected: false, label: const Text('filter chip'), ), ), @@ -2374,6 +2397,7 @@ void main() { const MaterialApp( home: Material( child: InputChip( + selected: false, label: Text('input chip'), ), ), @@ -2396,6 +2420,7 @@ void main() { Widget buildChip(ChipThemeData data) { return _wrapForChip( + textDirection: TextDirection.ltr, child: Theme( data: theme, child: inputChip, @@ -2442,7 +2467,7 @@ void main() { children: [ InputChip( materialTapTargetSize: MaterialTapTargetSize.padded, - shape: const RoundedRectangleBorder(), + shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), avatar: const CircleAvatar(child: Text('A')), label: const Text('Chip A'), onPressed: () { @@ -2463,7 +2488,7 @@ void main() { await tester.pumpWidget( _wrapForChip( child: InputChip( - shape: const RoundedRectangleBorder(), + shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), avatar: const CircleAvatar(child: Text('A')), label: const Text('Chip A'), onPressed: () { }, @@ -2471,7 +2496,7 @@ void main() { ), ); - expect(find.byType(InputChip).hitTestable(), findsOneWidget); + expect(find.byType(InputChip).hitTestable(at: Alignment.center), findsOneWidget); }); void checkChipMaterialClipBehavior(WidgetTester tester, Clip clipBehavior) { @@ -2677,7 +2702,7 @@ void main() { else if (states.contains(MaterialState.selected)) sideColor = selectedColor; - return BorderSide(color: sideColor); + return BorderSide(color: sideColor, width: 1); } Widget chipWidget({ bool enabled = true, bool selected = false }) { @@ -2762,7 +2787,7 @@ void main() { else if (states.contains(MaterialState.selected)) sideColor = selectedColor; - return BorderSide(color: sideColor); + return BorderSide(color: sideColor, width: 1); } Widget chipWidget({ bool enabled = true, bool selected = false }) { @@ -2850,7 +2875,7 @@ void main() { else if (states.contains(MaterialState.selected)) return null; - return BorderSide(color: sideColor); + return BorderSide(color: sideColor, width: 1); } Widget chipWidget({ bool enabled = true, bool selected = false }) { @@ -2993,8 +3018,8 @@ void main() { testWidgets('Chip defers to theme, if shape and side resolves to null', (WidgetTester tester) async { const OutlinedBorder themeShape = StadiumBorder(); const OutlinedBorder selectedShape = RoundedRectangleBorder(); - const BorderSide themeBorderSide = BorderSide(color: Color(0x00000001)); - const BorderSide selectedBorderSide = BorderSide(color: Color(0x00000002)); + const BorderSide themeBorderSide = BorderSide(color: Color(0x00000001), width: 1); + const BorderSide selectedBorderSide = BorderSide(color: Color(0x00000002), width: 1); OutlinedBorder? getShape(Set states) { if (states.contains(MaterialState.selected)) @@ -3046,7 +3071,7 @@ void main() { child: InputChip( focusNode: focusNode, autofocus: true, - shape: const RoundedRectangleBorder(), + shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), avatar: const CircleAvatar(child: Text('A')), label: const Text('Chip A'), onPressed: () { }, @@ -3061,9 +3086,10 @@ void main() { child: InputChip( focusNode: focusNode, autofocus: true, - shape: const RoundedRectangleBorder(), + shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), avatar: const CircleAvatar(child: Text('A')), label: const Text('Chip A'), + onPressed: null, ), ), ); @@ -3088,6 +3114,7 @@ void main() { focusNode: focusNode2, autofocus: true, label: const Text('Chip B'), + onPressed: null, ), ], ), @@ -3213,6 +3240,7 @@ void main() { await _pumpCheckmarkChip( tester, chip: _selectedInputChip(), + brightness: Brightness.light, ); _expectCheckmarkColor( @@ -3225,6 +3253,7 @@ void main() { await _pumpCheckmarkChip( tester, chip: _selectedFilterChip(), + brightness: Brightness.light, ); _expectCheckmarkColor( @@ -3395,6 +3424,7 @@ void main() { _chipWithOptionalDeleteButton( deleteButtonKey: deleteButtonKey, deletable: true, + useDeleteButtonTooltip: true, chipTooltip: 'Chip Tooltip', ), ); diff --git a/packages/flutter/test/material/chip_theme_test.dart b/packages/flutter/test/material/chip_theme_test.dart index 2fbdd7792c..a9fa9d184f 100644 --- a/packages/flutter/test/material/chip_theme_test.dart +++ b/packages/flutter/test/material/chip_theme_test.dart @@ -93,11 +93,16 @@ void main() { child: Theme( data: theme, child: RawChip( + showCheckmark: true, onDeleted: () { }, + tapEnabled: true, avatar: const Placeholder(), deleteIcon: const Placeholder(), + isEnabled: true, + selected: false, label: const Text('Chip'), onSelected: (bool newValue) { }, + onPressed: null, ), ), ), @@ -138,11 +143,16 @@ void main() { child: ChipTheme( data: customTheme, child: RawChip( + showCheckmark: true, onDeleted: () { }, + tapEnabled: true, avatar: const Placeholder(), deleteIcon: const Placeholder(), + isEnabled: true, + selected: value, label: const Text('$value'), onSelected: (bool newValue) { }, + onPressed: null, ), ), ), @@ -235,7 +245,7 @@ void main() { elevation: 1.0, labelPadding: const EdgeInsets.symmetric(horizontal: 8.0), shape: const StadiumBorder(), - side: const BorderSide(), + side: const BorderSide(color: Colors.black), pressElevation: 4.0, shadowColor: Colors.black, selectedShadowColor: Colors.black, @@ -287,7 +297,7 @@ void main() { expect(lerpANull25.secondarySelectedColor, equals(Colors.white.withAlpha(0x0f))); expect(lerpANull25.shadowColor, equals(Colors.white.withAlpha(0x40))); expect(lerpANull25.selectedShadowColor, equals(Colors.white.withAlpha(0x40))); - expect(lerpANull25.labelPadding, equals(const EdgeInsets.only(top: 2.0, bottom: 2.0))); + expect(lerpANull25.labelPadding, equals(const EdgeInsets.only(left: 0.0, top: 2.0, right: 0.0, bottom: 2.0))); expect(lerpANull25.padding, equals(const EdgeInsets.all(0.5))); expect(lerpANull25.side!.color, equals(Colors.white.withAlpha(0x3f))); expect(lerpANull25.shape, isA()); @@ -306,7 +316,7 @@ void main() { expect(lerpANull75.secondarySelectedColor, equals(Colors.white.withAlpha(0x2e))); expect(lerpANull75.shadowColor, equals(Colors.white.withAlpha(0xbf))); expect(lerpANull75.selectedShadowColor, equals(Colors.white.withAlpha(0xbf))); - expect(lerpANull75.labelPadding, equals(const EdgeInsets.only(top: 6.0, bottom: 6.0))); + expect(lerpANull75.labelPadding, equals(const EdgeInsets.only(left: 0.0, top: 6.0, right: 0.0, bottom: 6.0))); expect(lerpANull75.padding, equals(const EdgeInsets.all(1.5))); expect(lerpANull75.side!.color, equals(Colors.white.withAlpha(0xbf))); expect(lerpANull75.shape, isA()); @@ -325,7 +335,7 @@ void main() { expect(lerpBNull25.secondarySelectedColor, equals(Colors.black.withAlpha(0x2e))); expect(lerpBNull25.shadowColor, equals(Colors.black.withAlpha(0xbf))); expect(lerpBNull25.selectedShadowColor, equals(Colors.black.withAlpha(0xbf))); - expect(lerpBNull25.labelPadding, equals(const EdgeInsets.only(left: 6.0, right: 6.0))); + expect(lerpBNull25.labelPadding, equals(const EdgeInsets.only(left: 6.0, top: 0.0, right: 6.0, bottom: 0.0))); expect(lerpBNull25.padding, equals(const EdgeInsets.all(3.0))); expect(lerpBNull25.side!.color, equals(Colors.black.withAlpha(0x3f))); expect(lerpBNull25.shape, isA()); @@ -344,7 +354,7 @@ void main() { expect(lerpBNull75.secondarySelectedColor, equals(Colors.black.withAlpha(0x0f))); expect(lerpBNull75.shadowColor, equals(Colors.black.withAlpha(0x40))); expect(lerpBNull75.selectedShadowColor, equals(Colors.black.withAlpha(0x40))); - expect(lerpBNull75.labelPadding, equals(const EdgeInsets.only(left: 2.0, right: 2.0))); + expect(lerpBNull75.labelPadding, equals(const EdgeInsets.only(left: 2.0, top: 0.0, right: 2.0, bottom: 0.0))); expect(lerpBNull75.padding, equals(const EdgeInsets.all(1.0))); expect(lerpBNull75.side!.color, equals(Colors.black.withAlpha(0xbf))); expect(lerpBNull75.shape, isA()); @@ -460,7 +470,7 @@ void main() { if (states.contains(MaterialState.selected)) color = selectedColor; - return BorderSide(color: color); + return BorderSide(color: color, width: 1); } Widget chipWidget({ bool selected = false }) { @@ -499,7 +509,7 @@ void main() { if (states.contains(MaterialState.selected)) color = selectedColor; - return BorderSide(color: color); + return BorderSide(color: color, width: 1); } Widget chipWidget({ bool selected = false }) { diff --git a/packages/flutter/test/material/data_table_test.dart b/packages/flutter/test/material/data_table_test.dart index 3353a4ea3d..6f526f782b 100644 --- a/packages/flutter/test/material/data_table_test.dart +++ b/packages/flutter/test/material/data_table_test.dart @@ -464,7 +464,7 @@ void main() { // Check for ascending list await tester.pumpWidget(MaterialApp( - home: Material(child: buildTable()), + home: Material(child: buildTable(sortAscending: true)), )); // The `tester.widget` ensures that there is exactly one upward arrow. Transform transformOfArrow = tester.widget(find.widgetWithIcon(Transform, Icons.arrow_upward)); @@ -1181,7 +1181,9 @@ void main() { // Turn on sorting await tester.pumpWidget(MaterialApp( - home: Material(child: buildTable()), + home: Material(child: buildTable( + sortEnabled: true, + )), )); { @@ -1288,7 +1290,7 @@ void main() { return tableRow.decoration! as BoxDecoration; } - await tester.pumpWidget(buildTable()); + await tester.pumpWidget(buildTable(selected: false)); expect(lastTableRowBoxDecoration().color, null); await tester.pumpWidget(buildTable(selected: true)); diff --git a/packages/flutter/test/material/date_picker_test.dart b/packages/flutter/test/material/date_picker_test.dart index 055c82e4e1..c5de359cb4 100644 --- a/packages/flutter/test/material/date_picker_test.dart +++ b/packages/flutter/test/material/date_picker_test.dart @@ -37,7 +37,7 @@ void main() { } setUp(() { - firstDate = DateTime(2001); + firstDate = DateTime(2001, DateTime.january, 1); lastDate = DateTime(2031, DateTime.december, 31); initialDate = DateTime(2016, DateTime.january, 15); today = DateTime(2016, DateTime.january, 3); @@ -383,7 +383,7 @@ void main() { showDatePicker( context: context, initialDate: DateTime(2016, DateTime.january, 15), - firstDate:DateTime(2001), + firstDate:DateTime(2001, DateTime.january, 1), lastDate: DateTime(2031, DateTime.december, 31), builder: (BuildContext context, Widget? child) { return Directionality( @@ -674,7 +674,7 @@ void main() { group('Input mode', () { setUp(() { - firstDate = DateTime(2015); + firstDate = DateTime(2015, DateTime.january, 1); lastDate = DateTime(2017, DateTime.december, 31); initialDate = DateTime(2016, DateTime.january, 15); initialEntryMode = DatePickerEntryMode.input; @@ -1282,8 +1282,8 @@ class _RestorableDatePickerDialogTestWidgetState extends State<_RestorableDatePi restorationId: 'date_picker_dialog', initialEntryMode: DatePickerEntryMode.values[args['datePickerEntryMode'] as int], initialDate: DateTime.fromMillisecondsSinceEpoch(args['selectedDate'] as int), - firstDate: DateTime(2021), - lastDate: DateTime(2022), + firstDate: DateTime(2021, 1, 1), + lastDate: DateTime(2022, 1, 1), ); }, ); diff --git a/packages/flutter/test/material/date_range_picker_test.dart b/packages/flutter/test/material/date_range_picker_test.dart index 9c6f5b98a8..0a224b3268 100644 --- a/packages/flutter/test/material/date_range_picker_test.dart +++ b/packages/flutter/test/material/date_range_picker_test.dart @@ -28,7 +28,7 @@ void main() { String? saveText; setUp(() { - firstDate = DateTime(2015); + firstDate = DateTime(2015, DateTime.january, 1); lastDate = DateTime(2016, DateTime.december, 31); currentDate = null; initialDateRange = DateTimeRange( @@ -127,7 +127,7 @@ void main() { }); testWidgets('Last month header should be visible if last date is selected', (WidgetTester tester) async { - firstDate = DateTime(2015); + firstDate = DateTime(2015, DateTime.january, 1); lastDate = DateTime(2016, DateTime.december, 31); initialDateRange = DateTimeRange( start: lastDate, @@ -141,7 +141,7 @@ void main() { }); testWidgets('First month header should be visible if first date is selected', (WidgetTester tester) async { - firstDate = DateTime(2015); + firstDate = DateTime(2015, DateTime.january, 1); lastDate = DateTime(2016, DateTime.december, 31); initialDateRange = DateTimeRange( start: firstDate, @@ -156,9 +156,9 @@ void main() { }); testWidgets('Current month header should be visible if no date is selected', (WidgetTester tester) async { - firstDate = DateTime(2015); + firstDate = DateTime(2015, DateTime.january, 1); lastDate = DateTime(2016, DateTime.december, 31); - currentDate = DateTime(2016, DateTime.september); + currentDate = DateTime(2016, DateTime.september, 1); initialDateRange = null; await preparePicker(tester, (Future range) async { @@ -352,7 +352,7 @@ void main() { onPressed: () { showDateRangePicker( context: context, - firstDate:DateTime(2001), + firstDate:DateTime(2001, DateTime.january, 1), lastDate: DateTime(2031, DateTime.december, 31), builder: (BuildContext context, Widget? child) { return Directionality( @@ -618,7 +618,7 @@ void main() { group('Input mode', () { setUp(() { - firstDate = DateTime(2015); + firstDate = DateTime(2015, DateTime.january, 1); lastDate = DateTime(2017, DateTime.december, 31); initialDateRange = DateTimeRange( start: DateTime(2017, DateTime.january, 15), @@ -814,6 +814,7 @@ void main() { await tester.pumpWidget(MaterialApp( theme: ThemeData.light().copyWith( inputDecorationTheme: const InputDecorationTheme( + filled: false, border: border, ), ), @@ -977,7 +978,7 @@ class _RestorableDateRangePickerDialogTestWidgetState extends State<_RestorableD @override String? get restorationId => 'scaffold_state'; - final RestorableDateTimeN _startDate = RestorableDateTimeN(DateTime(2021)); + final RestorableDateTimeN _startDate = RestorableDateTimeN(DateTime(2021, 1, 1)); final RestorableDateTimeN _endDate = RestorableDateTimeN(DateTime(2021, 1, 5)); late final RestorableRouteFuture _restorableDateRangePickerRouteFuture = RestorableRouteFuture( onComplete: _selectDateRange, @@ -1018,9 +1019,9 @@ class _RestorableDateRangePickerDialogTestWidgetState extends State<_RestorableD return DateRangePickerDialog( restorationId: 'date_picker_dialog', initialEntryMode: DatePickerEntryMode.values[args['datePickerEntryMode'] as int], - firstDate: DateTime(2021), + firstDate: DateTime(2021, 1, 1), currentDate: DateTime(2021, 1, 25), - lastDate: DateTime(2022), + lastDate: DateTime(2022, 1, 1), ); }, ); diff --git a/packages/flutter/test/material/dialog_test.dart b/packages/flutter/test/material/dialog_test.dart index 1d3f6e8aae..cd2f4f5271 100644 --- a/packages/flutter/test/material/dialog_test.dart +++ b/packages/flutter/test/material/dialog_test.dart @@ -216,6 +216,7 @@ void main() { testWidgets('Null dialog shape', (WidgetTester tester) async { const AlertDialog dialog = AlertDialog( actions: [ ], + shape: null, ); await tester.pumpWidget(_buildAppWithDialog(dialog)); @@ -1256,7 +1257,9 @@ void main() { ); await tester.pumpWidget( const MediaQuery( - data: MediaQueryData(), + data: MediaQueryData( + viewInsets: EdgeInsets.zero, + ), child: Dialog( child: Placeholder(), ), @@ -1280,7 +1283,9 @@ void main() { // Test with no padding await tester.pumpWidget( const MediaQuery( - data: MediaQueryData(), + data: MediaQueryData( + viewInsets: EdgeInsets.zero, + ), child: Dialog( insetPadding: null, child: Placeholder(), @@ -1293,7 +1298,9 @@ void main() { // Test with an insetPadding await tester.pumpWidget( const MediaQuery( - data: MediaQueryData(), + data: MediaQueryData( + viewInsets: EdgeInsets.zero, + ), child: Dialog( insetPadding: EdgeInsets.fromLTRB(10.0, 20.0, 30.0, 40.0), child: Placeholder(), diff --git a/packages/flutter/test/material/dialog_theme_test.dart b/packages/flutter/test/material/dialog_theme_test.dart index a9d573e9b9..ab8047d53c 100644 --- a/packages/flutter/test/material/dialog_theme_test.dart +++ b/packages/flutter/test/material/dialog_theme_test.dart @@ -51,6 +51,7 @@ void main() { const DialogTheme( backgroundColor: Color(0xff123456), elevation: 8.0, + shape: null, alignment: Alignment.bottomLeft, titleTextStyle: TextStyle(color: Color(0xffffffff)), contentTextStyle: TextStyle(color: Color(0xff000000)), diff --git a/packages/flutter/test/material/drawer_test.dart b/packages/flutter/test/material/drawer_test.dart index 415366d982..f26fb354f6 100644 --- a/packages/flutter/test/material/drawer_test.dart +++ b/packages/flutter/test/material/drawer_test.dart @@ -143,7 +143,7 @@ void main() { // Default drawerScrimColor - await tester.pumpWidget(buildFrame()); + await tester.pumpWidget(buildFrame(drawerScrimColor: null)); scaffoldKey.currentState!.openDrawer(); await tester.pumpAndSettle(); diff --git a/packages/flutter/test/material/dropdown_form_field_test.dart b/packages/flutter/test/material/dropdown_form_field_test.dart index 0ccfb18388..e1ad316895 100644 --- a/packages/flutter/test/material/dropdown_form_field_test.dart +++ b/packages/flutter/test/material/dropdown_form_field_test.dart @@ -213,8 +213,8 @@ void main() { labelText: 'labelText', ), value: value, - onChanged: null, // this disables the menu and shows the disabledHint. disabledHint: const Text('disabledHint'), + onChanged: null, // disable the menu to show the disabledHint. items: const >[ DropdownMenuItem( value: 1, @@ -365,8 +365,8 @@ void main() { ), value: value, hint: const Text('hint'), - onChanged: null, // disabled disabledHint: const Text('disabledHint'), + onChanged: null, // disabled items: const >[ DropdownMenuItem( value: 1, @@ -409,6 +409,7 @@ void main() { }, items: const >[ DropdownMenuItem( + value: null, child: Text('None'), ), DropdownMenuItem( @@ -530,10 +531,12 @@ void main() { testWidgets('DropdownButtonFormField with isDense:true aligns selected menu item', (WidgetTester tester) async { final Key buttonKey = UniqueKey(); + const String value = 'two'; await tester.pumpWidget( buildFormFrame( buttonKey: buttonKey, + value: value, onChanged: onChanged, ), ); @@ -614,6 +617,7 @@ void main() { child: const Text(value), ), ], + isDense: true, onChanged: (_) { }, style: const TextStyle( color: Colors.amber, @@ -648,7 +652,7 @@ void main() { ); } // [disabledHint] should display when [items] is null - await tester.pumpWidget(build()); + await tester.pumpWidget(build(items: null)); expect(find.text('enabled'), findsNothing); expect(find.text('disabled'), findsOneWidget); @@ -670,10 +674,11 @@ void main() { buttonKey: buttonKey, value: null, hint: const Text('hint used when disabled'), + disabledHint: null, ); } // [hint] should display when [items] is null and [disabledHint] is not defined - await tester.pumpWidget(build()); + await tester.pumpWidget(build(items: null)); expect(find.text('hint used when disabled'), findsOneWidget); // [hint] should display when [items] is an empty list and [disabledHint] is not defined. @@ -694,7 +699,7 @@ void main() { ); } // [hint] should display when [items] is null and [disabledHint] is not defined - await tester.pumpWidget(build()); + await tester.pumpWidget(build(items: null)); expect(find.text('hint used when disabled'), findsOneWidget); // [hint] should display when [items] is an empty list and [disabledHint] is not defined. @@ -714,7 +719,7 @@ void main() { ); } // [hint] should display when [items] is null and [disabledHint] is not defined - await tester.pumpWidget(build()); + await tester.pumpWidget(build(items: null)); expect(find.text('hint used when disabled'), findsOneWidget); // [hint] should display when [items] is an empty list and [disabledHint] is not defined. @@ -735,7 +740,7 @@ void main() { disabledHint: const Text('disabled'), ); } - await tester.pumpWidget(build(items: menuItems)); + await tester.pumpWidget(build(items: menuItems, onChanged: null)); expect(find.text('enabled'), findsNothing); expect(find.text('disabled'), findsOneWidget); }); @@ -752,7 +757,7 @@ void main() { disabledHint: const Text('disabled'), ); } - await tester.pumpWidget(build()); + await tester.pumpWidget(build(items: null)); final RenderBox disabledHintBox = tester.renderObject( find.byKey(buttonKey), ); @@ -803,6 +808,7 @@ void main() { debugDisableShadows = false; await tester.pumpWidget(buildFormFrame( buttonKey: buttonKey, + items: menuItems, onChanged: onChanged, )); await tester.tap(find.byKey(buttonKey)); @@ -825,6 +831,7 @@ void main() { await tester.pumpWidget(buildFormFrame( buttonKey: buttonKeyOne, + items: menuItems, elevation: 16, onChanged: onChanged, )); @@ -840,6 +847,7 @@ void main() { await tester.tap(find.text('one').last); await tester.pumpWidget(buildFormFrame( buttonKey: buttonKeyTwo, + items: menuItems, elevation: 24, onChanged: onChanged, )); diff --git a/packages/flutter/test/material/dropdown_test.dart b/packages/flutter/test/material/dropdown_test.dart index 3a8ba4c544..7543ccb78d 100644 --- a/packages/flutter/test/material/dropdown_test.dart +++ b/packages/flutter/test/material/dropdown_test.dart @@ -331,7 +331,7 @@ bool sameGeometry(RenderBox box1, RenderBox box2) { void main() { testWidgets('Default dropdown golden', (WidgetTester tester) async { final Key buttonKey = UniqueKey(); - Widget build() => buildFrame(buttonKey: buttonKey, onChanged: onChanged); + Widget build() => buildFrame(buttonKey: buttonKey, value: 'two', onChanged: onChanged); await tester.pumpWidget(build()); final Finder buttonFinder = find.byKey(buttonKey); assert(tester.renderObject(buttonFinder).attached); @@ -343,7 +343,7 @@ void main() { testWidgets('Expanded dropdown golden', (WidgetTester tester) async { final Key buttonKey = UniqueKey(); - Widget build() => buildFrame(buttonKey: buttonKey, isExpanded: true, onChanged: onChanged); + Widget build() => buildFrame(buttonKey: buttonKey, value: 'two', isExpanded: true, onChanged: onChanged); await tester.pumpWidget(build()); final Finder buttonFinder = find.byKey(buttonKey); assert(tester.renderObject(buttonFinder).attached); @@ -693,8 +693,9 @@ void main() { for (final TextDirection textDirection in TextDirection.values) { testWidgets('Dropdown button aligns selected menu item ($textDirection)', (WidgetTester tester) async { final Key buttonKey = UniqueKey(); + const String value = 'two'; - Widget build() => buildFrame(buttonKey: buttonKey, textDirection: textDirection, onChanged: onChanged); + Widget build() => buildFrame(buttonKey: buttonKey, value: value, textDirection: textDirection, onChanged: onChanged); await tester.pumpWidget(build()); final RenderBox buttonBox = tester.renderObject(find.byKey(buttonKey)); @@ -741,7 +742,7 @@ void main() { testWidgets('Arrow icon aligns with the edge of button when expanded', (WidgetTester tester) async { final Key buttonKey = UniqueKey(); - Widget build() => buildFrame(buttonKey: buttonKey, isExpanded: true, onChanged: onChanged); + Widget build() => buildFrame(buttonKey: buttonKey, value: 'two', isExpanded: true, onChanged: onChanged); await tester.pumpWidget(build()); final RenderBox buttonBox = tester.renderObject(find.byKey(buttonKey)); @@ -806,6 +807,7 @@ void main() { // test for disabled color await tester.pumpWidget(buildFrame( icon: customIcon, + onChanged: null, )); final RichText disabledRichText = tester.widget(_iconRichText(iconKey)); @@ -838,6 +840,7 @@ void main() { iconSize: 30.0, iconEnabledColor: Colors.pink, iconDisabledColor: Colors.orange, + onChanged: null, )); final RichText disabledRichText = tester.widget(_iconRichText(iconKey)); @@ -876,6 +879,7 @@ void main() { iconSize: 30.0, iconEnabledColor: Colors.pink, iconDisabledColor: Colors.orange, + onChanged: null, )); final RichText disabledRichText = tester.widget(_iconRichText(iconKey)); @@ -884,8 +888,9 @@ void main() { testWidgets('Dropdown button with isDense:true aligns selected menu item', (WidgetTester tester) async { final Key buttonKey = UniqueKey(); + const String value = 'two'; - Widget build() => buildFrame(buttonKey: buttonKey, isDense: true, onChanged: onChanged); + Widget build() => buildFrame(buttonKey: buttonKey, value: value, isDense: true, onChanged: onChanged); await tester.pumpWidget(build()); final RenderBox buttonBox = tester.renderObject(find.byKey(buttonKey)); @@ -1209,7 +1214,7 @@ void main() { expect(menuRect.topRight, Offset(menuRect.width, buttonRect.top)); await popUpAndDown( - buildFrame(value: menuItems.first, onChanged: onChanged), + buildFrame(alignment: Alignment.center, value: menuItems.first, onChanged: onChanged), ); expect(menuRect.topLeft, buttonRect.topLeft); expect(menuRect.topRight, buttonRect.topRight); @@ -1267,7 +1272,7 @@ void main() { testWidgets('Semantics Tree contains only selected element', (WidgetTester tester) async { final SemanticsTester semantics = SemanticsTester(tester); - await tester.pumpWidget(buildFrame(onChanged: onChanged)); + await tester.pumpWidget(buildFrame(items: menuItems, onChanged: onChanged)); expect(semantics, isNot(includesNodeWith(label: menuItems[0]))); expect(semantics, includesNodeWith(label: menuItems[1])); @@ -1283,6 +1288,7 @@ void main() { await tester.pumpWidget(buildFrame( buttonKey: key, value: null, + items: menuItems, onChanged: (String? _) { }, hint: const Text('test'), )); @@ -1298,6 +1304,7 @@ void main() { await tester.pumpWidget(buildFrame( buttonKey: key, value: 'three', + items: menuItems, onChanged: onChanged, hint: const Text('test'), )); @@ -1318,6 +1325,7 @@ void main() { await tester.pumpWidget(buildFrame( buttonKey: key, value: null, + items: menuItems, onChanged: onChanged, )); await tester.tap(find.byKey(key)); @@ -1403,7 +1411,7 @@ void main() { ); // [disabledHint] should display when [items] is null - await tester.pumpWidget(build(onChanged: onChanged)); + await tester.pumpWidget(build(items: null, onChanged: onChanged)); expect(find.text('enabled'), findsNothing); expect(find.text('disabled'), findsOneWidget); @@ -1413,7 +1421,7 @@ void main() { expect(find.text('disabled'), findsOneWidget); // [disabledHint] should display when [onChanged] is null - await tester.pumpWidget(build(items: menuItems)); + await tester.pumpWidget(build(items: menuItems, onChanged: null)); expect(find.text('enabled'), findsNothing); expect(find.text('disabled'), findsOneWidget); final RenderBox disabledHintBox = tester.renderObject(find.byKey(buttonKey)); @@ -1439,7 +1447,7 @@ void main() { ); // The selected value should be displayed when the button is disabled. - await tester.pumpWidget(build(items: menuItems, value: 'two')); + await tester.pumpWidget(build(items: menuItems, onChanged: null, value: 'two')); // The dropdown icon and the selected menu item are vertically aligned. expect(tester.getCenter(find.text('two')).dy, tester.getCenter(find.byType(Icon)).dy); @@ -1447,6 +1455,7 @@ void main() { await tester.pumpWidget(build( items: menuItems, onChanged: onChanged, + value: null, hint: const Text('hint'), disabledHint: const Text('disabledHint'), )); @@ -1455,6 +1464,8 @@ void main() { // If [value] is null, the button is disabled, [disabledHint] is displayed when [disabledHint] is non-null. await tester.pumpWidget(build( items: menuItems, + onChanged: null, + value: null, hint: const Text('hint'), disabledHint: const Text('disabledHint'), )); @@ -1463,7 +1474,10 @@ void main() { // If [value] is null, the button is disabled, [hint] is displayed when [disabledHint] is null. await tester.pumpWidget(build( items: menuItems, + onChanged: null, + value: null, hint: const Text('hint'), + disabledHint: null, )); expect(tester.getCenter(find.text('hint')).dy, tester.getCenter(find.byType(Icon)).dy); @@ -1475,6 +1489,10 @@ void main() { // If [value], [hint] and [disabledHint] are null, the button is disabled, nothing displayed. await tester.pumpWidget(build( items: menuItems, + onChanged: null, + value: null, + hint: null, + disabledHint: null, )); expect(getIndex(), null); @@ -1482,6 +1500,9 @@ void main() { await tester.pumpWidget(build( items: menuItems, onChanged: onChanged, + value: null, + hint: null, + disabledHint: null, )); expect(getIndex(), null); }); @@ -1533,7 +1554,7 @@ void main() { expect(textColor('two'), Colors.yellow); // The selected value should be displayed when the button is disabled. - await tester.pumpWidget(build(value: 'two')); + await tester.pumpWidget(build(onChanged: null, value: 'two')); expect(tester.getCenter(find.text('two')).dy, tester.getCenter(find.byType(Icon)).dy); // Selected item has a disabled color from [theme.disabledColor] // when the button is disable. @@ -1552,10 +1573,11 @@ void main() { buttonKey: buttonKey, value: null, hint: const Text('hint used when disabled'), + disabledHint: null, ); } // [hint] should display when [items] is null and [disabledHint] is not defined - await tester.pumpWidget(build()); + await tester.pumpWidget(build(items: null)); expect(find.text('hint used when disabled'), findsOneWidget); // [hint] should display when [items] is an empty list and [disabledHint] is not defined. @@ -1576,7 +1598,7 @@ void main() { ); } // [hint] should display when [items] is null and [disabledHint] is not defined - await tester.pumpWidget(build()); + await tester.pumpWidget(build(items: null)); expect(find.text('hint used when disabled'), findsOneWidget); // [hint] should display when [items] is an empty list and [disabledHint] is not defined. @@ -1721,6 +1743,7 @@ void main() { ); }).toList(); }, + onChanged: null, )); final RenderBox dropdownButtonRenderBox = tester.renderObject( @@ -1758,6 +1781,7 @@ void main() { ); }).toList(); }, + onChanged: null, )); final RenderBox dropdownButtonRenderBox = tester.renderObject( @@ -1795,6 +1819,7 @@ void main() { ); }).toList(); }, + onChanged: null, )); final RenderBox dropdownButtonRenderBox = tester.renderObject( @@ -1832,6 +1857,7 @@ void main() { ); }).toList(); }, + onChanged: null, )); final RenderBox dropdownButtonRenderBox = tester.renderObject( @@ -1869,6 +1895,7 @@ void main() { MaterialApp( home: Material( child: Align( + alignment: Alignment.center, child: button, ), ), @@ -1979,6 +2006,7 @@ void main() { MaterialApp( home: Material( child: Align( + alignment: Alignment.center, child: button, ), ), @@ -2055,11 +2083,12 @@ void main() { await tester.pumpWidget(buildFrame( buttonKey: buttonKey, underline: customUnderline, + value: 'two', onChanged: onChanged, )); expect(tester.widgetList(decoratedBox).last.decoration, decoration); - await tester.pumpWidget(buildFrame(buttonKey: buttonKey, onChanged: onChanged)); + await tester.pumpWidget(buildFrame(buttonKey: buttonKey, value: 'two', onChanged: onChanged)); expect(tester.widgetList(decoratedBox).last.decoration, defaultDecoration); }); @@ -2341,6 +2370,7 @@ void main() { return DropdownButton( isExpanded: true, elevation: 2, + value: null, hint: LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { // Stack with a positioned widget is used to override the @@ -3435,15 +3465,14 @@ void main() { MaterialApp( home: Material( child: DropdownButton( - key: key, - onChanged: null, - items: ['One', 'Two', 'Three', 'Four'] - .map>((String value) { + key: key, + items: ['One', 'Two', 'Three', 'Four'] + .map>((String value) { return DropdownMenuItem( value: value, child: Text(value), ); - }).toList(), + }).toList() ), ), ), diff --git a/packages/flutter/test/material/elevated_button_test.dart b/packages/flutter/test/material/elevated_button_test.dart index e29c6142cd..10b14ffbe8 100644 --- a/packages/flutter/test/material/elevated_button_test.dart +++ b/packages/flutter/test/material/elevated_button_test.dart @@ -183,6 +183,7 @@ void main() { await expectLater(tester, meetsGuideline(textContrastGuideline)); }, skip: isBrowser, // https://github.com/flutter/flutter/issues/44115 + semanticsEnabled: true, ); @@ -357,7 +358,7 @@ void main() { // onPressed not null, onLongPress null. wasPressed = false; await tester.pumpWidget( - buildFrame(onPressed: () { wasPressed = true; }), + buildFrame(onPressed: () { wasPressed = true; }, onLongPress: null), ); elevatedButton = find.byType(ElevatedButton); expect(tester.widget(elevatedButton).enabled, true); @@ -367,7 +368,7 @@ void main() { // onPressed null, onLongPress not null. wasPressed = false; await tester.pumpWidget( - buildFrame(onLongPress: () { wasPressed = true; }), + buildFrame(onPressed: null, onLongPress: () { wasPressed = true; }), ); elevatedButton = find.byType(ElevatedButton); expect(tester.widget(elevatedButton).enabled, true); @@ -376,7 +377,7 @@ void main() { // onPressed null, onLongPress null. await tester.pumpWidget( - buildFrame(), + buildFrame(onPressed: null, onLongPress: null), ); elevatedButton = find.byType(ElevatedButton); expect(tester.widget(elevatedButton).enabled, false); diff --git a/packages/flutter/test/material/elevated_button_theme_test.dart b/packages/flutter/test/material/elevated_button_theme_test.dart index db694f4227..86c97ba7c7 100644 --- a/packages/flutter/test/material/elevated_button_theme_test.dart +++ b/packages/flutter/test/material/elevated_button_theme_test.dart @@ -178,7 +178,7 @@ void main() { }); testWidgets('Overall Theme button theme style overrides defaults, null theme and empty overall style', (WidgetTester tester) async { - await tester.pumpWidget(buildFrame(buttonStyle: const ButtonStyle(), overallStyle: style)); + await tester.pumpWidget(buildFrame(buttonStyle: const ButtonStyle(), themeStyle: null, overallStyle: style)); await tester.pumpAndSettle(); // allow the animations to finish checkButton(tester); }); diff --git a/packages/flutter/test/material/expand_icon_test.dart b/packages/flutter/test/material/expand_icon_test.dart index 8acf7071c1..2b6fffb391 100644 --- a/packages/flutter/test/material/expand_icon_test.dart +++ b/packages/flutter/test/material/expand_icon_test.dart @@ -100,6 +100,7 @@ void main() { await tester.pumpWidget(wrap( child: ExpandIcon( + isExpanded: false, onPressed: (bool isExpanded) { expanded = !expanded; }, @@ -193,6 +194,7 @@ void main() { await tester.pumpWidget(wrap( child: ExpandIcon( + isExpanded: false, onPressed: (bool _) { }, ), )); @@ -274,6 +276,7 @@ void main() { await tester.pumpWidget(wrap( child: const ExpandIcon( + isExpanded: false, onPressed: null, disabledColor: Colors.cyan, ), @@ -284,6 +287,7 @@ void main() { await tester.pumpWidget(wrap( child: const ExpandIcon( + isExpanded: false, onPressed: null, color: Colors.indigo, disabledColor: Colors.cyan, diff --git a/packages/flutter/test/material/expansion_panel_test.dart b/packages/flutter/test/material/expansion_panel_test.dart index beae622220..5bb342a7b9 100644 --- a/packages/flutter/test/material/expansion_panel_test.dart +++ b/packages/flutter/test/material/expansion_panel_test.dart @@ -89,6 +89,7 @@ class ExpansionPanelListSemanticsTestState extends State[ ExpansionPanel( + canTapOnHeader: false, headerBuilder: (BuildContext context, bool isExpanded) { return MergeSemantics( key: widget.headerKey, @@ -461,18 +462,21 @@ void main() { return Text(isExpanded ? 'B' : 'A'); }, body: const SizedBox(height: 100.0), + isExpanded: false, ), ExpansionPanel( headerBuilder: (BuildContext context, bool isExpanded) { return Text(isExpanded ? 'D' : 'C'); }, body: const SizedBox(height: 100.0), + isExpanded: false, ), ExpansionPanel( headerBuilder: (BuildContext context, bool isExpanded) { return Text(isExpanded ? 'F' : 'E'); }, body: const SizedBox(height: 100.0), + isExpanded: false, ), ]; @@ -920,6 +924,7 @@ void main() { return const Text('Collapsed', key: collapsedKey); }, body: const SizedBox(height: 100.0), + isExpanded: false, ), ]; @@ -1005,6 +1010,7 @@ void main() { }, canTapOnHeader: true, body: const SizedBox(height: 100.0), + isExpanded: false, ), ]; diff --git a/packages/flutter/test/material/expansion_tile_test.dart b/packages/flutter/test/material/expansion_tile_test.dart index 68ec473f43..42234d7ddb 100644 --- a/packages/flutter/test/material/expansion_tile_test.dart +++ b/packages/flutter/test/material/expansion_tile_test.dart @@ -78,6 +78,7 @@ void main() { ), ExpansionTile( key: collapsedKey, + initiallyExpanded: false, title: const Text('Collapsed'), children: [ ListTile( @@ -179,6 +180,7 @@ void main() { trailing: TestIcon(key: expandedIconKey), ), ExpansionTile( + initiallyExpanded: false, title: TestText('Collapsed', key: collapsedTitleKey), children: const [ListTile(title: Text('0'))], trailing: TestIcon(key: collapsedIconKey), @@ -240,6 +242,7 @@ void main() { children: const [ ExpansionTile( title: Text('Tile 1'), + initiallyExpanded: false, maintainState: true, children: [ Text('Maintaining State'), @@ -247,6 +250,8 @@ void main() { ), ExpansionTile( title: Text('Title 2'), + initiallyExpanded: false, + maintainState: false, children: [ Text('Discarding State'), ], @@ -533,6 +538,7 @@ void main() { collapsedIconColor: collapsedIconColor, textColor: textColor, collapsedTextColor: collapsedTextColor, + initiallyExpanded: false, title: TestText('title'), trailing: TestIcon(), children: [ diff --git a/packages/flutter/test/material/flat_button_test.dart b/packages/flutter/test/material/flat_button_test.dart index 08721f4b9c..edbe10cb12 100644 --- a/packages/flutter/test/material/flat_button_test.dart +++ b/packages/flutter/test/material/flat_button_test.dart @@ -154,12 +154,13 @@ void main() { await expectLater(tester, meetsGuideline(textContrastGuideline)); }, skip: isBrowser, // https://github.com/flutter/flutter/issues/44115 + semanticsEnabled: true, ); testWidgets('FlatButton with colored theme meets a11y contrast guidelines', (WidgetTester tester) async { final FocusNode focusNode = FocusNode(); - final ColorScheme colorScheme = ColorScheme.fromSwatch(); + final ColorScheme colorScheme = ColorScheme.fromSwatch(primarySwatch: Colors.blue); Color getTextColor(Set states) { final Set interactiveStates = { @@ -218,6 +219,7 @@ void main() { await expectLater(tester, meetsGuideline(textContrastGuideline)); }, skip: isBrowser, // https://github.com/flutter/flutter/issues/44115 + semanticsEnabled: true, ); testWidgets('FlatButton uses stateful color for text color in different states', (WidgetTester tester) async { @@ -578,7 +580,7 @@ void main() { textDirection: TextDirection.ltr, child: Material( child: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(textScaleFactor: 1.0), child: Center( child: FlatButton( onPressed: () { }, @@ -705,7 +707,7 @@ void main() { // onPressed not null, onLongPress null. wasPressed = false; await tester.pumpWidget( - buildFrame(onPressed: () { wasPressed = true; }), + buildFrame(onPressed: () { wasPressed = true; }, onLongPress: null), ); flatButton = find.byType(FlatButton); expect(tester.widget(flatButton).enabled, true); @@ -715,7 +717,7 @@ void main() { // onPressed null, onLongPress not null. wasPressed = false; await tester.pumpWidget( - buildFrame(onLongPress: () { wasPressed = true; }), + buildFrame(onPressed: null, onLongPress: () { wasPressed = true; }), ); flatButton = find.byType(FlatButton); expect(tester.widget(flatButton).enabled, true); @@ -724,7 +726,7 @@ void main() { // onPressed null, onLongPress null. await tester.pumpWidget( - buildFrame(), + buildFrame(onPressed: null, onLongPress: null), ); flatButton = find.byType(FlatButton); expect(tester.widget(flatButton).enabled, false); diff --git a/packages/flutter/test/material/flexible_space_bar_collapse_mode_test.dart b/packages/flutter/test/material/flexible_space_bar_collapse_mode_test.dart index 6c3b6758fa..40f37591c0 100644 --- a/packages/flutter/test/material/flexible_space_bar_collapse_mode_test.dart +++ b/packages/flutter/test/material/flexible_space_bar_collapse_mode_test.dart @@ -102,6 +102,7 @@ void main() { background: Container( key: appbarContainerKey, ), + collapseMode: CollapseMode.parallax, ), ), SliverToBoxAdapter( diff --git a/packages/flutter/test/material/floating_action_button_location_test.dart b/packages/flutter/test/material/floating_action_button_location_test.dart index 8cbf3f1a79..69ae6dee06 100644 --- a/packages/flutter/test/material/floating_action_button_location_test.dart +++ b/packages/flutter/test/material/floating_action_button_location_test.dart @@ -11,7 +11,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { group('Basic floating action button locations', () { testWidgets('still animates motion when the floating action button is null', (WidgetTester tester) async { - await tester.pumpWidget(_buildFrame(fab: null)); + await tester.pumpWidget(_buildFrame(fab: null, location: null)); expect(find.byType(FloatingActionButton), findsNothing); expect(tester.binding.transientCallbackCount, 0); @@ -641,6 +641,7 @@ void main() { label: '1', ), ], + currentIndex: 0, ) : null, floatingActionButtonLocation: location, floatingActionButton: Builder( diff --git a/packages/flutter/test/material/floating_action_button_test.dart b/packages/flutter/test/material/floating_action_button_test.dart index 20d895f3a2..9a0e62f8c7 100644 --- a/packages/flutter/test/material/floating_action_button_test.dart +++ b/packages/flutter/test/material/floating_action_button_test.dart @@ -909,7 +909,7 @@ void main() { isFocusable: true, ), ); - }); + }, semanticsEnabled: true); testWidgets('Foreground color applies to icon on fab', (WidgetTester tester) async { const Color foregroundColor = Color(0xcafefeed); diff --git a/packages/flutter/test/material/icon_button_test.dart b/packages/flutter/test/material/icon_button_test.dart index 18f765f93c..3e4daf2fa4 100644 --- a/packages/flutter/test/material/icon_button_test.dart +++ b/packages/flutter/test/material/icon_button_test.dart @@ -570,6 +570,7 @@ void main() { child: Center( child: IconButton( onPressed: () {}, + enableFeedback: true, icon: const Icon(Icons.link), ), ), diff --git a/packages/flutter/test/material/inherited_theme_test.dart b/packages/flutter/test/material/inherited_theme_test.dart index 995d65a31b..5b78b6c1a7 100644 --- a/packages/flutter/test/material/inherited_theme_test.dart +++ b/packages/flutter/test/material/inherited_theme_test.dart @@ -342,11 +342,14 @@ void main() { ListTile( leading: Icon(Icons.computer, key: selectedIconKey), title: const Text('selected'), + enabled: true, selected: true, ), ListTile( leading: Icon(Icons.add, key: unselectedIconKey), title: const Text('unselected'), + enabled: true, + selected: false, ), ], ), diff --git a/packages/flutter/test/material/ink_well_test.dart b/packages/flutter/test/material/ink_well_test.dart index ade64fd0a6..7dbf405d16 100644 --- a/packages/flutter/test/material/ink_well_test.dart +++ b/packages/flutter/test/material/ink_well_test.dart @@ -1339,6 +1339,7 @@ void main() { expect(tester.getSemantics(find.bySemanticsLabel('Foo')), matchesSemantics( label: 'Foo', + hasTapAction: false, hasLongPressAction: true, isFocusable: true, textDirection: TextDirection.ltr, diff --git a/packages/flutter/test/material/input_date_picker_form_field_test.dart b/packages/flutter/test/material/input_date_picker_form_field_test.dart index a440bd0aa9..047727dcdf 100644 --- a/packages/flutter/test/material/input_date_picker_form_field_test.dart +++ b/packages/flutter/test/material/input_date_picker_form_field_test.dart @@ -36,7 +36,7 @@ void main() { child: InputDatePickerFormField( key: key, initialDate: initialDate ?? DateTime(2016, DateTime.january, 15), - firstDate: firstDate ?? DateTime(2001), + firstDate: firstDate ?? DateTime(2001, DateTime.january, 1), lastDate: lastDate ?? DateTime(2031, DateTime.december, 31), onDateSubmitted: onDateSubmitted, onDateSaved: onDateSaved, @@ -271,6 +271,7 @@ void main() { await tester.pumpWidget(_inputDatePickerField( theme: ThemeData.from(colorScheme: const ColorScheme.light()).copyWith( inputDecorationTheme: const InputDecorationTheme( + filled: false, border: border, ), ), diff --git a/packages/flutter/test/material/input_decorator_test.dart b/packages/flutter/test/material/input_decorator_test.dart index ce700a9f36..604028ad13 100644 --- a/packages/flutter/test/material/input_decorator_test.dart +++ b/packages/flutter/test/material/input_decorator_test.dart @@ -204,6 +204,7 @@ void main() { // The label appears within the input text when there is content and floatingLabelBehavior is never await tester.pumpWidget( buildInputDecorator( + isEmpty: false, // isFocused: false (default) decoration: const InputDecoration( labelText: 'label', @@ -248,6 +249,7 @@ void main() { await tester.pumpWidget( buildInputDecorator( isEmpty: true, + isFocused: false, decoration: const InputDecoration( labelText: 'label', ), @@ -307,6 +309,7 @@ void main() { await tester.pumpWidget( buildInputDecorator( isEmpty: true, + isFocused: false, decoration: const InputDecoration( labelText: 'label', enabled: false, @@ -326,6 +329,7 @@ void main() { await tester.pumpWidget( buildInputDecorator( isEmpty: true, + isFocused: false, decoration: const InputDecoration( labelText: 'label', enabled: false, @@ -346,6 +350,7 @@ void main() { await tester.pumpWidget( buildInputDecorator( isEmpty: true, + isFocused: false, decoration: const InputDecoration( labelText: 'label', alignLabelWithHint: true, @@ -456,6 +461,7 @@ void main() { // the floatingLabelBehavior is set to never. await tester.pumpWidget( buildInputDecorator( + isEmpty: false, // isFocused: false (default) decoration: const InputDecoration( label: Text.rich( @@ -522,6 +528,7 @@ void main() { await tester.pumpWidget( buildInputDecorator( isEmpty: true, + isFocused: false, decoration: const InputDecoration( label: Text.rich( TextSpan( @@ -604,6 +611,7 @@ void main() { await tester.pumpWidget( buildInputDecorator( isEmpty: true, + isFocused: false, decoration: const InputDecoration( label: Text.rich( TextSpan( @@ -634,6 +642,7 @@ void main() { await tester.pumpWidget( buildInputDecorator( isEmpty: true, + isFocused: false, decoration: const InputDecoration( label: Text.rich( TextSpan( @@ -665,6 +674,7 @@ void main() { await tester.pumpWidget( buildInputDecorator( isEmpty: true, + isFocused: false, decoration: const InputDecoration( label: Text.rich( TextSpan( @@ -862,6 +872,7 @@ void main() { alignLabelWithHint: alignLabelWithHint, hintText: 'hint', border: const OutlineInputBorder( + borderSide: BorderSide(width: 1, color: Colors.black, style: BorderStyle.solid), borderRadius: BorderRadius.zero, ), ), @@ -1003,6 +1014,7 @@ void main() { await tester.pumpWidget( buildInputDecorator( + isEmpty: false, isFocused: true, decoration: const InputDecoration( labelText: 'label', @@ -1450,6 +1462,7 @@ void main() { labelText: 'label', helperText: kHelper3, helperMaxLines: 3, + errorText: null, filled: true, ), ), @@ -1480,6 +1493,7 @@ void main() { labelText: 'label', helperText: kHelper3, helperMaxLines: 2, + errorText: null, filled: true, ), ), @@ -1500,6 +1514,7 @@ void main() { labelText: 'label', helperText: kHelper2, helperMaxLines: 3, + errorText: null, filled: true, ), ), @@ -1520,6 +1535,7 @@ void main() { labelText: 'label', helperText: kHelper1, helperMaxLines: 3, + errorText: null, filled: true, ), ), @@ -1909,6 +1925,7 @@ void main() { await tester.pumpWidget( buildInputDecorator( + isEmpty: false, isFocused: true, visualDensity: VisualDensity.compact, decoration: const InputDecoration( @@ -2003,6 +2020,7 @@ void main() { await tester.pumpWidget( buildInputDecorator( + isEmpty: false, isFocused: true, visualDensity: const VisualDensity(horizontal: 2.0, vertical: 2.0), decoration: const InputDecoration( @@ -2930,6 +2948,7 @@ void main() { buildInputDecorator( // isEmpty: false (default) // isFocused: false (default) + textDirection: TextDirection.ltr, decoration: const InputDecoration( contentPadding: EdgeInsetsDirectional.only(start: 40.0, top: 12.0, bottom: 12.0), labelText: 'label', @@ -3140,6 +3159,7 @@ void main() { await tester.pumpWidget( buildInputDecorator( isEmpty: true, + isFocused: false, baseStyle: style, decoration: const InputDecoration( hintText: 'hint', @@ -3478,6 +3498,8 @@ void main() { decoration: InputDecoration(), baseStyle: TextStyle(), textAlign: TextAlign.center, + isFocused: false, + isEmpty: false, child: Placeholder(), ); expect( @@ -3936,7 +3958,7 @@ void main() { ); } - await pumpDecorator(focused: false); + await pumpDecorator(focused: false, empty: true); await tester.pumpAndSettle(); expect(getLabelRect(tester).topLeft, equals(const Offset(12, 20))); expect(getLabelRect(tester).size, equals(const Size(80, 16))); @@ -3946,7 +3968,7 @@ void main() { expect(getLabelRect(tester).topLeft, equals(const Offset(12, -5.5))); expect(getLabelRect(tester).size, equals(const Size(80, 16))); - await pumpDecorator(focused: true); + await pumpDecorator(focused: true, empty: true); await tester.pumpAndSettle(); expect(getLabelRect(tester).topLeft, equals(const Offset(12, -5.5))); expect(getLabelRect(tester).size, equals(const Size(80, 16))); @@ -3956,7 +3978,7 @@ void main() { expect(getLabelRect(tester).topLeft, equals(const Offset(12, -5.5))); expect(getLabelRect(tester).size, equals(const Size(80, 16))); - await pumpDecorator(focused: false, enabled: false); + await pumpDecorator(focused: false, empty: true, enabled: false); await tester.pumpAndSettle(); expect(getLabelRect(tester).topLeft, equals(const Offset(12, 20))); expect(getLabelRect(tester).size, equals(const Size(80, 16))); @@ -3967,7 +3989,7 @@ void main() { expect(getLabelRect(tester).size, equals(const Size(80, 16))); // Focused and disabled happens with NavigationMode.directional. - await pumpDecorator(focused: true, enabled: false); + await pumpDecorator(focused: true, empty: true, enabled: false); await tester.pumpAndSettle(); expect(getLabelRect(tester).topLeft, equals(const Offset(12, 20))); expect(getLabelRect(tester).size, equals(const Size(80, 16))); @@ -4039,6 +4061,7 @@ void main() { await tester.pumpWidget( buildInputDecorator( theme: theme, + decoration: const InputDecoration(), ), ); await tester.pumpAndSettle(); @@ -4061,6 +4084,7 @@ void main() { buildInputDecorator( theme: theme, isHovering: true, + decoration: const InputDecoration(), ), ); await tester.pumpAndSettle(); @@ -4071,6 +4095,7 @@ void main() { buildInputDecorator( theme: theme, isFocused: true, + decoration: const InputDecoration(), ), ); await tester.pumpAndSettle(); @@ -4778,7 +4803,7 @@ void main() { child: TextField( decoration: InputDecoration( border: const OutlineInputBorder( - borderSide: BorderSide(color: Colors.greenAccent), + borderSide: BorderSide(color: Colors.greenAccent, width: 1.0), ), suffixIcon: const Icon(Icons.arrow_drop_down), floatingLabelBehavior: floatingLabelBehavior, @@ -5190,7 +5215,8 @@ void main() { await tester.pumpWidget( buildInputDecorator( - isEmpty: true, // Label appears inline, on top of the input field. + isEmpty: true, + isFocused: false, // Label appears inline, on top of the input field. inputDecorationTheme: InputDecorationTheme( labelStyle: labelStyle, // filled: false (default) - don't pad by left/right 12dps diff --git a/packages/flutter/test/material/list_tile_test.dart b/packages/flutter/test/material/list_tile_test.dart index 03180c4792..b1bcf64e88 100644 --- a/packages/flutter/test/material/list_tile_test.dart +++ b/packages/flutter/test/material/list_tile_test.dart @@ -454,7 +454,10 @@ void main() { testWidgets('ListTile contentPadding', (WidgetTester tester) async { Widget buildFrame(TextDirection textDirection) { return MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData( + padding: EdgeInsets.zero, + textScaleFactor: 1.0, + ), child: Directionality( textDirection: textDirection, child: Material( @@ -496,7 +499,10 @@ void main() { testWidgets('ListTile contentPadding', (WidgetTester tester) async { Widget buildFrame(TextDirection textDirection) { return MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData( + padding: EdgeInsets.zero, + textScaleFactor: 1.0, + ), child: Directionality( textDirection: textDirection, child: Material( @@ -540,7 +546,10 @@ void main() { Widget buildFrame(double leadingWidth, TextDirection textDirection) { return MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData( + padding: EdgeInsets.zero, + textScaleFactor: 1.0, + ), child: Directionality( textDirection: textDirection, child: Material( @@ -1173,6 +1182,7 @@ void main() { ListTile( title: Text('A', key: childKey), dense: true, + enabled: true, onTap: () {}, ), ], @@ -1220,6 +1230,7 @@ void main() { ListTile( title: Text('A', key: childKey), dense: true, + enabled: true, autofocus: true, onTap: () {}, ), @@ -1943,7 +1954,10 @@ void main() { testWidgets('ListTile horizontalTitleGap = 0.0', (WidgetTester tester) async { Widget buildFrame(TextDirection textDirection, { double? themeHorizontalTitleGap, double? widgetHorizontalTitleGap }) { return MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData( + padding: EdgeInsets.zero, + textScaleFactor: 1.0, + ), child: Directionality( textDirection: textDirection, child: Material( @@ -1995,7 +2009,10 @@ void main() { testWidgets('ListTile horizontalTitleGap = (default) && ListTile minLeadingWidth = (default)', (WidgetTester tester) async { Widget buildFrame(TextDirection textDirection) { return MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData( + padding: EdgeInsets.zero, + textScaleFactor: 1.0, + ), child: Directionality( textDirection: textDirection, child: Material( @@ -2034,7 +2051,10 @@ void main() { VisualDensity? visualDensity, }) { return MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData( + padding: EdgeInsets.zero, + textScaleFactor: 1.0, + ), child: Directionality( textDirection: TextDirection.ltr, child: Material( @@ -2076,7 +2096,10 @@ void main() { testWidgets('ListTile minVerticalPadding = 80.0', (WidgetTester tester) async { Widget buildFrame(TextDirection textDirection, { double? themeMinVerticalPadding, double? widgetMinVerticalPadding }) { return MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData( + padding: EdgeInsets.zero, + textScaleFactor: 1.0, + ), child: Directionality( textDirection: textDirection, child: Material( @@ -2122,7 +2145,10 @@ void main() { testWidgets('ListTile minLeadingWidth = 60.0', (WidgetTester tester) async { Widget buildFrame(TextDirection textDirection, { double? themeMinLeadingWidth, double? widgetMinLeadingWidth }) { return MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData( + padding: EdgeInsets.zero, + textScaleFactor: 1.0, + ), child: Directionality( textDirection: textDirection, child: Material( @@ -2300,6 +2326,7 @@ void main() { home: Material( child: Center( child: ListTile( + enabled: true, selected: selected, leading: TestIcon(key: leadingKey), trailing: TestIcon(key: trailingKey), diff --git a/packages/flutter/test/material/material_button_test.dart b/packages/flutter/test/material/material_button_test.dart index dcdd6a4e6f..d5f68a6931 100644 --- a/packages/flutter/test/material/material_button_test.dart +++ b/packages/flutter/test/material/material_button_test.dart @@ -261,6 +261,7 @@ void main() { await expectLater(tester, meetsGuideline(textContrastGuideline)); }, skip: isBrowser, // https://github.com/flutter/flutter/issues/44115 + semanticsEnabled: true, ); testWidgets('MaterialButton gets focus when autofocus is set.', (WidgetTester tester) async { @@ -316,7 +317,7 @@ void main() { // onPressed not null, onLongPress null. wasPressed = false; await tester.pumpWidget( - buildFrame(onPressed: () { wasPressed = true; }), + buildFrame(onPressed: () { wasPressed = true; }, onLongPress: null), ); materialButton = find.byType(MaterialButton); expect(tester.widget(materialButton).enabled, true); @@ -326,7 +327,7 @@ void main() { // onPressed null, onLongPress not null. wasPressed = false; await tester.pumpWidget( - buildFrame(onLongPress: () { wasPressed = true; }), + buildFrame(onPressed: null, onLongPress: () { wasPressed = true; }), ); materialButton = find.byType(MaterialButton); expect(tester.widget(materialButton).enabled, true); @@ -335,7 +336,7 @@ void main() { // onPressed null, onLongPress null. await tester.pumpWidget( - buildFrame(), + buildFrame(onPressed: null, onLongPress: null), ); materialButton = find.byType(MaterialButton); expect(tester.widget(materialButton).enabled, false); diff --git a/packages/flutter/test/material/material_test.dart b/packages/flutter/test/material/material_test.dart index 591518cea7..25689ab3d8 100644 --- a/packages/flutter/test/material/material_test.dart +++ b/packages/flutter/test/material/material_test.dart @@ -97,6 +97,7 @@ void main() { testWidgets('Material implements debugFillProperties', (WidgetTester tester) async { final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder(); const Material( + type: MaterialType.canvas, color: Color(0xFFFFFFFF), shadowColor: Color(0xffff0000), textStyle: TextStyle(color: Color(0xff00ff00)), @@ -189,7 +190,7 @@ void main() { // This code verifies that the PhysicalModel's elevation animates over // a kThemeChangeDuration time interval. - await tester.pumpWidget(buildMaterial()); + await tester.pumpWidget(buildMaterial(elevation: 0.0)); final RenderPhysicalShape modelA = getModel(tester); expect(modelA.elevation, equals(0.0)); @@ -214,7 +215,7 @@ void main() { // This code verifies that the PhysicalModel's shadowColor animates over // a kThemeChangeDuration time interval. - await tester.pumpWidget(buildMaterial()); + await tester.pumpWidget(buildMaterial(shadowColor: const Color(0xFF00FF00))); final RenderPhysicalShape modelA = getModel(tester); expect(modelA.shadowColor, equals(const Color(0xFF00FF00))); @@ -365,7 +366,7 @@ void main() { Theme( data: ThemeData( applyElevationOverlayColor: true, - colorScheme: const ColorScheme.dark(), + colorScheme: const ColorScheme.dark(surface: surfaceColor), ), child: buildMaterial( color: surfaceColor.withOpacity(.75), @@ -547,6 +548,7 @@ void main() { await tester.pumpWidget( Material( key: materialKey, + type: MaterialType.canvas, child: const SizedBox(width: 100.0, height: 100.0), ), ); @@ -563,6 +565,7 @@ void main() { await tester.pumpWidget( Material( key: materialKey, + type: MaterialType.canvas, borderRadius: const BorderRadius.all(Radius.circular(5.0)), elevation: 1.0, child: const SizedBox(width: 100.0, height: 100.0), @@ -581,6 +584,7 @@ void main() { await tester.pumpWidget( Material( key: materialKey, + type: MaterialType.canvas, shape: const StadiumBorder(), elevation: 1.0, child: const SizedBox(width: 100.0, height: 100.0), @@ -792,6 +796,7 @@ void main() { height: 300, child: Material( clipBehavior: Clip.hardEdge, + elevation: 0, shape: const RoundedRectangleBorder( side: BorderSide(color: Colors.grey, width: 6), borderRadius: BorderRadius.all(Radius.circular(8)), @@ -830,6 +835,7 @@ void main() { height: 300, child: Material( clipBehavior: Clip.hardEdge, + elevation: 0, shape: const RoundedRectangleBorder( side: BorderSide(color: Colors.grey, width: 6), borderRadius: BorderRadius.all(Radius.circular(8)), diff --git a/packages/flutter/test/material/navigation_bar_test.dart b/packages/flutter/test/material/navigation_bar_test.dart index ee29b6f47f..fa6dba2b77 100644 --- a/packages/flutter/test/material/navigation_bar_test.dart +++ b/packages/flutter/test/material/navigation_bar_test.dart @@ -230,7 +230,7 @@ void main() { ); } - await tester.pumpWidget(_widget()); + await tester.pumpWidget(_widget(selectedIndex: 0)); expect( tester.getSemantics(find.text('AC')), @@ -248,6 +248,7 @@ void main() { label: 'Alarm\nTab 2 of 2', textDirection: TextDirection.ltr, isFocusable: true, + isSelected: false, hasTapAction: true, ), ); @@ -260,6 +261,7 @@ void main() { label: 'AC\nTab 1 of 2', textDirection: TextDirection.ltr, isFocusable: true, + isSelected: false, hasTapAction: true, ), ); @@ -295,7 +297,7 @@ void main() { ); } - await tester.pumpWidget(_widget()); + await tester.pumpWidget(_widget(selectedIndex: 0)); expect( tester.getSemantics(find.text('AC')), @@ -313,6 +315,7 @@ void main() { label: 'Alarm\nTab 2 of 2', textDirection: TextDirection.ltr, isFocusable: true, + isSelected: false, hasTapAction: true, ), ); @@ -325,6 +328,7 @@ void main() { label: 'AC\nTab 1 of 2', textDirection: TextDirection.ltr, isFocusable: true, + isSelected: false, hasTapAction: true, ), ); diff --git a/packages/flutter/test/material/navigation_bar_theme_test.dart b/packages/flutter/test/material/navigation_bar_theme_test.dart index 684336ab39..48c7cb960a 100644 --- a/packages/flutter/test/material/navigation_bar_theme_test.dart +++ b/packages/flutter/test/material/navigation_bar_theme_test.dart @@ -97,6 +97,7 @@ void main() { labelBehavior: labelBehavior, ), child: NavigationBar( + selectedIndex: 0, destinations: _destinations(), ), ), @@ -136,6 +137,7 @@ void main() { height: height, backgroundColor: backgroundColor, labelBehavior: labelBehavior, + selectedIndex: 0, destinations: _destinations(), ), ), diff --git a/packages/flutter/test/material/outline_button_test.dart b/packages/flutter/test/material/outline_button_test.dart index 583b8309e4..434760bca2 100644 --- a/packages/flutter/test/material/outline_button_test.dart +++ b/packages/flutter/test/material/outline_button_test.dart @@ -294,12 +294,13 @@ void main() { await expectLater(tester, meetsGuideline(textContrastGuideline)); }, skip: isBrowser, // https://github.com/flutter/flutter/issues/44115 + semanticsEnabled: true, ); testWidgets('OutlineButton with colored theme meets a11y contrast guidelines', (WidgetTester tester) async { final FocusNode focusNode = FocusNode(); - final ColorScheme colorScheme = ColorScheme.fromSwatch(); + final ColorScheme colorScheme = ColorScheme.fromSwatch(primarySwatch: Colors.blue); Color getTextColor(Set states) { final Set interactiveStates = { @@ -358,6 +359,7 @@ void main() { await expectLater(tester, meetsGuideline(textContrastGuideline)); }, skip: isBrowser, // https://github.com/flutter/flutter/issues/44115 + semanticsEnabled: true, ); testWidgets('OutlineButton uses stateful color for text color in different states', (WidgetTester tester) async { @@ -682,7 +684,7 @@ void main() { // onPressed not null, onLongPress null. wasPressed = false; await tester.pumpWidget( - buildFrame(onPressed: () { wasPressed = true; }), + buildFrame(onPressed: () { wasPressed = true; }, onLongPress: null), ); outlineButton = find.byType(OutlineButton); expect(tester.widget(outlineButton).enabled, true); @@ -692,7 +694,7 @@ void main() { // onPressed null, onLongPress not null. wasPressed = false; await tester.pumpWidget( - buildFrame(onLongPress: () { wasPressed = true; }), + buildFrame(onPressed: null, onLongPress: () { wasPressed = true; }), ); outlineButton = find.byType(OutlineButton); expect(tester.widget(outlineButton).enabled, true); @@ -701,7 +703,7 @@ void main() { // onPressed null, onLongPress null. await tester.pumpWidget( - buildFrame(), + buildFrame(onPressed: null, onLongPress: null), ); outlineButton = find.byType(OutlineButton); expect(tester.widget(outlineButton).enabled, false); @@ -770,7 +772,7 @@ void main() { // Pump a button with a null onPressed callback to make it disabled. await tester.pumpWidget( - buildFrame(), + buildFrame(onPressed: null), ); // Expect that the button is disabled and painted with the disabled border color. @@ -910,7 +912,7 @@ void main() { textDirection: TextDirection.ltr, child: Material( child: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(textScaleFactor: 1.0), child: Center( child: OutlineButton( onPressed: () {}, diff --git a/packages/flutter/test/material/outlined_button_test.dart b/packages/flutter/test/material/outlined_button_test.dart index ef30649472..3c042ed401 100644 --- a/packages/flutter/test/material/outlined_button_test.dart +++ b/packages/flutter/test/material/outlined_button_test.dart @@ -43,7 +43,7 @@ void main() { expect(material.shape, isInstanceOf()); RoundedRectangleBorder materialShape = material.shape! as RoundedRectangleBorder; - expect(materialShape.side, BorderSide(color: colorScheme.onSurface.withOpacity(0.12))); + expect(materialShape.side, BorderSide(width: 1, color: colorScheme.onSurface.withOpacity(0.12))); expect(materialShape.borderRadius, const BorderRadius.all(Radius.circular(4.0))); expect(material.textStyle!.color, colorScheme.primary); @@ -76,7 +76,7 @@ void main() { expect(material.shape, isInstanceOf()); materialShape = material.shape! as RoundedRectangleBorder; - expect(materialShape.side, BorderSide(color: colorScheme.onSurface.withOpacity(0.12))); + expect(materialShape.side, BorderSide(width: 1, color: colorScheme.onSurface.withOpacity(0.12))); expect(materialShape.borderRadius, const BorderRadius.all(Radius.circular(4.0))); expect(material.textStyle!.color, colorScheme.primary); @@ -117,7 +117,7 @@ void main() { expect(material.shape, isInstanceOf()); materialShape = material.shape! as RoundedRectangleBorder; - expect(materialShape.side, BorderSide(color: colorScheme.onSurface.withOpacity(0.12))); + expect(materialShape.side, BorderSide(width: 1, color: colorScheme.onSurface.withOpacity(0.12))); expect(materialShape.borderRadius, const BorderRadius.all(Radius.circular(4.0))); expect(material.textStyle!.color, colorScheme.primary); @@ -150,7 +150,7 @@ void main() { expect(material.shape, isInstanceOf()); materialShape = material.shape! as RoundedRectangleBorder; - expect(materialShape.side, BorderSide(color: colorScheme.onSurface.withOpacity(0.12))); + expect(materialShape.side, BorderSide(width: 1, color: colorScheme.onSurface.withOpacity(0.12))); expect(materialShape.borderRadius, const BorderRadius.all(Radius.circular(4.0))); expect(material.textStyle!.color, colorScheme.onSurface.withOpacity(0.38)); @@ -294,6 +294,7 @@ void main() { await gesture.removePointer(); }, skip: isBrowser, // https://github.com/flutter/flutter/issues/44115 + semanticsEnabled: true, ); testWidgets('OutlinedButton with colored theme meets a11y contrast guidelines', (WidgetTester tester) async { @@ -313,7 +314,7 @@ void main() { await tester.pumpWidget( MaterialApp( - theme: ThemeData.from(colorScheme: ColorScheme.fromSwatch()), + theme: ThemeData.from(colorScheme: ColorScheme.fromSwatch(primarySwatch: Colors.blue)), home: Scaffold( backgroundColor: Colors.white, body: Center( @@ -364,6 +365,7 @@ void main() { await expectLater(tester, meetsGuideline(textContrastGuideline)); }, skip: isBrowser, // https://github.com/flutter/flutter/issues/44115 + semanticsEnabled: true, ); testWidgets('OutlinedButton uses stateful color for text color in different states', (WidgetTester tester) async { @@ -512,15 +514,15 @@ void main() { BorderSide getBorderSide(Set states) { if (states.contains(MaterialState.pressed)) { - return const BorderSide(color: pressedColor); + return const BorderSide(color: pressedColor, width: 1); } if (states.contains(MaterialState.hovered)) { - return const BorderSide(color: hoverColor); + return const BorderSide(color: hoverColor, width: 1); } if (states.contains(MaterialState.focused)) { - return const BorderSide(color: focusedColor); + return const BorderSide(color: focusedColor, width: 1); } - return const BorderSide(color: defaultColor); + return const BorderSide(color: defaultColor, width: 1); } await tester.pumpWidget( @@ -586,7 +588,7 @@ void main() { // onPressed not null, onLongPress null. wasPressed = false; await tester.pumpWidget( - buildFrame(onPressed: () { wasPressed = true; }), + buildFrame(onPressed: () { wasPressed = true; }, onLongPress: null), ); outlinedButton = find.byType(OutlinedButton); expect(tester.widget(outlinedButton).enabled, true); @@ -596,7 +598,7 @@ void main() { // onPressed null, onLongPress not null. wasPressed = false; await tester.pumpWidget( - buildFrame(onLongPress: () { wasPressed = true; }), + buildFrame(onPressed: null, onLongPress: () { wasPressed = true; }), ); outlinedButton = find.byType(OutlinedButton); expect(tester.widget(outlinedButton).enabled, true); @@ -605,7 +607,7 @@ void main() { // onPressed null, onLongPress null. await tester.pumpWidget( - buildFrame(), + buildFrame(onPressed: null, onLongPress: null), ); outlinedButton = find.byType(OutlinedButton); expect(tester.widget(outlinedButton).enabled, false); @@ -856,7 +858,7 @@ void main() { // Pump a button with a null onPressed callback to make it disabled. await tester.pumpWidget( - buildFrame(), + buildFrame(onPressed: null), ); // Expect that the button is disabled and painted with the disabled border color. @@ -981,7 +983,7 @@ void main() { textDirection: TextDirection.ltr, child: Material( child: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(textScaleFactor: 1.0), child: Center( child: OutlinedButton( style: ButtonStyle( diff --git a/packages/flutter/test/material/outlined_button_theme_test.dart b/packages/flutter/test/material/outlined_button_theme_test.dart index fd71f2827e..6662ea2fd4 100644 --- a/packages/flutter/test/material/outlined_button_theme_test.dart +++ b/packages/flutter/test/material/outlined_button_theme_test.dart @@ -36,7 +36,7 @@ void main() { expect(material.shape, isInstanceOf()); final RoundedRectangleBorder materialShape = material.shape! as RoundedRectangleBorder; - expect(materialShape.side, BorderSide(color: colorScheme.onSurface.withOpacity(0.12))); + expect(materialShape.side, BorderSide(width: 1, color: colorScheme.onSurface.withOpacity(0.12))); expect(materialShape.borderRadius, const BorderRadius.all(Radius.circular(4.0))); expect(material.textStyle!.color, colorScheme.primary); @@ -181,7 +181,7 @@ void main() { }); testWidgets('Overall Theme button theme style overrides defaults, null theme and empty overall style', (WidgetTester tester) async { - await tester.pumpWidget(buildFrame(buttonStyle: const ButtonStyle(), overallStyle: style)); + await tester.pumpWidget(buildFrame(buttonStyle: const ButtonStyle(), themeStyle: null, overallStyle: style)); await tester.pumpAndSettle(); // allow the animations to finish checkButton(tester); }); diff --git a/packages/flutter/test/material/page_test.dart b/packages/flutter/test/material/page_test.dart index f5321ebd5b..2b1a77b888 100644 --- a/packages/flutter/test/material/page_test.dart +++ b/packages/flutter/test/material/page_test.dart @@ -879,7 +879,7 @@ void main() { expect(find.text('second'), findsOneWidget); myPages = >[ - MaterialPage(key: pageKeyOne, child: const Text('first')), + MaterialPage(key: pageKeyOne, maintainState: true, child: const Text('first')), MaterialPage(key: pageKeyTwo, child: const Text('second')), ]; diff --git a/packages/flutter/test/material/paginated_data_table_test.dart b/packages/flutter/test/material/paginated_data_table_test.dart index ab3b89aed6..23b5a8f826 100644 --- a/packages/flutter/test/material/paginated_data_table_test.dart +++ b/packages/flutter/test/material/paginated_data_table_test.dart @@ -302,6 +302,7 @@ void main() { header: header != null ? Text(header) : null, actions: actions, source: TestDataSource(allowSelection: true), + showCheckboxColumn: true, columns: const [ DataColumn(label: Text('Name')), DataColumn(label: Text('Calories'), numeric: true), @@ -861,6 +862,7 @@ void main() { home: PaginatedDataTable( header: const Text('Test table'), source: TestDataSource(allowSelection: true), + showCheckboxColumn: true, columns: const [ DataColumn(label: Text('Name')), DataColumn(label: Text('Calories'), numeric: true), diff --git a/packages/flutter/test/material/persistent_bottom_sheet_test.dart b/packages/flutter/test/material/persistent_bottom_sheet_test.dart index 5ef26fd914..175bec0a63 100644 --- a/packages/flutter/test/material/persistent_bottom_sheet_test.dart +++ b/packages/flutter/test/material/persistent_bottom_sheet_test.dart @@ -466,6 +466,7 @@ void main() { await tester.pumpWidget( const MaterialApp( home: Scaffold( + bottomSheet: null, body: Placeholder(), ), ), diff --git a/packages/flutter/test/material/popup_menu_test.dart b/packages/flutter/test/material/popup_menu_test.dart index f2a1b1a513..fe9e6c277c 100644 --- a/packages/flutter/test/material/popup_menu_test.dart +++ b/packages/flutter/test/material/popup_menu_test.dart @@ -438,6 +438,7 @@ void main() { itemBuilderCalled = true; return >[ PopupMenuItem( + enabled: true, value: 1, child: Text('Tap me please!', key: childKey), ), diff --git a/packages/flutter/test/material/progress_indicator_test.dart b/packages/flutter/test/material/progress_indicator_test.dart index 2d81980be7..5c49e9924e 100644 --- a/packages/flutter/test/material/progress_indicator_test.dart +++ b/packages/flutter/test/material/progress_indicator_test.dart @@ -50,7 +50,7 @@ void main() { child: Center( child: SizedBox( width: 200.0, - child: LinearProgressIndicator(), + child: LinearProgressIndicator(value: null), ), ), ), @@ -368,7 +368,7 @@ void main() { final SemanticsHandle handle = tester.ensureSemantics(); await tester.pumpWidget( const Center( - child: CircularProgressIndicator(), + child: CircularProgressIndicator(value: null), ), ); diff --git a/packages/flutter/test/material/radio_test.dart b/packages/flutter/test/material/radio_test.dart index 34baceb074..c3ccf6fb6d 100644 --- a/packages/flutter/test/material/radio_test.dart +++ b/packages/flutter/test/material/radio_test.dart @@ -1007,7 +1007,7 @@ void main() { ); } - await tester.pumpWidget(buildRadio(useOverlay: false)); + await tester.pumpWidget(buildRadio(active: false, useOverlay: false)); await tester.press(_findRadio()); await tester.pumpAndSettle(); @@ -1035,7 +1035,7 @@ void main() { reason: 'Default active pressed Radio should have overlay color from fillColor', ); - await tester.pumpWidget(buildRadio()); + await tester.pumpWidget(buildRadio(active: false)); await tester.press(_findRadio()); await tester.pumpAndSettle(); diff --git a/packages/flutter/test/material/raised_button_test.dart b/packages/flutter/test/material/raised_button_test.dart index 5ea00505ce..200da4c17e 100644 --- a/packages/flutter/test/material/raised_button_test.dart +++ b/packages/flutter/test/material/raised_button_test.dart @@ -156,6 +156,7 @@ void main() { await expectLater(tester, meetsGuideline(textContrastGuideline)); }, skip: isBrowser, // https://github.com/flutter/flutter/issues/44115 + semanticsEnabled: true, ); testWidgets('RaisedButton uses stateful color for text color in different states', (WidgetTester tester) async { @@ -349,7 +350,7 @@ void main() { // onPressed not null, onLongPress null. wasPressed = false; await tester.pumpWidget( - buildFrame(onPressed: () { wasPressed = true; }), + buildFrame(onPressed: () { wasPressed = true; }, onLongPress: null), ); raisedButton = find.byType(RaisedButton); expect(tester.widget(raisedButton).enabled, true); @@ -359,7 +360,7 @@ void main() { // onPressed null, onLongPress not null. wasPressed = false; await tester.pumpWidget( - buildFrame(onLongPress: () { wasPressed = true; }), + buildFrame(onPressed: null, onLongPress: () { wasPressed = true; }), ); raisedButton = find.byType(RaisedButton); expect(tester.widget(raisedButton).enabled, true); @@ -368,7 +369,7 @@ void main() { // onPressed null, onLongPress null. await tester.pumpWidget( - buildFrame(), + buildFrame(onPressed: null, onLongPress: null), ); raisedButton = find.byType(RaisedButton); expect(tester.widget(raisedButton).enabled, false); diff --git a/packages/flutter/test/material/range_slider_test.dart b/packages/flutter/test/material/range_slider_test.dart index 03a3f17af4..a4727ae664 100644 --- a/packages/flutter/test/material/range_slider_test.dart +++ b/packages/flutter/test/material/range_slider_test.dart @@ -134,6 +134,7 @@ void main() { child: Center( child: RangeSlider( values: values, + min: 0.0, max: 100.0, divisions: 10, onChanged: (RangeValues newValues) { @@ -192,6 +193,7 @@ void main() { child: Center( child: RangeSlider( values: values, + min: 0, max: 100, divisions: 10, onChanged: (RangeValues newValues) { @@ -338,6 +340,7 @@ void main() { child: Center( child: RangeSlider( values: values, + min: 0, max: 100, divisions: 10, onChanged: (RangeValues newValues) { @@ -384,6 +387,7 @@ void main() { child: Center( child: RangeSlider( values: values, + min: 0, max: 100, divisions: 10, onChanged: (RangeValues newValues) { @@ -530,6 +534,7 @@ void main() { child: Center( child: RangeSlider( values: values, + min: 0, max: 100, divisions: 10, onChanged: (RangeValues newValues) { @@ -582,6 +587,7 @@ void main() { child: Center( child: RangeSlider( values: values, + min: 0, max: 100, divisions: 10, onChanged: (RangeValues newValues) { @@ -734,6 +740,7 @@ void main() { child: Center( child: RangeSlider( values: values, + min: 0, max: 100, divisions: 10, onChanged: (RangeValues newValues) { @@ -786,6 +793,7 @@ void main() { child: Center( child: RangeSlider( values: values, + min: 0, max: 100, divisions: 10, onChanged: (RangeValues newValues) { @@ -840,6 +848,7 @@ void main() { child: Center( child: RangeSlider( values: values, + min: 0, max: 100, onChanged: (RangeValues newValues) { setState(() { @@ -894,6 +903,7 @@ void main() { child: Center( child: RangeSlider( values: values, + min: 0, max: 100, onChanged: (RangeValues newValues) { setState(() { @@ -1692,6 +1702,7 @@ void main() { child: Material( child: RangeSlider( values: const RangeValues(10.0, 12.0), + min: 0.0, max: 100.0, onChanged: (RangeValues v) { }, ), @@ -1746,7 +1757,11 @@ void main() { inactiveColor: Colors.grey, labels: const RangeLabels('lowerValue', 'upperValue'), max: 100.0, + min: 0.0, onChanged: null, + onChangeEnd: null, + onChangeStart: null, + semanticFormatterCallback: null, values: const RangeValues(25.0, 75.0), ).debugFillProperties(builder); diff --git a/packages/flutter/test/material/raw_material_button_test.dart b/packages/flutter/test/material/raw_material_button_test.dart index d42b02e751..27f6f60205 100644 --- a/packages/flutter/test/material/raw_material_button_test.dart +++ b/packages/flutter/test/material/raw_material_button_test.dart @@ -236,6 +236,7 @@ void main() { await tester.pumpWidget( MaterialApp( home: Column( + crossAxisAlignment: CrossAxisAlignment.center, children: [ RawMaterialButton( materialTapTargetSize: MaterialTapTargetSize.padded, @@ -456,7 +457,7 @@ void main() { // onPressed not null, onLongPress null. wasPressed = false; await tester.pumpWidget( - buildFrame(onPressed: () { wasPressed = true; }), + buildFrame(onPressed: () { wasPressed = true; }, onLongPress: null), ); rawMaterialButton = find.byType(RawMaterialButton); expect(tester.widget(rawMaterialButton).enabled, true); @@ -466,7 +467,7 @@ void main() { // onPressed null, onLongPress not null. wasPressed = false; await tester.pumpWidget( - buildFrame(onLongPress: () { wasPressed = true; }), + buildFrame(onPressed: null, onLongPress: () { wasPressed = true; }), ); rawMaterialButton = find.byType(RawMaterialButton); expect(tester.widget(rawMaterialButton).enabled, true); @@ -475,7 +476,7 @@ void main() { // onPressed null, onLongPress null. await tester.pumpWidget( - buildFrame(), + buildFrame(onPressed: null, onLongPress: null), ); rawMaterialButton = find.byType(RawMaterialButton); expect(tester.widget(rawMaterialButton).enabled, false); diff --git a/packages/flutter/test/material/reorderable_list_test.dart b/packages/flutter/test/material/reorderable_list_test.dart index 34ce29cd0c..f250ccb34f 100644 --- a/packages/flutter/test/material/reorderable_list_test.dart +++ b/packages/flutter/test/material/reorderable_list_test.dart @@ -73,6 +73,7 @@ void main() { final List currentListItems = listItems.take(1).toList(); final ReorderableListView reorderableListView = ReorderableListView( header: const Text('Header'), + scrollDirection: Axis.vertical, onReorder: (_, __) => onReorderWasCalled = true, children: currentListItems.map(listItemToWidget).toList(), ); @@ -159,6 +160,7 @@ void main() { testWidgets('properly determines the vertical drop area extents', (WidgetTester tester) async { final Widget reorderableListView = ReorderableListView( + scrollDirection: Axis.vertical, onReorder: (int oldIndex, int newIndex) { }, children: const [ SizedBox( @@ -338,6 +340,7 @@ void main() { width: 100, height: 100, child: ReorderableListView( + scrollDirection: Axis.vertical, children: const [ SizedBox(key: firstBox, width: 10, height: 10), ], @@ -621,6 +624,7 @@ void main() { testWidgets("Doesn't hide accessibility when a child declares its own semantics", (WidgetTester tester) async { final SemanticsHandle handle = tester.ensureSemantics(); final Widget reorderableListView = ReorderableListView( + scrollDirection: Axis.vertical, onReorder: (int oldIndex, int newIndex) { }, children: [ const SizedBox( @@ -1316,6 +1320,7 @@ void main() { testWidgets('Animation test when placing an item in place', (WidgetTester tester) async { const Key testItemKey = Key('Test item'); final Widget reorderableListView = ReorderableListView( + scrollDirection: Axis.vertical, onReorder: (int oldIndex, int newIndex) { }, children: const [ SizedBox( diff --git a/packages/flutter/test/material/scaffold_test.dart b/packages/flutter/test/material/scaffold_test.dart index 139a372c14..58623f1fda 100644 --- a/packages/flutter/test/material/scaffold_test.dart +++ b/packages/flutter/test/material/scaffold_test.dart @@ -252,6 +252,7 @@ void main() { await tester.pumpWidget( MediaQuery( data: const MediaQueryData( + padding: EdgeInsets.zero, viewPadding: EdgeInsets.only(bottom: 20), viewInsets: EdgeInsets.only(bottom: 300), ), @@ -430,6 +431,7 @@ void main() { await tester.pumpWidget( MediaQuery( data: const MediaQueryData( + padding: EdgeInsets.zero, viewPadding: EdgeInsets.only(bottom: 20), viewInsets: EdgeInsets.only(bottom: 300), ), @@ -520,6 +522,7 @@ void main() { await tester.pumpWidget( MediaQuery( data: const MediaQueryData( + padding: EdgeInsets.zero, viewPadding: EdgeInsets.only(bottom: 20), viewInsets: EdgeInsets.only(bottom: 300), ), @@ -1174,6 +1177,7 @@ void main() { await tester.pumpWidget( MediaQuery( data: const MediaQueryData( + padding: EdgeInsets.zero, viewPadding: EdgeInsets.only(bottom: 20), viewInsets: EdgeInsets.only(bottom: 300), ), @@ -1363,6 +1367,7 @@ void main() { MaterialApp( home: SafeArea( left: false, + top: true, right: false, bottom: false, child: Scaffold( @@ -1419,6 +1424,7 @@ void main() { MaterialApp( home: SafeArea( left: false, + top: true, right: false, bottom: false, child: Scaffold( @@ -1637,6 +1643,7 @@ void main() { drawer: const Drawer( child: Text('Drawer'), ), + drawerEnableOpenDragGesture: true, body: const Text('Scaffold Body'), appBar: AppBar( centerTitle: true, @@ -1705,6 +1712,7 @@ void main() { endDrawer: const Drawer( child: Text('Drawer'), ), + endDrawerEnableOpenDragGesture: true, body: const Text('Scaffold Body'), appBar: AppBar( centerTitle: true, @@ -2068,6 +2076,7 @@ void main() { child: const Icon(Icons.add), ), floatingActionButtonLocation: FloatingActionButtonLocation.endTop, + extendBodyBehindAppBar: false, ), )); final Offset defaultOffset = tester.getCenter(find.byType(FloatingActionButton)); diff --git a/packages/flutter/test/material/scrollbar_test.dart b/packages/flutter/test/material/scrollbar_test.dart index 8910d40391..648d7c1d0b 100644 --- a/packages/flutter/test/material/scrollbar_test.dart +++ b/packages/flutter/test/material/scrollbar_test.dart @@ -1095,6 +1095,7 @@ void main() { behavior: const NoScrollbarBehavior(), child: Scrollbar( key: key2, + notificationPredicate: null, child: SingleChildScrollView( key: outerKey, child: SizedBox( @@ -1104,6 +1105,7 @@ void main() { children: [ Scrollbar( key: key1, + notificationPredicate: null, child: SizedBox( height: 300.0, width: double.infinity, diff --git a/packages/flutter/test/material/search_test.dart b/packages/flutter/test/material/search_test.dart index bb97fbef24..56ee34a87e 100644 --- a/packages/flutter/test/material/search_test.dart +++ b/packages/flutter/test/material/search_test.dart @@ -321,6 +321,7 @@ void main() { await tester.pumpWidget(TestHomePage( delegate: delegate, passInInitialQuery: true, + initialQuery: null, )); await tester.tap(find.byTooltip('Search')); await tester.pumpAndSettle(); @@ -334,6 +335,7 @@ void main() { await tester.pumpWidget(TestHomePage( delegate: delegate, passInInitialQuery: true, + initialQuery: null, )); await tester.tap(find.byTooltip('Search')); await tester.pumpAndSettle(); @@ -355,6 +357,7 @@ void main() { await tester.pumpWidget(TestHomePage( delegate: delegate, passInInitialQuery: true, + initialQuery: null, )); // runs while search fades in @@ -786,7 +789,10 @@ void main() { testWidgets('`Leading` and `Actions` nullable test', (WidgetTester tester) async { // The search delegate page is displayed with no issues // even with a null return values for [buildLeading] and [buildActions]. - final _TestEmptySearchDelegate delegate = _TestEmptySearchDelegate(); + final _TestEmptySearchDelegate delegate = _TestEmptySearchDelegate( + result: 'Result', + suggestions: 'Suggestions', + ); final List selectedResults = []; await tester.pumpWidget(TestHomePage( @@ -825,7 +831,10 @@ void main() { final _MyNavigatorObserver rootObserver = _MyNavigatorObserver(); final _MyNavigatorObserver localObserver = _MyNavigatorObserver(); - final _TestEmptySearchDelegate delegate = _TestEmptySearchDelegate(); + final _TestEmptySearchDelegate delegate = _TestEmptySearchDelegate( + result: 'Result', + suggestions: 'Suggestions', + ); await tester.pumpWidget(MaterialApp( navigatorObservers: [rootObserver], diff --git a/packages/flutter/test/material/slider_test.dart b/packages/flutter/test/material/slider_test.dart index 8897d5e3e7..2a65e60378 100644 --- a/packages/flutter/test/material/slider_test.dart +++ b/packages/flutter/test/material/slider_test.dart @@ -476,6 +476,7 @@ void main() { width: 144.0 + 2 * 16.0, // _kPreferredTotalWidth child: Slider( key: sliderKey, + min: 0.0, max: 100.0, divisions: 10, value: value, @@ -521,6 +522,8 @@ void main() { child: Material( child: Slider( value: 0.0, + min: 0.0, + max: 1.0, onChanged: (double newValue) { log.add(newValue); }, @@ -541,6 +544,7 @@ void main() { child: Material( child: Slider( value: 0.0, + min: 0.0, max: 0.0, onChanged: (double newValue) { log.add(newValue); @@ -988,6 +992,7 @@ void main() { maxHeight: double.infinity, child: Slider( key: sliderKey, + min: 0.0, max: 100.0, divisions: isDiscrete ? 10 : null, label: '${value.round()}', @@ -1120,6 +1125,7 @@ void main() { child: Material( child: Center( child: Slider( + min: 0.0, max: 100.0, divisions: divisions, value: 0.25, @@ -1453,6 +1459,7 @@ void main() { child: Material( child: Slider( value: 100.0, + min: 0.0, max: 200.0, onChanged: (double v) { }, ), @@ -1561,6 +1568,7 @@ void main() { child: Material( child: Slider( value: 40.0, + min: 0.0, max: 200.0, divisions: 10, semanticFormatterCallback: (double value) => value.round().toString(), @@ -1944,30 +1952,30 @@ void main() { } // Default (showValueIndicator set to onlyForDiscrete). - await expectValueIndicator(isVisible: true, theme: theme, divisions: 3); + await expectValueIndicator(isVisible: true, theme: theme, divisions: 3, enabled: true); await expectValueIndicator(isVisible: false, theme: theme, divisions: 3, enabled: false); - await expectValueIndicator(isVisible: false, theme: theme); + await expectValueIndicator(isVisible: false, theme: theme, enabled: true); await expectValueIndicator(isVisible: false, theme: theme, enabled: false); // With showValueIndicator set to onlyForContinuous. theme = theme.copyWith(showValueIndicator: ShowValueIndicator.onlyForContinuous); - await expectValueIndicator(isVisible: false, theme: theme, divisions: 3); + await expectValueIndicator(isVisible: false, theme: theme, divisions: 3, enabled: true); await expectValueIndicator(isVisible: false, theme: theme, divisions: 3, enabled: false); - await expectValueIndicator(isVisible: true, theme: theme); + await expectValueIndicator(isVisible: true, theme: theme, enabled: true); await expectValueIndicator(isVisible: false, theme: theme, enabled: false); // discrete enabled widget with showValueIndicator set to always. theme = theme.copyWith(showValueIndicator: ShowValueIndicator.always); - await expectValueIndicator(isVisible: true, theme: theme, divisions: 3); + await expectValueIndicator(isVisible: true, theme: theme, divisions: 3, enabled: true); await expectValueIndicator(isVisible: false, theme: theme, divisions: 3, enabled: false); - await expectValueIndicator(isVisible: true, theme: theme); + await expectValueIndicator(isVisible: true, theme: theme, enabled: true); await expectValueIndicator(isVisible: false, theme: theme, enabled: false); // discrete enabled widget with showValueIndicator set to never. theme = theme.copyWith(showValueIndicator: ShowValueIndicator.never); - await expectValueIndicator(isVisible: false, theme: theme, divisions: 3); + await expectValueIndicator(isVisible: false, theme: theme, divisions: 3, enabled: true); await expectValueIndicator(isVisible: false, theme: theme, divisions: 3, enabled: false); - await expectValueIndicator(isVisible: false, theme: theme); + await expectValueIndicator(isVisible: false, theme: theme, enabled: true); await expectValueIndicator(isVisible: false, theme: theme, enabled: false); }); @@ -2001,13 +2009,13 @@ void main() { ); final TestGesture gesture = await tester.startGesture(tester.getCenter(find.byKey(sliderKey))); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(const Duration(milliseconds: 100)); expect(value, equals(0.5)); await gesture.moveBy(const Offset(-500.0, 0.0)); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(const Duration(milliseconds: 100)); // Change the tree to dispose the original widget. await tester.pumpWidget(Container()); - expect(await tester.pumpAndSettle(), equals(1)); + expect(await tester.pumpAndSettle(const Duration(milliseconds: 100)), equals(1)); await gesture.up(); }); @@ -2031,6 +2039,7 @@ void main() { children: [ Slider( key: sliderKey, + min: 0.0, max: 100.0, divisions: divisions, label: '${value.round()}', @@ -2286,7 +2295,11 @@ void main() { inactiveColor: Colors.grey, label: 'Set a value', max: 100.0, + min: 0.0, onChanged: null, + onChangeEnd: null, + onChangeStart: null, + semanticFormatterCallback: null, value: 50.0, ).debugFillProperties(builder); diff --git a/packages/flutter/test/material/slider_theme_test.dart b/packages/flutter/test/material/slider_theme_test.dart index 1d00f37a61..7c61bc1e27 100644 --- a/packages/flutter/test/material/slider_theme_test.dart +++ b/packages/flutter/test/material/slider_theme_test.dart @@ -1136,13 +1136,17 @@ void main() { ..rrect(rrect: RRect.fromLTRBAndCorners( 24.0, 298.0, 24.0, 302.0, topLeft: const Radius.circular(2.0), + topRight: Radius.zero, + bottomRight: Radius.zero, bottomLeft: const Radius.circular(2.0), )) ..rect(rect: const Rect.fromLTRB(24.0, 297.0, 24.0, 303.0)) ..rrect(rrect: RRect.fromLTRBAndCorners( 24.0, 298.0, 776.0, 302.0, + topLeft: Radius.zero, topRight: const Radius.circular(2.0), bottomRight: const Radius.circular(2.0), + bottomLeft: Radius.zero, )) ..circle(x: 24.0, y: 300.0) ..shadow(elevation: 1.0) diff --git a/packages/flutter/test/material/snack_bar_test.dart b/packages/flutter/test/material/snack_bar_test.dart index 2d4901d6f8..ccc3ab1d8a 100644 --- a/packages/flutter/test/material/snack_bar_test.dart +++ b/packages/flutter/test/material/snack_bar_test.dart @@ -741,7 +741,8 @@ void main() { dialogTheme: const DialogTheme(backgroundColor: Colors.black), floatingActionButtonTheme: const FloatingActionButtonThemeData(backgroundColor: Colors.black), navigationRailTheme: const NavigationRailThemeData(backgroundColor: Colors.black), - typography: Typography.material2018(), + typography: Typography.material2018(platform: TargetPlatform.android), + cupertinoOverrideTheme: null, snackBarTheme: const SnackBarThemeData(backgroundColor: Colors.black), bottomSheetTheme: const BottomSheetThemeData(backgroundColor: Colors.black), popupMenuTheme: const PopupMenuThemeData(color: Colors.black), @@ -1918,6 +1919,7 @@ void main() { await tester.pumpWidget( MediaQuery( data: const MediaQueryData( + padding: EdgeInsets.zero, viewPadding: EdgeInsets.all(20), viewInsets: EdgeInsets.all(100), ), diff --git a/packages/flutter/test/material/stepper_test.dart b/packages/flutter/test/material/stepper_test.dart index 9d66e1a400..89b580ee33 100644 --- a/packages/flutter/test/material/stepper_test.dart +++ b/packages/flutter/test/material/stepper_test.dart @@ -583,6 +583,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async Step( title: const Text('Step 2'), content: Stepper( + type: StepperType.vertical, steps: const [ Step( title: Text('Nested step 1'), @@ -701,6 +702,8 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async MaterialApp( home: Material( child: Stepper( + currentStep: 0, + type: StepperType.vertical, steps: const [ Step( title: Text('Step 0'), @@ -725,6 +728,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async MaterialApp( home: Material( child: Stepper( + currentStep: 0, type: StepperType.horizontal, steps: const [ Step( @@ -962,7 +966,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async // Light theme final ColorScheme light = ThemeData.light().colorScheme; - await tester.pumpWidget(buildFrame(brightness: Brightness.light)); + await tester.pumpWidget(buildFrame(isActive: true, brightness: Brightness.light)); expect(circleFillColor(), light.primary); await tester.pumpWidget(buildFrame(isActive: false, brightness: Brightness.light)); await tester.pumpAndSettle(); @@ -970,7 +974,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async // Dark theme final ColorScheme dark = ThemeData.dark().colorScheme; - await tester.pumpWidget(buildFrame(brightness: Brightness.dark)); + await tester.pumpWidget(buildFrame(isActive: true, brightness: Brightness.dark)); await tester.pumpAndSettle(); expect(circleFillColor(), dark.secondary); await tester.pumpWidget(buildFrame(isActive: false, brightness: Brightness.dark)); @@ -1130,6 +1134,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async height: 75, child: Stepper( margin: margin, + type: StepperType.vertical, steps: const [ Step( title: Text('Regular title'), diff --git a/packages/flutter/test/material/switch_list_tile_test.dart b/packages/flutter/test/material/switch_list_tile_test.dart index 6ce3a4aee6..74121e7dbb 100644 --- a/packages/flutter/test/material/switch_list_tile_test.dart +++ b/packages/flutter/test/material/switch_list_tile_test.dart @@ -73,6 +73,7 @@ void main() { TestSemantics.rootChild( id: 1, rect: const Rect.fromLTWH(0.0, 0.0, 800.0, 56.0), + transform: null, flags: [ SemanticsFlag.hasEnabledState, SemanticsFlag.hasToggledState, @@ -219,7 +220,10 @@ void main() { testWidgets('SwitchListTile contentPadding', (WidgetTester tester) async { Widget buildFrame(TextDirection textDirection) { return MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData( + padding: EdgeInsets.zero, + textScaleFactor: 1.0, + ), child: Directionality( textDirection: textDirection, child: Material( diff --git a/packages/flutter/test/material/switch_test.dart b/packages/flutter/test/material/switch_test.dart index c15d1dc91e..27131c5e00 100644 --- a/packages/flutter/test/material/switch_test.dart +++ b/packages/flutter/test/material/switch_test.dart @@ -241,6 +241,7 @@ void main() { return Material( child: Center( child: Switch( + dragStartBehavior: DragStartBehavior.start, value: value, onChanged: (bool newValue) { setState(() { @@ -1599,7 +1600,7 @@ void main() { ); } - await tester.pumpWidget(buildSwitch(useOverlay: false)); + await tester.pumpWidget(buildSwitch(active: false, useOverlay: false)); await tester.press(find.byType(Switch)); await tester.pumpAndSettle(); @@ -1629,7 +1630,7 @@ void main() { reason: 'Default active pressed Switch should have overlay color from thumbColor', ); - await tester.pumpWidget(buildSwitch()); + await tester.pumpWidget(buildSwitch(active: false)); await tester.press(find.byType(Switch)); await tester.pumpAndSettle(); diff --git a/packages/flutter/test/material/tab_bar_theme_test.dart b/packages/flutter/test/material/tab_bar_theme_test.dart index 319554c2ae..18bcaaba00 100644 --- a/packages/flutter/test/material/tab_bar_theme_test.dart +++ b/packages/flutter/test/material/tab_bar_theme_test.dart @@ -290,7 +290,8 @@ void main() { testWidgets('Tab bar theme - custom tab indicator', (WidgetTester tester) async { final TabBarTheme tabBarTheme = TabBarTheme( indicator: BoxDecoration( - border: Border.all(), + border: Border.all(color: Colors.black), + shape: BoxShape.rectangle, ), ); diff --git a/packages/flutter/test/material/tabbed_scrollview_warp_test.dart b/packages/flutter/test/material/tabbed_scrollview_warp_test.dart index bfc55deaa3..b167fd2e11 100644 --- a/packages/flutter/test/material/tabbed_scrollview_warp_test.dart +++ b/packages/flutter/test/material/tabbed_scrollview_warp_test.dart @@ -37,7 +37,7 @@ class _MyHomePageState extends State with TickerProviderStateMixin { @override void initState() { super.initState(); - tabController = TabController(length: tabCount, vsync: this); + tabController = TabController(initialIndex: 0, length: tabCount, vsync: this); } @override diff --git a/packages/flutter/test/material/tabs_test.dart b/packages/flutter/test/material/tabs_test.dart index 374f5e5496..5bd2223856 100644 --- a/packages/flutter/test/material/tabs_test.dart +++ b/packages/flutter/test/material/tabs_test.dart @@ -89,6 +89,7 @@ class _NestedTabBarContainer extends StatelessWidget { ], ), Expanded( + flex: 1, child: TabBarView( controller: tabController, children: [ @@ -324,7 +325,7 @@ void main() { testWidgets('TabBar tap selects tab', (WidgetTester tester) async { final List tabs = ['A', 'B', 'C']; - await tester.pumpWidget(buildFrame(tabs: tabs, value: 'C')); + await tester.pumpWidget(buildFrame(tabs: tabs, value: 'C', isScrollable: false)); expect(find.text('A'), findsOneWidget); expect(find.text('B'), findsOneWidget); expect(find.text('C'), findsOneWidget); @@ -333,7 +334,7 @@ void main() { expect(controller.index, 2); expect(controller.previousIndex, 2); - await tester.pumpWidget(buildFrame(tabs: tabs, value: 'C')); + await tester.pumpWidget(buildFrame(tabs: tabs, value: 'C', isScrollable: false)); await tester.tap(find.text('B')); await tester.pump(); expect(controller.indexIsChanging, true); @@ -342,14 +343,14 @@ void main() { expect(controller.previousIndex, 2); expect(controller.indexIsChanging, false); - await tester.pumpWidget(buildFrame(tabs: tabs, value: 'C')); + await tester.pumpWidget(buildFrame(tabs: tabs, value: 'C', isScrollable: false)); await tester.tap(find.text('C')); await tester.pump(); await tester.pump(const Duration(seconds: 1)); expect(controller.index, 2); expect(controller.previousIndex, 1); - await tester.pumpWidget(buildFrame(tabs: tabs, value: 'C')); + await tester.pumpWidget(buildFrame(tabs: tabs, value: 'C', isScrollable: false)); await tester.tap(find.text('A')); await tester.pump(); await tester.pump(const Duration(seconds: 1)); @@ -1900,6 +1901,8 @@ void main() { child: TabBar( padding: padding, labelPadding: EdgeInsets.zero, + indicatorPadding: EdgeInsets.zero, + isScrollable: false, controller: controller, tabs: tabs, ), @@ -1955,6 +1958,7 @@ void main() { child: TabBar( padding: padding, labelPadding: EdgeInsets.zero, + indicatorPadding: EdgeInsets.zero, isScrollable: true, controller: controller, tabs: tabs, @@ -2215,6 +2219,7 @@ void main() { final TabController controller = TabController( vsync: const TestVSync(), length: tabs.length, + initialIndex: 0, ); await tester.pumpWidget( @@ -2288,6 +2293,7 @@ void main() { final TabController controller = TabController( vsync: const TestVSync(), length: tabs.length, + initialIndex: 0, ); await tester.pumpWidget( @@ -2431,6 +2437,7 @@ void main() { final TabController controller = TabController( vsync: const TestVSync(), length: 2, + initialIndex: 0, ); await tester.pumpWidget( @@ -2480,6 +2487,7 @@ void main() { final TabController controller = TabController( vsync: const TestVSync(), length: tabs.length, + initialIndex: 0, ); await tester.pumpWidget( @@ -2689,11 +2697,13 @@ void main() { final TabController controller1 = TabController( vsync: const TestVSync(), length: 2, + initialIndex: 0, ); final TabController controller2 = TabController( vsync: const TestVSync(), length: 2, + initialIndex: 0, ); await tester.pumpWidget(buildFrame(controller1)); @@ -3187,6 +3197,7 @@ void main() { : const Center(child: Text('No tabs')), bottomNavigationBar: BottomAppBar( child: Row( + mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ IconButton( @@ -3308,6 +3319,8 @@ void main() { }); testWidgets('TabBar expands vertically to accommodate the Icon and child Text() pair the same amount it would expand for Icon and text pair.', (WidgetTester tester) async { + const double indicatorWeight = 2.0; + const List tabListWithText = [ Tab(icon: Icon(Icons.notifications), text: 'Test'), ]; @@ -3315,8 +3328,8 @@ void main() { Tab(icon: Icon(Icons.notifications), child: Text('Test')), ]; - const TabBar tabBarWithText = TabBar(tabs: tabListWithText); - const TabBar tabBarWithTextChild = TabBar(tabs: tabListWithTextChild); + const TabBar tabBarWithText = TabBar(tabs: tabListWithText, indicatorWeight: indicatorWeight); + const TabBar tabBarWithTextChild = TabBar(tabs: tabListWithTextChild, indicatorWeight: indicatorWeight); expect(tabBarWithText.preferredSize, tabBarWithTextChild.preferredSize); }); @@ -3352,6 +3365,7 @@ void main() { await tester.pumpWidget(TabControllerFrame( builder: buildTabControllerFrame, length: tabs.length, + initialIndex: 0, )); final RenderBox box = tester.renderObject(find.byType(TabBar)); @@ -3685,7 +3699,7 @@ void main() { testWidgets('Tabs are given uniform padding in case of few tabs having both text and icon', (WidgetTester tester) async { const EdgeInsetsGeometry expectedPaddingAdjusted = EdgeInsets.symmetric(vertical: 13.0, horizontal: 16.0); - const EdgeInsetsGeometry expectedPaddingDefault = EdgeInsets.symmetric(horizontal: 16.0); + const EdgeInsetsGeometry expectedPaddingDefault = EdgeInsets.symmetric(vertical: 0.0, horizontal: 16.0); await tester.pumpWidget( MaterialApp( @@ -3850,6 +3864,7 @@ void main() { final TabController controller = TabController( vsync: const TestVSync(), length: 2, + initialIndex: 0, ); await tester.pumpWidget( diff --git a/packages/flutter/test/material/text_button_test.dart b/packages/flutter/test/material/text_button_test.dart index 45a3a9c8fe..277f0e8233 100644 --- a/packages/flutter/test/material/text_button_test.dart +++ b/packages/flutter/test/material/text_button_test.dart @@ -185,6 +185,7 @@ void main() { await gesture.removePointer(); }, skip: isBrowser, // https://github.com/flutter/flutter/issues/44115 + semanticsEnabled: true, ); testWidgets('TextButton with colored theme meets a11y contrast guidelines', (WidgetTester tester) async { @@ -253,6 +254,7 @@ void main() { await expectLater(tester, meetsGuideline(textContrastGuideline)); }, skip: isBrowser, // https://github.com/flutter/flutter/issues/44115 + semanticsEnabled: true, ); testWidgets('TextButton uses stateful color for text color in different states', (WidgetTester tester) async { @@ -526,7 +528,7 @@ void main() { textDirection: TextDirection.ltr, child: Material( child: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(textScaleFactor: 1.0), child: Center( child: TextButton( onPressed: () { }, @@ -639,7 +641,7 @@ void main() { // onPressed not null, onLongPress null. wasPressed = false; await tester.pumpWidget( - buildFrame(onPressed: () { wasPressed = true; }), + buildFrame(onPressed: () { wasPressed = true; }, onLongPress: null), ); textButton = find.byType(TextButton); expect(tester.widget(textButton).enabled, true); @@ -649,7 +651,7 @@ void main() { // onPressed null, onLongPress not null. wasPressed = false; await tester.pumpWidget( - buildFrame(onLongPress: () { wasPressed = true; }), + buildFrame(onPressed: null, onLongPress: () { wasPressed = true; }), ); textButton = find.byType(TextButton); expect(tester.widget(textButton).enabled, true); @@ -658,7 +660,7 @@ void main() { // onPressed null, onLongPress null. await tester.pumpWidget( - buildFrame(), + buildFrame(onPressed: null, onLongPress: null), ); textButton = find.byType(TextButton); expect(tester.widget(textButton).enabled, false); diff --git a/packages/flutter/test/material/text_button_theme_test.dart b/packages/flutter/test/material/text_button_theme_test.dart index 819397148b..81e2212f9f 100644 --- a/packages/flutter/test/material/text_button_theme_test.dart +++ b/packages/flutter/test/material/text_button_theme_test.dart @@ -176,7 +176,7 @@ void main() { }); testWidgets('Overall Theme button theme style overrides defaults, null theme and empty overall style', (WidgetTester tester) async { - await tester.pumpWidget(buildFrame(buttonStyle: const ButtonStyle(), overallStyle: style)); + await tester.pumpWidget(buildFrame(buttonStyle: const ButtonStyle(), themeStyle: null, overallStyle: style)); await tester.pumpAndSettle(); // allow the animations to finish checkButton(tester); }); diff --git a/packages/flutter/test/material/text_field_restoration_test.dart b/packages/flutter/test/material/text_field_restoration_test.dart index 523d17c20f..dc37d0523c 100644 --- a/packages/flutter/test/material/text_field_restoration_test.dart +++ b/packages/flutter/test/material/text_field_restoration_test.dart @@ -99,6 +99,7 @@ class TestWidgetState extends State with RestorationMixin { Widget build(BuildContext context) { return Material( child: Align( + alignment: Alignment.center, child: SizedBox( width: 50, child: TextField( diff --git a/packages/flutter/test/material/text_field_test.dart b/packages/flutter/test/material/text_field_test.dart index 98a815d2ef..4fa99060d6 100644 --- a/packages/flutter/test/material/text_field_test.dart +++ b/packages/flutter/test/material/text_field_test.dart @@ -506,7 +506,7 @@ void main() { await tester.tap(find.byKey(icon)); await tester.pump(); expect(controller.text, ''); - expect(controller.selection, const TextSelection.collapsed(offset: 0)); + expect(controller.selection, const TextSelection.collapsed(offset: 0, affinity: TextAffinity.downstream)); }); testWidgets('Cursor radius is 2.0', (WidgetTester tester) async { @@ -684,7 +684,7 @@ void main() { actualNewValue, const TextEditingValue( text: '12', - selection: TextSelection.collapsed(offset: 2), + selection: TextSelection.collapsed(offset: 2, affinity: TextAffinity.downstream), ), ); }, skip: areKeyEventsHandledByPlatform); // [intended] only applies to platforms where we handle key events. @@ -770,7 +770,7 @@ void main() { // First tap moved the cursor. expect( controller.selection, - const TextSelection.collapsed(offset: 8), + const TextSelection.collapsed(offset: 8, affinity: TextAffinity.downstream), ); await tester.tapAt(textfieldStart + const Offset(150.0, 9.0)); await tester.pump(); @@ -862,6 +862,7 @@ void main() { style: const TextStyle(height: 4, color: Colors.black45), toolbarOptions: const ToolbarOptions(copy: true, selectAll: true), selectionHeightStyle: ui.BoxHeightStyle.includeLineSpacingBottom, + selectionWidthStyle: ui.BoxWidthStyle.tight, maxLines: 3, ), ], @@ -2222,6 +2223,7 @@ void main() { child: TextField( controller: controller, expands: true, + minLines: null, maxLines: null, ), ), @@ -4115,6 +4117,7 @@ void main() { tester.testTextInput.updateEditingValue(const TextEditingValue( text: testValue, selection: TextSelection.collapsed(offset: 10), + composing: TextRange.empty, )); await tester.pump(); expect(textController.text, testValue); @@ -4124,6 +4127,7 @@ void main() { tester.testTextInput.updateEditingValue(const TextEditingValue( text: '${testValue}9999999', selection: TextSelection.collapsed(offset: 10 + 7), + composing: TextRange.empty, )); await tester.pump(); @@ -4135,6 +4139,7 @@ void main() { tester.testTextInput.updateEditingValue(const TextEditingValue( text: '0123455555555556789', selection: TextSelection.collapsed(offset: 19), + composing: TextRange.empty, )); await tester.pump(); @@ -4161,6 +4166,7 @@ void main() { tester.testTextInput.updateEditingValue(const TextEditingValue( text: testValue, selection: TextSelection(baseOffset: 8, extentOffset: 10), + composing: TextRange.empty, )); await tester.pump(); expect(textController.text, testValue); @@ -4170,6 +4176,7 @@ void main() { tester.testTextInput.updateEditingValue(const TextEditingValue( text: '01234569999999', selection: TextSelection.collapsed(offset: 14), + composing: TextRange.empty, )); await tester.pump(); @@ -4701,6 +4708,7 @@ void main() { home: Material( child: RawKeyboardListener( focusNode: focusNode, + onKey: null, child: TextField( controller: controller, maxLines: 3, @@ -4893,6 +4901,7 @@ void main() { home: Material( child: RawKeyboardListener( focusNode: focusNode, + onKey: null, child: textField, ), ), @@ -4969,6 +4978,7 @@ void main() { home: Material( child: RawKeyboardListener( focusNode: focusNode, + onKey: null, child: textField, ), ), @@ -5042,6 +5052,7 @@ void main() { home: Material( child: RawKeyboardListener( focusNode: focusNode, + onKey: null, child: textField, ), ), @@ -5094,6 +5105,7 @@ void main() { home: Material( child: RawKeyboardListener( focusNode: focusNode, + onKey: null, child: textField, ), ), @@ -5171,6 +5183,7 @@ void main() { home: Material( child: RawKeyboardListener( focusNode: focusNode, + onKey: null, child: textField, ), ), @@ -5239,6 +5252,7 @@ void main() { home: Material( child: RawKeyboardListener( focusNode: focusNode, + onKey: null, child: textField, ), ), @@ -5290,6 +5304,7 @@ void main() { home: Material( child: RawKeyboardListener( focusNode: focusNode, + onKey: null, child: textField, ), ), @@ -6978,7 +6993,7 @@ void main() { // Cursor at tap position, not at word edge. expect( controller.selection, - const TextSelection.collapsed(offset: 3), + const TextSelection.collapsed(offset: 3, affinity: TextAffinity.downstream), ); }, variant: const TargetPlatformVariant({ TargetPlatform.iOS, TargetPlatform.macOS }), @@ -7082,7 +7097,7 @@ void main() { // First tap moved the cursor. expect( controller.selection, - const TextSelection.collapsed(offset: 8), + const TextSelection.collapsed(offset: 8, affinity: TextAffinity.downstream), ); await tester.tapAt(textfieldStart + const Offset(150.0, 9.0)); await tester.pumpAndSettle(); @@ -7484,7 +7499,7 @@ void main() { // First tap moved the cursor. expect( controller.selection, - const TextSelection.collapsed(offset: 8), + const TextSelection.collapsed(offset: 8, affinity: TextAffinity.downstream), ); await tester.tapAt(textfieldStart + const Offset(150.0, 9.0)); await tester.pump(const Duration(milliseconds: 500)); @@ -7642,7 +7657,7 @@ void main() { // Long press on iOS shows collapsed selection cursor. expect( controller.selection, - const TextSelection.collapsed(offset: 3), + const TextSelection.collapsed(offset: 3, affinity: TextAffinity.downstream), ); // Cursor move doesn't trigger a toolbar initially. expect(find.byType(CupertinoButton), findsNothing); @@ -7653,7 +7668,7 @@ void main() { // The selection position is now moved with the drag. expect( controller.selection, - const TextSelection.collapsed(offset: 6), + const TextSelection.collapsed(offset: 6, affinity: TextAffinity.downstream), ); // Still no toolbar. expect(find.byType(CupertinoButton), findsNothing); @@ -7664,7 +7679,7 @@ void main() { // The selection position is now moved with the drag. expect( controller.selection, - const TextSelection.collapsed(offset: 9), + const TextSelection.collapsed(offset: 9, affinity: TextAffinity.downstream), ); // Still no toolbar. expect(find.byType(CupertinoButton), findsNothing); @@ -7675,7 +7690,7 @@ void main() { // The selection isn't affected by the gesture lift. expect( controller.selection, - const TextSelection.collapsed(offset: 9), + const TextSelection.collapsed(offset: 9, affinity: TextAffinity.downstream), ); // The toolbar now shows up. expect(find.byType(CupertinoButton), isContextMenuProvidedByPlatform ? findsNothing : findsNWidgets(2)); @@ -7693,6 +7708,7 @@ void main() { child: Center( child: TextField( controller: controller, + maxLines: 1, ), ), ), @@ -7727,14 +7743,14 @@ void main() { await tester.pump(); expect( controller.selection, - const TextSelection.collapsed(offset: 56), + const TextSelection.collapsed(offset: 56, affinity: TextAffinity.downstream), ); // Keep moving out. await gesture.moveBy(const Offset(1, 0)); await tester.pump(); expect( controller.selection, - const TextSelection.collapsed(offset: 62), + const TextSelection.collapsed(offset: 62, affinity: TextAffinity.downstream), ); await gesture.moveBy(const Offset(1, 0)); await tester.pump(); @@ -7796,7 +7812,7 @@ void main() { // First tap moved the cursor to the beginning of the second word. expect( controller.selection, - const TextSelection.collapsed(offset: 8), + const TextSelection.collapsed(offset: 8, affinity: TextAffinity.downstream), ); await tester.tapAt(textfieldStart + const Offset(150.0, 9.0)); await tester.pump(const Duration(milliseconds: 500)); @@ -7840,7 +7856,7 @@ void main() { await tester.pump(const Duration(milliseconds: 50)); expect( controller.selection, - const TextSelection.collapsed(offset: 3), + const TextSelection.collapsed(offset: 3, affinity: TextAffinity.downstream), ); await tester.tapAt(textfieldStart + const Offset(150.0, 9.0)); @@ -7848,7 +7864,7 @@ void main() { // First tap moved the cursor. expect( controller.selection, - const TextSelection.collapsed(offset: 8), + const TextSelection.collapsed(offset: 8, affinity: TextAffinity.downstream), ); await tester.tapAt(textfieldStart + const Offset(150.0, 9.0)); await tester.pumpAndSettle(); @@ -7894,7 +7910,7 @@ void main() { await tester.pumpAndSettle(); expect( controller.selection, - const TextSelection.collapsed(offset: 3), + const TextSelection.collapsed(offset: 3, affinity: TextAffinity.downstream), ); await gesture.down(textFieldStart + const Offset(150.0, 9.0)); @@ -7905,7 +7921,7 @@ void main() { // the word. expect( controller.selection, - const TextSelection.collapsed(offset: 9), + const TextSelection.collapsed(offset: 9, affinity: TextAffinity.downstream), ); // Double click selection. @@ -7978,7 +7994,7 @@ void main() { // First tap moved the cursor. expect( controller.selection, - const TextSelection.collapsed(offset: 8), + const TextSelection.collapsed(offset: 8, affinity: TextAffinity.downstream), ); await tester.tapAt(textfieldStart + const Offset(150.0, 9.0)); await tester.pumpAndSettle(); @@ -8024,7 +8040,7 @@ void main() { await tester.pump(const Duration(milliseconds: 50)); expect( controller.selection, - const TextSelection.collapsed(offset: 3), + const TextSelection.collapsed(offset: 3, affinity: TextAffinity.downstream), ); // Second click selects. @@ -8046,7 +8062,7 @@ void main() { // First tap moved the cursor. expect( controller.selection, - const TextSelection.collapsed(offset: 6), + const TextSelection.collapsed(offset: 6, affinity: TextAffinity.downstream), ); await gesture.down(textFieldStart + const Offset(100.0, 9.0)); await tester.pump(); @@ -8065,7 +8081,7 @@ void main() { // First tap moved the cursor. expect( controller.selection, - const TextSelection.collapsed(offset: 9), + const TextSelection.collapsed(offset: 9, affinity: TextAffinity.downstream), ); await gesture.down(textFieldStart + const Offset(150.0, 9.0)); await tester.pump(); @@ -8307,6 +8323,7 @@ void main() { position: offset + const Offset(150.0, 9.0), pressure: 0.5, pressureMin: 0, + pressureMax: 1, )); // We don't want this gesture to select any word on Android. @@ -8353,6 +8370,7 @@ void main() { position: textfieldStart + const Offset(150.0, 9.0), pressure: 0.5, pressureMin: 0, + pressureMax: 1, ), ); // We expect the force press to select a word at the given location. @@ -8404,6 +8422,7 @@ void main() { position: textfieldStart + const Offset(150.0, 9.0), pressure: 0.5, pressureMin: 0, + pressureMax: 1, ), ); await gesture.up(); @@ -8442,10 +8461,12 @@ void main() { decoration: InputDecoration(labelText: 'foo'), keyboardType: TextInputType.text, textInputAction: TextInputAction.done, + textCapitalization: TextCapitalization.none, style: TextStyle(color: Color(0xff00ff00)), textAlign: TextAlign.end, textDirection: TextDirection.ltr, autofocus: true, + obscureText: false, autocorrect: false, maxLines: 10, maxLength: 100, @@ -9752,7 +9773,7 @@ void main() { ); } - await tester.pumpWidget(textFieldBuilder()); + await tester.pumpWidget(textFieldBuilder(behavior: FloatingLabelBehavior.auto)); // The label will be positioned within the content when unfocused. expect(tester.getTopLeft(find.text('Label')).dy, 20.0); diff --git a/packages/flutter/test/material/text_form_field_restoration_test.dart b/packages/flutter/test/material/text_form_field_restoration_test.dart index 95440d1f4a..dd4fc54c68 100644 --- a/packages/flutter/test/material/text_form_field_restoration_test.dart +++ b/packages/flutter/test/material/text_form_field_restoration_test.dart @@ -41,7 +41,7 @@ void main() { return MaterialApp( restorationScopeId: 'app', home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -99,7 +99,7 @@ void main() { return MaterialApp( restorationScopeId: 'app', home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -231,6 +231,7 @@ class TestWidgetState extends State with RestorationMixin { Widget build(BuildContext context) { return Material( child: Align( + alignment: Alignment.center, child: SizedBox( width: 50, child: TextFormField( diff --git a/packages/flutter/test/material/text_form_field_test.dart b/packages/flutter/test/material/text_form_field_test.dart index e41865cdab..ab7edb6aaa 100644 --- a/packages/flutter/test/material/text_form_field_test.dart +++ b/packages/flutter/test/material/text_form_field_test.dart @@ -517,7 +517,9 @@ void main() { MaterialApp( home: Material( child: Center( - child: TextFormField(), + child: TextFormField( + initialValue: null, + ), ), ), ), @@ -540,7 +542,9 @@ void main() { MaterialApp( home: Material( child: Center( - child: TextFormField(), + child: TextFormField( + initialValue: null, + ), ), ), ), diff --git a/packages/flutter/test/material/text_selection_test.dart b/packages/flutter/test/material/text_selection_test.dart index 29c968fe9e..d0cf606070 100644 --- a/packages/flutter/test/material/text_selection_test.dart +++ b/packages/flutter/test/material/text_selection_test.dart @@ -568,7 +568,7 @@ void main() { padding: const EdgeInsets.symmetric(horizontal: 250), child: FittedBox( child: materialTextSelectionControls.buildHandle( - context, TextSelectionHandleType.right, 10.0, + context, TextSelectionHandleType.right, 10.0, null, ), ), ), diff --git a/packages/flutter/test/material/text_selection_theme_test.dart b/packages/flutter/test/material/text_selection_theme_test.dart index c722ca14da..b815cde065 100644 --- a/packages/flutter/test/material/text_selection_theme_test.dart +++ b/packages/flutter/test/material/text_selection_theme_test.dart @@ -88,6 +88,7 @@ void main() { context, TextSelectionHandleType.left, 10.0, + null, ); }, ), @@ -141,6 +142,7 @@ void main() { context, TextSelectionHandleType.left, 10.0, + null, ); }, ), @@ -202,6 +204,7 @@ void main() { context, TextSelectionHandleType.left, 10.0, + null, ); }, ), diff --git a/packages/flutter/test/material/text_theme_test.dart b/packages/flutter/test/material/text_theme_test.dart index 9a89a6b972..e5a88c2c21 100644 --- a/packages/flutter/test/material/text_theme_test.dart +++ b/packages/flutter/test/material/text_theme_test.dart @@ -15,7 +15,7 @@ void main() { }); test('TextTheme copyWith apply, merge basics with Typography.black', () { - final Typography typography = Typography.material2018(); + final Typography typography = Typography.material2018(platform: TargetPlatform.android); expect(typography.black, equals(typography.black.copyWith())); expect(typography.black, equals(typography.black.apply())); expect(typography.black, equals(typography.black.merge(null))); @@ -27,7 +27,7 @@ void main() { }); test('TextTheme copyWith', () { - final Typography typography = Typography.material2018(); + final Typography typography = Typography.material2018(platform: TargetPlatform.android); final TextTheme whiteCopy = typography.black.copyWith( headline1: typography.white.headline1, headline2: typography.white.headline2, @@ -84,7 +84,7 @@ void main() { TextDecoration.lineThrough, ]); - final Typography typography = Typography.material2018(); + final Typography typography = Typography.material2018(platform: TargetPlatform.android); final TextTheme theme = typography.black.apply( fontFamily: fontFamily, displayColor: displayColor, @@ -130,7 +130,7 @@ void main() { }); test('TextTheme apply fontSizeFactor fontSizeDelta', () { - final Typography typography = Typography.material2018(); + final Typography typography = Typography.material2018(platform: TargetPlatform.android); final TextTheme baseTheme = Typography.englishLike2018.merge(typography.black); final TextTheme sizeTheme = baseTheme.apply( fontSizeFactor: 2.0, diff --git a/packages/flutter/test/material/theme_data_test.dart b/packages/flutter/test/material/theme_data_test.dart index c556bf64be..915ddc4a26 100644 --- a/packages/flutter/test/material/theme_data_test.dart +++ b/packages/flutter/test/material/theme_data_test.dart @@ -52,7 +52,7 @@ void main() { }); test('Default chip label style gets a default bodyText1 if textTheme.bodyText1 is null', () { - const TextTheme noBodyText1TextTheme = TextTheme(); + const TextTheme noBodyText1TextTheme = TextTheme(bodyText1: null); final ThemeData lightTheme = ThemeData(brightness: Brightness.light, textTheme: noBodyText1TextTheme); final ThemeData darkTheme = ThemeData(brightness: Brightness.dark, textTheme: noBodyText1TextTheme); final Typography typography = Typography.material2018(platform: lightTheme.platform); @@ -326,7 +326,7 @@ void main() { floatingActionButtonTheme: const FloatingActionButtonThemeData(backgroundColor: Colors.black), navigationBarTheme: const NavigationBarThemeData(backgroundColor: Colors.black), navigationRailTheme: const NavigationRailThemeData(backgroundColor: Colors.black), - typography: Typography.material2018(), + typography: Typography.material2018(platform: TargetPlatform.android), cupertinoOverrideTheme: null, snackBarTheme: const SnackBarThemeData(backgroundColor: Colors.black), bottomSheetTheme: const BottomSheetThemeData(backgroundColor: Colors.black), diff --git a/packages/flutter/test/material/theme_defaults_test.dart b/packages/flutter/test/material/theme_defaults_test.dart index 78ac3915a3..672dafd716 100644 --- a/packages/flutter/test/material/theme_defaults_test.dart +++ b/packages/flutter/test/material/theme_defaults_test.dart @@ -216,7 +216,7 @@ void main() { group('FloatingActionButton', () { const BoxConstraints defaultFABConstraints = BoxConstraints.tightFor(width: 56.0, height: 56.0); - const ShapeBorder defaultFABShape = CircleBorder(); + const ShapeBorder defaultFABShape = CircleBorder(side: BorderSide.none); const EdgeInsets defaultFABPadding = EdgeInsets.zero; testWidgets('theme: ThemeData.light(), enabled: true', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/time_picker_test.dart b/packages/flutter/test/material/time_picker_test.dart index b2e7a36441..41d9278c87 100644 --- a/packages/flutter/test/material/time_picker_test.dart +++ b/packages/flutter/test/material/time_picker_test.dart @@ -814,6 +814,7 @@ void _tests() { await mediaQueryBoilerplate( tester, false, + textScaleFactor: 1.0, initialTime: const TimeOfDay(hour: 7, minute: 41), ); @@ -919,7 +920,7 @@ void _testsInput() { testWidgets('Switching to input entry mode triggers entry callback', (WidgetTester tester) async { bool triggeredCallback = false; - await mediaQueryBoilerplate(tester, true, onEntryModeChange: (TimePickerEntryMode mode) { + await mediaQueryBoilerplate(tester, true, entryMode: TimePickerEntryMode.dial, onEntryModeChange: (TimePickerEntryMode mode) { if (mode == TimePickerEntryMode.input) { triggeredCallback = true; } @@ -931,7 +932,7 @@ void _testsInput() { }); testWidgets('Can double tap hours (when selected) to enter input mode', (WidgetTester tester) async { - await mediaQueryBoilerplate(tester, false); + await mediaQueryBoilerplate(tester, false, entryMode: TimePickerEntryMode.dial); final Finder hourFinder = find.ancestor( of: find.text('7'), matching: find.byType(InkWell), @@ -949,7 +950,7 @@ void _testsInput() { }); testWidgets('Can not double tap hours (when not selected) to enter input mode', (WidgetTester tester) async { - await mediaQueryBoilerplate(tester, false); + await mediaQueryBoilerplate(tester, false, entryMode: TimePickerEntryMode.dial); final Finder hourFinder = find.ancestor( of: find.text('7'), matching: find.byType(InkWell), @@ -975,7 +976,7 @@ void _testsInput() { }); testWidgets('Can double tap minutes (when selected) to enter input mode', (WidgetTester tester) async { - await mediaQueryBoilerplate(tester, false); + await mediaQueryBoilerplate(tester, false, entryMode: TimePickerEntryMode.dial); final Finder minuteFinder = find.ancestor( of: find.text('00'), matching: find.byType(InkWell), @@ -997,7 +998,7 @@ void _testsInput() { }); testWidgets('Can not double tap minutes (when not selected) to enter input mode', (WidgetTester tester) async { - await mediaQueryBoilerplate(tester, false); + await mediaQueryBoilerplate(tester, false, entryMode: TimePickerEntryMode.dial); final Finder minuteFinder = find.ancestor( of: find.text('00'), matching: find.byType(InkWell), diff --git a/packages/flutter/test/material/toggle_buttons_test.dart b/packages/flutter/test/material/toggle_buttons_test.dart index 3e01b47083..6682452713 100644 --- a/packages/flutter/test/material/toggle_buttons_test.dart +++ b/packages/flutter/test/material/toggle_buttons_test.dart @@ -620,6 +620,7 @@ void main() { child: boilerplate( child: ToggleButtons( isSelected: const [true], + onPressed: null, children: [ Row(children: const [ Text('First child'), @@ -708,6 +709,7 @@ void main() { child: ToggleButtons( fillColor: selectedFillColor, isSelected: const [false, true], + onPressed: null, children: const [ Text('First child'), Text('Second child'), @@ -771,6 +773,7 @@ void main() { child: ToggleButtons( fillColor: MaterialStateColor.resolveWith(getFillColor), isSelected: const [false, true], + onPressed: null, children: const [ Text('First child'), Text('Second child'), @@ -1489,6 +1492,7 @@ void main() { child: boilerplate( child: ToggleButtons( direction: Axis.vertical, + verticalDirection: VerticalDirection.down, isSelected: const [false, true, false], onPressed: (int index) {}, children: const [ diff --git a/packages/flutter/test/material/toggle_buttons_theme_test.dart b/packages/flutter/test/material/toggle_buttons_theme_test.dart index cd8246ec5d..aadbf321db 100644 --- a/packages/flutter/test/material/toggle_buttons_theme_test.dart +++ b/packages/flutter/test/material/toggle_buttons_theme_test.dart @@ -416,6 +416,7 @@ void main() { data: ToggleButtonsThemeData(fillColor: MaterialStateColor.resolveWith(getColor)), child: ToggleButtons( isSelected: const [true, false], + onPressed: null, children: const [ Text('First child'), Text('Second child'), diff --git a/packages/flutter/test/material/typography_test.dart b/packages/flutter/test/material/typography_test.dart index cdee39affe..4b60e80a3c 100644 --- a/packages/flutter/test/material/typography_test.dart +++ b/packages/flutter/test/material/typography_test.dart @@ -17,12 +17,12 @@ void main() { }); test('Typography on non-Apple platforms defaults to the correct font', () { - expect(Typography.material2018().black.headline6!.fontFamily, 'Roboto'); + expect(Typography.material2018(platform: TargetPlatform.android).black.headline6!.fontFamily, 'Roboto'); expect(Typography.material2018(platform: TargetPlatform.fuchsia).black.headline6!.fontFamily, 'Roboto'); expect(Typography.material2018(platform: TargetPlatform.linux).black.headline6!.fontFamily, 'Roboto'); expect(Typography.material2018(platform: TargetPlatform.linux).black.headline6!.fontFamilyFallback, ['Ubuntu', 'Cantarell', 'DejaVu Sans', 'Liberation Sans', 'Arial']); expect(Typography.material2018(platform: TargetPlatform.windows).black.headline6!.fontFamily, 'Segoe UI'); - expect(Typography.material2018().white.headline6!.fontFamily, 'Roboto'); + expect(Typography.material2018(platform: TargetPlatform.android).white.headline6!.fontFamily, 'Roboto'); expect(Typography.material2018(platform: TargetPlatform.fuchsia).white.headline6!.fontFamily, 'Roboto'); expect(Typography.material2018(platform: TargetPlatform.linux).white.headline6!.fontFamily, 'Roboto'); expect(Typography.material2018(platform: TargetPlatform.linux).white.headline6!.fontFamilyFallback, ['Ubuntu', 'Cantarell', 'DejaVu Sans', 'Liberation Sans', 'Arial']); @@ -83,6 +83,7 @@ void main() { testWidgets('Typography implements debugFillProperties', (WidgetTester tester) async { final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder(); Typography.material2014( + platform: TargetPlatform.android, black: Typography.blackCupertino, white: Typography.whiteCupertino, englishLike: Typography.englishLike2018, diff --git a/packages/flutter/test/painting/binding_test.dart b/packages/flutter/test/painting/binding_test.dart index 687baea937..337591db32 100644 --- a/packages/flutter/test/painting/binding_test.dart +++ b/packages/flutter/test/painting/binding_test.dart @@ -18,6 +18,7 @@ Future main() async { imageCache!.putIfAbsent(1, () => OneFrameImageStreamCompleter( Future.value(ImageInfo( image: image, + scale: 1.0, )), )); diff --git a/packages/flutter/test/painting/border_radius_test.dart b/packages/flutter/test/painting/border_radius_test.dart index 5e29b72279..8812b698b9 100644 --- a/packages/flutter/test/painting/border_radius_test.dart +++ b/packages/flutter/test/painting/border_radius_test.dart @@ -73,7 +73,9 @@ void main() { expect(borderRadius.bottomRight, radius2); expect(borderRadius.toRRect(rect), RRect.fromRectAndCorners( rect, + topLeft: Radius.zero, topRight: radius1, + bottomLeft: Radius.zero, bottomRight: radius2, )); @@ -243,13 +245,17 @@ void main() { expect(borderRadius.bottomEnd, radius2); expect(borderRadius.resolve(TextDirection.ltr).toRRect(rect), RRect.fromRectAndCorners( rect, + topLeft: Radius.zero, topRight: radius1, + bottomLeft: Radius.zero, bottomRight: radius2, )); expect(borderRadius.resolve(TextDirection.rtl).toRRect(rect), RRect.fromRectAndCorners( rect, topLeft: radius1, + topRight: Radius.zero, bottomLeft: radius2, + bottomRight: Radius.zero, )); expect( @@ -452,11 +458,14 @@ void main() { const BorderRadius ltr = BorderRadius.only( topLeft: Radius.elliptical(300.0, 500.0), // tL + 0 - 0 topRight: Radius.elliptical(30.0, 50.0), // 0 + tE - 0 - bottomLeft: Radius.elliptical(-3.0, -5.0), // 0 + 0 - 0 + bottomLeft: Radius.elliptical(-3.0, -5.0), // 0 + 0 - bL + bottomRight: Radius.zero, // 0 + 0 - 0 ); const BorderRadius rtl = BorderRadius.only( - topLeft: Radius.elliptical(330.0, 550.0), // 0 + 0 - 0 - bottomLeft: Radius.elliptical(-3.0, -5.0), // 0 + 0 - 0 + topLeft: Radius.elliptical(330.0, 550.0), // tL + tE - 0 + topRight: Radius.zero, // 0 + 0 - 0 + bottomLeft: Radius.elliptical(-3.0, -5.0), // 0 + 0 - bL + bottomRight: Radius.zero, // 0 + 0 - 0 ); expect(a.add(b.subtract(c)).resolve(TextDirection.ltr), ltr); expect(a.add(b.subtract(c)).resolve(TextDirection.rtl), rtl); diff --git a/packages/flutter/test/painting/border_rtl_test.dart b/packages/flutter/test/painting/border_rtl_test.dart index d1804cb8cd..fac5316db5 100644 --- a/packages/flutter/test/painting/border_rtl_test.dart +++ b/packages/flutter/test/painting/border_rtl_test.dart @@ -443,7 +443,7 @@ void main() { top: BorderSide(style: BorderStyle.none), start: BorderSide(style: BorderStyle.none), end: BorderSide(style: BorderStyle.none), - bottom: BorderSide(width: 0.0), + bottom: BorderSide(style: BorderStyle.solid, width: 0.0), ).isUniform, false, ); @@ -452,11 +452,17 @@ void main() { top: BorderSide(style: BorderStyle.none), start: BorderSide(style: BorderStyle.none), end: BorderSide(style: BorderStyle.none), + bottom: BorderSide.none, ).isUniform, false, ); expect( - const BorderDirectional().isUniform, + const BorderDirectional( + top: BorderSide.none, + start: BorderSide.none, + end: BorderSide.none, + bottom: BorderSide.none, + ).isUniform, true, ); expect( diff --git a/packages/flutter/test/painting/border_side_test.dart b/packages/flutter/test/painting/border_side_test.dart index c655cefd4b..93d12f602d 100644 --- a/packages/flutter/test/painting/border_side_test.dart +++ b/packages/flutter/test/painting/border_side_test.dart @@ -9,13 +9,19 @@ void main() { test('BorderSide - asserts when constructed incorrectly', () { expect( const BorderSide(), - const BorderSide(), + const BorderSide( + color: Color(0xFF000000), + width: 1.0, + style: BorderStyle.solid, + ), ); expect(() => BorderSide(width: nonconst(-1.0)), throwsAssertionError); expect( const BorderSide(width: -0.0), const BorderSide( + color: Color(0xFF000000), width: 0.0, + style: BorderStyle.solid, ), ); }); @@ -32,7 +38,7 @@ void main() { const BorderSide side2 = BorderSide(width: 2.0); const BorderSide side3 = BorderSide(width: 3.0); const BorderSide side5 = BorderSide(width: 5.0); - const BorderSide solid = BorderSide(); + const BorderSide solid = BorderSide(style: BorderStyle.solid); const BorderSide yellowNone = BorderSide(style: BorderStyle.none, color: Color(0xFFFFFF00), width: 0.0); // canMerge expect( BorderSide.canMerge(BorderSide.none, BorderSide.none), isTrue); @@ -95,7 +101,7 @@ void main() { expect(none.scale(2.0), none); }); test('BorderSide - toPaint', () { - final Paint paint1 = const BorderSide(width: 2.5, color: Color(0xFFFFFF00)).toPaint(); + final Paint paint1 = const BorderSide(width: 2.5, color: Color(0xFFFFFF00), style: BorderStyle.solid).toPaint(); expect(paint1.strokeWidth, 2.5); expect(paint1.style, PaintingStyle.stroke); expect(paint1.color, const Color(0xFFFFFF00)); @@ -108,7 +114,7 @@ void main() { }); test("BorderSide - won't lerp into negative widths", () { const BorderSide side0 = BorderSide(width: 0.0); - const BorderSide side1 = BorderSide(); + const BorderSide side1 = BorderSide(width: 1.0); const BorderSide side2 = BorderSide(width: 2.0); expect(BorderSide.lerp(side2, side1, 10.0), BorderSide.none); expect(BorderSide.lerp(side1, side2, -10.0), BorderSide.none); diff --git a/packages/flutter/test/painting/border_test.dart b/packages/flutter/test/painting/border_test.dart index 355964bd9d..ae9916e039 100644 --- a/packages/flutter/test/painting/border_test.dart +++ b/packages/flutter/test/painting/border_test.dart @@ -17,7 +17,7 @@ void main() { test('Border.symmetric constructor', () { const BorderSide side1 = BorderSide(color: Color(0xFFFFFFFF)); - const BorderSide side2 = BorderSide(); + const BorderSide side2 = BorderSide(color: Color(0xFF000000)); const Border border = Border.symmetric(vertical: side1, horizontal: side2); expect(border.left, same(side1)); expect(border.top, same(side2)); @@ -168,7 +168,7 @@ void main() { left: BorderSide(style: BorderStyle.none), top: BorderSide(style: BorderStyle.none), right: BorderSide(style: BorderStyle.none), - bottom: BorderSide(width: 0.0), + bottom: BorderSide(style: BorderStyle.solid, width: 0.0), ).isUniform, false, ); @@ -177,7 +177,7 @@ void main() { left: BorderSide(style: BorderStyle.none), top: BorderSide(style: BorderStyle.none), right: BorderSide(style: BorderStyle.none), - bottom: BorderSide(width: 0.0), + bottom: BorderSide(style: BorderStyle.solid, width: 0.0), ).isUniform, false, ); @@ -186,11 +186,17 @@ void main() { left: BorderSide(style: BorderStyle.none), top: BorderSide(style: BorderStyle.none), right: BorderSide(style: BorderStyle.none), + bottom: BorderSide.none, ).isUniform, false, ); expect( - const Border().isUniform, + const Border( + left: BorderSide.none, + top: BorderSide.none, + right: BorderSide.none, + bottom: BorderSide.none, + ).isUniform, true, ); expect( diff --git a/packages/flutter/test/painting/box_painter_test.dart b/packages/flutter/test/painting/box_painter_test.dart index b1c095a721..33be44f1c0 100644 --- a/packages/flutter/test/painting/box_painter_test.dart +++ b/packages/flutter/test/painting/box_painter_test.dart @@ -34,6 +34,7 @@ void main() { expect(BorderSide.lerp(side1, side2, 0.5), equals(BorderSide( color: Color.lerp(const Color(0xFF000000), const Color(0xFF00FFFF), 0.5)!, width: 1.5, + style: BorderStyle.solid, ))); final BorderSide side3 = side2.copyWith(style: BorderStyle.none); @@ -261,7 +262,7 @@ void main() { child: Center( child: Container( decoration: const BoxDecoration( - boxShadow: [BoxShadow(blurRadius: 4.0)], + boxShadow: [BoxShadow(blurRadius: 4.0, blurStyle: BlurStyle.normal)], ), width: 20, height: 20, @@ -294,7 +295,7 @@ void main() { child: Container( decoration: const BoxDecoration( color: Colors.black, - boxShadow: [BoxShadow(blurRadius: 16.0, offset: Offset(4, 4), color: Colors.green, spreadRadius: 2)], + boxShadow: [BoxShadow(blurRadius: 16.0, offset: Offset(4, 4), blurStyle: BlurStyle.normal, color: Colors.green, spreadRadius: 2)], ), width: 64, height: 64, diff --git a/packages/flutter/test/painting/decoration_test.dart b/packages/flutter/test/painting/decoration_test.dart index 3d5a1c801e..6206a18da4 100644 --- a/packages/flutter/test/painting/decoration_test.dart +++ b/packages/flutter/test/painting/decoration_test.dart @@ -37,7 +37,7 @@ class SynchronousTestImageProvider extends ImageProvider { @override ImageStreamCompleter load(int key, DecoderCallback decode) { return OneFrameImageStreamCompleter( - SynchronousFuture(TestImageInfo(key, image: image)), + SynchronousFuture(TestImageInfo(key, image: image, scale: 1.0)), ); } } @@ -336,11 +336,13 @@ void main() { image: SynchronousTestImageProvider(image), colorFilter: colorFilter, fit: BoxFit.contain, + alignment: Alignment.center, centerSlice: const Rect.fromLTWH(10.0, 20.0, 30.0, 40.0), repeat: ImageRepeat.repeatY, matchTextDirection: true, scale: 0.5, opacity: 0.5, + filterQuality: FilterQuality.low, invertColors: true, isAntiAlias: true, ); @@ -353,6 +355,7 @@ void main() { try { boxPainter.paint(canvas, Offset.zero, const ImageConfiguration( size: Size(100.0, 100.0), + textDirection: null, )); } on FlutterError catch (e) { error = e; @@ -404,31 +407,31 @@ void main() { // (Use a ShapeDecoration and ShapeBorder if you want to lerp the shapes...) expect( BoxDecoration.lerp( - const BoxDecoration(), + const BoxDecoration(shape: BoxShape.rectangle), const BoxDecoration(shape: BoxShape.circle), -1.0, ), - const BoxDecoration(), + const BoxDecoration(shape: BoxShape.rectangle), ); expect( BoxDecoration.lerp( - const BoxDecoration(), + const BoxDecoration(shape: BoxShape.rectangle), const BoxDecoration(shape: BoxShape.circle), 0.0, ), - const BoxDecoration(), + const BoxDecoration(shape: BoxShape.rectangle), ); expect( BoxDecoration.lerp( - const BoxDecoration(), + const BoxDecoration(shape: BoxShape.rectangle), const BoxDecoration(shape: BoxShape.circle), 0.25, ), - const BoxDecoration(), + const BoxDecoration(shape: BoxShape.rectangle), ); expect( BoxDecoration.lerp( - const BoxDecoration(), + const BoxDecoration(shape: BoxShape.rectangle), const BoxDecoration(shape: BoxShape.circle), 0.75, ), @@ -436,7 +439,7 @@ void main() { ); expect( BoxDecoration.lerp( - const BoxDecoration(), + const BoxDecoration(shape: BoxShape.rectangle), const BoxDecoration(shape: BoxShape.circle), 1.0, ), @@ -444,7 +447,7 @@ void main() { ); expect( BoxDecoration.lerp( - const BoxDecoration(), + const BoxDecoration(shape: BoxShape.rectangle), const BoxDecoration(shape: BoxShape.circle), 2.0, ), @@ -525,6 +528,8 @@ void main() { scale: scale, alignment: Alignment.bottomRight, fit: BoxFit.none, + repeat: ImageRepeat.noRepeat, + flipHorizontally: false, ); const Size imageSize = Size(100.0, 100.0); @@ -567,6 +572,8 @@ void main() { scale: scale, alignment: Alignment.bottomRight, fit: BoxFit.scaleDown, + repeat: ImageRepeat.noRepeat, + flipHorizontally: false, ); const Size imageSize = Size(100.0, 100.0); @@ -608,6 +615,8 @@ void main() { scale: 2.0, alignment: Alignment.bottomRight, fit: BoxFit.scaleDown, + repeat: ImageRepeat.noRepeat, + flipHorizontally: false, ); const Size imageSize = Size(100.0, 100.0); @@ -656,7 +665,10 @@ void main() { rect: outputRect, image: image, scale: 3.0, + alignment: Alignment.center, fit: boxFit, + repeat: ImageRepeat.noRepeat, + flipHorizontally: false, ); final Invocation call = canvas.invocations.firstWhere((Invocation call) => call.memberName == #drawImageRect); diff --git a/packages/flutter/test/painting/edge_insets_test.dart b/packages/flutter/test/painting/edge_insets_test.dart index 989ea6f52b..92fd81650c 100644 --- a/packages/flutter/test/painting/edge_insets_test.dart +++ b/packages/flutter/test/painting/edge_insets_test.dart @@ -118,8 +118,8 @@ void main() { expect(EdgeInsetsGeometry.lerp(const EdgeInsetsDirectional.only(bottom: 10.0), EdgeInsetsDirectional.zero, 0.5), const EdgeInsetsDirectional.only(bottom: 5.0)); expect(EdgeInsetsGeometry.lerp(const EdgeInsetsDirectional.only(bottom: 10.0), EdgeInsets.zero, 0.5), const EdgeInsetsDirectional.only(bottom: 5.0)); expect(EdgeInsetsGeometry.lerp(const EdgeInsetsDirectional.only(start: 10.0), const EdgeInsets.only(left: 20.0), 0.5), const EdgeInsetsDirectional.only(start: 5.0).add(const EdgeInsets.only(left: 10.0))); - expect(EdgeInsetsGeometry.lerp(const EdgeInsetsDirectional.only(bottom: 1.0), const EdgeInsetsDirectional.only(start: 1.0, bottom: 1.0).add(const EdgeInsets.only(right: 2.0)), 0.5), const EdgeInsetsDirectional.only(start: 0.5).add(const EdgeInsets.only(right: 1.0, bottom: 1.0))); - expect(EdgeInsetsGeometry.lerp(const EdgeInsets.only(bottom: 1.0), const EdgeInsetsDirectional.only(end: 1.0, bottom: 1.0).add(const EdgeInsets.only(right: 2.0)), 0.5), const EdgeInsetsDirectional.only(end: 0.5).add(const EdgeInsets.only(right: 1.0, bottom: 1.0))); + expect(EdgeInsetsGeometry.lerp(const EdgeInsetsDirectional.only(start: 0.0, bottom: 1.0), const EdgeInsetsDirectional.only(start: 1.0, bottom: 1.0).add(const EdgeInsets.only(right: 2.0, bottom: 0.0)), 0.5), const EdgeInsetsDirectional.only(start: 0.5).add(const EdgeInsets.only(right: 1.0, bottom: 1.0))); + expect(EdgeInsetsGeometry.lerp(const EdgeInsets.only(left: 0.0, bottom: 1.0), const EdgeInsetsDirectional.only(end: 1.0, bottom: 1.0).add(const EdgeInsets.only(right: 2.0, bottom: 0.0)), 0.5), const EdgeInsetsDirectional.only(start: 0.0, end: 0.5).add(const EdgeInsets.only(right: 1.0, bottom: 1.0))); }); test('EdgeInsetsGeometry.lerp(normal, ...)', () { diff --git a/packages/flutter/test/painting/geometry_test.dart b/packages/flutter/test/painting/geometry_test.dart index a0bc3836a4..6798107777 100644 --- a/packages/flutter/test/painting/geometry_test.dart +++ b/packages/flutter/test/painting/geometry_test.dart @@ -15,6 +15,7 @@ void main() { childSize: const Size(20.0, 10.0), target: const Offset(50.0, 50.0), preferBelow: false, + verticalOffset: 0.0, margin: 0.0, ), const Offset(40.0, 40.0), @@ -25,6 +26,7 @@ void main() { childSize: const Size(200.0, 10.0), target: const Offset(50.0, 50.0), preferBelow: false, + verticalOffset: 0.0, margin: 0.0, ), const Offset(-50.0, 40.0), @@ -35,6 +37,7 @@ void main() { childSize: const Size(200.0, 10.0), target: const Offset(0.0, 50.0), preferBelow: false, + verticalOffset: 0.0, margin: 0.0, ), const Offset(-50.0, 40.0), @@ -45,6 +48,7 @@ void main() { childSize: const Size(200.0, 10.0), target: const Offset(100.0, 50.0), preferBelow: false, + verticalOffset: 0.0, margin: 0.0, ), const Offset(-50.0, 40.0), @@ -55,6 +59,7 @@ void main() { childSize: const Size(50.0, 10.0), target: const Offset(50.0, 50.0), preferBelow: false, + verticalOffset: 0.0, margin: 20.0, // 60.0 left ), const Offset(25.0, 40.0), @@ -65,6 +70,7 @@ void main() { childSize: const Size(50.0, 10.0), target: const Offset(50.0, 50.0), preferBelow: false, + verticalOffset: 0.0, margin: 30.0, // 40.0 left ), const Offset(25.0, 40.0), @@ -75,6 +81,7 @@ void main() { childSize: const Size(50.0, 10.0), target: const Offset(0.0, 50.0), preferBelow: false, + verticalOffset: 0.0, margin: 20.0, // 60.0 left ), const Offset(20.0, 40.0), @@ -85,6 +92,7 @@ void main() { childSize: const Size(50.0, 10.0), target: const Offset(0.0, 50.0), preferBelow: false, + verticalOffset: 0.0, margin: 30.0, // 40.0 left ), const Offset(25.0, 40.0), @@ -95,6 +103,7 @@ void main() { childSize: const Size(50.0, 10.0), target: const Offset(100.0, 50.0), preferBelow: false, + verticalOffset: 0.0, margin: 20.0, // 60.0 left ), const Offset(30.0, 40.0), @@ -105,6 +114,7 @@ void main() { childSize: const Size(50.0, 10.0), target: const Offset(100.0, 50.0), preferBelow: false, + verticalOffset: 0.0, margin: 30.0, // 40.0 left ), const Offset(25.0, 40.0), diff --git a/packages/flutter/test/painting/gradient_test.dart b/packages/flutter/test/painting/gradient_test.dart index 26cb6d8da2..ed798c0b23 100644 --- a/packages/flutter/test/painting/gradient_test.dart +++ b/packages/flutter/test/painting/gradient_test.dart @@ -490,6 +490,7 @@ void main() { test('SweepGradient lerp test', () { const SweepGradient testGradient1 = SweepGradient( center: Alignment.topLeft, + startAngle: 0.0, endAngle: math.pi / 2, colors: [ Color(0x33333333), @@ -525,6 +526,7 @@ void main() { test('SweepGradient lerp test with stops', () { const SweepGradient testGradient1 = SweepGradient( center: Alignment.topLeft, + startAngle: 0.0, endAngle: math.pi / 2, colors: [ Color(0x33333333), @@ -641,6 +643,7 @@ void main() { test('SweepGradient scale test)', () { const SweepGradient testGradient = SweepGradient( center: Alignment.topLeft, + startAngle: 0.0, endAngle: math.pi / 2, colors: [ Color(0xff333333), @@ -652,6 +655,7 @@ void main() { expect(actual, const SweepGradient( center: Alignment.topLeft, + startAngle: 0.0, endAngle: math.pi / 2, colors: [ Color(0x80333333), @@ -716,6 +720,7 @@ void main() { ], ); const RadialGradient testGradient2 = RadialGradient( + center: Alignment.center, radius: 20.0, colors: [ Color(0x44444444), diff --git a/packages/flutter/test/painting/image_provider_resize_image_test.dart b/packages/flutter/test/painting/image_provider_resize_image_test.dart index 292b0824f3..ea1a413a30 100644 --- a/packages/flutter/test/painting/image_provider_resize_image_test.dart +++ b/packages/flutter/test/painting/image_provider_resize_image_test.dart @@ -87,7 +87,7 @@ void main() { test('ResizeImage takes one dim', () async { final Uint8List bytes = Uint8List.fromList(kTransparentImage); final MemoryImage memoryImage = MemoryImage(bytes); - final ResizeImage resizeImage = ResizeImage(memoryImage, width: 10); + final ResizeImage resizeImage = ResizeImage(memoryImage, width: 10, height: null); expect(resizeImage.width, 10); expect(resizeImage.height, null); expect(resizeImage.imageProvider, memoryImage); diff --git a/packages/flutter/test/painting/matrix_utils_test.dart b/packages/flutter/test/painting/matrix_utils_test.dart index 65b1381699..2860893c4f 100644 --- a/packages/flutter/test/painting/matrix_utils_test.dart +++ b/packages/flutter/test/painting/matrix_utils_test.dart @@ -11,7 +11,7 @@ import 'package:vector_math/vector_math_64.dart'; void main() { test('MatrixUtils.transformRect handles very large finite values', () { const Rect evilRect = Rect.fromLTRB(0.0, -1.7976931348623157e+308, 800.0, 1.7976931348623157e+308); - final Matrix4 transform = Matrix4.identity()..translate(10.0); + final Matrix4 transform = Matrix4.identity()..translate(10.0, 0.0); final Rect transformedRect = MatrixUtils.transformRect(transform, evilRect); expect(transformedRect.isFinite, true); }); @@ -83,6 +83,7 @@ void main() { final Matrix4 actual = MatrixUtils.createCylindricalProjectionTransform( radius: 100.0, angle: pi / 3.0, + perspective: 0.001, ); expect(actual.storage, [ diff --git a/packages/flutter/test/painting/mocks_for_image_cache.dart b/packages/flutter/test/painting/mocks_for_image_cache.dart index f89f6189b4..d5be093486 100644 --- a/packages/flutter/test/painting/mocks_for_image_cache.dart +++ b/packages/flutter/test/painting/mocks_for_image_cache.dart @@ -136,6 +136,6 @@ class LoadErrorCompleterImageProvider extends ImageProvider[ Offset(30.0, 10.0), Offset(50.0, 10.0), ], diff --git a/packages/flutter/test/painting/shape_decoration_test.dart b/packages/flutter/test/painting/shape_decoration_test.dart index bfb6894141..5a79d3b925 100644 --- a/packages/flutter/test/painting/shape_decoration_test.dart +++ b/packages/flutter/test/painting/shape_decoration_test.dart @@ -22,10 +22,10 @@ void main() { expect(() => ShapeDecoration(color: colorR, gradient: nonconst(gradient), shape: const Border()), throwsAssertionError); expect( ShapeDecoration.fromBoxDecoration(const BoxDecoration(shape: BoxShape.circle)), - const ShapeDecoration(shape: CircleBorder()), + const ShapeDecoration(shape: CircleBorder(side: BorderSide.none)), ); expect( - ShapeDecoration.fromBoxDecoration(BoxDecoration(borderRadius: BorderRadiusDirectional.circular(100.0))), + ShapeDecoration.fromBoxDecoration(BoxDecoration(shape: BoxShape.rectangle, borderRadius: BorderRadiusDirectional.circular(100.0))), ShapeDecoration(shape: RoundedRectangleBorder(borderRadius: BorderRadiusDirectional.circular(100.0))), ); expect( @@ -33,11 +33,11 @@ void main() { const ShapeDecoration(shape: CircleBorder(side: BorderSide(color: colorG))), ); expect( - ShapeDecoration.fromBoxDecoration(BoxDecoration(border: Border.all(color: colorR))), + ShapeDecoration.fromBoxDecoration(BoxDecoration(shape: BoxShape.rectangle, border: Border.all(color: colorR))), ShapeDecoration(shape: Border.all(color: colorR)), ); expect( - ShapeDecoration.fromBoxDecoration(const BoxDecoration(border: BorderDirectional(start: BorderSide()))), + ShapeDecoration.fromBoxDecoration(const BoxDecoration(shape: BoxShape.rectangle, border: BorderDirectional(start: BorderSide()))), const ShapeDecoration(shape: BorderDirectional(start: BorderSide())), ); }); @@ -98,7 +98,7 @@ void main() { }); test('ShapeDecoration.getClipPath', () { - const ShapeDecoration decoration = ShapeDecoration(shape: CircleBorder()); + const ShapeDecoration decoration = ShapeDecoration(shape: CircleBorder(side: BorderSide.none)); const Rect rect = Rect.fromLTWH(0.0, 0.0, 100.0, 20.0); final Path clipPath = decoration.getClipPath(rect, TextDirection.ltr); final Matcher isLookLikeExpectedPath = isPathThat( @@ -122,7 +122,7 @@ class TestImageProvider extends ImageProvider { @override ImageStreamCompleter load(TestImageProvider key, DecoderCallback decode) { return OneFrameImageStreamCompleter( - SynchronousFuture(ImageInfo(image: image)), + SynchronousFuture(ImageInfo(image: image, scale: 1.0)), ); } } diff --git a/packages/flutter/test/painting/stadium_border_test.dart b/packages/flutter/test/painting/stadium_border_test.dart index 1743be2931..496db9bfd7 100644 --- a/packages/flutter/test/painting/stadium_border_test.dart +++ b/packages/flutter/test/painting/stadium_border_test.dart @@ -32,9 +32,9 @@ void main() { expect(ShapeBorder.lerp(c10, c20, 0.5), c15); expect(ShapeBorder.lerp(c10, c20, 1.0), c20); - const StadiumBorder c1 = StadiumBorder(side: BorderSide()); + const StadiumBorder c1 = StadiumBorder(side: BorderSide(width: 1.0)); expect(c1.getOuterPath(Rect.fromCircle(center: Offset.zero, radius: 1.0)), isUnitCircle); - const StadiumBorder c2 = StadiumBorder(side: BorderSide()); + const StadiumBorder c2 = StadiumBorder(side: BorderSide(width: 1.0)); expect(c2.getInnerPath(Rect.fromCircle(center: Offset.zero, radius: 2.0)), isUnitCircle); const Rect rect = Rect.fromLTRB(10.0, 20.0, 100.0, 200.0); expect( @@ -48,8 +48,8 @@ void main() { }); test('StadiumBorder and CircleBorder', () { - const StadiumBorder stadium = StadiumBorder(); - const CircleBorder circle = CircleBorder(); + const StadiumBorder stadium = StadiumBorder(side: BorderSide.none); + const CircleBorder circle = CircleBorder(side: BorderSide.none); const Rect rect = Rect.fromLTWH(0.0, 0.0, 100.0, 20.0); final Matcher looksLikeS = isPathThat( includes: const [ Offset(30.0, 10.0), Offset(50.0, 10.0), ], @@ -111,8 +111,8 @@ void main() { }); test('StadiumBorder and RoundedRectBorder', () { - const StadiumBorder stadium = StadiumBorder(); - const RoundedRectangleBorder rrect = RoundedRectangleBorder(); + const StadiumBorder stadium = StadiumBorder(side: BorderSide.none); + const RoundedRectangleBorder rrect = RoundedRectangleBorder(side: BorderSide.none); const Rect rect = Rect.fromLTWH(0.0, 0.0, 100.0, 50.0); final Matcher looksLikeS = isPathThat( includes: const [ diff --git a/packages/flutter/test/painting/text_painter_rtl_test.dart b/packages/flutter/test/painting/text_painter_rtl_test.dart index ea05a25834..98d8d75afc 100644 --- a/packages/flutter/test/painting/text_painter_rtl_test.dart +++ b/packages/flutter/test/painting/text_painter_rtl_test.dart @@ -21,15 +21,15 @@ void main() { painter.layout(); expect( - painter.getWordBoundary(const TextPosition(offset: 1)), + painter.getWordBoundary(const TextPosition(offset: 1, affinity: TextAffinity.downstream)), const TextRange(start: 0, end: 3), ); expect( - painter.getWordBoundary(const TextPosition(offset: 5)), + painter.getWordBoundary(const TextPosition(offset: 5, affinity: TextAffinity.downstream)), const TextRange(start: 4, end: 7), ); expect( - painter.getWordBoundary(const TextPosition(offset: 9)), + painter.getWordBoundary(const TextPosition(offset: 9, affinity: TextAffinity.downstream)), const TextRange(start: 8, end: 11), ); }); @@ -50,11 +50,11 @@ void main() { // The skips here are because the old rendering code considers the bidi formatting characters // to be part of the word sometimes and not others, which is fine, but we'd mildly prefer if // we were consistently considering them part of words always. - final TextRange hebrew1 = painter.getWordBoundary(const TextPosition(offset: 4)); + final TextRange hebrew1 = painter.getWordBoundary(const TextPosition(offset: 4, affinity: TextAffinity.downstream)); expect(hebrew1, const TextRange(start: 0, end: 8), skip: skipExpectsWithKnownBugs); // https://github.com/flutter/flutter/issues/87536 - final TextRange english2 = painter.getWordBoundary(const TextPosition(offset: 14)); + final TextRange english2 = painter.getWordBoundary(const TextPosition(offset: 14, affinity: TextAffinity.downstream)); expect(english2, const TextRange(start: 9, end: 19), skip: skipExpectsWithKnownBugs); // https://github.com/flutter/flutter/issues/87536 - final TextRange hebrew3 = painter.getWordBoundary(const TextPosition(offset: 24)); + final TextRange hebrew3 = painter.getWordBoundary(const TextPosition(offset: 24, affinity: TextAffinity.downstream)); expect(hebrew3, const TextRange(start: 20, end: 28)); // >>>>>>>>>>>>>>> embedding level 2 @@ -72,7 +72,7 @@ void main() { Offset.zero, ); expect( - painter.getOffsetForCaret(const TextPosition(offset: 0), Rect.zero), + painter.getOffsetForCaret(const TextPosition(offset: 0, affinity: TextAffinity.downstream), Rect.zero), Offset.zero, ); expect( @@ -80,7 +80,7 @@ void main() { const Offset(240.0, 0.0), ); expect( - painter.getOffsetForCaret(const TextPosition(offset: 1), Rect.zero), + painter.getOffsetForCaret(const TextPosition(offset: 1, affinity: TextAffinity.downstream), Rect.zero), const Offset(240.0, 0.0), ); expect( @@ -88,7 +88,7 @@ void main() { const Offset(180.0, 0.0), ); expect( - painter.getOffsetForCaret(const TextPosition(offset: 7), Rect.zero), + painter.getOffsetForCaret(const TextPosition(offset: 7, affinity: TextAffinity.downstream), Rect.zero), const Offset(180.0, 0.0), ); expect( @@ -96,7 +96,7 @@ void main() { const Offset(170.0, 0.0), ); expect( - painter.getOffsetForCaret(const TextPosition(offset: 8), Rect.zero), + painter.getOffsetForCaret(const TextPosition(offset: 8, affinity: TextAffinity.downstream), Rect.zero), const Offset(170.0, 0.0), ); expect( @@ -104,7 +104,7 @@ void main() { const Offset(160.0, 0.0), ); expect( - painter.getOffsetForCaret(const TextPosition(offset: 9), Rect.zero), + painter.getOffsetForCaret(const TextPosition(offset: 9, affinity: TextAffinity.downstream), Rect.zero), const Offset(160.0, 0.0), ); expect( @@ -112,7 +112,7 @@ void main() { const Offset(80.0, 0.0), ); expect( - painter.getOffsetForCaret(const TextPosition(offset: 10), Rect.zero), + painter.getOffsetForCaret(const TextPosition(offset: 10, affinity: TextAffinity.downstream), Rect.zero), const Offset(80.0, 0.0), ); @@ -179,11 +179,11 @@ void main() { expect(textSpan.text!.length, 28); painter.layout(); - final TextRange hebrew1 = painter.getWordBoundary(const TextPosition(offset: 4)); + final TextRange hebrew1 = painter.getWordBoundary(const TextPosition(offset: 4, affinity: TextAffinity.downstream)); expect(hebrew1, const TextRange(start: 0, end: 8), skip: skipExpectsWithKnownBugs); // https://github.com/flutter/flutter/issues/87536 - final TextRange english2 = painter.getWordBoundary(const TextPosition(offset: 14)); + final TextRange english2 = painter.getWordBoundary(const TextPosition(offset: 14, affinity: TextAffinity.downstream)); expect(english2, const TextRange(start: 9, end: 19), skip: skipExpectsWithKnownBugs); // https://github.com/flutter/flutter/issues/87536 - final TextRange hebrew3 = painter.getWordBoundary(const TextPosition(offset: 24)); + final TextRange hebrew3 = painter.getWordBoundary(const TextPosition(offset: 24, affinity: TextAffinity.downstream)); expect(hebrew3, const TextRange(start: 20, end: 28)); // >>>>>>>>>>>>>>> embedding level 2 @@ -200,7 +200,7 @@ void main() { const Offset(240.0, 0.0), ); expect( - painter.getOffsetForCaret(const TextPosition(offset: 0), Rect.zero), + painter.getOffsetForCaret(const TextPosition(offset: 0, affinity: TextAffinity.downstream), Rect.zero), const Offset(240.0, 0.0), ); expect( @@ -208,7 +208,7 @@ void main() { const Offset(240.0, 0.0), ); expect( - painter.getOffsetForCaret(const TextPosition(offset: 1), Rect.zero), + painter.getOffsetForCaret(const TextPosition(offset: 1, affinity: TextAffinity.downstream), Rect.zero), const Offset(240.0, 0.0), ); expect( @@ -216,7 +216,7 @@ void main() { const Offset(180.0, 0.0), ); expect( - painter.getOffsetForCaret(const TextPosition(offset: 7), Rect.zero), + painter.getOffsetForCaret(const TextPosition(offset: 7, affinity: TextAffinity.downstream), Rect.zero), const Offset(180.0, 0.0), ); expect( @@ -224,7 +224,7 @@ void main() { const Offset(170.0, 0.0), ); expect( - painter.getOffsetForCaret(const TextPosition(offset: 8), Rect.zero), + painter.getOffsetForCaret(const TextPosition(offset: 8, affinity: TextAffinity.downstream), Rect.zero), const Offset(170.0, 0.0), ); expect( @@ -232,7 +232,7 @@ void main() { const Offset(160.0, 0.0), ); expect( - painter.getOffsetForCaret(const TextPosition(offset: 9), Rect.zero), + painter.getOffsetForCaret(const TextPosition(offset: 9, affinity: TextAffinity.downstream), Rect.zero), const Offset(160.0, 0.0), ); expect( @@ -240,7 +240,7 @@ void main() { const Offset(80.0, 0.0), ); expect( - painter.getOffsetForCaret(const TextPosition(offset: 10), Rect.zero), + painter.getOffsetForCaret(const TextPosition(offset: 10, affinity: TextAffinity.downstream), Rect.zero), const Offset(80.0, 0.0), ); @@ -271,7 +271,7 @@ void main() { for (int index = 0; index <= 2; index += 1) { expect( - painter.getWordBoundary(const TextPosition(offset: 0)), + painter.getWordBoundary(const TextPosition(offset: 0, affinity: TextAffinity.downstream)), const TextRange(start: 0, end: 2), ); } @@ -281,7 +281,7 @@ void main() { Offset.zero, ); expect( // before the A - painter.getOffsetForCaret(const TextPosition(offset: 0), Rect.zero), + painter.getOffsetForCaret(const TextPosition(offset: 0, affinity: TextAffinity.downstream), Rect.zero), Offset.zero, ); @@ -290,7 +290,7 @@ void main() { const Offset(10.0, 0.0), ); expect( // between A and Alef, before the Alef - painter.getOffsetForCaret(const TextPosition(offset: 1), Rect.zero), + painter.getOffsetForCaret(const TextPosition(offset: 1, affinity: TextAffinity.downstream), Rect.zero), const Offset(10.0, 10.0), ); @@ -299,7 +299,7 @@ void main() { const Offset(0.0, 10.0), ); expect( // after the Alef - painter.getOffsetForCaret(const TextPosition(offset: 2), Rect.zero), + painter.getOffsetForCaret(const TextPosition(offset: 2, affinity: TextAffinity.downstream), Rect.zero), const Offset(0.0, 10.0), ); @@ -495,19 +495,19 @@ void main() { // Aaa Bbb Ccc Gimel Bet Alef Ddd Eee Fff // ^ painter.getPositionForOffset(const Offset(0.0, 5.0)).toString(), - const TextPosition(offset: 0).toString(), + const TextPosition(offset: 0, affinity: TextAffinity.downstream).toString(), ); expect( // Aaa Bbb Ccc Gimel Bet Alef Ddd Eee Fff // ^ painter.getPositionForOffset(const Offset(-100.0, 5.0)).toString(), - const TextPosition(offset: 0).toString(), + const TextPosition(offset: 0, affinity: TextAffinity.downstream).toString(), ); expect( // Aaa Bbb Ccc Gimel Bet Alef Ddd Eee Fff // ^ painter.getPositionForOffset(const Offset(4.0, 5.0)).toString(), - const TextPosition(offset: 0).toString(), + const TextPosition(offset: 0, affinity: TextAffinity.downstream).toString(), ); expect( // Aaa Bbb Ccc Gimel Bet Alef Ddd Eee Fff @@ -519,7 +519,7 @@ void main() { // Aaa Bbb Ccc Gimel Bet Alef Ddd Eee Fff // ^ painter.getPositionForOffset(const Offset(12.0, 5.0)).toString(), - const TextPosition(offset: 1).toString(), + const TextPosition(offset: 1, affinity: TextAffinity.downstream).toString(), // currently we say upstream instead of downstream skip: skipExpectsWithKnownBugs, // https://github.com/flutter/flutter/issues/87536 ); @@ -540,14 +540,14 @@ void main() { // Aaa Bbb Ccc Gimel Bet Alef Ddd Eee Fff // ^ painter.getPositionForOffset(const Offset(58.0, 5.0)).toString(), - const TextPosition(offset: 3).toString(), + const TextPosition(offset: 3, affinity: TextAffinity.downstream).toString(), skip: skipExpectsWithKnownBugs, // this is part of https://github.com/flutter/flutter/issues/11375 ); expect( // Aaa Bbb Ccc Gimel Bet Alef Ddd Eee Fff // ^ painter.getPositionForOffset(const Offset(62.0, 5.0)).toString(), - const TextPosition(offset: 6).toString(), + const TextPosition(offset: 6, affinity: TextAffinity.downstream).toString(), ); expect( // Aaa Bbb Ccc Gimel Bet Alef Ddd Eee Fff @@ -584,13 +584,13 @@ void main() { // Vav He Dalet Aaa Bbb Ccc Gimel Bet Alef // ^ painter.getPositionForOffset(const Offset(28.0, 5.0)).toString(), - const TextPosition(offset: 6).toString(), + const TextPosition(offset: 6, affinity: TextAffinity.downstream).toString(), ); expect( // Vav He Dalet Aaa Bbb Ccc Gimel Bet Alef // ^ painter.getPositionForOffset(const Offset(32.0, 5.0)).toString(), - const TextPosition(offset: 3).toString(), + const TextPosition(offset: 3, affinity: TextAffinity.downstream).toString(), skip: skipExpectsWithKnownBugs, // this is part of https://github.com/flutter/flutter/issues/11375 ); expect( diff --git a/packages/flutter/test/painting/text_painter_test.dart b/packages/flutter/test/painting/text_painter_test.dart index 78af9ed471..ade3a71e92 100644 --- a/packages/flutter/test/painting/text_painter_test.dart +++ b/packages/flutter/test/painting/text_painter_test.dart @@ -9,7 +9,7 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; const bool isCanvasKit = - bool.fromEnvironment('FLUTTER_WEB_USE_SKIA'); + bool.fromEnvironment('FLUTTER_WEB_USE_SKIA', defaultValue: false); void main() { test('TextPainter caret test', () { @@ -42,7 +42,7 @@ void main() { ..textDirection = TextDirection.ltr; List children = [const TextSpan(text: 'B'), const TextSpan(text: 'C')]; - painter.text = TextSpan(children: children); + painter.text = TextSpan(text: null, children: children); painter.layout(); Offset caretOffset = painter.getOffsetForCaret(const ui.TextPosition(offset: 0), ui.Rect.zero); @@ -53,7 +53,7 @@ void main() { expect(caretOffset.dx, painter.width); children = []; - painter.text = TextSpan(children: children); + painter.text = TextSpan(text: null, children: children); painter.layout(); caretOffset = painter.getOffsetForCaret(const ui.TextPosition(offset: 0), ui.Rect.zero); @@ -759,7 +759,7 @@ void main() { // Null values are valid. See https://github.com/flutter/flutter/pull/48346#issuecomment-584839221 test('TextPainter set TextHeightBehavior null test', () { - final TextPainter painter = TextPainter() + final TextPainter painter = TextPainter(textHeightBehavior: null) ..textDirection = TextDirection.ltr; painter.textHeightBehavior = const TextHeightBehavior(); @@ -907,6 +907,7 @@ void main() { ..textHeightBehavior = const TextHeightBehavior( applyHeightToFirstAscent: false, applyHeightToLastDescent: false, + leadingDistribution: TextLeadingDistribution.proportional, ) ..layout(); @@ -953,7 +954,9 @@ void main() { const TextSelection(baseOffset: 0, extentOffset: 1), ).first.toRect(); - painter.textHeightBehavior = const TextHeightBehavior(); + painter.textHeightBehavior = const TextHeightBehavior( + leadingDistribution: TextLeadingDistribution.proportional, + ); painter.layout(); final Rect newGlyphBox = painter.getBoxesForSelection( diff --git a/packages/flutter/test/painting/text_span_test.dart b/packages/flutter/test/painting/text_span_test.dart index ce6e11e9b5..bcec0332eb 100644 --- a/packages/flutter/test/painting/text_span_test.dart +++ b/packages/flutter/test/painting/text_span_test.dart @@ -13,8 +13,8 @@ void main() { const TextSpan a2 = TextSpan(text: 'a'); const TextSpan b1 = TextSpan(children: [ a1 ]); const TextSpan b2 = TextSpan(children: [ a2 ]); - const TextSpan c1 = TextSpan(); - const TextSpan c2 = TextSpan(); + const TextSpan c1 = TextSpan(text: null); + const TextSpan c2 = TextSpan(text: null); expect(a1 == a2, isTrue); expect(b1 == b2, isTrue); diff --git a/packages/flutter/test/painting/text_style_test.dart b/packages/flutter/test/painting/text_style_test.dart index 0f1922af72..5187cde627 100644 --- a/packages/flutter/test/painting/text_style_test.dart +++ b/packages/flutter/test/painting/text_style_test.dart @@ -94,7 +94,7 @@ void main() { equals('TextStyle(inherit: false, )'), ); expect( - const TextStyle().toString(), + const TextStyle(inherit: true).toString(), equals('TextStyle()'), ); @@ -465,7 +465,7 @@ void main() { final ui.ParagraphStyle paragraphStyle0 = style0.getParagraphStyle(textScaleFactor: 2.5); const TextStyle style1 = TextStyle(fontSize: 25); - final ui.ParagraphStyle paragraphStyle1 = style1.getParagraphStyle(); + final ui.ParagraphStyle paragraphStyle1 = style1.getParagraphStyle(textScaleFactor: 1); expect(paragraphStyle0 == paragraphStyle1, true); }); diff --git a/packages/flutter/test/physics/newton_test.dart b/packages/flutter/test/physics/newton_test.dart index 92852c3eaf..e70d7363b0 100644 --- a/packages/flutter/test/physics/newton_test.dart +++ b/packages/flutter/test/physics/newton_test.dart @@ -128,6 +128,7 @@ void main() { crit = SpringSimulation(SpringDescription.withDampingRatio( mass: 1.0, stiffness: 100.0, + ratio: 1.0, ), 0.0, 300.0, 0.0); expect(crit.type, SpringType.criticallyDamped); @@ -158,6 +159,7 @@ void main() { final SpringSimulation crit = SpringSimulation(SpringDescription.withDampingRatio( mass: 1.0, stiffness: 100.0, + ratio: 1.0, ), 0.0, 500.0, 0.0); crit.tolerance = const Tolerance(distance: 0.01, velocity: 0.01); diff --git a/packages/flutter/test/rendering/annotated_region_test.dart b/packages/flutter/test/rendering/annotated_region_test.dart index 1b8e38e741..2c94bbc0c3 100644 --- a/packages/flutter/test/rendering/annotated_region_test.dart +++ b/packages/flutter/test/rendering/annotated_region_test.dart @@ -11,7 +11,7 @@ void main() { test('finds the first value in a OffsetLayer when sized', () { final ContainerLayer containerLayer = ContainerLayer(); final List layers = [ - OffsetLayer(), + OffsetLayer(offset: Offset.zero), OffsetLayer(offset: const Offset(0.0, 100.0)), OffsetLayer(offset: const Offset(0.0, 200.0)), ]; @@ -140,7 +140,7 @@ void main() { test('finds the first value in a OffsetLayer when sized', () { final ContainerLayer containerLayer = ContainerLayer(); final List layers = [ - OffsetLayer(), + OffsetLayer(offset: Offset.zero), OffsetLayer(offset: const Offset(0.0, 100.0)), OffsetLayer(offset: const Offset(0.0, 200.0)), ]; diff --git a/packages/flutter/test/rendering/baseline_test.dart b/packages/flutter/test/rendering/baseline_test.dart index 93aff3afb4..1047269906 100644 --- a/packages/flutter/test/rendering/baseline_test.dart +++ b/packages/flutter/test/rendering/baseline_test.dart @@ -21,31 +21,31 @@ void main() { ); final BoxParentData childParentData = child.parentData! as BoxParentData; - layout(root); + layout(root, phase: EnginePhase.layout); expect(childParentData.offset.dx, equals(0.0)); expect(childParentData.offset.dy, equals(-100.0)); expect(parent.size, equals(const Size(100.0, 0.0))); parent.baseline = 25.0; - pumpFrame(); + pumpFrame(phase: EnginePhase.layout); expect(childParentData.offset.dx, equals(0.0)); expect(childParentData.offset.dy, equals(-75.0)); expect(parent.size, equals(const Size(100.0, 25.0))); parent.baseline = 90.0; - pumpFrame(); + pumpFrame(phase: EnginePhase.layout); expect(childParentData.offset.dx, equals(0.0)); expect(childParentData.offset.dy, equals(-10.0)); expect(parent.size, equals(const Size(100.0, 90.0))); parent.baseline = 100.0; - pumpFrame(); + pumpFrame(phase: EnginePhase.layout); expect(childParentData.offset.dx, equals(0.0)); expect(childParentData.offset.dy, equals(0.0)); expect(parent.size, equals(const Size(100.0, 100.0))); parent.baseline = 110.0; - pumpFrame(); + pumpFrame(phase: EnginePhase.layout); expect(childParentData.offset.dx, equals(0.0)); expect(childParentData.offset.dy, equals(10.0)); expect(parent.size, equals(const Size(100.0, 110.0))); diff --git a/packages/flutter/test/rendering/box_constraints_test.dart b/packages/flutter/test/rendering/box_constraints_test.dart index aa337b3560..f4e3c26aed 100644 --- a/packages/flutter/test/rendering/box_constraints_test.dart +++ b/packages/flutter/test/rendering/box_constraints_test.dart @@ -93,16 +93,19 @@ void main() { test('BoxConstraints lerp with unbounded width', () { const BoxConstraints constraints1 = BoxConstraints( minWidth: double.infinity, + maxWidth: double.infinity, minHeight: 10.0, maxHeight: 20.0, ); const BoxConstraints constraints2 = BoxConstraints( minWidth: double.infinity, + maxWidth: double.infinity, minHeight: 20.0, maxHeight: 30.0, ); const BoxConstraints constraints3 = BoxConstraints( minWidth: double.infinity, + maxWidth: double.infinity, minHeight: 15.0, maxHeight: 25.0, ); @@ -114,16 +117,19 @@ void main() { minWidth: 10.0, maxWidth: 20.0, minHeight: double.infinity, + maxHeight: double.infinity, ); const BoxConstraints constraints2 = BoxConstraints( minWidth: 20.0, maxWidth: 30.0, minHeight: double.infinity, + maxHeight: double.infinity, ); const BoxConstraints constraints3 = BoxConstraints( minWidth: 15.0, maxWidth: 25.0, minHeight: double.infinity, + maxHeight: double.infinity, ); expect(BoxConstraints.lerp(constraints1, constraints2, 0.5), constraints3); }); @@ -131,15 +137,19 @@ void main() { test('BoxConstraints lerp from bounded to unbounded', () { const BoxConstraints constraints1 = BoxConstraints( minWidth: double.infinity, + maxWidth: double.infinity, minHeight: double.infinity, + maxHeight: double.infinity, ); const BoxConstraints constraints2 = BoxConstraints( minWidth: 20.0, maxWidth: 30.0, minHeight: double.infinity, + maxHeight: double.infinity, ); const BoxConstraints constraints3 = BoxConstraints( minWidth: double.infinity, + maxWidth: double.infinity, minHeight: 20.0, maxHeight: 30.0, ); diff --git a/packages/flutter/test/rendering/box_test.dart b/packages/flutter/test/rendering/box_test.dart index 2de55ae804..bdfa639c93 100644 --- a/packages/flutter/test/rendering/box_test.dart +++ b/packages/flutter/test/rendering/box_test.dart @@ -596,6 +596,7 @@ void main() { constrainedAxis: Axis.horizontal, textDirection: TextDirection.ltr, child: RenderFlex( + direction: Axis.horizontal, textDirection: TextDirection.ltr, children: [flexible], ), @@ -1084,9 +1085,9 @@ void main() { test('localToGlobal with ancestor', () { final RenderConstrainedBox innerConstrained = RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 50, height: 50)); - final RenderPositionedBox innerCenter = RenderPositionedBox(child: innerConstrained); + final RenderPositionedBox innerCenter = RenderPositionedBox(alignment: Alignment.center, child: innerConstrained); final RenderConstrainedBox outerConstrained = RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100, height: 100), child: innerCenter); - final RenderPositionedBox outerCentered = RenderPositionedBox(child: outerConstrained); + final RenderPositionedBox outerCentered = RenderPositionedBox(alignment: Alignment.center, child: outerConstrained); layout(outerCentered); diff --git a/packages/flutter/test/rendering/debug_test.dart b/packages/flutter/test/rendering/debug_test.dart index 695041add9..dce60cc9f2 100644 --- a/packages/flutter/test/rendering/debug_test.dart +++ b/packages/flutter/test/rendering/debug_test.dart @@ -224,7 +224,7 @@ void main() { ); layout(root, phase: EnginePhase.compositingBits); - final OffsetLayer rootLayer = OffsetLayer(); + final OffsetLayer rootLayer = OffsetLayer(offset: Offset.zero); final PaintingContext context = PaintingContext( rootLayer, const Rect.fromLTWH(0, 0, 500, 500), diff --git a/packages/flutter/test/rendering/dynamic_intrinsics_test.dart b/packages/flutter/test/rendering/dynamic_intrinsics_test.dart index 725992c6c3..a1ab1a444f 100644 --- a/packages/flutter/test/rendering/dynamic_intrinsics_test.dart +++ b/packages/flutter/test/rendering/dynamic_intrinsics_test.dart @@ -86,6 +86,8 @@ void main() { ), ), constraints: const BoxConstraints( + minWidth: 0.0, + minHeight: 0.0, maxWidth: 1000.0, maxHeight: 1000.0, ), @@ -108,6 +110,8 @@ void main() { ), ), constraints: const BoxConstraints( + minWidth: 0.0, + minHeight: 0.0, maxWidth: 1000.0, maxHeight: 1000.0, ), @@ -126,6 +130,8 @@ void main() { layout( RenderInvalidIntrinsics(), constraints: const BoxConstraints( + minWidth: 0.0, + minHeight: 0.0, maxWidth: 1000.0, maxHeight: 1000.0, ), diff --git a/packages/flutter/test/rendering/editable_test.dart b/packages/flutter/test/rendering/editable_test.dart index 13f036c0bc..0ce14f895a 100644 --- a/packages/flutter/test/rendering/editable_test.dart +++ b/packages/flutter/test/rendering/editable_test.dart @@ -41,7 +41,7 @@ class _FakeEditableTextState with TextSelectionDelegate { @override Future pasteText(SelectionChangedCause cause) { - return Future.value(); + return Future.value(null); } @override @@ -131,6 +131,7 @@ void main() { ), startHandleLayerLink: LayerLink(), endHandleLayerLink: LayerLink(), + textAlign: TextAlign.start, textDirection: TextDirection.ltr, locale: const Locale('ja', 'JP'), offset: ViewportOffset.zero(), @@ -182,6 +183,7 @@ void main() { ), startHandleLayerLink: LayerLink(), endHandleLayerLink: LayerLink(), + textAlign: TextAlign.start, textDirection: TextDirection.ltr, locale: const Locale('en', 'US'), offset: ViewportOffset.fixed(10.0), @@ -281,6 +283,7 @@ void main() { final TextSelectionDelegate delegate = _FakeEditableTextState(); final RenderEditable editable = RenderEditable( + textAlign: TextAlign.start, textDirection: TextDirection.ltr, offset: ViewportOffset.zero(), textSelectionDelegate: delegate, @@ -791,6 +794,7 @@ void main() { ), startHandleLayerLink: LayerLink(), endHandleLayerLink: LayerLink(), + textAlign: TextAlign.start, textDirection: TextDirection.ltr, locale: const Locale('en', 'US'), offset: ViewportOffset.fixed(10.0), @@ -828,6 +832,7 @@ void main() { style: TextStyle(height: 1.0, fontSize: 10.0, fontFamily: 'Ahem'), text: '12345', ), + textAlign: TextAlign.start, textDirection: TextDirection.ltr, locale: const Locale('en', 'US'), offset: ViewportOffset.zero(), @@ -891,6 +896,7 @@ void main() { // This is a Unicode left-to-right mark character that will not render // any glyphs. text: const TextSpan(text: '\u200e'), + textAlign: TextAlign.start, textDirection: TextDirection.ltr, offset: ViewportOffset.zero(), textSelectionDelegate: delegate, @@ -909,6 +915,7 @@ void main() { final TextSelectionDelegate delegate = _FakeEditableTextState(); final RenderEditable editable = RenderEditable( maxLines: null, + textAlign: TextAlign.start, textDirection: TextDirection.ltr, offset: ViewportOffset.zero(), textSelectionDelegate: delegate, @@ -1274,6 +1281,7 @@ void main() { textDirection: TextDirection.ltr, // Given maxLines of 1 and an offset of 5, the editable will be // scrolled by 5 pixels to the left. + maxLines: 1, offset: ViewportOffset.fixed(5.0), textSelectionDelegate: delegate, selection: const TextSelection.collapsed( @@ -1688,8 +1696,10 @@ void main() { ), startHandleLayerLink: LayerLink(), endHandleLayerLink: LayerLink(), + textAlign: TextAlign.start, textDirection: TextDirection.ltr, locale: const Locale('en', 'US'), + forceLine: true, offset: ViewportOffset.fixed(10.0), textSelectionDelegate: delegate, selection: const TextSelection.collapsed(offset: 0), diff --git a/packages/flutter/test/rendering/flex_test.dart b/packages/flutter/test/rendering/flex_test.dart index 733769a789..f72a46e3de 100644 --- a/packages/flutter/test/rendering/flex_test.dart +++ b/packages/flutter/test/rendering/flex_test.dart @@ -79,6 +79,7 @@ void main() { ); final RenderFlex flex = RenderFlex( direction: Axis.vertical, + verticalDirection: VerticalDirection.down, children: [ RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(height: 200.0)), flexible, @@ -100,6 +101,7 @@ void main() { additionalConstraints: const BoxConstraints.expand(), ); final RenderFlex flex = RenderFlex( + direction: Axis.horizontal, textDirection: TextDirection.ltr, children: [ RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 200.0)), @@ -120,6 +122,7 @@ void main() { test('Vertical Flipped Constraints', () { final RenderFlex flex = RenderFlex( direction: Axis.vertical, + verticalDirection: VerticalDirection.down, children: [ RenderAspectRatio(aspectRatio: 1.0), ], @@ -158,7 +161,9 @@ void main() { final RenderDecoratedBox box2 = RenderDecoratedBox(decoration: const BoxDecoration()); final RenderFlex flex = RenderFlex(textDirection: TextDirection.ltr, children: [box1, box2]); layout(flex, constraints: const BoxConstraints( + minWidth: 0.0, maxWidth: 100.0, + minHeight: 0.0, maxHeight: 100.0, )); expect(box1.size.width, equals(0.0)); @@ -185,7 +190,9 @@ void main() { box2ParentData.flex = 2; flex.addAll([box1, box2]); layout(flex, constraints: const BoxConstraints( + minWidth: 0.0, maxWidth: 100.0, + minHeight: 0.0, maxHeight: 100.0, )); expect(box1.size.width, equals(0.0)); @@ -215,7 +222,9 @@ void main() { final RenderFlex flex = RenderFlex(textDirection: TextDirection.ltr, mainAxisAlignment: MainAxisAlignment.spaceEvenly); flex.addAll([box1, box2, box3]); layout(flex, constraints: const BoxConstraints( + minWidth: 0.0, maxWidth: 500.0, + minHeight: 0.0, maxHeight: 400.0, )); Offset getOffset(RenderBox box) { @@ -246,7 +255,9 @@ void main() { final RenderFlex flex = RenderFlex(textDirection: TextDirection.ltr, mainAxisAlignment: MainAxisAlignment.spaceBetween); flex.addAll([box1, box2, box3]); layout(flex, constraints: const BoxConstraints( + minWidth: 0.0, maxWidth: 500.0, + minHeight: 0.0, maxHeight: 400.0, )); Offset getOffset(RenderBox box) { @@ -299,7 +310,9 @@ void main() { ); flex.addAll([box1, box2, box3]); layout(flex, constraints: const BoxConstraints( + minWidth: 0.0, maxWidth: 500.0, + minHeight: 0.0, maxHeight: 400.0, )); Offset getOffset(RenderBox box) { @@ -421,6 +434,7 @@ void main() { final RenderConstrainedBox box3 = RenderConstrainedBox(additionalConstraints: square); final RenderFlex flex = RenderFlex( textDirection: TextDirection.ltr, + mainAxisSize: MainAxisSize.max, ); final RenderConstrainedOverflowBox parent = RenderConstrainedOverflowBox( minWidth: 0.0, diff --git a/packages/flutter/test/rendering/independent_layout_test.dart b/packages/flutter/test/rendering/independent_layout_test.dart index 87db55d535..0ffbe51013 100644 --- a/packages/flutter/test/rendering/independent_layout_test.dart +++ b/packages/flutter/test/rendering/independent_layout_test.dart @@ -34,6 +34,7 @@ class TestLayout { void main() { const ViewConfiguration testConfiguration = ViewConfiguration( size: Size(800.0, 600.0), + devicePixelRatio: 1.0, ); test('onscreen layout does not affect offscreen', () { diff --git a/packages/flutter/test/rendering/layer_annotations_test.dart b/packages/flutter/test/rendering/layer_annotations_test.dart index 33a97ca2dc..d78ec70e98 100644 --- a/packages/flutter/test/rendering/layer_annotations_test.dart +++ b/packages/flutter/test/rendering/layer_annotations_test.dart @@ -524,7 +524,7 @@ void main() { final Layer root = _withBackgroundAnnotation( 1000, _Layers( - AnnotatedRegionLayer(1), + AnnotatedRegionLayer(1, opaque: false), children: [ _TestAnnotatedLayer(2, opaque: false), ], @@ -626,7 +626,7 @@ void main() { final Layer root = _withBackgroundAnnotation( 1000, _Layers( - AnnotatedRegionLayer(1, size: Size.zero), + AnnotatedRegionLayer(1, opaque: false, size: Size.zero), children: [ _TestAnnotatedLayer(2, opaque: true), ], @@ -651,7 +651,7 @@ void main() { final Layer root = _withBackgroundAnnotation( 1000, _Layers( - AnnotatedRegionLayer(1), + AnnotatedRegionLayer(1, opaque: false), children: [ _TestAnnotatedLayer(2, opaque: false), ], diff --git a/packages/flutter/test/rendering/mouse_tracker_cursor_test.dart b/packages/flutter/test/rendering/mouse_tracker_cursor_test.dart index b74224eba1..331b2a3624 100644 --- a/packages/flutter/test/rendering/mouse_tracker_cursor_test.dart +++ b/packages/flutter/test/rendering/mouse_tracker_cursor_test.dart @@ -251,7 +251,7 @@ void main() { ); annotations = [ - const TestAnnotationTarget(), + const TestAnnotationTarget(cursor: MouseCursor.defer), const TestAnnotationTarget(cursor: SystemMouseCursors.click), const TestAnnotationTarget(cursor: SystemMouseCursors.grabbing), ]; @@ -279,8 +279,8 @@ void main() { ); annotations = [ - const TestAnnotationTarget(), - const TestAnnotationTarget(), + const TestAnnotationTarget(cursor: MouseCursor.defer), + const TestAnnotationTarget(cursor: MouseCursor.defer), const TestAnnotationTarget(cursor: SystemMouseCursors.grabbing), ]; ui.window.onPointerDataPacket!(ui.PointerDataPacket(data: [ diff --git a/packages/flutter/test/rendering/mouse_tracker_test.dart b/packages/flutter/test/rendering/mouse_tracker_test.dart index 4d2a55727d..8b2dec51d4 100644 --- a/packages/flutter/test/rendering/mouse_tracker_test.dart +++ b/packages/flutter/test/rendering/mouse_tracker_test.dart @@ -93,7 +93,7 @@ void main() { addTearDown(() => dispatchRemoveDevice()); expect(events, _equalToEventsOnCriticalFields([ - EventMatcher(const PointerEnterEvent()), + EventMatcher(const PointerEnterEvent(position: Offset.zero)), ])); expect(listenerLogs, [true]); events.clear(); @@ -145,7 +145,7 @@ void main() { _pointerData(PointerChange.hover, const Offset(0.0, 1.0)), ])); expect(events, _equalToEventsOnCriticalFields([ - EventMatcher(const PointerEnterEvent()), + EventMatcher(const PointerEnterEvent(position: Offset.zero)), EventMatcher(const PointerHoverEvent(position: Offset(0.0, 1.0))), ])); expect(_mouseTracker.mouseIsConnected, isTrue); diff --git a/packages/flutter/test/rendering/non_render_object_root_test.dart b/packages/flutter/test/rendering/non_render_object_root_test.dart index 9d5054d93d..a87430772c 100644 --- a/packages/flutter/test/rendering/non_render_object_root_test.dart +++ b/packages/flutter/test/rendering/non_render_object_root_test.dart @@ -45,6 +45,7 @@ void main() { RenderPositionedBox child; final RealRoot root = RealRoot( child = RenderPositionedBox( + alignment: Alignment.center, child: RenderSizedBox(const Size(100.0, 100.0)), ), ); diff --git a/packages/flutter/test/rendering/paragraph_test.dart b/packages/flutter/test/rendering/paragraph_test.dart index d9664683a8..b8e2cb08e2 100644 --- a/packages/flutter/test/rendering/paragraph_test.dart +++ b/packages/flutter/test/rendering/paragraph_test.dart @@ -254,6 +254,7 @@ void main() { ), textDirection: TextDirection.ltr, maxLines: 1, + softWrap: true, ); void relayoutWith({ @@ -275,7 +276,7 @@ void main() { relayoutWith(maxLines: 3, softWrap: true, overflow: TextOverflow.clip); expect(paragraph.size.height, equals(3 * lineHeight)); - relayoutWith(softWrap: true, overflow: TextOverflow.clip); + relayoutWith(maxLines: null, softWrap: true, overflow: TextOverflow.clip); expect(paragraph.size.height, greaterThan(5 * lineHeight)); // Try again with ellipsis overflow. We can't test that the ellipsis are @@ -290,7 +291,7 @@ void main() { // infinite wrapping. However, if we did, we'd never know when to append an // ellipsis, so this really means "append ellipsis as soon as we exceed the // width". - relayoutWith(softWrap: true, overflow: TextOverflow.ellipsis); + relayoutWith(maxLines: null, softWrap: true, overflow: TextOverflow.ellipsis); expect(paragraph.size.height, equals(2 * lineHeight)); // Now with no soft wrapping. @@ -300,7 +301,7 @@ void main() { relayoutWith(maxLines: 3, softWrap: false, overflow: TextOverflow.clip); expect(paragraph.size.height, equals(2 * lineHeight)); - relayoutWith(softWrap: false, overflow: TextOverflow.clip); + relayoutWith(maxLines: null, softWrap: false, overflow: TextOverflow.clip); expect(paragraph.size.height, equals(2 * lineHeight)); relayoutWith(maxLines: 1, softWrap: false, overflow: TextOverflow.ellipsis); @@ -309,7 +310,7 @@ void main() { relayoutWith(maxLines: 3, softWrap: false, overflow: TextOverflow.ellipsis); expect(paragraph.size.height, equals(3 * lineHeight)); - relayoutWith(softWrap: false, overflow: TextOverflow.ellipsis); + relayoutWith(maxLines: null, softWrap: false, overflow: TextOverflow.ellipsis); expect(paragraph.size.height, equals(2 * lineHeight)); // Test presence of the fade effect. @@ -575,6 +576,7 @@ void main() { WidgetSpan(child: Text(sentence)), ], ), + textScaleFactor: 1.0, children: renderBoxes, textDirection: TextDirection.ltr, ); @@ -619,6 +621,7 @@ void main() { WidgetSpan(child: Text(sentence)), ], ), + textScaleFactor: 1.0, children: renderBoxes, textDirection: TextDirection.ltr, ); @@ -715,6 +718,7 @@ void main() { ], ), overflow: TextOverflow.ellipsis, + textScaleFactor: 1.0, children: renderBoxes, textDirection: TextDirection.ltr, ); diff --git a/packages/flutter/test/rendering/proxy_box_test.dart b/packages/flutter/test/rendering/proxy_box_test.dart index 7a832420c9..6733cce245 100644 --- a/packages/flutter/test/rendering/proxy_box_test.dart +++ b/packages/flutter/test/rendering/proxy_box_test.dart @@ -17,6 +17,7 @@ void main() { test('RenderFittedBox handles applying paint transform and hit-testing with empty size', () { final RenderFittedBox fittedBox = RenderFittedBox( child: RenderCustomPaint( + preferredSize: Size.zero, painter: TestCallbackPainter(onPaint: () {}), ), ); @@ -275,6 +276,7 @@ void main() { test('RenderOpacity does composite if it is opaque', () { final RenderOpacity renderOpacity = RenderOpacity( + opacity: 1.0, child: RenderSizedBox(const Size(1.0, 1.0)), // size doesn't matter ); @@ -295,6 +297,7 @@ void main() { )..value = 0.0; final RenderAnimatedOpacity renderAnimatedOpacity = RenderAnimatedOpacity( + alwaysIncludeSemantics: false, opacity: opacityAnimation, child: RenderSizedBox(const Size(1.0, 1.0)), // size doesn't matter ); @@ -309,6 +312,7 @@ void main() { )..value = 1.0; final RenderAnimatedOpacity renderAnimatedOpacity = RenderAnimatedOpacity( + alwaysIncludeSemantics: false, opacity: opacityAnimation, child: RenderSizedBox(const Size(1.0, 1.0)), // size doesn't matter ); @@ -429,6 +433,7 @@ void main() { void _testFittedBoxWithClipRectLayer() { _testLayerReuse(RenderFittedBox( + alignment: Alignment.center, fit: BoxFit.cover, clipBehavior: Clip.hardEdge, // Inject opacity under the clip to force compositing. @@ -441,6 +446,7 @@ void main() { void _testFittedBoxWithTransformLayer() { _testLayerReuse(RenderFittedBox( + alignment: Alignment.center, fit: BoxFit.fill, // Inject opacity under the clip to force compositing. child: RenderOpacity( @@ -510,6 +516,7 @@ void main() { test('RenderFollowerLayer hit test without a leader layer and the showWhenUnlinked is true', () { final RenderFollowerLayer follower = RenderFollowerLayer( link: LayerLink(), + showWhenUnlinked: true, child: RenderSizedBox(const Size(1.0, 1.0)), ); layout(follower, constraints: BoxConstraints.tight(const Size(200.0, 200.0))); @@ -536,6 +543,7 @@ void main() { final RenderFollowerLayer follower = RenderFollowerLayer( link: link, + showWhenUnlinked: true, child: RenderSizedBox(const Size(1.0, 1.0)), ); layout(follower, constraints: BoxConstraints.tight(const Size(200.0, 200.0))); diff --git a/packages/flutter/test/rendering/proxy_sliver_test.dart b/packages/flutter/test/rendering/proxy_sliver_test.dart index d2de69c6d9..a197f8292f 100644 --- a/packages/flutter/test/rendering/proxy_sliver_test.dart +++ b/packages/flutter/test/rendering/proxy_sliver_test.dart @@ -18,6 +18,7 @@ void main() { ); final RenderViewport root = RenderViewport( + axisDirection: AxisDirection.down, crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(), cacheExtent: 250.0, @@ -30,12 +31,14 @@ void main() { test('RenderSliverOpacity does composite if it is opaque', () { final RenderSliverOpacity renderSliverOpacity = RenderSliverOpacity( + opacity: 1.0, sliver: RenderSliverToBoxAdapter( child: RenderSizedBox(const Size(1.0, 1.0)), // size doesn't matter ), ); final RenderViewport root = RenderViewport( + axisDirection: AxisDirection.down, crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(), cacheExtent: 250.0, @@ -54,6 +57,7 @@ void main() { ); final RenderViewport root = RenderViewport( + axisDirection: AxisDirection.down, crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(), cacheExtent: 250.0, @@ -79,6 +83,7 @@ void main() { )..value = 0.0; final RenderSliverAnimatedOpacity renderSliverAnimatedOpacity = RenderSliverAnimatedOpacity( + alwaysIncludeSemantics: false, opacity: opacityAnimation, sliver: RenderSliverToBoxAdapter( child: RenderSizedBox(const Size(1.0, 1.0)), // size doesn't matter @@ -86,6 +91,7 @@ void main() { ); final RenderViewport root = RenderViewport( + axisDirection: AxisDirection.down, crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(), cacheExtent: 250.0, @@ -102,6 +108,7 @@ void main() { )..value = 1.0; final RenderSliverAnimatedOpacity renderSliverAnimatedOpacity = RenderSliverAnimatedOpacity( + alwaysIncludeSemantics: false, opacity: opacityAnimation, sliver: RenderSliverToBoxAdapter( child: RenderSizedBox(const Size(1.0, 1.0)), // size doesn't matter @@ -109,6 +116,7 @@ void main() { ); final RenderViewport root = RenderViewport( + axisDirection: AxisDirection.down, crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(), cacheExtent: 250.0, @@ -132,6 +140,7 @@ void main() { ); final RenderViewport root = RenderViewport( + axisDirection: AxisDirection.down, crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(), cacheExtent: 250.0, diff --git a/packages/flutter/test/rendering/reattach_test.dart b/packages/flutter/test/rendering/reattach_test.dart index d29b4fc8b5..74c13216a0 100644 --- a/packages/flutter/test/rendering/reattach_test.dart +++ b/packages/flutter/test/rendering/reattach_test.dart @@ -84,7 +84,7 @@ void main() { test('objects can be detached and re-attached: layout', () { final TestTree testTree = TestTree(); // Lay out - layout(testTree.root); + layout(testTree.root, phase: EnginePhase.layout); expect(testTree.child.size, equals(const Size(20.0, 20.0))); // Remove testTree from the custom render view renderer.renderView.child = null; @@ -93,7 +93,7 @@ void main() { testTree.child.additionalConstraints = const BoxConstraints.tightFor(height: 5.0, width: 5.0); // Lay out again - layout(testTree.root); + layout(testTree.root, phase: EnginePhase.layout); expect(testTree.child.size, equals(const Size(5.0, 5.0))); }); test('objects can be detached and re-attached: compositingBits', () { diff --git a/packages/flutter/test/rendering/repaint_boundary_test.dart b/packages/flutter/test/rendering/repaint_boundary_test.dart index 5c23c2c3e8..7a12512bdb 100644 --- a/packages/flutter/test/rendering/repaint_boundary_test.dart +++ b/packages/flutter/test/rendering/repaint_boundary_test.dart @@ -11,10 +11,14 @@ void main() { test('nested repaint boundaries - smoke test', () { RenderOpacity a, b, c; a = RenderOpacity( + opacity: 1.0, child: RenderRepaintBoundary( child: b = RenderOpacity( + opacity: 1.0, child: RenderRepaintBoundary( - child: c = RenderOpacity(), + child: c = RenderOpacity( + opacity: 1.0, + ), ), ), ), @@ -51,6 +55,7 @@ void main() { test('Framework creates an OffsetLayer for a repaint boundary', () { final _TestRepaintBoundary repaintBoundary = _TestRepaintBoundary(); final RenderOpacity opacity = RenderOpacity( + opacity: 1.0, child: repaintBoundary, ); layout(opacity, phase: EnginePhase.flushSemantics); @@ -60,6 +65,7 @@ void main() { test('Framework does not create an OffsetLayer for a non-repaint boundary', () { final _TestNonCompositedBox nonCompositedBox = _TestNonCompositedBox(); final RenderOpacity opacity = RenderOpacity( + opacity: 1.0, child: nonCompositedBox, ); layout(opacity, phase: EnginePhase.flushSemantics); @@ -69,6 +75,7 @@ void main() { test('Framework allows a non-repaint boundary to create own layer', () { final _TestCompositedBox compositedBox = _TestCompositedBox(); final RenderOpacity opacity = RenderOpacity( + opacity: 1.0, child: compositedBox, ); layout(opacity, phase: EnginePhase.flushSemantics); @@ -78,6 +85,7 @@ void main() { test('Framework ensures repaint boundary layer is not overwritten', () { final _TestRepaintBoundaryThatOverwritesItsLayer faultyRenderObject = _TestRepaintBoundaryThatOverwritesItsLayer(); final RenderOpacity opacity = RenderOpacity( + opacity: 1.0, child: faultyRenderObject, ); diff --git a/packages/flutter/test/rendering/semantics_and_children_test.dart b/packages/flutter/test/rendering/semantics_and_children_test.dart index 5371f58dbe..740e973106 100644 --- a/packages/flutter/test/rendering/semantics_and_children_test.dart +++ b/packages/flutter/test/rendering/semantics_and_children_test.dart @@ -42,6 +42,7 @@ void main() { test('RenderOpacity and children and semantics', () { final AnimationController controller = AnimationController(vsync: const TestVSync()); final RenderAnimatedOpacity box = RenderAnimatedOpacity( + alwaysIncludeSemantics: false, opacity: controller, child: RenderParagraph( const TextSpan(), diff --git a/packages/flutter/test/rendering/sliver_cache_test.dart b/packages/flutter/test/rendering/sliver_cache_test.dart index b70a0fb83e..644962505c 100644 --- a/packages/flutter/test/rendering/sliver_cache_test.dart +++ b/packages/flutter/test/rendering/sliver_cache_test.dart @@ -18,6 +18,7 @@ void main() { // Viewport is 800x600, can show 6 children at a time. final RenderViewport root = RenderViewport( + axisDirection: AxisDirection.down, crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(), cacheExtent: 250.0, @@ -288,6 +289,7 @@ void main() { ); RenderSliverFixedExtentList inner; final RenderViewport root = RenderViewport( + axisDirection: AxisDirection.down, crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(), cacheExtent: 250.0, @@ -387,6 +389,7 @@ void main() { ); RenderSliverList inner; final RenderViewport root = RenderViewport( + axisDirection: AxisDirection.down, crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(), cacheExtent: 250.0, @@ -486,6 +489,7 @@ void main() { ); RenderSliverGrid inner; final RenderViewport root = RenderViewport( + axisDirection: AxisDirection.down, crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(), cacheExtent: 250.0, @@ -593,6 +597,7 @@ void main() { final RenderViewport root = RenderViewport( + axisDirection: AxisDirection.down, crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(), cacheExtent: 250.0, diff --git a/packages/flutter/test/rendering/sliver_fixed_extent_layout_test.dart b/packages/flutter/test/rendering/sliver_fixed_extent_layout_test.dart index 3863b46b63..8b262e4e6d 100644 --- a/packages/flutter/test/rendering/sliver_fixed_extent_layout_test.dart +++ b/packages/flutter/test/rendering/sliver_fixed_extent_layout_test.dart @@ -18,6 +18,7 @@ void main() { children: children, ); final RenderViewport root = RenderViewport( + axisDirection: AxisDirection.down, crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(), cacheExtent: 0, diff --git a/packages/flutter/test/rendering/sliver_persistent_header_test.dart b/packages/flutter/test/rendering/sliver_persistent_header_test.dart index 48f373fdff..6ad191beee 100644 --- a/packages/flutter/test/rendering/sliver_persistent_header_test.dart +++ b/packages/flutter/test/rendering/sliver_persistent_header_test.dart @@ -12,6 +12,7 @@ void main() { test('RenderSliverFloatingPersistentHeader maxScrollObstructionExtent is 0', () { final TestRenderSliverFloatingPersistentHeader header = TestRenderSliverFloatingPersistentHeader(child: RenderSizedBox(const Size(400.0, 100.0))); final RenderViewport root = RenderViewport( + axisDirection: AxisDirection.down, crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(), cacheExtent: 0, @@ -29,6 +30,7 @@ void main() { child: RenderSizedBox(const Size(400.0, 100.0)), ); final RenderViewport root = RenderViewport( + axisDirection: AxisDirection.down, crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(), cacheExtent: 0, diff --git a/packages/flutter/test/rendering/slivers_block_test.dart b/packages/flutter/test/rendering/slivers_block_test.dart index ccac4b7dc2..87f2257742 100644 --- a/packages/flutter/test/rendering/slivers_block_test.dart +++ b/packages/flutter/test/rendering/slivers_block_test.dart @@ -126,6 +126,7 @@ void main() { ], ); final RenderViewport root = RenderViewport( + axisDirection: AxisDirection.down, crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(), cacheExtent: 0.0, @@ -277,6 +278,7 @@ void main() { ], ); final RenderViewport root = RenderViewport( + axisDirection: AxisDirection.down, crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(), children: [ @@ -311,6 +313,7 @@ void main() { ); inner = childManager.createRenderObject(); final RenderViewport root = RenderViewport( + axisDirection: AxisDirection.down, crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(), children: [ diff --git a/packages/flutter/test/rendering/slivers_test.dart b/packages/flutter/test/rendering/slivers_test.dart index a3505ce1bf..67c6f2e944 100644 --- a/packages/flutter/test/rendering/slivers_test.dart +++ b/packages/flutter/test/rendering/slivers_test.dart @@ -701,6 +701,7 @@ void main() { expect( const SliverGeometry( scrollExtent: 100.0, + paintExtent: 0.0, layoutExtent: 20.0, ).toString(), equals( @@ -716,6 +717,7 @@ void main() { child: RenderSizedBox(const Size(400.0, height)), ); final RenderViewport root = RenderViewport( + axisDirection: AxisDirection.down, crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(), children: [ @@ -758,6 +760,7 @@ void main() { child: RenderSizedBox(const Size(viewportWidth, 150.0)), ); final RenderViewport root = RenderViewport( + axisDirection: AxisDirection.down, crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(), children: [ @@ -781,6 +784,7 @@ void main() { child: RenderSizedBox(const Size(viewportWidth, 150.0)), ); final RenderViewport root = RenderViewport( + axisDirection: AxisDirection.down, crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(), children: [ @@ -807,6 +811,7 @@ void main() { child: RenderSizedBox(const Size(viewportWidth, 150.0)), ); final RenderViewport root = RenderViewport( + axisDirection: AxisDirection.down, crossAxisDirection: AxisDirection.right, offset: ViewportOffset.fixed(100.0), children: [ diff --git a/packages/flutter/test/rendering/table_border_test.dart b/packages/flutter/test/rendering/table_border_test.dart index 304902a50a..12056612bc 100644 --- a/packages/flutter/test/rendering/table_border_test.dart +++ b/packages/flutter/test/rendering/table_border_test.dart @@ -8,16 +8,16 @@ import 'package:flutter_test/flutter_test.dart'; void main() { test('TableBorder constructor', () { const TableBorder border1 = TableBorder( - left: BorderSide(), + left: BorderSide(width: 1.0), right: BorderSide(color: Color(0xFF00FF00)), verticalInside: BorderSide(), ); expect(border1.top, BorderSide.none); expect(border1.right, const BorderSide(color: Color(0xFF00FF00))); expect(border1.bottom, BorderSide.none); - expect(border1.left, const BorderSide()); + expect(border1.left, const BorderSide(width: 1.0)); expect(border1.horizontalInside, BorderSide.none); - expect(border1.verticalInside, const BorderSide()); + expect(border1.verticalInside, const BorderSide(width: 1.0, color: Color(0xFF000000))); expect(border1.dimensions, const EdgeInsets.symmetric(horizontal: 1.0)); expect(border1.isUniform, isFalse); expect(border1.scale(2.0), const TableBorder( @@ -57,12 +57,13 @@ void main() { expect(border3.dimensions, const EdgeInsets.symmetric(horizontal: 1.0, vertical: 1.0)); expect(border3.isUniform, isFalse); expect(border3.scale(0.0), TableBorder.symmetric( + inside: BorderSide.none, outside: const BorderSide(width: 0.0, color: Color(0xFFFF0000), style: BorderStyle.none), )); }); test('TableBorder.lerp', () { - const BorderSide side1 = BorderSide(color: Color(0x00000001)); + const BorderSide side1 = BorderSide(width: 1.0, color: Color(0x00000001)); const BorderSide side2 = BorderSide(width: 2.0, color: Color(0x00000002)); const BorderSide side3 = BorderSide(width: 3.0, color: Color(0x00000003)); const BorderSide side4 = BorderSide(width: 4.0, color: Color(0x00000004)); @@ -110,7 +111,7 @@ void main() { test('TableBorder.lerp with nulls', () { final TableBorder table2 = TableBorder.all(width: 2.0); - final TableBorder table1 = TableBorder.all(); + final TableBorder table1 = TableBorder.all(width: 1.0); expect(TableBorder.lerp(table2, null, 0.5), table1); expect(TableBorder.lerp(null, table2, 0.5), table1); expect(TableBorder.lerp(null, null, 0.5), null); diff --git a/packages/flutter/test/rendering/table_test.dart b/packages/flutter/test/rendering/table_test.dart index 1b1ef2a7b0..6a0a7c7b5d 100644 --- a/packages/flutter/test/rendering/table_test.dart +++ b/packages/flutter/test/rendering/table_test.dart @@ -240,7 +240,7 @@ void main() { ), ], columnWidths: const { - 0: FlexColumnWidth(), + 0: FlexColumnWidth(1.0), 1: FlexColumnWidth(0.123), 2: FlexColumnWidth(0.123), 3: FlexColumnWidth(0.123), diff --git a/packages/flutter/test/rendering/viewport_caching_test.dart b/packages/flutter/test/rendering/viewport_caching_test.dart index ea29851d88..8f36caa263 100644 --- a/packages/flutter/test/rendering/viewport_caching_test.dart +++ b/packages/flutter/test/rendering/viewport_caching_test.dart @@ -66,6 +66,7 @@ void main() { () => RenderViewport( crossAxisDirection: AxisDirection.left, offset: ViewportOffset.zero(), + cacheExtent: null, cacheExtentStyle: CacheExtentStyle.viewport, children: children, ), diff --git a/packages/flutter/test/rendering/viewport_test.dart b/packages/flutter/test/rendering/viewport_test.dart index e5b9a51a3d..2cfe466f96 100644 --- a/packages/flutter/test/rendering/viewport_test.dart +++ b/packages/flutter/test/rendering/viewport_test.dart @@ -582,7 +582,7 @@ void main() { testWidgets('Nested Viewports showOnScreen', (WidgetTester tester) async { final List controllersX = List.generate(10, (int i) => ScrollController(initialScrollOffset: 400.0)); - final ScrollController controllerY = ScrollController(initialScrollOffset: 400.0); + final ScrollController controllerY = ScrollController(initialScrollOffset: 400.0); final List> children = List>.generate(10, (int y) { return List.generate(10, (int x) { return SizedBox( @@ -943,8 +943,8 @@ void main() { // Regression test for https://github.com/flutter/flutter/issues/20893. List slivers; - final ScrollController controllerX = ScrollController(); - final ScrollController controllerY = ScrollController(); + final ScrollController controllerX = ScrollController(initialScrollOffset: 0.0); + final ScrollController controllerY = ScrollController(initialScrollOffset: 0.0); await tester.pumpWidget( Directionality( @@ -993,8 +993,8 @@ void main() { testWidgets('Nested Viewports showOnScreen on Sliver with allowImplicitScrolling=false for inner viewport', (WidgetTester tester) async { Widget sliver; - final ScrollController controllerX = ScrollController(); - final ScrollController controllerY = ScrollController(); + final ScrollController controllerX = ScrollController(initialScrollOffset: 0.0); + final ScrollController controllerY = ScrollController(initialScrollOffset: 0.0); await tester.pumpWidget( Directionality( @@ -1130,6 +1130,7 @@ void main() { return i == 10 ? SliverPersistentHeader( pinned: true, + floating: false, delegate: _TestSliverPersistentHeaderDelegate( minExtent: 100, maxExtent: 300, @@ -1283,7 +1284,7 @@ void main() { key: headerKey, pinned: true, floating: true, - delegate: _TestSliverPersistentHeaderDelegate(minExtent: 100, maxExtent: 300, vsync: vsync), + delegate: _TestSliverPersistentHeaderDelegate(minExtent: 100, maxExtent: 300, child: null, vsync: vsync), ), ), ); @@ -1485,8 +1486,8 @@ void main() { } group('Floating header showOnScreen', () { - testFloatingHeaderShowOnScreen(); - testFloatingHeaderShowOnScreen(axis: Axis.horizontal); + testFloatingHeaderShowOnScreen(animated: true, axis: Axis.vertical); + testFloatingHeaderShowOnScreen(animated: true, axis: Axis.horizontal); }); group('RenderViewport getOffsetToReveal renderBox to sliver coordinates conversion', () { @@ -1524,7 +1525,7 @@ void main() { } testWidgets('up, forward growth', (WidgetTester tester) async { - await tester.pumpWidget(buildList(axis: Axis.vertical, reverse: true)); + await tester.pumpWidget(buildList(axis: Axis.vertical, reverse: true, reverseGrowth: false)); final RenderAbstractViewport viewport = tester.allRenderObjects.whereType().first; final RenderObject target = tester.renderObject(find.text('Tile 5', skipOffstage: false)); @@ -1542,7 +1543,7 @@ void main() { }); testWidgets('right, forward growth', (WidgetTester tester) async { - await tester.pumpWidget(buildList(axis: Axis.horizontal)); + await tester.pumpWidget(buildList(axis: Axis.horizontal, reverse: false, reverseGrowth: false)); final RenderAbstractViewport viewport = tester.allRenderObjects.whereType().first; final RenderObject target = tester.renderObject(find.text('Tile 5', skipOffstage: false)); @@ -1551,7 +1552,7 @@ void main() { }); testWidgets('right, reverse growth', (WidgetTester tester) async { - await tester.pumpWidget(buildList(axis: Axis.horizontal, reverseGrowth: true)); + await tester.pumpWidget(buildList(axis: Axis.horizontal, reverse: false, reverseGrowth: true)); final RenderAbstractViewport viewport = tester.allRenderObjects.whereType().first; final RenderObject target = tester.renderObject(find.text('Tile 0', skipOffstage: false)); @@ -1560,7 +1561,7 @@ void main() { }); testWidgets('down, forward growth', (WidgetTester tester) async { - await tester.pumpWidget(buildList(axis: Axis.vertical)); + await tester.pumpWidget(buildList(axis: Axis.vertical, reverse: false, reverseGrowth: false)); final RenderAbstractViewport viewport = tester.allRenderObjects.whereType().first; final RenderObject target = tester.renderObject(find.text('Tile 5', skipOffstage: false)); @@ -1569,7 +1570,7 @@ void main() { }); testWidgets('down, reverse growth', (WidgetTester tester) async { - await tester.pumpWidget(buildList(axis: Axis.vertical, reverseGrowth: true)); + await tester.pumpWidget(buildList(axis: Axis.vertical, reverse: false, reverseGrowth: true)); final RenderAbstractViewport viewport = tester.allRenderObjects.whereType().first; final RenderObject target = tester.renderObject(find.text('Tile 0', skipOffstage: false)); @@ -1578,7 +1579,7 @@ void main() { }); testWidgets('left, forward growth', (WidgetTester tester) async { - await tester.pumpWidget(buildList(axis: Axis.horizontal, reverse: true)); + await tester.pumpWidget(buildList(axis: Axis.horizontal, reverse: true, reverseGrowth: false)); final RenderAbstractViewport viewport = tester.allRenderObjects.whereType().first; final RenderObject target = tester.renderObject(find.text('Tile 5', skipOffstage: false)); @@ -1697,7 +1698,7 @@ void main() { testWidgets('Horizontal viewport was given unbounded width', (WidgetTester tester) async { await expectFlutterError( - widget: buildNestedWidget(Axis.horizontal), + widget: buildNestedWidget(Axis.horizontal, Axis.horizontal), tester: tester, message: 'FlutterError\n' diff --git a/packages/flutter/test/semantics/semantics_test.dart b/packages/flutter/test/semantics/semantics_test.dart index 33e9f54201..9a1cb5dd1b 100644 --- a/packages/flutter/test/semantics/semantics_test.dart +++ b/packages/flutter/test/semantics/semantics_test.dart @@ -241,10 +241,13 @@ void main() { isSemanticBoundary: true, child: TestRender( hasLongPressAction: true, + isSemanticBoundary: false, child: middle = TestRender( hasScrollLeftAction: true, + isSemanticBoundary: false, child: TestRender( hasScrollRightAction: true, + isSemanticBoundary: false, child: TestRender( hasScrollUpAction: true, isSemanticBoundary: true, @@ -289,7 +292,7 @@ void main() { expect(child2.transform, isNull); expect( - root.toStringDeep(), + root.toStringDeep(childOrder: DebugSemanticsDumpOrder.traversalOrder), 'SemanticsNode#3\n' ' │ STALE\n' ' │ owner: null\n' @@ -375,7 +378,7 @@ void main() { childrenInInversePaintOrder: [child1, child2], ); expect( - root.toStringDeep(), + root.toStringDeep(childOrder: DebugSemanticsDumpOrder.traversalOrder), 'SemanticsNode#3\n' ' │ STALE\n' ' │ owner: null\n' @@ -430,7 +433,7 @@ void main() { ); expect( - rootComplex.toStringDeep(), + rootComplex.toStringDeep(childOrder: DebugSemanticsDumpOrder.traversalOrder), 'SemanticsNode#7\n' ' │ STALE\n' ' │ owner: null\n' @@ -552,7 +555,7 @@ void main() { final SemanticsNode allProperties = SemanticsNode() ..rect = const Rect.fromLTWH(50.0, 10.0, 20.0, 30.0) ..transform = Matrix4.translation(Vector3(10.0, 10.0, 0.0)) - ..updateWith(config: config); + ..updateWith(config: config, childrenInInversePaintOrder: null); expect( allProperties.toStringDeep(), equalsIgnoringHashCodes( diff --git a/packages/flutter/test/services/default_binary_messenger_test.dart b/packages/flutter/test/services/default_binary_messenger_test.dart index 6576ffc221..9d26f60d99 100644 --- a/packages/flutter/test/services/default_binary_messenger_test.dart +++ b/packages/flutter/test/services/default_binary_messenger_test.dart @@ -51,7 +51,7 @@ void main() { }); test('can check the mock handler', () { - Future handler(ByteData? call) => Future.value(); + Future handler(ByteData? call) => Future.value(null); final TestDefaultBinaryMessenger messenger = TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger; expect(messenger.checkMockMessageHandler('test_channel', null), true); diff --git a/packages/flutter/test/services/message_codecs_test.dart b/packages/flutter/test/services/message_codecs_test.dart index e8d0dc50b1..c7193e746f 100644 --- a/packages/flutter/test/services/message_codecs_test.dart +++ b/packages/flutter/test/services/message_codecs_test.dart @@ -80,6 +80,7 @@ void main() { test('should allow null error message,', () { final ByteData errorData = method.encodeErrorEnvelope( code: 'errorCode', + message: null, details: 'errorDetails', ); expect( diff --git a/packages/flutter/test/services/platform_channel_test.dart b/packages/flutter/test/services/platform_channel_test.dart index 86a3e86301..9e08660323 100644 --- a/packages/flutter/test/services/platform_channel_test.dart +++ b/packages/flutter/test/services/platform_channel_test.dart @@ -217,7 +217,7 @@ void main() { test('can handle method call with expressive error result', () async { channel.setMethodCallHandler((MethodCall call) async { - throw PlatformException(code: 'bad', message: 'sayHello failed'); + throw PlatformException(code: 'bad', message: 'sayHello failed', details: null); }); final ByteData call = jsonMethod.encodeMethodCall(const MethodCall('sayHello', 'hello')); ByteData? envelope; @@ -256,7 +256,7 @@ void main() { }); test('can check the mock handler', () async { - Future handler(MethodCall call) => Future.value(); + Future handler(MethodCall call) => Future.value(null); const MethodChannel channel = MethodChannel('test_handler'); expect(TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger.checkMockMessageHandler(channel.name, null), true); diff --git a/packages/flutter/test/services/raw_keyboard_test.dart b/packages/flutter/test/services/raw_keyboard_test.dart index aec3be993a..bb1ca4abe3 100644 --- a/packages/flutter/test/services/raw_keyboard_test.dart +++ b/packages/flutter/test/services/raw_keyboard_test.dart @@ -204,6 +204,7 @@ void main() { final Map data = KeyEventSimulator.getKeyData( LogicalKeyboardKey.keyA, platform: 'macos', + isDown: true, ); // Change the modifiers so that they show the shift key as already down // when this event is received, but it's not in keysPressed yet. @@ -228,6 +229,7 @@ void main() { final Map data = KeyEventSimulator.getKeyData( LogicalKeyboardKey.keyA, platform: 'ios', + isDown: true, ); // Change the modifiers so that they show the shift key as already down // when this event is received, but it's not in keysPressed yet. @@ -252,6 +254,7 @@ void main() { final Map data = KeyEventSimulator.getKeyData( LogicalKeyboardKey.keyA, platform: 'windows', + isDown: true, ); // Change the modifiers so that they show the shift key as already down // when this event is received, but it's not in keysPressed yet. @@ -276,6 +279,7 @@ void main() { final Map data = KeyEventSimulator.getKeyData( LogicalKeyboardKey.keyA, platform: 'android', + isDown: true, ); // Change the modifiers so that they show the shift key as already down // when this event is received, but it's not in keysPressed yet. @@ -300,6 +304,7 @@ void main() { final Map data = KeyEventSimulator.getKeyData( LogicalKeyboardKey.keyA, platform: 'fuchsia', + isDown: true, ); // Change the modifiers so that they show the shift key as already down // when this event is received, but it's not in keysPressed yet. @@ -324,6 +329,7 @@ void main() { final Map data = KeyEventSimulator.getKeyData( LogicalKeyboardKey.keyA, platform: 'linux', + isDown: true, ); // Change the modifiers so that they show the shift key as already down // when this event is received, but it's not in keysPressed yet. @@ -356,6 +362,7 @@ void main() { final Map data = KeyEventSimulator.getKeyData( LogicalKeyboardKey.keyA, platform: 'web', + isDown: true, ); data['metaState'] = (data['metaState'] as int) | RawKeyEventDataWeb.modifierShift; // Dispatch the modified data. @@ -399,6 +406,7 @@ void main() { final Map data3 = KeyEventSimulator.getKeyData( LogicalKeyboardKey.shiftRight, platform: 'web', + isDown: true, ); data['metaState'] = (data['metaState'] as int) | RawKeyEventDataWeb.modifierShift; // Dispatch the modified data. @@ -442,6 +450,7 @@ void main() { final Map data = KeyEventSimulator.getKeyData( LogicalKeyboardKey.keyA, platform: 'android', + isDown: true, ); // Set only the generic "down" modifier, without setting a side. data['metaState'] = (data['metaState'] as int) | @@ -479,6 +488,7 @@ void main() { final Map data = KeyEventSimulator.getKeyData( LogicalKeyboardKey.keyA, platform: 'macos', + isDown: true, ); // Set only the generic "shift down" modifier, without setting a side. data['modifiers'] = (data['modifiers'] as int) | @@ -516,6 +526,7 @@ void main() { final Map data = KeyEventSimulator.getKeyData( LogicalKeyboardKey.keyA, platform: 'ios', + isDown: true, ); // Set only the generic "shift down" modifier, without setting a side. data['modifiers'] = (data['modifiers'] as int) | @@ -553,6 +564,7 @@ void main() { final Map data = KeyEventSimulator.getKeyData( LogicalKeyboardKey.keyA, platform: 'windows', + isDown: true, ); // Set only the generic "shift down" modifier, without setting a side. // Windows doesn't have a concept of "either" for the Windows (meta) key. @@ -588,6 +600,7 @@ void main() { final Map data = KeyEventSimulator.getKeyData( LogicalKeyboardKey.keyA, platform: 'linux', + isDown: true, ); // Set only the generic "shift down" modifier, without setting a side. // Windows doesn't have a concept of "either" for the Windows (meta) key. @@ -626,6 +639,7 @@ void main() { final Map data = KeyEventSimulator.getKeyData( LogicalKeyboardKey.keyA, platform: 'web', + isDown: true, ); // Set only the generic "shift down" modifier, without setting a side. data['metaState'] = (data['metaState'] as int) | @@ -994,6 +1008,7 @@ void main() { final Map data = KeyEventSimulator.getKeyData( LogicalKeyboardKey.keyA, platform: 'android', + isDown: true, ); Map? message; await TestDefaultBinaryMessengerBinding.instance!.defaultBinaryMessenger.handlePlatformMessage( @@ -1062,10 +1077,12 @@ void main() { 'source': 0x101, // Keyboard source. 'repeatCount': 42, }).data, const RawKeyEventDataAndroid( + flags: 0, codePoint: 65, plainCodePoint: 97, keyCode: 29, scanCode: 30, + metaState: 0, )); expect(RawKeyEvent.fromMessage(const { diff --git a/packages/flutter/test/services/text_formatter_test.dart b/packages/flutter/test/services/text_formatter_test.dart index 088fc281e9..ab168ea358 100644 --- a/packages/flutter/test/services/text_formatter_test.dart +++ b/packages/flutter/test/services/text_formatter_test.dart @@ -232,6 +232,7 @@ void main() { test('test length limiting formatter with zero-length string', () { testNewValue = const TextEditingValue( + text: '', selection: TextSelection( baseOffset: 0, extentOffset: 0, @@ -244,6 +245,7 @@ void main() { // Expecting the empty string. expect(actualValue, const TextEditingValue( + text: '', selection: TextSelection( baseOffset: 0, extentOffset: 0, @@ -354,6 +356,8 @@ void main() { test('Removes characters from the end', () async { const TextEditingValue value = TextEditingValue( text: '01234567890', + selection: TextSelection.collapsed(offset: -1), + composing: TextRange.empty, ); final TextEditingValue truncated = LengthLimitingTextInputFormatter .truncate(value, 10); @@ -367,6 +371,7 @@ void main() { // Put the cursor at the end of the overflowing string to test if it // ends up at the end of the new string after truncation. selection: TextSelection.collapsed(offset: stringOverflowing.length), + composing: TextRange.empty, ); final TextEditingValue truncated = LengthLimitingTextInputFormatter .truncate(value, 10); @@ -383,6 +388,7 @@ void main() { // Put the cursor at the end of the overflowing string to test if it // ends up at the end of the new string after truncation. selection: TextSelection.collapsed(offset: stringOverflowing.length), + composing: TextRange.empty, ); final TextEditingValue truncated = LengthLimitingTextInputFormatter .truncate(value, 10); @@ -399,9 +405,13 @@ void main() { test('Passes through when under limit', () async { const TextEditingValue oldValue = TextEditingValue( text: 'aaa', + selection: TextSelection.collapsed(offset: -1), + composing: TextRange.empty, ); const TextEditingValue newValue = TextEditingValue( text: 'aaab', + selection: TextSelection.collapsed(offset: -1), + composing: TextRange.empty, ); final LengthLimitingTextInputFormatter formatter = LengthLimitingTextInputFormatter(maxLength); @@ -415,9 +425,13 @@ void main() { test('Uses old value when at the limit', () async { const TextEditingValue oldValue = TextEditingValue( text: 'aaaaaaaaaa', + selection: TextSelection.collapsed(offset: -1), + composing: TextRange.empty, ); const TextEditingValue newValue = TextEditingValue( text: 'aaaaabbbbbaaaaa', + selection: TextSelection.collapsed(offset: -1), + composing: TextRange.empty, ); final LengthLimitingTextInputFormatter formatter = LengthLimitingTextInputFormatter(maxLength); @@ -431,9 +445,13 @@ void main() { test('Truncates newValue when oldValue already over limit', () async { const TextEditingValue oldValue = TextEditingValue( text: 'aaaaaaaaaaaaaaaaaaaa', + selection: TextSelection.collapsed(offset: -1), + composing: TextRange.empty, ); const TextEditingValue newValue = TextEditingValue( text: 'bbbbbbbbbbbbbbbbbbbb', + selection: TextSelection.collapsed(offset: -1), + composing: TextRange.empty, ); final LengthLimitingTextInputFormatter formatter = LengthLimitingTextInputFormatter(maxLength); @@ -708,7 +726,7 @@ void main() { // AAA | BBB | CCC => AAA | CCC expect( - FilteringTextInputFormatter.deny('BBB').formatEditUpdate( + FilteringTextInputFormatter.deny('BBB', replacementString: '').formatEditUpdate( oldValue, newValue.copyWith( selection: const TextSelection(baseOffset: 6, extentOffset: 3), @@ -718,7 +736,7 @@ void main() { ); expect( - FilteringTextInputFormatter.deny('BBB').formatEditUpdate( + FilteringTextInputFormatter.deny('BBB', replacementString: '').formatEditUpdate( oldValue, newValue.copyWith( selection: const TextSelection(baseOffset: 6, extentOffset: 3), @@ -779,7 +797,7 @@ void main() { // Overlapping matches: AAA | BBBBB | CCC => | BBB | expect( - FilteringTextInputFormatter.allow('BBB').formatEditUpdate( + FilteringTextInputFormatter.allow('BBB', replacementString: '').formatEditUpdate( oldValue, const TextEditingValue( text: 'AAABBBBBCCC', @@ -840,7 +858,7 @@ void main() { // AAA | BBB | CCC => | AAA CCC expect( - FilteringTextInputFormatter.deny('BBB').formatEditUpdate( + FilteringTextInputFormatter.deny('BBB', replacementString: '').formatEditUpdate( oldValue, newValue.copyWith( composing: const TextRange(start: 3, end: 6), diff --git a/packages/flutter/test/services/text_input_test.dart b/packages/flutter/test/services/text_input_test.dart index f24fa0f263..e6efaaff9d 100644 --- a/packages/flutter/test/services/text_input_test.dart +++ b/packages/flutter/test/services/text_input_test.dart @@ -18,11 +18,13 @@ void main() { const TextSelection invalidSelection1 = TextSelection( baseOffset: -1, extentOffset: 0, + affinity: TextAffinity.downstream, isDirectional: true, ); const TextSelection invalidSelection2 = TextSelection(baseOffset: 123, extentOffset: -1, affinity: TextAffinity.upstream, + isDirectional: false, ); expect(invalidSelection1, invalidSelection2); expect(invalidSelection1.hashCode, invalidSelection2.hashCode); @@ -32,6 +34,7 @@ void main() { const TextSelection selection1 = TextSelection( baseOffset: 1, extentOffset: 2, + affinity: TextAffinity.downstream, ); const TextSelection selection2 = TextSelection( baseOffset: 1, @@ -63,7 +66,7 @@ void main() { MethodCall('TextInput.setClient', [1, client.configuration.toJson()]), ]); - fakeTextChannel.incoming!(const MethodCall('TextInputClient.requestExistingInputState')); + fakeTextChannel.incoming!(const MethodCall('TextInputClient.requestExistingInputState', null)); expect(fakeTextChannel.outgoingCalls.length, 3); fakeTextChannel.validateOutgoingMethodCalls([ @@ -82,7 +85,7 @@ void main() { MethodCall('TextInput.setClient', [1, client.configuration.toJson()]), ]); - fakeTextChannel.incoming!(const MethodCall('TextInputClient.requestExistingInputState')); + fakeTextChannel.incoming!(const MethodCall('TextInputClient.requestExistingInputState', null)); expect(fakeTextChannel.outgoingCalls.length, 3); fakeTextChannel.validateOutgoingMethodCalls([ @@ -126,6 +129,7 @@ void main() { test('text serializes to JSON', () async { const TextInputConfiguration configuration = TextInputConfiguration( + inputType: TextInputType.text, readOnly: true, obscureText: true, autocorrect: false, diff --git a/packages/flutter/test/widgets/absorb_pointer_test.dart b/packages/flutter/test/widgets/absorb_pointer_test.dart index 59e53bbed4..168448be17 100644 --- a/packages/flutter/test/widgets/absorb_pointer_test.dart +++ b/packages/flutter/test/widgets/absorb_pointer_test.dart @@ -19,7 +19,9 @@ void main() { ), ), const Expanded( - child: AbsorbPointer(), + child: AbsorbPointer( + absorbing: true, + ), ), ], ), @@ -32,6 +34,7 @@ void main() { final SemanticsTester semantics = SemanticsTester(tester); await tester.pumpWidget( AbsorbPointer( + absorbing: true, child: Semantics( label: 'test', textDirection: TextDirection.ltr, diff --git a/packages/flutter/test/widgets/actions_test.dart b/packages/flutter/test/widgets/actions_test.dart index d2c1f61da8..4838542054 100644 --- a/packages/flutter/test/widgets/actions_test.dart +++ b/packages/flutter/test/widgets/actions_test.dart @@ -824,7 +824,7 @@ void main() { FocusManager.instance.highlightStrategy = FocusHighlightStrategy.alwaysTraditional; final GlobalKey containerKey = GlobalKey(); - await pumpTest(tester, key: containerKey); + await pumpTest(tester, enabled: true, key: containerKey); focusNode.requestFocus(); await tester.pump(); final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); @@ -843,14 +843,14 @@ void main() { await tester.sendKeyEvent(LogicalKeyboardKey.enter); await tester.pump(); expect(invoked, isFalse); - await pumpTest(tester, key: containerKey); + await pumpTest(tester, enabled: true, key: containerKey); expect(focusing, isFalse); expect(hovering, isTrue); await pumpTest(tester, enabled: false, key: containerKey); expect(focusing, isFalse); expect(hovering, isFalse); await gesture.moveTo(Offset.zero); - await pumpTest(tester, key: containerKey); + await pumpTest(tester, enabled: true, key: containerKey); expect(hovering, isFalse); expect(focusing, isFalse); }); @@ -858,11 +858,11 @@ void main() { FocusManager.instance.highlightStrategy = FocusHighlightStrategy.alwaysTraditional; final GlobalKey containerKey = GlobalKey(); - await pumpTest(tester, key: containerKey); + await pumpTest(tester, enabled: true, key: containerKey); await tester.pump(); expect(focusing, isFalse); - await pumpTest(tester, key: containerKey); + await pumpTest(tester, enabled: true, key: containerKey); focusNode.requestFocus(); await tester.pump(); expect(focusing, isTrue); @@ -888,7 +888,7 @@ void main() { FocusManager.instance.highlightStrategy = FocusHighlightStrategy.alwaysTraditional; final GlobalKey containerKey = GlobalKey(); - await pumpTest(tester, key: containerKey, supplyCallbacks: false); + await pumpTest(tester, enabled: true, key: containerKey, supplyCallbacks: false); focusNode.requestFocus(); await tester.pump(); final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); @@ -907,14 +907,14 @@ void main() { await tester.sendKeyEvent(LogicalKeyboardKey.enter); await tester.pump(); expect(invoked, isFalse); - await pumpTest(tester, key: containerKey, supplyCallbacks: false); + await pumpTest(tester, enabled: true, key: containerKey, supplyCallbacks: false); expect(focusing, isFalse); expect(hovering, isFalse); await pumpTest(tester, enabled: false, key: containerKey, supplyCallbacks: false); expect(focusing, isFalse); expect(hovering, isFalse); await gesture.moveTo(Offset.zero); - await pumpTest(tester, key: containerKey, supplyCallbacks: false); + await pumpTest(tester, enabled: true, key: containerKey, supplyCallbacks: false); expect(hovering, isFalse); expect(focusing, isFalse); }); @@ -927,6 +927,7 @@ void main() { await tester.pumpWidget( MaterialApp( home: FocusableActionDetector( + descendantsAreFocusable: true, child: MaterialButton( focusNode: buttonNode, child: const Text('Test'), @@ -1344,7 +1345,7 @@ void main() { builder: (BuildContext context1) { return Actions( actions: > { - LogIntent: Action.overridable(defaultAction: LogInvocationAction(actionName: 'action1'), context: context1), + LogIntent: Action.overridable(defaultAction: LogInvocationAction(actionName: 'action1', enabled: true), context: context1), }, child: Builder( builder: (BuildContext context2) { diff --git a/packages/flutter/test/widgets/align_test.dart b/packages/flutter/test/widgets/align_test.dart index d89ec77b2b..9e5464aeac 100644 --- a/packages/flutter/test/widgets/align_test.dart +++ b/packages/flutter/test/widgets/align_test.dart @@ -16,6 +16,7 @@ void main() { await tester.pumpWidget( Align( + alignment: Alignment.center, child: Container(), ), ); @@ -92,6 +93,7 @@ void main() { SingleChildScrollView( child: Align( key: alignKey, + alignment: Alignment.center, child: const SizedBox( width: 10.0, height: 10.0, @@ -137,6 +139,7 @@ void main() { crossAxisAlignment: CrossAxisAlignment.start, children: const [ Align( + alignment: Alignment.center, heightFactor: 0.5, child: SizedBox( height: 100.0, diff --git a/packages/flutter/test/widgets/animated_list_test.dart b/packages/flutter/test/widgets/animated_list_test.dart index 579377ba25..e570ccbc80 100644 --- a/packages/flutter/test/widgets/animated_list_test.dart +++ b/packages/flutter/test/widgets/animated_list_test.dart @@ -54,7 +54,7 @@ void main() { expect(find.text('removing item'), findsOneWidget); expect(find.text('item 2'), findsNothing); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(const Duration(milliseconds: 100)); expect(find.text('removing item'), findsNothing); }); @@ -105,6 +105,7 @@ void main() { itemBuilder: (BuildContext context, int index, Animation animation) { return SizeTransition( key: ValueKey(index), + axis: Axis.vertical, sizeFactor: animation, child: SizedBox( height: 100.0, @@ -184,6 +185,7 @@ void main() { Widget buildItem(BuildContext context, int item, Animation animation) { return SizeTransition( key: ValueKey(item), + axis: Axis.vertical, sizeFactor: animation, child: SizedBox( height: 100.0, diff --git a/packages/flutter/test/widgets/animated_switcher_test.dart b/packages/flutter/test/widgets/animated_switcher_test.dart index 793c18eecc..634782cf3f 100644 --- a/packages/flutter/test/widgets/animated_switcher_test.dart +++ b/packages/flutter/test/widgets/animated_switcher_test.dart @@ -13,6 +13,8 @@ void main() { await tester.pumpWidget( AnimatedSwitcher( duration: const Duration(milliseconds: 100), + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, child: Container(key: containerOne, color: const Color(0x00000000)), ), ); @@ -24,6 +26,8 @@ void main() { await tester.pumpWidget( AnimatedSwitcher( duration: const Duration(milliseconds: 100), + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, child: Container(key: containerTwo, color: const Color(0xff000000)), ), ); @@ -36,6 +40,8 @@ void main() { await tester.pumpWidget( AnimatedSwitcher( duration: const Duration(milliseconds: 100), + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, child: Container(key: containerThree, color: const Color(0xffff0000)), ), ); @@ -57,6 +63,8 @@ void main() { await tester.pumpWidget( AnimatedSwitcher( duration: const Duration(milliseconds: 100), + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, child: Container(key: container1), ), ); @@ -67,6 +75,8 @@ void main() { await tester.pumpWidget( AnimatedSwitcher( duration: const Duration(milliseconds: 100), + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, child: Container(key: container2), ), ); @@ -77,6 +87,8 @@ void main() { await tester.pumpWidget( AnimatedSwitcher( duration: const Duration(milliseconds: 100), + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, child: Container(key: container3), ), ); @@ -89,6 +101,8 @@ void main() { await tester.pumpWidget( AnimatedSwitcher( duration: const Duration(milliseconds: 100), + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, child: Container(color: const Color(0x00000000)), ), ); @@ -100,6 +114,8 @@ void main() { await tester.pumpWidget( AnimatedSwitcher( duration: const Duration(milliseconds: 100), + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, child: Container(color: const Color(0xff000000)), ), ); @@ -115,6 +131,9 @@ void main() { await tester.pumpWidget( const AnimatedSwitcher( duration: Duration(milliseconds: 100), + child: null, + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, ), ); @@ -123,6 +142,8 @@ void main() { await tester.pumpWidget( AnimatedSwitcher( duration: const Duration(milliseconds: 100), + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, child: Container(color: const Color(0xff000000)), ), ); @@ -135,6 +156,8 @@ void main() { await tester.pumpWidget( AnimatedSwitcher( duration: const Duration(milliseconds: 100), + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, child: Container(color: const Color(0x00000000)), ), ); @@ -146,6 +169,9 @@ void main() { await tester.pumpWidget( const AnimatedSwitcher( duration: Duration(milliseconds: 100), + child: null, + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, ), ); @@ -156,6 +182,9 @@ void main() { await tester.pumpWidget( const AnimatedSwitcher( duration: Duration(milliseconds: 100), + child: null, + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, ), ); @@ -169,13 +198,14 @@ void main() { testWidgets("AnimatedSwitcher doesn't start any animations after dispose.", (WidgetTester tester) async { await tester.pumpWidget(AnimatedSwitcher( duration: const Duration(milliseconds: 100), + switchInCurve: Curves.linear, child: Container(color: const Color(0xff000000)), )); await tester.pump(const Duration(milliseconds: 50)); // Change the widget tree in the middle of the animation. await tester.pumpWidget(Container(color: const Color(0xffff0000))); - expect(await tester.pumpAndSettle(), equals(1)); + expect(await tester.pumpAndSettle(const Duration(milliseconds: 100)), equals(1)); }); testWidgets('AnimatedSwitcher uses custom layout.', (WidgetTester tester) async { @@ -191,6 +221,7 @@ void main() { await tester.pumpWidget( AnimatedSwitcher( duration: const Duration(milliseconds: 100), + switchInCurve: Curves.linear, layoutBuilder: newLayoutBuilder, child: Container(color: const Color(0x00000000)), ), @@ -221,6 +252,7 @@ void main() { textDirection: TextDirection.rtl, child: AnimatedSwitcher( duration: const Duration(milliseconds: 100), + switchInCurve: Curves.linear, layoutBuilder: newLayoutBuilder, transitionBuilder: newTransitionBuilder, child: Container(color: const Color(0x00000000)), @@ -238,6 +270,8 @@ void main() { textDirection: TextDirection.rtl, child: AnimatedSwitcher( duration: const Duration(milliseconds: 100), + child: null, + switchInCurve: Curves.linear, layoutBuilder: newLayoutBuilder, transitionBuilder: newTransitionBuilder, ), @@ -264,6 +298,8 @@ void main() { await tester.pumpWidget( AnimatedSwitcher( duration: const Duration(milliseconds: 100), + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, child: StatefulTest(key: statefulOne), ), ); @@ -276,6 +312,8 @@ void main() { await tester.pumpWidget( AnimatedSwitcher( duration: const Duration(milliseconds: 100), + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, child: StatefulTest(key: statefulTwo), ), ); @@ -289,6 +327,8 @@ void main() { await tester.pumpWidget( AnimatedSwitcher( duration: const Duration(milliseconds: 100), + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, child: StatefulTest(key: statefulThree), ), ); @@ -312,6 +352,8 @@ void main() { textDirection: TextDirection.rtl, child: AnimatedSwitcher( duration: const Duration(milliseconds: 100), + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, child: child, ), ), @@ -350,6 +392,8 @@ void main() { await tester.pumpWidget( AnimatedSwitcher( duration: const Duration(milliseconds: 100), + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, layoutBuilder: newLayoutBuilder, child: Container(key: containerOne, color: const Color(0xFFFF0000)), ), @@ -360,6 +404,8 @@ void main() { await tester.pumpWidget( AnimatedSwitcher( duration: const Duration(milliseconds: 100), + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, layoutBuilder: newLayoutBuilder, child: Container(key: containerTwo, color: const Color(0xFF00FF00)), ), @@ -370,6 +416,8 @@ void main() { await tester.pumpWidget( AnimatedSwitcher( duration: const Duration(milliseconds: 100), + switchInCurve: Curves.linear, + switchOutCurve: Curves.linear, layoutBuilder: newLayoutBuilder, child: Container(key: containerThree, color: const Color(0xFF0000FF)), ), @@ -398,6 +446,7 @@ void main() { await tester.pumpWidget( AnimatedSwitcher( duration: const Duration(milliseconds: 100), + switchInCurve: Curves.linear, layoutBuilder: newLayoutBuilder, transitionBuilder: newTransitionBuilder, child: Container(color: const Color(0x00000000)), diff --git a/packages/flutter/test/widgets/app_test.dart b/packages/flutter/test/widgets/app_test.dart index dd81d71a46..a2403ecba6 100644 --- a/packages/flutter/test/widgets/app_test.dart +++ b/packages/flutter/test/widgets/app_test.dart @@ -465,6 +465,7 @@ void main() { late BuildContext capturedContext; await tester.pumpWidget( WidgetsApp( + useInheritedMediaQuery: false, builder: (BuildContext context, Widget? child) { capturedContext = context; return const Placeholder(); diff --git a/packages/flutter/test/widgets/async_test.dart b/packages/flutter/test/widgets/async_test.dart index 367a268f5f..f43705b0f2 100644 --- a/packages/flutter/test/widgets/async_test.dart +++ b/packages/flutter/test/widgets/async_test.dart @@ -46,7 +46,7 @@ void main() { final Error error = Error(); expect( AsyncSnapshot.withError(ConnectionState.done, error), - AsyncSnapshot.withError(ConnectionState.done, error), + AsyncSnapshot.withError(ConnectionState.done, error, StackTrace.empty), ); }); }); @@ -76,7 +76,7 @@ void main() { testWidgets('gracefully handles transition from null future', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); await tester.pumpWidget(FutureBuilder( - key: key, builder: snapshotText, + key: key, future: null, builder: snapshotText, )); expect(find.text('AsyncSnapshot(ConnectionState.none, null, null, null)'), findsOneWidget); final Completer completer = Completer(); @@ -93,7 +93,7 @@ void main() { )); expect(find.text('AsyncSnapshot(ConnectionState.waiting, null, null, null)'), findsOneWidget); await tester.pumpWidget(FutureBuilder( - key: key, builder: snapshotText, + key: key, future: null, builder: snapshotText, )); expect(find.text('AsyncSnapshot(ConnectionState.none, null, null, null)'), findsOneWidget); completer.complete('hello'); @@ -141,6 +141,7 @@ void main() { final GlobalKey key = GlobalKey(); await tester.pumpWidget(FutureBuilder( key: key, + future: null, builder: snapshotText, initialData: 'I', )); @@ -150,6 +151,7 @@ void main() { final GlobalKey key = GlobalKey(); await tester.pumpWidget(FutureBuilder( key: key, + future: null, builder: snapshotText, initialData: 'I', )); @@ -186,7 +188,7 @@ void main() { testWidgets('gracefully handles transition from null stream', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); await tester.pumpWidget(StreamBuilder( - key: key, builder: snapshotText, + key: key, stream: null, builder: snapshotText, )); expect(find.text('AsyncSnapshot(ConnectionState.none, null, null, null)'), findsOneWidget); final StreamController controller = StreamController(); @@ -203,7 +205,7 @@ void main() { )); expect(find.text('AsyncSnapshot(ConnectionState.waiting, null, null, null)'), findsOneWidget); await tester.pumpWidget(StreamBuilder( - key: key, builder: snapshotText, + key: key, stream: null, builder: snapshotText, )); expect(find.text('AsyncSnapshot(ConnectionState.none, null, null, null)'), findsOneWidget); }); @@ -256,6 +258,7 @@ void main() { final GlobalKey key = GlobalKey(); await tester.pumpWidget(StreamBuilder( key: key, + stream: null, builder: snapshotText, initialData: 'I', )); @@ -306,15 +309,15 @@ void main() { }); testWidgets('when Future is null', (WidgetTester tester) async { await tester.pumpWidget(Column(children: [ - FutureBuilder(builder: snapshotText), - StreamBuilder(builder: snapshotText), + FutureBuilder(future: null, builder: snapshotText), + StreamBuilder(stream: null, builder: snapshotText), ])); expect(find.text('AsyncSnapshot(ConnectionState.none, null, null, null)'), findsNWidgets(2)); }); testWidgets('when initialData is used with null Future and Stream', (WidgetTester tester) async { await tester.pumpWidget(Column(children: [ - FutureBuilder(builder: snapshotText, initialData: 'I'), - StreamBuilder(builder: snapshotText, initialData: 'I'), + FutureBuilder(future: null, builder: snapshotText, initialData: 'I'), + StreamBuilder(stream: null, builder: snapshotText, initialData: 'I'), ])); expect(find.text('AsyncSnapshot(ConnectionState.none, I, null, null)'), findsNWidgets(2)); }); @@ -333,7 +336,7 @@ void main() { group('StreamBuilderBase', () { testWidgets('gracefully handles transition from null stream', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); - await tester.pumpWidget(StringCollector(key: key)); + await tester.pumpWidget(StringCollector(key: key, stream: null)); expect(find.text(''), findsOneWidget); final StreamController controller = StreamController(); await tester.pumpWidget(StringCollector(key: key, stream: controller.stream)); @@ -344,7 +347,7 @@ void main() { final StreamController controller = StreamController(); await tester.pumpWidget(StringCollector(key: key, stream: controller.stream)); expect(find.text('conn'), findsOneWidget); - await tester.pumpWidget(StringCollector(key: key)); + await tester.pumpWidget(StringCollector(key: key, stream: null)); expect(find.text('conn, disc'), findsOneWidget); }); testWidgets('gracefully handles transition to other stream', (WidgetTester tester) async { diff --git a/packages/flutter/test/widgets/autocomplete_test.dart b/packages/flutter/test/widgets/autocomplete_test.dart index fdcee8e7d2..8c26983428 100644 --- a/packages/flutter/test/widgets/autocomplete_test.dart +++ b/packages/flutter/test/widgets/autocomplete_test.dart @@ -470,6 +470,7 @@ void main() { // optionsBuilder returns nothing for an empty field query. focusNode.requestFocus(); textEditingController.value = const TextEditingValue( + text: '', selection: TextSelection(baseOffset: 0, extentOffset: 0), ); await tester.pump(); diff --git a/packages/flutter/test/widgets/autofill_group_test.dart b/packages/flutter/test/widgets/autofill_group_test.dart index 8c42981807..6e7dc3fe78 100644 --- a/packages/flutter/test/widgets/autofill_group_test.dart +++ b/packages/flutter/test/widgets/autofill_group_test.dart @@ -161,11 +161,13 @@ void main() { List children = const [ AutofillGroup( key: group1, + onDisposeAction: AutofillContextAction.commit, child: AutofillGroup(child: placeholder), ), AutofillGroup(key: group2, onDisposeAction: AutofillContextAction.cancel, child: placeholder), AutofillGroup( key: group3, + onDisposeAction: AutofillContextAction.commit, child: AutofillGroup(child: placeholder), ), ]; @@ -196,6 +198,7 @@ void main() { AutofillGroup(key: group2, onDisposeAction: AutofillContextAction.cancel, child: placeholder), AutofillGroup( key: group3, + onDisposeAction: AutofillContextAction.commit, child: AutofillGroup(child: placeholder), ), ]; @@ -215,6 +218,7 @@ void main() { children = const [ AutofillGroup( key: group3, + onDisposeAction: AutofillContextAction.commit, child: AutofillGroup(child: placeholder), ), ]; @@ -234,6 +238,7 @@ void main() { children = const [ AutofillGroup( key: group3, + onDisposeAction: AutofillContextAction.commit, child: placeholder, ), ]; diff --git a/packages/flutter/test/widgets/automatic_keep_alive_test.dart b/packages/flutter/test/widgets/automatic_keep_alive_test.dart index bad30339dd..c8bfa74518 100644 --- a/packages/flutter/test/widgets/automatic_keep_alive_test.dart +++ b/packages/flutter/test/widgets/automatic_keep_alive_test.dart @@ -446,7 +446,7 @@ void main() { AutomaticKeepAlive( child: SizedBox( height: 400.0, - child: Stack(), + child: Stack(children: const []), ), ), AutomaticKeepAlive( diff --git a/packages/flutter/test/widgets/basic_test.dart b/packages/flutter/test/widgets/basic_test.dart index ab1f3e19d4..debe8dbec3 100644 --- a/packages/flutter/test/widgets/basic_test.dart +++ b/packages/flutter/test/widgets/basic_test.dart @@ -160,6 +160,7 @@ void main() { Center( child: FractionalTranslation( translation: Offset.zero, + transformHitTests: true, child: Listener( onPointerDown: (PointerDownEvent event) { _pointerDown = true; @@ -189,6 +190,7 @@ void main() { Center( child: FractionalTranslation( translation: const Offset(0.5, 0.5), + transformHitTests: true, child: Listener( onPointerDown: (PointerDownEvent event) { _pointerDown = true; @@ -218,6 +220,7 @@ void main() { Center( child: FractionalTranslation( translation: const Offset(1.0, 1.0), + transformHitTests: true, child: Listener( onPointerDown: (PointerDownEvent event) { _pointerDown = true; @@ -255,6 +258,7 @@ void main() { child: FractionalTranslation( key: fractionalTranslationKey, translation: offset, + transformHitTests: true, child: GestureDetector( onTap: () { setState(() { @@ -865,6 +869,10 @@ void main() { Wrap( spacing: 8.0, // gap between adjacent Text widget runSpacing: 4.0, // gap between lines + direction: Axis.horizontal, + alignment: WrapAlignment.start, + runAlignment: WrapAlignment.start, + crossAxisAlignment: WrapCrossAlignment.start, textDirection: TextDirection.ltr, verticalDirection: VerticalDirection.up, children: const [ diff --git a/packages/flutter/test/widgets/box_decoration_test.dart b/packages/flutter/test/widgets/box_decoration_test.dart index 6328f12d00..59e1d7554f 100644 --- a/packages/flutter/test/widgets/box_decoration_test.dart +++ b/packages/flutter/test/widgets/box_decoration_test.dart @@ -248,11 +248,15 @@ Future main() async { ..drrect( outer: RRect.fromLTRBAndCorners( 350.0, 200.0, 450.0, 300.0, + topLeft: Radius.zero, topRight: const Radius.circular(10.0), + bottomRight: Radius.zero, + bottomLeft: Radius.zero, ), inner: RRect.fromLTRBAndCorners( 360.0, 210.0, 440.0, 290.0, topLeft: const Radius.circular(-10.0), + topRight: Radius.zero, bottomRight: const Radius.circular(-10.0), bottomLeft: const Radius.circular(-10.0), ), @@ -350,7 +354,7 @@ Future main() async { key: key, width: 100.0, height: 50.0, - decoration: BoxDecoration(border: border, borderRadius: const BorderRadius.all(Radius.circular(20.0))), + decoration: BoxDecoration(border: border, shape: BoxShape.rectangle, borderRadius: const BorderRadius.all(Radius.circular(20.0))), ), onTap: () { itemsTapped.add(1); @@ -393,7 +397,7 @@ Future main() async { key: key, width: width, height: height, - decoration: BoxDecoration(border: border,borderRadius: BorderRadius.circular(radius)), + decoration: BoxDecoration(border: border, shape: BoxShape.rectangle,borderRadius: BorderRadius.circular(radius)), ), onTap: () { itemsTapped.add(1); @@ -453,7 +457,7 @@ Future main() async { key: key, width: width, height: height, - decoration: BoxDecoration(border: border,borderRadius: BorderRadius.circular(radius)), + decoration: BoxDecoration(border: border, shape: BoxShape.rectangle,borderRadius: BorderRadius.circular(radius)), ), onTap: () { itemsTapped.add(1); @@ -501,7 +505,7 @@ Future main() async { key: key, width: width, height: height, - decoration: BoxDecoration(border: border,borderRadius: BorderRadius.circular(radius)), + decoration: BoxDecoration(border: border, shape: BoxShape.rectangle,borderRadius: BorderRadius.circular(radius)), ), onTap: () { itemsTapped.add(1); diff --git a/packages/flutter/test/widgets/clip_test.dart b/packages/flutter/test/widgets/clip_test.dart index 0f4861068b..af7aa65035 100644 --- a/packages/flutter/test/widgets/clip_test.dart +++ b/packages/flutter/test/widgets/clip_test.dart @@ -395,6 +395,7 @@ void main() { width: 100.0, height: 100.0, child: ClipRect( + clipBehavior: Clip.hardEdge, child: Container( color: Colors.blue, ), diff --git a/packages/flutter/test/widgets/container_test.dart b/packages/flutter/test/widgets/container_test.dart index 79d00f7197..a08e6531ba 100644 --- a/packages/flutter/test/widgets/container_test.dart +++ b/packages/flutter/test/widgets/container_test.dart @@ -119,7 +119,7 @@ void main() { ); expect( - box.toStringDeep(), + box.toStringDeep(minLevel: DiagnosticLevel.debug), equalsIgnoringHashCodes( 'RenderPadding#00000 relayoutBoundary=up1\n' ' │ creator: Padding ← Container ← Align ← [root]\n' @@ -518,9 +518,9 @@ void main() { }); testWidgets('giving clipBehaviour Clip.None, will not add a ClipPath to the tree', (WidgetTester tester) async { - await tester.pumpWidget( - Container( - decoration: const BoxDecoration( + await tester.pumpWidget(Container( + clipBehavior: Clip.none, + decoration: const BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(1)), ), child: const SizedBox(), @@ -642,6 +642,7 @@ void main() { boxShadow: [ BoxShadow( color: Colors.blue, + offset: Offset.zero, spreadRadius: 10, blurRadius: 20.0, ), diff --git a/packages/flutter/test/widgets/custom_paint_test.dart b/packages/flutter/test/widgets/custom_paint_test.dart index 151a7a99ab..124ddcc446 100644 --- a/packages/flutter/test/widgets/custom_paint_test.dart +++ b/packages/flutter/test/widgets/custom_paint_test.dart @@ -157,7 +157,7 @@ void main() { expect(target.currentContext!.size, const Size(800.0, 100.0)); await tester.pumpWidget(Center( - child: CustomPaint(key: target, child: Container()), + child: CustomPaint(key: target, size: Size.zero, child: Container()), )); expect(target.currentContext!.size, const Size(800.0, 600.0)); diff --git a/packages/flutter/test/widgets/custom_painter_test.dart b/packages/flutter/test/widgets/custom_painter_test.dart index c2978e936b..f6b4433395 100644 --- a/packages/flutter/test/widgets/custom_painter_test.dart +++ b/packages/flutter/test/widgets/custom_painter_test.dart @@ -32,7 +32,9 @@ void _defineTests() { )); expect(semanticsTester, hasSemantics( - TestSemantics.root(), + TestSemantics.root( + children: const [], + ), )); semanticsTester.dispose(); diff --git a/packages/flutter/test/widgets/default_text_editing_actions_test.dart b/packages/flutter/test/widgets/default_text_editing_actions_test.dart index ff674e88cd..8718d710ce 100644 --- a/packages/flutter/test/widgets/default_text_editing_actions_test.dart +++ b/packages/flutter/test/widgets/default_text_editing_actions_test.dart @@ -54,7 +54,7 @@ void main() { EditableText( controller: controller, focusNode: focusNodeTarget, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, ), diff --git a/packages/flutter/test/widgets/default_text_height_behavior_test.dart b/packages/flutter/test/widgets/default_text_height_behavior_test.dart index 3817f8025e..37e8bfd7e9 100644 --- a/packages/flutter/test/widgets/default_text_height_behavior_test.dart +++ b/packages/flutter/test/widgets/default_text_height_behavior_test.dart @@ -12,6 +12,7 @@ void main() { applyHeightToFirstAscent: false, ); const TextHeightBehavior behavior2 = TextHeightBehavior( + applyHeightToLastDescent: true, applyHeightToFirstAscent: false, ); @@ -37,6 +38,7 @@ void main() { applyHeightToFirstAscent: false, ); const TextHeightBehavior behavior2 = TextHeightBehavior( + applyHeightToLastDescent: true, applyHeightToFirstAscent: false, ); diff --git a/packages/flutter/test/widgets/dismissible_test.dart b/packages/flutter/test/widgets/dismissible_test.dart index eccd44cd78..b9d7444f30 100644 --- a/packages/flutter/test/widgets/dismissible_test.dart +++ b/packages/flutter/test/widgets/dismissible_test.dart @@ -231,7 +231,10 @@ void main() { testWidgets('Horizontal drag triggers dismiss scrollDirection=vertical', (WidgetTester tester) async { await tester.pumpWidget( - buildTest(), + buildTest( + scrollDirection: Axis.vertical, + dismissDirection: DismissDirection.horizontal, + ), ); expect(dismissedItems, isEmpty); @@ -248,7 +251,10 @@ void main() { testWidgets('Horizontal fling triggers dismiss scrollDirection=vertical', (WidgetTester tester) async { await tester.pumpWidget( - buildTest(), + buildTest( + scrollDirection: Axis.vertical, + dismissDirection: DismissDirection.horizontal, + ), ); expect(dismissedItems, isEmpty); @@ -267,6 +273,8 @@ void main() { await tester.pumpWidget( buildTest( startToEndThreshold: 0.95, + scrollDirection: Axis.vertical, + dismissDirection: DismissDirection.horizontal, ), ); expect(dismissedItems, isEmpty); @@ -313,6 +321,7 @@ void main() { testWidgets('drag-left with DismissDirection.endToStart triggers dismiss (LTR)', (WidgetTester tester) async { await tester.pumpWidget( buildTest( + scrollDirection: Axis.vertical, dismissDirection: DismissDirection.endToStart, ), ); @@ -332,6 +341,7 @@ void main() { testWidgets('drag-right with DismissDirection.startToEnd triggers dismiss (LTR)', (WidgetTester tester) async { await tester.pumpWidget( buildTest( + scrollDirection: Axis.vertical, dismissDirection: DismissDirection.startToEnd, ), ); @@ -350,6 +360,7 @@ void main() { await tester.pumpWidget( buildTest( textDirection: TextDirection.rtl, + scrollDirection: Axis.vertical, dismissDirection: DismissDirection.endToStart, ), ); @@ -369,6 +380,7 @@ void main() { await tester.pumpWidget( buildTest( textDirection: TextDirection.rtl, + scrollDirection: Axis.vertical, dismissDirection: DismissDirection.startToEnd, ), ); @@ -388,6 +400,7 @@ void main() { testWidgets('fling-left with DismissDirection.endToStart triggers dismiss (LTR)', (WidgetTester tester) async { await tester.pumpWidget( buildTest( + scrollDirection: Axis.vertical, dismissDirection: DismissDirection.endToStart, ), ); @@ -407,6 +420,7 @@ void main() { testWidgets('fling-right with DismissDirection.startToEnd triggers dismiss (LTR)', (WidgetTester tester) async { await tester.pumpWidget( buildTest( + scrollDirection: Axis.vertical, dismissDirection: DismissDirection.startToEnd, ), ); @@ -426,6 +440,7 @@ void main() { await tester.pumpWidget( buildTest( textDirection: TextDirection.rtl, + scrollDirection: Axis.vertical, dismissDirection: DismissDirection.endToStart, ), ); @@ -444,6 +459,7 @@ void main() { await tester.pumpWidget( buildTest( textDirection: TextDirection.rtl, + scrollDirection: Axis.vertical, dismissDirection: DismissDirection.startToEnd, ), ); @@ -536,6 +552,8 @@ void main() { await tester.pumpWidget( buildTest( startToEndThreshold: 1.0, + scrollDirection: Axis.vertical, + dismissDirection: DismissDirection.horizontal, ), ); expect(dismissedItems, isEmpty); @@ -553,6 +571,8 @@ void main() { await tester.pumpWidget( buildTest( startToEndThreshold: 1.0, + scrollDirection: Axis.vertical, + dismissDirection: DismissDirection.horizontal, ), ); expect(dismissedItems, isEmpty); @@ -635,6 +655,8 @@ void main() { await tester.pumpWidget( buildTest( background: const Text('background'), + scrollDirection: Axis.vertical, + dismissDirection: DismissDirection.horizontal, ), ); expect(dismissedItems, isEmpty); @@ -675,24 +697,24 @@ void main() { await tester.pumpWidget(buildTest(scrollDirection: Axis.horizontal)); expect(dismissedItems, isEmpty); - await checkFlingItemAfterMovement(tester, 0, gestureDirection: AxisDirection.left); + await checkFlingItemAfterMovement(tester, 0, gestureDirection: AxisDirection.left, mechanism: rollbackElement); expect(find.text('0'), findsOneWidget); expect(dismissedItems, isEmpty); - await checkFlingItemAfterMovement(tester, 1, gestureDirection: AxisDirection.right); + await checkFlingItemAfterMovement(tester, 1, gestureDirection: AxisDirection.right, mechanism: rollbackElement); expect(find.text('1'), findsOneWidget); expect(dismissedItems, isEmpty); }); testWidgets('Vertical fling less than threshold', (WidgetTester tester) async { - await tester.pumpWidget(buildTest()); + await tester.pumpWidget(buildTest(scrollDirection: Axis.vertical)); expect(dismissedItems, isEmpty); - await checkFlingItemAfterMovement(tester, 0, gestureDirection: AxisDirection.left); + await checkFlingItemAfterMovement(tester, 0, gestureDirection: AxisDirection.left, mechanism: rollbackElement); expect(find.text('0'), findsOneWidget); expect(dismissedItems, isEmpty); - await checkFlingItemAfterMovement(tester, 1, gestureDirection: AxisDirection.right); + await checkFlingItemAfterMovement(tester, 1, gestureDirection: AxisDirection.right, mechanism: rollbackElement); expect(find.text('1'), findsOneWidget); expect(dismissedItems, isEmpty); }); @@ -702,6 +724,8 @@ void main() { Widget buildFrame(bool? confirmDismissValue) { return buildTest( + scrollDirection: Axis.vertical, + dismissDirection: DismissDirection.horizontal, confirmDismiss: (BuildContext context, DismissDirection dismissDirection) { confirmDismissDirection = dismissDirection; return Future.value(confirmDismissValue); @@ -869,6 +893,7 @@ void main() { child: Dismissible( dragStartBehavior: DragStartBehavior.down, key: UniqueKey(), + direction: DismissDirection.horizontal, resizeDuration: null, onDismissed: (DismissDirection direction) { dismissed = true; @@ -892,17 +917,22 @@ void main() { }); testWidgets('setState that does not remove the Dismissible from tree should throw Error', (WidgetTester tester) async { + const Axis scrollDirection = Axis.vertical; + const DismissDirection dismissDirection = DismissDirection.horizontal; + await tester.pumpWidget(Directionality( textDirection: TextDirection.ltr, child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { return ListView( dragStartBehavior: DragStartBehavior.down, + scrollDirection: scrollDirection, itemExtent: 100.0, children: [ Dismissible( dragStartBehavior: DragStartBehavior.down, key: const ValueKey(1), + direction: dismissDirection, onDismissed: (DismissDirection direction) { setState(() { reportedDismissDirection = direction; @@ -910,6 +940,7 @@ void main() { dismissedItems.add(1); }); }, + dismissThresholds: const {}, crossAxisEndOffset: crossAxisEndOffset, child: SizedBox( width: 100.0, diff --git a/packages/flutter/test/widgets/draggable_scrollable_sheet_test.dart b/packages/flutter/test/widgets/draggable_scrollable_sheet_test.dart index ce9b0b38a5..67cffa1064 100644 --- a/packages/flutter/test/widgets/draggable_scrollable_sheet_test.dart +++ b/packages/flutter/test/widgets/draggable_scrollable_sheet_test.dart @@ -81,6 +81,7 @@ void main() { const Key key = ValueKey('container'); await tester.pumpWidget(_boilerplate( null, + maxChildSize: 1.0, initialChildSize: .25, itemExtent: 25.0, containerKey: key, diff --git a/packages/flutter/test/widgets/draggable_test.dart b/packages/flutter/test/widgets/draggable_test.dart index 7e190f224c..23b1b7561a 100644 --- a/packages/flutter/test/widgets/draggable_test.dart +++ b/packages/flutter/test/widgets/draggable_test.dart @@ -3063,6 +3063,7 @@ void main() { home: Column( children: const [ Draggable( + hitTestBehavior: hitTestBehavior, feedback: SizedBox(height: 50.0, child: Text('Draggable')), child: SizedBox(height: 50.0, child: Text('Target')), ), @@ -3102,7 +3103,7 @@ void main() { expect(const LongPressDraggable(child: widget1, feedback: widget2), isA>()); expect(const LongPressDraggable(child: widget1, feedback: widget2).child, widget1); expect(const LongPressDraggable(child: widget1, feedback: widget2).feedback, widget2); - expect(const LongPressDraggable(child: widget1, feedback: widget2).dragAnchor, DragAnchor.child); + expect(const LongPressDraggable(child: widget1, feedback: widget2, dragAnchor: DragAnchor.child).dragAnchor, DragAnchor.child); expect(const LongPressDraggable(child: widget1, feedback: widget2, dragAnchor: DragAnchor.pointer).dragAnchor, DragAnchor.pointer); expect(LongPressDraggable(child: widget1, feedback: widget2, dragAnchorStrategy: dummyStrategy).dragAnchorStrategy, dummyStrategy); }); diff --git a/packages/flutter/test/widgets/editable_text_cursor_test.dart b/packages/flutter/test/widgets/editable_text_cursor_test.dart index 96a257f55d..94f8609944 100644 --- a/packages/flutter/test/widgets/editable_text_cursor_test.dart +++ b/packages/flutter/test/widgets/editable_text_cursor_test.dart @@ -32,7 +32,7 @@ void main() { testWidgets('cursor has expected width, height, and radius', (WidgetTester tester) async { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: EditableText( @@ -68,7 +68,7 @@ void main() { key: editableTextKey, controller: TextEditingController(), focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, selectionControls: materialTextSelectionControls, keyboardType: TextInputType.text, @@ -121,7 +121,7 @@ void main() { key: editableTextKey, controller: TextEditingController(), focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, selectionControls: materialTextSelectionControls, keyboardType: TextInputType.text, @@ -345,8 +345,10 @@ void main() { controller: controller, focusNode: FocusNode(), style: const TextStyle(fontSize: 20.0), + maxLines: 1, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, + cursorOpacityAnimates: false, selectionControls: materialTextSelectionControls, keyboardType: TextInputType.text, textAlign: TextAlign.left, @@ -463,7 +465,7 @@ void main() { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -558,7 +560,7 @@ void main() { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -615,7 +617,7 @@ void main() { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -660,7 +662,7 @@ void main() { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -727,7 +729,7 @@ void main() { controller.text = text; await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( diff --git a/packages/flutter/test/widgets/editable_text_show_on_screen_test.dart b/packages/flutter/test/widgets/editable_text_show_on_screen_test.dart index 0603ece943..8d5ddd07cd 100644 --- a/packages/flutter/test/widgets/editable_text_show_on_screen_test.dart +++ b/packages/flutter/test/widgets/editable_text_show_on_screen_test.dart @@ -233,7 +233,7 @@ void main() { await tester.pumpWidget( MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Material( @@ -383,11 +383,12 @@ void main() { height: 600.0, width: 600.0, child: CustomScrollView( - controller: controller = ScrollController(), + controller: controller = ScrollController(initialScrollOffset: 0), slivers: List.generate(50, (int i) { return i == 10 ? SliverPersistentHeader( pinned: true, + floating: false, delegate: _TestSliverPersistentHeaderDelegate( minExtent: 50, maxExtent: 50, @@ -445,11 +446,12 @@ void main() { height: 600.0, width: 600.0, child: CustomScrollView( - controller: controller = ScrollController(), + controller: controller = ScrollController(initialScrollOffset: 0), slivers: List.generate(50, (int i) { return i == 10 ? SliverPersistentHeader( pinned: true, + floating: false, delegate: _TestSliverPersistentHeaderDelegate( minExtent: 50, maxExtent: 50, diff --git a/packages/flutter/test/widgets/editable_text_test.dart b/packages/flutter/test/widgets/editable_text_test.dart index 9261be9d36..a9e4ff2758 100644 --- a/packages/flutter/test/widgets/editable_text_test.dart +++ b/packages/flutter/test/widgets/editable_text_test.dart @@ -78,7 +78,7 @@ void main() { }) async { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -120,6 +120,7 @@ void main() { backgroundCursorColor: Colors.blue, controller: controller, focusNode: focusNode, + maxLines: 1, // Sets text keyboard implicitly. style: textStyle, cursorColor: cursorColor, ), @@ -163,7 +164,7 @@ void main() { testWidgets('has expected defaults', (WidgetTester tester) async { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: EditableText( @@ -193,7 +194,7 @@ void main() { testWidgets('text keyboard is requested when maxLines is default', (WidgetTester tester) async { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -332,7 +333,7 @@ void main() { (WidgetTester tester) async { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -371,7 +372,7 @@ void main() { (WidgetTester tester) async { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -404,7 +405,7 @@ void main() { (WidgetTester tester) async { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -439,7 +440,7 @@ void main() { (WidgetTester tester) async { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -472,7 +473,7 @@ void main() { testWidgets('multiline keyboard is requested when set explicitly', (WidgetTester tester) async { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -508,7 +509,7 @@ void main() { controller.value = value; await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: EditableText( @@ -542,7 +543,7 @@ void main() { testWidgets('visiblePassword keyboard is requested when set explicitly', (WidgetTester tester) async { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -575,7 +576,7 @@ void main() { const bool enableSuggestions = false; await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -605,7 +606,7 @@ void main() { const bool enableIMEPersonalizedLearning = false; await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -637,7 +638,7 @@ void main() { const SmartQuotesType smartQuotesType = SmartQuotesType.disabled; await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -668,7 +669,7 @@ void main() { final TextEditingController controller = TextEditingController(); await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -680,6 +681,7 @@ void main() { focusNode: focusNode, style: textStyle, cursorColor: cursorColor, + obscureText: false, ), ), ), @@ -697,7 +699,7 @@ void main() { final TextEditingController controller = TextEditingController(); await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -789,7 +791,7 @@ void main() { final Key key2 = UniqueKey(); await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -832,7 +834,7 @@ void main() { // Updates the style. await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -870,7 +872,7 @@ void main() { testWidgets('Multiline keyboard with newline action is requested when maxLines = null', (WidgetTester tester) async { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -901,7 +903,7 @@ void main() { testWidgets('Text keyboard is requested when explicitly set and maxLines = null', (WidgetTester tester) async { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -933,7 +935,7 @@ void main() { testWidgets('Correct keyboard is requested when set explicitly and maxLines > 1', (WidgetTester tester) async { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -965,7 +967,7 @@ void main() { testWidgets('multiline keyboard is requested when set implicitly', (WidgetTester tester) async { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -996,7 +998,7 @@ void main() { testWidgets('single line inputs have correct default keyboard', (WidgetTester tester) async { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -1006,6 +1008,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: controller, focusNode: focusNode, + maxLines: 1, // Sets text keyboard implicitly. style: textStyle, cursorColor: cursorColor, ), @@ -1026,7 +1029,7 @@ void main() { testWidgets('connection is closed when TextInputClient.onConnectionClosed message received', (WidgetTester tester) async { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -1036,6 +1039,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: controller, focusNode: focusNode, + maxLines: 1, // Sets text keyboard implicitly. style: textStyle, cursorColor: cursorColor, ), @@ -1069,7 +1073,7 @@ void main() { testWidgets('closed connection reopened when user focused', (WidgetTester tester) async { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -1079,6 +1083,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: controller, focusNode: focusNode, + maxLines: 1, // Sets text keyboard implicitly. style: textStyle, cursorColor: cursorColor, ), @@ -1142,7 +1147,7 @@ void main() { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -1449,7 +1454,9 @@ void main() { backgroundCursorColor: Colors.grey, controller: TextEditingController(text: 'blah blah'), focusNode: focusNode, - toolbarOptions: const ToolbarOptions(), + toolbarOptions: const ToolbarOptions( + selectAll: false, + ), style: textStyle, cursorColor: cursorColor, selectionControls: cupertinoTextSelectionControls, @@ -1480,6 +1487,7 @@ void main() { focusNode: focusNode, toolbarOptions: const ToolbarOptions( copy: true, + selectAll: false, ), style: textStyle, cursorColor: cursorColor, @@ -1514,6 +1522,12 @@ void main() { controller: TextEditingController(text: 'blah blah'), focusNode: focusNode, readOnly: true, + toolbarOptions: const ToolbarOptions( + paste: true, + cut: true, + selectAll: true, + copy: true, + ), style: textStyle, cursorColor: cursorColor, selectionControls: materialTextSelectionControls, @@ -1617,6 +1631,7 @@ void main() { const TextEditingValue( text: 'Lorem ipsum dolor sit amet', selection: TextSelection(baseOffset: 0, extentOffset: 3), + composing: TextRange.empty, ), ); } @@ -1707,7 +1722,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: TextEditingController(), focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, selectionControls: materialTextSelectionControls, keyboardType: TextInputType.text, @@ -1785,7 +1800,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: TextEditingController(), focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, selectionControls: materialTextSelectionControls, keyboardType: TextInputType.text, @@ -1831,7 +1846,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: TextEditingController(), focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, selectionControls: materialTextSelectionControls, keyboardType: TextInputType.text, @@ -1868,7 +1883,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: TextEditingController(), focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, onEditingComplete: () { onEditingCompleteCalled = true; @@ -1908,7 +1923,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: TextEditingController(), focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, onEditingComplete: () { onEditingCompleteCalled = true; @@ -1948,8 +1963,9 @@ void main() { backgroundCursorColor: Colors.grey, controller: TextEditingController(), focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, + maxLines: 1, onEditingComplete: () { onEditingCompleteCalled = true; assert(!onSubmittedCalled); @@ -1987,7 +2003,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: TextEditingController(), focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, maxLines: 3, onEditingComplete: () { @@ -2023,7 +2039,7 @@ void main() { Widget widget = MaterialApp( home: EditableText( backgroundCursorColor: Colors.grey, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, focusNode: focusNode, controller: controller, @@ -2047,7 +2063,7 @@ void main() { widget = MaterialApp( home: EditableText( backgroundCursorColor: Colors.grey, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, focusNode: focusNode, controller: controller, @@ -2118,8 +2134,9 @@ void main() { backgroundCursorColor: Colors.grey, controller: controller, focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, + autocorrect: true, autocorrectionTextRectColor: rectColor, showCursor: false, onEditingComplete: () { }, @@ -2175,7 +2192,7 @@ void main() { setState = setter; return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -2184,7 +2201,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: currentController, focusNode: focusNode, - style: Typography.material2018() + style: Typography.material2018(platform: TargetPlatform.android) .black .subtitle1!, cursorColor: Colors.blue, @@ -2251,7 +2268,7 @@ void main() { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -2291,7 +2308,7 @@ void main() { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -2303,6 +2320,7 @@ void main() { focusNode: focusNode, style: textStyle, cursorColor: cursorColor, + maxLines: 1, ), ), ), @@ -2316,7 +2334,7 @@ void main() { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -2355,7 +2373,7 @@ void main() { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -3367,6 +3385,7 @@ void main() { SemanticsAction.setSelection, SemanticsAction.setText, ], + value: '', textSelection: TextSelection.collapsed(offset: controller.text.length), textDirection: TextDirection.ltr, ), @@ -3415,7 +3434,7 @@ void main() { }); final TextEditingController controller = TextEditingController(); final MediaQuery mediaQuery = MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: EditableText( controller: controller, backgroundCursorColor: Colors.red, @@ -3462,13 +3481,15 @@ void main() { final TextEditingController controller = TextEditingController(); await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData( + devicePixelRatio: 1.0, + ), child: Directionality( textDirection: TextDirection.ltr, child: EditableText( controller: controller, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, ), @@ -3491,13 +3512,15 @@ void main() { final TextEditingController controller = TextEditingController(); await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData( + devicePixelRatio: 1.0, + ), child: Directionality( textDirection: TextDirection.ltr, child: EditableText( controller: controller, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, ), @@ -3530,17 +3553,20 @@ void main() { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData( + devicePixelRatio: 1.0, + ), child: Directionality( textDirection: TextDirection.ltr, child: Column( + mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ EditableText( key: ValueKey(controller1.text), controller: controller1, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, ), @@ -3549,7 +3575,7 @@ void main() { key: ValueKey(controller2.text), controller: controller2, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, minLines: 10, @@ -3653,7 +3679,7 @@ void main() { final TextEditingController controller = TextEditingController(); await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: EditableText( textDirection: TextDirection.rtl, controller: controller, @@ -3704,7 +3730,7 @@ void main() { setState = setter; return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -3759,7 +3785,7 @@ void main() { Widget builder() { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -3860,7 +3886,7 @@ void main() { Widget builder() { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -3967,13 +3993,15 @@ void main() { final TextEditingController controller = TextEditingController(); await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData( + devicePixelRatio: 1.0, + ), child: Directionality( textDirection: TextDirection.ltr, child: EditableText( controller: controller, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, keyboardAppearance: Brightness.dark, @@ -4050,7 +4078,7 @@ void main() { showSelectionHandles: true, controller: controller, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -4219,7 +4247,7 @@ void main() { controller: controller, showSelectionHandles: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -4356,7 +4384,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -4527,6 +4555,7 @@ void main() { const TextSelection( baseOffset: 20, extentOffset: 20, + affinity: TextAffinity.downstream, ), ), reason: 'on $platform', @@ -4548,6 +4577,7 @@ void main() { const TextSelection( baseOffset: 20, extentOffset: 39, + affinity: TextAffinity.downstream, ), ), reason: 'on $platform', @@ -4572,6 +4602,7 @@ void main() { const TextSelection( baseOffset: 20, extentOffset: testText.length, + affinity: TextAffinity.downstream, ), ), reason: 'on $platform', @@ -4593,6 +4624,7 @@ void main() { const TextSelection( baseOffset: 20, extentOffset: 57, + affinity: TextAffinity.downstream, ), ), reason: 'on $platform', @@ -4681,6 +4713,7 @@ void main() { const TextSelection( baseOffset: 0, extentOffset: 0, + affinity: TextAffinity.downstream, ), ), reason: 'on $platform', @@ -4692,6 +4725,7 @@ void main() { [ LogicalKeyboardKey.arrowDown, ], + shift: false, lineModifier: true, targetPlatform: defaultTargetPlatform, ); @@ -4701,6 +4735,7 @@ void main() { equals( const TextSelection.collapsed( offset: testText.length, + affinity: TextAffinity.downstream, ), ), reason: 'on $platform', @@ -4713,6 +4748,7 @@ void main() { [ LogicalKeyboardKey.arrowUp, ], + shift: false, lineModifier: true, targetPlatform: defaultTargetPlatform, ); @@ -4737,6 +4773,8 @@ void main() { LogicalKeyboardKey.arrowRight, LogicalKeyboardKey.arrowRight, ], + shift: false, + lineModifier: false, targetPlatform: defaultTargetPlatform, ); @@ -4745,6 +4783,7 @@ void main() { equals( const TextSelection.collapsed( offset: 3, + affinity: TextAffinity.downstream, ), ), reason: 'on $platform', @@ -4767,6 +4806,7 @@ void main() { const TextSelection( baseOffset: 3, extentOffset: testText.length, + affinity: TextAffinity.downstream, ), ), reason: 'on $platform', @@ -4801,6 +4841,8 @@ void main() { [ LogicalKeyboardKey.arrowUp, ], + shift: false, + lineModifier: false, targetPlatform: defaultTargetPlatform, ); @@ -5035,7 +5077,7 @@ void main() { controller: controller, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -5215,7 +5257,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -5250,6 +5292,7 @@ void main() { equals( const TextSelection.collapsed( offset: 23, + affinity: TextAffinity.downstream, ), ), reason: 'on $platform', @@ -5291,6 +5334,7 @@ void main() { equals( TextSelection.collapsed( offset: afterHomeOffset, + affinity: TextAffinity.downstream, ), ), reason: 'on $platform', @@ -5343,7 +5387,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -5378,6 +5422,7 @@ void main() { equals( const TextSelection.collapsed( offset: 23, + affinity: TextAffinity.downstream, ), ), reason: 'on $platform', @@ -5398,6 +5443,7 @@ void main() { // Move back to position 23. controller.selection = const TextSelection.collapsed( offset: 23, + affinity: TextAffinity.downstream, ); await tester.pump(); @@ -5424,6 +5470,7 @@ void main() { const TextSelection( baseOffset: 23, extentOffset: 23, + affinity: TextAffinity.downstream, ), ), reason: 'on $platform', @@ -5434,6 +5481,7 @@ void main() { const TextSelection( baseOffset: 23, extentOffset: 23, + affinity: TextAffinity.downstream, ), ), reason: 'on $platform', @@ -5448,6 +5496,7 @@ void main() { const TextSelection( baseOffset: 23, extentOffset: 20, + affinity: TextAffinity.downstream, ), ), reason: 'on $platform', @@ -5473,6 +5522,7 @@ void main() { const TextSelection( baseOffset: 23, extentOffset: 20, + affinity: TextAffinity.downstream, ), ), reason: 'on $platform', @@ -5483,6 +5533,7 @@ void main() { const TextSelection( baseOffset: 23, extentOffset: 35, + affinity: TextAffinity.downstream, ), ), reason: 'on $platform', @@ -5508,6 +5559,7 @@ void main() { const TextSelection( baseOffset: 23, extentOffset: 72, + affinity: TextAffinity.downstream, ), ), reason: 'on $platform', @@ -5704,7 +5756,7 @@ void main() { maxLines: 2, controller: controller, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!.copyWith(fontFamily: 'Roboto'), cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -5836,6 +5888,7 @@ void main() { MaterialApp( home: EditableText( controller: TextEditingController(text: 'A' * 1000), + maxLines: 1, focusNode: FocusNode(), style: textStyle, cursorColor: Colors.blue, @@ -5853,6 +5906,7 @@ void main() { MaterialApp( home: EditableText( controller: TextEditingController(text: 'A' * 1000), + maxLines: 1, focusNode: FocusNode(), style: textStyle, cursorColor: Colors.blue, @@ -5870,6 +5924,7 @@ void main() { MaterialApp( home: EditableText( controller: TextEditingController(text: 'A' * 1000), + maxLines: 1, focusNode: FocusNode(), style: textStyle, cursorColor: Colors.blue, @@ -5886,6 +5941,7 @@ void main() { MaterialApp( home: EditableText( controller: TextEditingController(text: 'A' * 1000), + maxLines: 1, focusNode: FocusNode(), style: textStyle, cursorColor: Colors.blue, @@ -5932,6 +5988,7 @@ void main() { controller: controller, cursorColor: cursorColor, focusNode: focusNode, + maxLines: 1, obscureText: true, style: textStyle, ); @@ -5963,7 +6020,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, ); @@ -6061,7 +6118,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, inputFormatters: [LengthLimitingTextInputFormatter(6)], onChanged: (String s) => controller.text += ' onChanged', @@ -6160,7 +6217,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, inputFormatters: [LengthLimitingTextInputFormatter(6)], ), @@ -6204,7 +6261,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, ); @@ -6248,7 +6305,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, ); @@ -6296,7 +6353,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, ); @@ -6356,7 +6413,7 @@ void main() { setState = setter; return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -6479,7 +6536,7 @@ void main() { builder: (BuildContext context, StateSetter setter) { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -6555,7 +6612,7 @@ void main() { builder: (BuildContext context, StateSetter setter) { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -6632,7 +6689,7 @@ void main() { await tester.pumpWidget( MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -6676,7 +6733,7 @@ void main() { builder: (BuildContext context, StateSetter setter) { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -6747,7 +6804,7 @@ void main() { home: EditableText( controller: controller, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, ), @@ -6809,7 +6866,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -6829,7 +6886,7 @@ void main() { final MockTextFormatter formatter = MockTextFormatter(); await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -6839,6 +6896,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: controller, focusNode: focusNode, + maxLines: 1, // Sets text keyboard implicitly. style: textStyle, cursorColor: cursorColor, inputFormatters: [formatter], @@ -6901,7 +6959,7 @@ void main() { final MockTextFormatter formatter = MockTextFormatter(); await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -6911,6 +6969,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: controller, focusNode: focusNode, + maxLines: 1, // Sets text keyboard implicitly. style: textStyle, cursorColor: cursorColor, inputFormatters: [formatter], @@ -6982,7 +7041,7 @@ void main() { final MockTextFormatter formatter = MockTextFormatter(); await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -6992,6 +7051,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: controller, focusNode: focusNode, + maxLines: 1, // Sets text keyboard implicitly. style: textStyle, cursorColor: cursorColor, inputFormatters: [formatter], @@ -7022,7 +7082,7 @@ void main() { testWidgets('EditableText changes mouse cursor when hovered', (WidgetTester tester) async { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -7054,7 +7114,7 @@ void main() { // Test default cursor await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -7084,7 +7144,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: TextEditingController(), focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, selectionControls: materialTextSelectionControls, keyboardType: TextInputType.text, @@ -7105,7 +7165,7 @@ void main() { testWidgets('EditableText can set and update clipBehavior', (WidgetTester tester) async { await tester.pumpWidget(MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -7125,7 +7185,7 @@ void main() { expect(renderObject.clipBehavior, equals(Clip.hardEdge)); await tester.pumpWidget(MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -7147,10 +7207,11 @@ void main() { testWidgets('EditableText inherits DefaultTextHeightBehavior', (WidgetTester tester) async { const TextHeightBehavior customTextHeightBehavior = TextHeightBehavior( + applyHeightToLastDescent: true, applyHeightToFirstAscent: false, ); await tester.pumpWidget(MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -7175,6 +7236,7 @@ void main() { testWidgets('EditableText defaultTextHeightBehavior is used over inherited widget', (WidgetTester tester) async { const TextHeightBehavior inheritedTextHeightBehavior = TextHeightBehavior( + applyHeightToLastDescent: true, applyHeightToFirstAscent: false, ); const TextHeightBehavior customTextHeightBehavior = TextHeightBehavior( @@ -7182,7 +7244,7 @@ void main() { applyHeightToFirstAscent: false, ); await tester.pumpWidget(MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FocusScope( @@ -7650,7 +7712,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, selectionControls: materialTextSelectionControls, onSelectionChanged: (TextSelection selection, SelectionChangedCause? cause) { @@ -7677,7 +7739,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, onChanged: (String text) { throw FlutterError(errorText); @@ -7703,7 +7765,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, onEditingComplete: () { throw FlutterError(errorText); @@ -7734,7 +7796,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, onSubmitted: (String text) { throw FlutterError(errorText); @@ -7770,7 +7832,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, ), )); @@ -7793,7 +7855,7 @@ void main() { final UnsettableController unsettableController = UnsettableController(); await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: EditableText( @@ -7849,7 +7911,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -7905,7 +7967,7 @@ void main() { controller: controller, autofocus: true, focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, keyboardType: TextInputType.text, @@ -8044,7 +8106,7 @@ void main() { controller: controller, autofocus: true, focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, keyboardType: TextInputType.text, @@ -8190,7 +8252,7 @@ void main() { controller: controller, autofocus: true, focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, keyboardType: TextInputType.text, @@ -8301,7 +8363,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -8371,7 +8433,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -8412,7 +8474,7 @@ void main() { setState = setter; return EditableText( focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: enableInteractiveSelection ? materialTextSelectionControls : null, @@ -8473,6 +8535,7 @@ void main() { home: EditableText( autofocus: true, controller: TextEditingController(text: 'A'), + maxLines: 1, focusNode: focusNode, style: textStyle, cursorColor: Colors.blue, @@ -8517,7 +8580,7 @@ void main() { child: EditableText( key: key, focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, controller: controller, @@ -8749,10 +8812,13 @@ class _TransformedEditableTextState extends State { @override Widget build(BuildContext context) { return MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData( + devicePixelRatio: 1.0, + ), child: Directionality( textDirection: TextDirection.ltr, child: Column( + mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Transform.translate( @@ -8760,7 +8826,7 @@ class _TransformedEditableTextState extends State { child: EditableText( controller: TextEditingController(), focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, ), diff --git a/packages/flutter/test/widgets/editable_text_utils.dart b/packages/flutter/test/widgets/editable_text_utils.dart index 4d95a83a31..03628e8aa8 100644 --- a/packages/flutter/test/widgets/editable_text_utils.dart +++ b/packages/flutter/test/widgets/editable_text_utils.dart @@ -59,6 +59,7 @@ class OverflowWidgetTextEditingController extends TextEditingController { children: [ const TextSpan(text: 'Hi'), WidgetSpan( + alignment: PlaceholderAlignment.bottom, child: Container( color: Colors.redAccent, height: 100.0, diff --git a/packages/flutter/test/widgets/ensure_visible_test.dart b/packages/flutter/test/widgets/ensure_visible_test.dart index e4155acc54..2c54de04ea 100644 --- a/packages/flutter/test/widgets/ensure_visible_test.dart +++ b/packages/flutter/test/widgets/ensure_visible_test.dart @@ -247,6 +247,7 @@ void main() { child: SingleChildScrollView( scrollDirection: Axis.horizontal, child: SingleChildScrollView( + scrollDirection: Axis.vertical, child: Column( children: rows, ), diff --git a/packages/flutter/test/widgets/fitted_box_test.dart b/packages/flutter/test/widgets/fitted_box_test.dart index a5b1cdc52b..76321c8f46 100644 --- a/packages/flutter/test/widgets/fitted_box_test.dart +++ b/packages/flutter/test/widgets/fitted_box_test.dart @@ -346,6 +346,7 @@ void main() { width: 100.0, height: 10.0, child: FittedBox( + fit: BoxFit.contain, child: SizedBox( width: 50.0, height: 50.0, @@ -451,6 +452,7 @@ void main() { width: 100.0, height: 100.0, child: FittedBox( + fit: BoxFit.contain, alignment: FractionalOffset.center, child: SizedBox( width: 1000.0, diff --git a/packages/flutter/test/widgets/focus_manager_test.dart b/packages/flutter/test/widgets/focus_manager_test.dart index c7c1d3d655..2bc0afe385 100644 --- a/packages/flutter/test/widgets/focus_manager_test.dart +++ b/packages/flutter/test/widgets/focus_manager_test.dart @@ -480,7 +480,7 @@ void main() { testWidgets('canRequestFocus affects children.', (WidgetTester tester) async { final BuildContext context = await setupWidget(tester); - final FocusScopeNode scope = FocusScopeNode(debugLabel: 'Scope'); + final FocusScopeNode scope = FocusScopeNode(debugLabel: 'Scope', canRequestFocus: true); final FocusAttachment scopeAttachment = scope.attach(context); final FocusNode parent1 = FocusNode(debugLabel: 'Parent 1'); final FocusAttachment parent1Attachment = parent1.attach(context); @@ -516,7 +516,7 @@ void main() { testWidgets("skipTraversal doesn't affect children.", (WidgetTester tester) async { final BuildContext context = await setupWidget(tester); - final FocusScopeNode scope = FocusScopeNode(debugLabel: 'Scope'); + final FocusScopeNode scope = FocusScopeNode(debugLabel: 'Scope', skipTraversal: false); final FocusAttachment scopeAttachment = scope.attach(context); final FocusNode parent1 = FocusNode(debugLabel: 'Parent 1'); final FocusAttachment parent1Attachment = parent1.attach(context); @@ -801,7 +801,7 @@ void main() { expect(scope1.focusedChild, equals(child1)); expect(scope2.focusedChild, equals(child3)); - child1.unfocus(); + child1.unfocus(disposition: UnfocusDisposition.scope); await tester.pump(); // Focused child doesn't change. expect(scope1.focusedChild, isNull); @@ -823,7 +823,7 @@ void main() { expect(child3.hasPrimaryFocus, isFalse); // The same thing happens when unfocusing a second time. - child1.unfocus(); + child1.unfocus(disposition: UnfocusDisposition.scope); await tester.pump(); expect(scope1.focusedChild, isNull); expect(scope2.focusedChild, equals(child3)); @@ -836,7 +836,7 @@ void main() { // gets focus, but it doesn't mess with the focused children. child1.requestFocus(); await tester.pump(); - scope1.unfocus(); + scope1.unfocus(disposition: UnfocusDisposition.scope); await tester.pump(); expect(scope1.focusedChild, equals(child1)); expect(scope2.focusedChild, equals(child3)); @@ -892,7 +892,7 @@ void main() { expect(scope2.focusedChild, equals(child3)); expect(child3.hasPrimaryFocus, isTrue); - child1.unfocus(); + child1.unfocus(disposition: UnfocusDisposition.scope); await tester.pump(); expect(child3.hasPrimaryFocus, isTrue); expect(scope1.focusedChild, equals(child1)); diff --git a/packages/flutter/test/widgets/focus_scope_test.dart b/packages/flutter/test/widgets/focus_scope_test.dart index a8b05f9722..979e75f170 100644 --- a/packages/flutter/test/widgets/focus_scope_test.dart +++ b/packages/flutter/test/widgets/focus_scope_test.dart @@ -81,7 +81,7 @@ void main() { final GlobalKey key = GlobalKey(); await tester.pumpWidget( - TestFocus(key: key), + TestFocus(key: key, name: 'a'), ); expect(key.currentState!.focusNode.hasFocus, isFalse); @@ -99,7 +99,7 @@ void main() { await tester.pumpWidget( Column( children: [ - TestFocus(key: keyA), + TestFocus(key: keyA, name: 'a'), TestFocus(key: keyB, name: 'b'), ], ), @@ -134,7 +134,7 @@ void main() { await tester.pumpWidget( Column( children: [ - TestFocus(key: keyA), + TestFocus(key: keyA, name: 'a'), TestFocus(key: keyB, name: 'b', autofocus: true), ], ), @@ -157,6 +157,7 @@ void main() { children: [ TestFocus( key: keyA, + name: 'a', autofocus: true, ), TestFocus( @@ -210,6 +211,7 @@ void main() { children: [ TestFocus( key: key, + name: 'a', debugLabel: 'Child', ), ], @@ -361,6 +363,7 @@ void main() { children: [ TestFocus( key: keyA, + name: 'a', autofocus: true, debugLabel: 'Child A', ), @@ -451,6 +454,7 @@ void main() { children: [ TestFocus( key: keyA, + name: 'a', ), TestFocus( key: keyB, @@ -548,6 +552,7 @@ void main() { TestFocus( debugLabel: 'Widget A', key: keyA, + name: 'a', ), TestFocus( debugLabel: 'Widget B', @@ -611,6 +616,7 @@ void main() { TestFocus( debugLabel: 'Child A', key: keyA, + name: 'a', ), ], ), @@ -673,6 +679,7 @@ void main() { TestFocus( debugLabel: 'Child A', key: keyA, + name: 'a', ), ], ), @@ -756,6 +763,7 @@ void main() { TestFocus( debugLabel: 'Child A', key: keyA, + name: 'a', ), ], ), @@ -834,6 +842,7 @@ void main() { children: [ TestFocus( key: keyA, + name: 'a', ), ], ), @@ -884,6 +893,7 @@ void main() { children: [ TestFocus( key: keyA, + name: 'a', ), ], ), @@ -916,6 +926,7 @@ void main() { TestFocus( debugLabel: 'Child A', key: keyA, + name: 'a', ), ], ), @@ -958,6 +969,7 @@ void main() { TestFocus( debugLabel: 'Child A', key: keyA, + name: 'a', ), ], ), @@ -1397,7 +1409,7 @@ void main() { final GlobalKey key = GlobalKey(); await tester.pumpWidget( - TestFocus(key: key), + TestFocus(key: key, name: 'a'), ); final SemanticsNode semantics = tester.getSemantics(find.byKey(key)); @@ -1425,7 +1437,7 @@ void main() { testWidgets('Setting canRequestFocus on focus node causes update.', (WidgetTester tester) async { final GlobalKey key = GlobalKey(); - final TestFocus testFocus = TestFocus(key: key); + final TestFocus testFocus = TestFocus(key: key, name: 'a'); await tester.pumpWidget( testFocus, ); @@ -1820,6 +1832,7 @@ void main() { bool? gotFocus; await tester.pumpWidget( ExcludeFocus( + excluding: true, child: Focus( onFocusChange: (bool focused) => gotFocus = focused, child: Focus( @@ -1894,6 +1907,7 @@ void main() { // Now turn off the focus for the subtree. await tester.pumpWidget( ExcludeFocus( + excluding: true, child: Focus( focusNode: parentFocusNode, child: Column( diff --git a/packages/flutter/test/widgets/focus_traversal_test.dart b/packages/flutter/test/widgets/focus_traversal_test.dart index af77ebd029..8fc023d99d 100644 --- a/packages/flutter/test/widgets/focus_traversal_test.dart +++ b/packages/flutter/test/widgets/focus_traversal_test.dart @@ -1372,6 +1372,7 @@ void main() { child: FocusScope( debugLabel: 'Scope', child: Column( + crossAxisAlignment: CrossAxisAlignment.center, children: [ Row( mainAxisAlignment: MainAxisAlignment.center, @@ -1692,6 +1693,7 @@ void main() { Focus(focusNode: topNode, child: Container(height: 100)), Expanded( child: ListView( + scrollDirection: Axis.vertical, controller: controller, children: items.map((int item) { return Focus( diff --git a/packages/flutter/test/widgets/form_test.dart b/packages/flutter/test/widgets/form_test.dart index 8861d58777..eb47fa9d18 100644 --- a/packages/flutter/test/widgets/form_test.dart +++ b/packages/flutter/test/widgets/form_test.dart @@ -14,7 +14,7 @@ void main() { Widget builder() { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -53,7 +53,7 @@ void main() { Widget builder() { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -91,7 +91,7 @@ void main() { Widget builder(AutovalidateMode autovalidateMode) { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -147,7 +147,7 @@ void main() { Widget builder() { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -194,7 +194,7 @@ void main() { Widget builder() { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -241,7 +241,7 @@ void main() { Widget builder() { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -289,7 +289,7 @@ void main() { Widget builder() { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -334,7 +334,7 @@ void main() { Widget builder() { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -381,7 +381,7 @@ void main() { Widget builder() { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -433,7 +433,7 @@ void main() { setState = setter; return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -533,7 +533,7 @@ void main() { Widget builder(bool remove) { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -588,7 +588,7 @@ void main() { Widget builder() { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -624,7 +624,7 @@ void main() { Widget builder() { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -740,7 +740,7 @@ void main() { Widget builder() { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -773,7 +773,7 @@ void main() { return MaterialApp( theme: ThemeData(), home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -813,7 +813,7 @@ void main() { Widget builder() { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Form( @@ -832,7 +832,7 @@ void main() { Widget builder() { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: FormField( @@ -856,7 +856,7 @@ void main() { final Widget widget = MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -894,7 +894,7 @@ void main() { Widget builder({required bool autovalidate}) { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( @@ -937,7 +937,7 @@ void main() { Widget builder({required bool autovalidate}) { return MaterialApp( home: MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Center( diff --git a/packages/flutter/test/widgets/gesture_detector_semantics_test.dart b/packages/flutter/test/widgets/gesture_detector_semantics_test.dart index 389e2a9b93..c71254ae65 100644 --- a/packages/flutter/test/widgets/gesture_detector_semantics_test.dart +++ b/packages/flutter/test/widgets/gesture_detector_semantics_test.dart @@ -287,6 +287,7 @@ void main() { Center( child: RawGestureDetector( key: detectorKey, + gestures: const {}, semantics: _TestSemanticsGestureDelegate( onTap: () { logs.add('tap'); }, onLongPress: () { logs.add('longPress'); }, diff --git a/packages/flutter/test/widgets/gesture_detector_test.dart b/packages/flutter/test/widgets/gesture_detector_test.dart index 6ba520e86a..e8acdb3647 100644 --- a/packages/flutter/test/widgets/gesture_detector_test.dart +++ b/packages/flutter/test/widgets/gesture_detector_test.dart @@ -515,8 +515,10 @@ void main() { await gesture.updateWithCustomEvent(PointerMoveEvent( pointer: pointerValue, + position: Offset.zero, pressure: 0.3, pressureMin: 0, + pressureMax: 1, )); expect(forcePressStart, 0); @@ -526,8 +528,10 @@ void main() { await gesture.updateWithCustomEvent(PointerMoveEvent( pointer: pointerValue, + position: Offset.zero, pressure: 0.5, pressureMin: 0, + pressureMax: 1, )); expect(forcePressStart, 1); @@ -537,23 +541,31 @@ void main() { await gesture.updateWithCustomEvent(PointerMoveEvent( pointer: pointerValue, + position: Offset.zero, pressure: 0.6, pressureMin: 0, + pressureMax: 1, )); await gesture.updateWithCustomEvent(PointerMoveEvent( pointer: pointerValue, + position: Offset.zero, pressure: 0.7, pressureMin: 0, + pressureMax: 1, )); await gesture.updateWithCustomEvent(PointerMoveEvent( pointer: pointerValue, + position: Offset.zero, pressure: 0.2, pressureMin: 0, + pressureMax: 1, )); await gesture.updateWithCustomEvent(PointerMoveEvent( pointer: pointerValue, + position: Offset.zero, pressure: 0.3, pressureMin: 0, + pressureMax: 1, )); expect(forcePressStart, 1); @@ -563,8 +575,10 @@ void main() { await gesture.updateWithCustomEvent(PointerMoveEvent( pointer: pointerValue, + position: Offset.zero, pressure: 0.9, pressureMin: 0, + pressureMax: 1, )); expect(forcePressStart, 1); @@ -681,8 +695,10 @@ void main() { await gesture.updateWithCustomEvent(PointerMoveEvent( pointer: pointerValue, + position: Offset.zero, pressure: 0.3, pressureMin: 0, + pressureMax: 1, )); expect(forcePressStart, 0); @@ -697,8 +713,10 @@ void main() { // Failed attempt to trigger the force press. await gesture.updateWithCustomEvent(PointerMoveEvent( pointer: pointerValue, + position: Offset.zero, pressure: 0.5, pressureMin: 0, + pressureMax: 1, )); expect(horizontalDragStart, 1); @@ -766,6 +784,7 @@ void main() { final GlobalKey key = GlobalKey(); await tester.pumpWidget(RawGestureDetector( key: key, + gestures: const {}, semantics: _EmptySemanticsGestureDelegate(), excludeFromSemantics: true, child: Container(), diff --git a/packages/flutter/test/widgets/gesture_disambiguation_test.dart b/packages/flutter/test/widgets/gesture_disambiguation_test.dart index 0788d5a5c1..e3d9a36e20 100644 --- a/packages/flutter/test/widgets/gesture_disambiguation_test.dart +++ b/packages/flutter/test/widgets/gesture_disambiguation_test.dart @@ -12,6 +12,7 @@ void main() { final Widget widget = GestureDetector( child: Column( + mainAxisAlignment: MainAxisAlignment.start, children: [ GestureDetector( onTap: () { detector1TapCount += 1; }, diff --git a/packages/flutter/test/widgets/grid_view_test.dart b/packages/flutter/test/widgets/grid_view_test.dart index 77a206a695..c70f4fd586 100644 --- a/packages/flutter/test/widgets/grid_view_test.dart +++ b/packages/flutter/test/widgets/grid_view_test.dart @@ -19,6 +19,7 @@ void main() { child: GridView.count( dragStartBehavior: DragStartBehavior.down, crossAxisCount: 4, + children: const [], ), ), ); diff --git a/packages/flutter/test/widgets/heroes_test.dart b/packages/flutter/test/widgets/heroes_test.dart index d60ad87827..99df4acf85 100644 --- a/packages/flutter/test/widgets/heroes_test.dart +++ b/packages/flutter/test/widgets/heroes_test.dart @@ -1308,6 +1308,7 @@ Future main() async { ), '/two': (BuildContext context) => Material( child: Column( + crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox( height: 200.0, @@ -1422,6 +1423,7 @@ Future main() async { ), '/two': (BuildContext context) => Material( child: Column( + crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox( height: 200.0, @@ -2717,6 +2719,7 @@ Future main() async { child: Column( children: [ HeroMode( + enabled: true, child: Card( child: Hero( tag: 'a', diff --git a/packages/flutter/test/widgets/hit_testing_test.dart b/packages/flutter/test/widgets/hit_testing_test.dart index 5ddf736a40..a73a465ad7 100644 --- a/packages/flutter/test/widgets/hit_testing_test.dart +++ b/packages/flutter/test/widgets/hit_testing_test.dart @@ -42,7 +42,7 @@ void main() { ); final TestGesture gesture = - await tester.startGesture(tester.getCenter(find.byType(_HitTestCounter))); + await tester.startGesture(tester.getCenter(find.byType(_HitTestCounter)), kind: PointerDeviceKind.touch); await gesture.moveBy(const Offset(1, 1)); await gesture.up(); diff --git a/packages/flutter/test/widgets/image_resolution_test.dart b/packages/flutter/test/widgets/image_resolution_test.dart index 8a286af0f0..b5c067d4d7 100644 --- a/packages/flutter/test/widgets/image_resolution_test.dart +++ b/packages/flutter/test/widgets/image_resolution_test.dart @@ -108,6 +108,7 @@ Widget buildImageAtRatio(String imageName, Key key, double ratio, bool inferSize data: MediaQueryData( size: const Size(windowSize, windowSize), devicePixelRatio: ratio, + padding: EdgeInsets.zero, ), child: DefaultAssetBundle( bundle: bundle ?? TestAssetBundle(), diff --git a/packages/flutter/test/widgets/image_rtl_test.dart b/packages/flutter/test/widgets/image_rtl_test.dart index 6d574d524e..2666bd3e5e 100644 --- a/packages/flutter/test/widgets/image_rtl_test.dart +++ b/packages/flutter/test/widgets/image_rtl_test.dart @@ -542,6 +542,7 @@ void main() { child: Image( image: TestImageProvider(testImage), alignment: Alignment.centerRight, + matchTextDirection: false, ), ), Duration.zero, @@ -565,6 +566,7 @@ void main() { child: Image( image: TestImageProvider(testImage), alignment: Alignment.centerRight, + matchTextDirection: false, ), ), Duration.zero, diff --git a/packages/flutter/test/widgets/image_test.dart b/packages/flutter/test/widgets/image_test.dart index 04c7cafae2..458b9cc095 100644 --- a/packages/flutter/test/widgets/image_test.dart +++ b/packages/flutter/test/widgets/image_test.dart @@ -210,11 +210,13 @@ void main() { key: mediaQueryKey1, data: const MediaQueryData( devicePixelRatio: 10.0, + padding: EdgeInsets.zero, ), child: MediaQuery( key: mediaQueryKey2, data: const MediaQueryData( devicePixelRatio: 5.0, + padding: EdgeInsets.zero, ), child: Image( excludeFromSemantics: true, @@ -235,11 +237,13 @@ void main() { key: mediaQueryKey2, data: const MediaQueryData( devicePixelRatio: 5.0, + padding: EdgeInsets.zero, ), child: MediaQuery( key: mediaQueryKey1, data: const MediaQueryData( devicePixelRatio: 10.0, + padding: EdgeInsets.zero, ), child: Image( excludeFromSemantics: true, @@ -271,6 +275,7 @@ void main() { key: mediaQueryKey2, data: const MediaQueryData( devicePixelRatio: 5.0, + padding: EdgeInsets.zero, ), child: Image( excludeFromSemantics: true, @@ -282,6 +287,7 @@ void main() { key: mediaQueryKey1, data: const MediaQueryData( devicePixelRatio: 10.0, + padding: EdgeInsets.zero, ), child: Container(width: 100.0), ), @@ -299,6 +305,7 @@ void main() { key: mediaQueryKey2, data: const MediaQueryData( devicePixelRatio: 5.0, + padding: EdgeInsets.zero, ), child: Container(width: 100.0), ), @@ -306,6 +313,7 @@ void main() { key: mediaQueryKey1, data: const MediaQueryData( devicePixelRatio: 10.0, + padding: EdgeInsets.zero, ), child: Image( excludeFromSemantics: true, @@ -335,11 +343,13 @@ void main() { key: mediaQueryKey1, data: const MediaQueryData( devicePixelRatio: 10.0, + padding: EdgeInsets.zero, ), child: MediaQuery( key: mediaQueryKey2, data: const MediaQueryData( devicePixelRatio: 5.0, + padding: EdgeInsets.zero, ), child: Image( excludeFromSemantics: true, @@ -360,11 +370,13 @@ void main() { key: mediaQueryKey2, data: const MediaQueryData( devicePixelRatio: 5.0, + padding: EdgeInsets.zero, ), child: MediaQuery( key: mediaQueryKey1, data: const MediaQueryData( devicePixelRatio: 10.0, + padding: EdgeInsets.zero, ), child: Image( excludeFromSemantics: true, @@ -396,6 +408,7 @@ void main() { key: mediaQueryKey2, data: const MediaQueryData( devicePixelRatio: 5.0, + padding: EdgeInsets.zero, ), child: Image( excludeFromSemantics: true, @@ -407,6 +420,7 @@ void main() { key: mediaQueryKey1, data: const MediaQueryData( devicePixelRatio: 10.0, + padding: EdgeInsets.zero, ), child: Container(width: 100.0), ), @@ -424,6 +438,7 @@ void main() { key: mediaQueryKey2, data: const MediaQueryData( devicePixelRatio: 5.0, + padding: EdgeInsets.zero, ), child: Container(width: 100.0), ), @@ -431,6 +446,7 @@ void main() { key: mediaQueryKey1, data: const MediaQueryData( devicePixelRatio: 10.0, + padding: EdgeInsets.zero, ), child: Image( excludeFromSemantics: true, @@ -1729,6 +1745,7 @@ void main() { await tester.pumpWidget(RepaintBoundary( key: key, child: Row( + crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceAround, textDirection: TextDirection.ltr, children: [ @@ -1784,6 +1801,7 @@ void main() { final _TestImageStreamCompleter streamCompleter = _TestImageStreamCompleter( ImageInfo( image: image, + scale: 1.0, debugLabel: 'test.png', ), ); @@ -1813,7 +1831,7 @@ void main() { }); testWidgets('Disposes image handle when disposed', (WidgetTester tester) async { - final ui.Image image = (await tester.runAsync(() => createTestImage(cache: false)))!; + final ui.Image image = (await tester.runAsync(() => createTestImage(width: 1, height: 1, cache: false)))!; expect(image.debugGetOpenHandleStackTraces()!.length, 1); @@ -1822,6 +1840,7 @@ void main() { Future.value( ImageInfo( image: image, + scale: 1.0, debugLabel: '_TestImage', ), ), @@ -1854,7 +1873,7 @@ void main() { testWidgets('Keeps stream alive when ticker mode is disabled', (WidgetTester tester) async { imageCache!.maximumSize = 0; - final ui.Image image = (await tester.runAsync(() => createTestImage(cache: false)))!; + final ui.Image image = (await tester.runAsync(() => createTestImage(width: 1, height: 1, cache: false)))!; final _TestImageProvider provider = _TestImageProvider(); provider.complete(image); diff --git a/packages/flutter/test/widgets/implicit_semantics_test.dart b/packages/flutter/test/widgets/implicit_semantics_test.dart index 18455bede7..6c7985f10b 100644 --- a/packages/flutter/test/widgets/implicit_semantics_test.dart +++ b/packages/flutter/test/widgets/implicit_semantics_test.dart @@ -17,6 +17,7 @@ void main() { textDirection: TextDirection.ltr, child: Semantics( container: true, + explicitChildNodes: false, child: Column( children: const [ Text('Michael Goderbauer'), @@ -138,6 +139,7 @@ void main() { textDirection: TextDirection.ltr, child: Semantics( container: true, + explicitChildNodes: false, child: Semantics( label: 'Signed in as', child: Column( @@ -180,6 +182,7 @@ void main() { textDirection: TextDirection.ltr, child: Semantics( container: true, + explicitChildNodes: false, child: Column( children: [ Semantics( diff --git a/packages/flutter/test/widgets/inherited_test.dart b/packages/flutter/test/widgets/inherited_test.dart index 362acd7786..c6b96506c2 100644 --- a/packages/flutter/test/widgets/inherited_test.dart +++ b/packages/flutter/test/widgets/inherited_test.dart @@ -78,7 +78,7 @@ void main() { expect(log, equals([first])); - final TestInherited third = TestInherited(child: builder); + final TestInherited third = TestInherited(shouldNotify: true, child: builder); await tester.pumpWidget(third); expect(log, equals([first, third])); @@ -471,6 +471,7 @@ void main() { expect(buildCount, equals(2)); await tester.pumpWidget(ChangeNotifierInherited( + notifier: null, child: builder, )); expect(buildCount, equals(3)); diff --git a/packages/flutter/test/widgets/interactive_viewer_test.dart b/packages/flutter/test/widgets/interactive_viewer_test.dart index a10aa9d3f5..871a2310f1 100644 --- a/packages/flutter/test/widgets/interactive_viewer_test.dart +++ b/packages/flutter/test/widgets/interactive_viewer_test.dart @@ -68,12 +68,14 @@ void main() { testWidgets('boundary slightly bigger than child', (WidgetTester tester) async { final TransformationController transformationController = TransformationController(); const double boundaryMargin = 10.0; + const double minScale = 0.8; await tester.pumpWidget( MaterialApp( home: Scaffold( body: Center( child: InteractiveViewer( boundaryMargin: const EdgeInsets.all(boundaryMargin), + minScale: minScale, transformationController: transformationController, child: const SizedBox(width: 200.0, height: 200.0), ), @@ -244,6 +246,7 @@ void main() { body: Center( child: InteractiveViewer( boundaryMargin: const EdgeInsets.all(double.infinity), + minScale: minScale, transformationController: transformationController, child: const SizedBox(width: 200.0, height: 200.0), ), @@ -375,12 +378,14 @@ void main() { testWidgets('inertia fling and boundary sliding', (WidgetTester tester) async { final TransformationController transformationController = TransformationController(); const double boundaryMargin = 50.0; + const double minScale = 0.8; await tester.pumpWidget( MaterialApp( home: Scaffold( body: Center( child: InteractiveViewer( boundaryMargin: const EdgeInsets.all(boundaryMargin), + minScale: minScale, transformationController: transformationController, child: const SizedBox(width: 200.0, height: 200.0), ), diff --git a/packages/flutter/test/widgets/keyboard_listener_test.dart b/packages/flutter/test/widgets/keyboard_listener_test.dart index 985e5dd3f9..128b7be3b4 100644 --- a/packages/flutter/test/widgets/keyboard_listener_test.dart +++ b/packages/flutter/test/widgets/keyboard_listener_test.dart @@ -9,8 +9,8 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Can dispose without keyboard', (WidgetTester tester) async { final FocusNode focusNode = FocusNode(); - await tester.pumpWidget(KeyboardListener(focusNode: focusNode, child: Container())); - await tester.pumpWidget(KeyboardListener(focusNode: focusNode, child: Container())); + await tester.pumpWidget(KeyboardListener(focusNode: focusNode, onKeyEvent: null, child: Container())); + await tester.pumpWidget(KeyboardListener(focusNode: focusNode, onKeyEvent: null, child: Container())); await tester.pumpWidget(Container()); }); @@ -58,7 +58,7 @@ void main() { focusNode.requestFocus(); await tester.idle(); - await tester.sendKeyEvent(LogicalKeyboardKey.metaLeft); + await tester.sendKeyEvent(LogicalKeyboardKey.metaLeft, platform: 'web'); await tester.idle(); expect(events.length, 2); diff --git a/packages/flutter/test/widgets/list_body_test.dart b/packages/flutter/test/widgets/list_body_test.dart index 1949518c01..0f6ba928b5 100644 --- a/packages/flutter/test/widgets/list_body_test.dart +++ b/packages/flutter/test/widgets/list_body_test.dart @@ -163,6 +163,7 @@ void main() { Directionality( textDirection: TextDirection.ltr, child: ListBody( + mainAxis: Axis.vertical, children: children, ), ), diff --git a/packages/flutter/test/widgets/list_view_misc_test.dart b/packages/flutter/test/widgets/list_view_misc_test.dart index d20a5c5296..0e9cc758b7 100644 --- a/packages/flutter/test/widgets/list_view_misc_test.dart +++ b/packages/flutter/test/widgets/list_view_misc_test.dart @@ -104,7 +104,7 @@ void main() { expect(first, equals(0)); expect(second, equals(1)); - await tester.pumpWidget(buildBlock()); + await tester.pumpWidget(buildBlock(reverse: false)); await tester.tapAt(target); expect(first, equals(1)); diff --git a/packages/flutter/test/widgets/list_view_relayout_test.dart b/packages/flutter/test/widgets/list_view_relayout_test.dart index 7d0ff9bb14..a2a759b393 100644 --- a/packages/flutter/test/widgets/list_view_relayout_test.dart +++ b/packages/flutter/test/widgets/list_view_relayout_test.dart @@ -96,7 +96,9 @@ void main() { await tester.pumpWidget( Directionality( textDirection: TextDirection.ltr, - child: ListView(), + child: ListView( + children: const [], + ), ), ); expect(list.geometry!.scrollExtent, equals(0.0)); @@ -135,7 +137,9 @@ void main() { await tester.pumpWidget( Directionality( textDirection: TextDirection.ltr, - child: ListView(), + child: ListView( + children: const [], + ), ), ); diff --git a/packages/flutter/test/widgets/list_view_test.dart b/packages/flutter/test/widgets/list_view_test.dart index 7d1a9922f9..a4b06431a3 100644 --- a/packages/flutter/test/widgets/list_view_test.dart +++ b/packages/flutter/test/widgets/list_view_test.dart @@ -327,7 +327,7 @@ void main() { ), ), ); - expect(tester.getSemantics(find.text('Text 5')), matchesSemantics()); + expect(tester.getSemantics(find.text('Text 5')), matchesSemantics(isHidden: false)); expect(tester.getSemantics(find.text('Text 6', skipOffstage: false)), matchesSemantics(isHidden: true)); expect(tester.getSemantics(find.text('Text 7', skipOffstage: false)), matchesSemantics(isHidden: true)); expect(tester.getSemantics(find.text('Text 8', skipOffstage: false)), matchesSemantics(isHidden: true)); @@ -353,7 +353,7 @@ void main() { ); // Scrollable maybe be marked dirty after layout. await tester.pumpAndSettle(); - expect(tester.getSemantics(find.text('Text 5')), matchesSemantics()); + expect(tester.getSemantics(find.text('Text 5')), matchesSemantics(isHidden: false)); expect(tester.getSemantics(find.text('Text 6', skipOffstage: false)), matchesSemantics(isHidden: true)); expect(tester.getSemantics(find.text('Text 7', skipOffstage: false)), matchesSemantics(isHidden: true)); expect(tester.getSemantics(find.text('Text 8', skipOffstage: false)), matchesSemantics(isHidden: true)); diff --git a/packages/flutter/test/widgets/list_view_vertical_test.dart b/packages/flutter/test/widgets/list_view_vertical_test.dart index 73b0910b0a..5642be78c3 100644 --- a/packages/flutter/test/widgets/list_view_vertical_test.dart +++ b/packages/flutter/test/widgets/list_view_vertical_test.dart @@ -12,6 +12,7 @@ Widget buildFrame() { textDirection: TextDirection.ltr, child: ListView( itemExtent: 290.0, + scrollDirection: Axis.vertical, children: items.map((int item) { return Text('$item'); }).toList(), @@ -70,6 +71,7 @@ void main() { child: ListView( itemExtent: 290.0, padding: const EdgeInsets.only(top: 250.0), + scrollDirection: Axis.vertical, children: items.map((int item) { return Text('$item'); }).toList(), diff --git a/packages/flutter/test/widgets/list_wheel_scroll_view_test.dart b/packages/flutter/test/widgets/list_wheel_scroll_view_test.dart index 395b56ada2..ce0f94770a 100644 --- a/packages/flutter/test/widgets/list_wheel_scroll_view_test.dart +++ b/packages/flutter/test/widgets/list_wheel_scroll_view_test.dart @@ -121,6 +121,7 @@ void main() { expect( () { ListWheelScrollView( + overAndUnderCenterOpacity: 1, itemExtent: 20.0, children: [Container()], ); diff --git a/packages/flutter/test/widgets/listener_test.dart b/packages/flutter/test/widgets/listener_test.dart index d1e33fbd10..8547d8996a 100644 --- a/packages/flutter/test/widgets/listener_test.dart +++ b/packages/flutter/test/widgets/listener_test.dart @@ -272,7 +272,7 @@ void main() { final Matrix4 expectedTransform = Matrix4.identity() ..scale(1 / scaleFactor, 1 / scaleFactor, 1.0) - ..translate(-topLeft.dx, -topLeft.dy); + ..translate(-topLeft.dx, -topLeft.dy, 0); expect(center, isNot(const Offset(50, 50))); @@ -350,7 +350,7 @@ void main() { const Offset offset = Offset((800 - 100) / 2, (600 - 100) / 2); final Matrix4 expectedTransform = Matrix4.identity() ..rotateZ(-math.pi / 2) - ..translate(-offset.dx, -offset.dy); + ..translate(-offset.dx, -offset.dy, 0.0); final Offset localDownPosition = const Offset(50, 50) + const Offset(5, -10); expect(down.localPosition, within(distance: 0.001, from: localDownPosition)); diff --git a/packages/flutter/test/widgets/modal_barrier_test.dart b/packages/flutter/test/widgets/modal_barrier_test.dart index 0470031997..050941dd4a 100644 --- a/packages/flutter/test/widgets/modal_barrier_test.dart +++ b/packages/flutter/test/widgets/modal_barrier_test.dart @@ -380,6 +380,7 @@ void main() { await tester.pumpWidget(const Directionality( textDirection: TextDirection.ltr, child: ModalBarrier( + dismissible: true, semanticsLabel: 'Dismiss', ), )); @@ -401,7 +402,7 @@ void main() { testWidgets('Dismissible ModalBarrier is hidden on Android (back button is used to dismiss)', (WidgetTester tester) async { final SemanticsTester semantics = SemanticsTester(tester); - await tester.pumpWidget(const ModalBarrier()); + await tester.pumpWidget(const ModalBarrier(dismissible: true)); final TestSemantics expectedSemantics = TestSemantics.root(); expect(semantics, hasSemantics(expectedSemantics)); @@ -447,6 +448,7 @@ class SecondWidget extends StatelessWidget { Widget build(BuildContext context) { return const ModalBarrier( key: ValueKey('barrier'), + dismissible: true, ); } } @@ -459,6 +461,7 @@ class SecondWidgetWithCompetence extends StatelessWidget { children: [ const ModalBarrier( key: ValueKey('barrier'), + dismissible: true, ), GestureDetector( onVerticalDragStart: (_) {}, diff --git a/packages/flutter/test/widgets/mouse_region_test.dart b/packages/flutter/test/widgets/mouse_region_test.dart index 8a09b8bec4..6ade4bbef3 100644 --- a/packages/flutter/test/widgets/mouse_region_test.dart +++ b/packages/flutter/test/widgets/mouse_region_test.dart @@ -91,7 +91,7 @@ void main() { ), )); - final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); + final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse, buttons: kPrimaryMouseButton); await gesture.addPointer(location: Offset.zero); await gesture.down(Offset.zero); // Press the mouse button. addTearDown(gesture.removePointer); @@ -415,7 +415,7 @@ void main() { onExit: (PointerExitEvent details) => exit = details, ), )); - final TestGesture gesture = await tester.createGesture(); + final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.touch); await gesture.addPointer(location: Offset.zero); addTearDown(gesture.removePointer); await tester.pump(); @@ -456,6 +456,7 @@ void main() { await tester.pumpWidget( Column( mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ MouseRegion( onEnter: (PointerEnterEvent details) => enter1.add(details), @@ -532,6 +533,7 @@ void main() { await tester.pumpWidget( Column( mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ MouseRegion( key: key1, @@ -1323,6 +1325,7 @@ void main() { testWidgets('opaque should default to true', (WidgetTester tester) async { final List logs = []; await tester.pumpWidget(tripleRegions( + opaqueC: null, addLog: (String log) => logs.add(log), )); @@ -1363,7 +1366,7 @@ void main() { ), ), ), - const MouseRegion(), + const MouseRegion(opaque: true), ], ), ), @@ -1452,16 +1455,19 @@ void main() { await gesture.addPointer(location: const Offset(5, 5)); addTearDown(gesture.removePointer); - void _handleHover(PointerHoverEvent _) {} - void _handlePaintChild() { logs.add('paint'); } + void onHover(PointerHoverEvent _) {} + void onPaintChild() { logs.add('paint'); } await tester.pumpWidget(_Scaffold( topLeft: SizedBox( height: 10, width: 10, child: MouseRegion( - onHover: _handleHover, - child: CustomPaint(painter: _DelegatedPainter(onPaint: _handlePaintChild)), + opaque: true, + // Dummy callback so that MouseRegion stays affective after opaque + // turns false. + onHover: onHover, + child: CustomPaint(painter: _DelegatedPainter(onPaint: onPaintChild)), ), ), background: MouseRegion(onEnter: (_) { logs.add('hover-enter'); }), @@ -1478,10 +1484,8 @@ void main() { width: 10, child: MouseRegion( opaque: false, - // Dummy callback so that MouseRegion stays affective after opaque - // turns false. - onHover: _handleHover, - child: CustomPaint(painter: _DelegatedPainter(onPaint: _handlePaintChild)), + onHover: onHover, + child: CustomPaint(painter: _DelegatedPainter(onPaint: onPaintChild)), ), ), background: MouseRegion(onEnter: (_) { logs.add('hover-enter'); }), @@ -1507,6 +1511,7 @@ void main() { child: MouseRegion( cursor: SystemMouseCursors.forbidden, onEnter: (_) { logEnters.add('enter'); }, + opaque: true, child: CustomPaint(painter: _DelegatedPainter(onPaint: onPaintChild)), ), ), @@ -1526,6 +1531,7 @@ void main() { child: MouseRegion( cursor: SystemMouseCursors.text, onEnter: (_) { logEnters.add('enter'); }, + opaque: true, child: CustomPaint(painter: _DelegatedPainter(onPaint: onPaintChild)), ), ), @@ -1577,6 +1583,7 @@ void main() { child: MouseRegion( cursor: SystemMouseCursors.forbidden, child: MouseRegion( + cursor: MouseCursor.defer, onEnter: (_) { logEnters.add('enter'); }, child: CustomPaint(painter: _DelegatedPainter(onPaint: onPaintChild)), ), @@ -1598,6 +1605,7 @@ void main() { cursor: SystemMouseCursors.forbidden, child: MouseRegion( cursor: SystemMouseCursors.text, + opaque: true, child: CustomPaint(painter: _DelegatedPainter(onPaint: onPaintChild)), ), ), @@ -1866,6 +1874,7 @@ class _ColumnContainer extends StatelessWidget { return Directionality( textDirection: TextDirection.ltr, child: Column( + mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: children, ), diff --git a/packages/flutter/test/widgets/navigator_restoration_test.dart b/packages/flutter/test/widgets/navigator_restoration_test.dart index 5462834359..f1794de036 100644 --- a/packages/flutter/test/widgets/navigator_restoration_test.dart +++ b/packages/flutter/test/widgets/navigator_restoration_test.dart @@ -812,7 +812,9 @@ void main() { // Move navigator into restoration scope. await tester.pumpWidget(const RootRestorationScope( restorationId: 'root', - child: TestWidget(), + child: TestWidget( + restorationId: 'app', + ), )); expect(findRoute('Foo'), findsOneWidget); diff --git a/packages/flutter/test/widgets/navigator_test.dart b/packages/flutter/test/widgets/navigator_test.dart index 0c84e28773..780d00c4ed 100644 --- a/packages/flutter/test/widgets/navigator_test.dart +++ b/packages/flutter/test/widgets/navigator_test.dart @@ -2990,11 +2990,13 @@ void main() { navigator.currentState!.push( MaterialPageRoute( builder: (BuildContext context) => const Text('second-pageless1'), + settings: null, ), ); navigator.currentState!.push( MaterialPageRoute( builder: (BuildContext context) => const Text('second-pageless2'), + settings: null, ), ); await tester.pumpAndSettle(); @@ -3024,6 +3026,7 @@ void main() { navigator.currentState!.push( MaterialPageRoute( builder: (BuildContext context) => const Text('third-pageless1'), + settings: null, ), ); await tester.pumpAndSettle(); @@ -3120,6 +3123,7 @@ void main() { navigator.currentState!.push( MaterialPageRoute( builder: (BuildContext context) => const Text('initial-pageless1'), + settings: null, ), ).then((_) => initialPageless1Completed = true); await tester.pumpAndSettle(); @@ -3137,6 +3141,7 @@ void main() { navigator.currentState!.push( MaterialPageRoute( builder: (BuildContext context) => const Text('second-pageless1'), + settings: null, ), ).then((_) => secondPageless1Completed = true); await tester.pumpAndSettle(); @@ -3144,6 +3149,7 @@ void main() { navigator.currentState!.push( MaterialPageRoute( builder: (BuildContext context) => const Text('second-pageless2'), + settings: null, ), ).then((_) => secondPageless2Completed = true); await tester.pumpAndSettle(); @@ -3162,6 +3168,7 @@ void main() { navigator.currentState!.push( MaterialPageRoute( builder: (BuildContext context) => const Text('third-pageless1'), + settings: null, ), ).then((_) => thirdPageless1Completed = true); await tester.pumpAndSettle(); @@ -3232,6 +3239,7 @@ void main() { navigator.currentState!.push( MaterialPageRoute( builder: (BuildContext context) => const Text('initial-pageless1'), + settings: null, ), ).then((_) => initialPageless1Completed = true); await tester.pumpAndSettle(); @@ -3253,6 +3261,7 @@ void main() { navigator.currentState!.push( MaterialPageRoute( builder: (BuildContext context) => const Text('second-pageless1'), + settings: null, ), ).then((_) => secondPageless1Completed = true); await tester.pumpAndSettle(); @@ -3260,6 +3269,7 @@ void main() { navigator.currentState!.push( MaterialPageRoute( builder: (BuildContext context) => const Text('second-pageless2'), + settings: null, ), ).then((_) => secondPageless2Completed = true); await tester.pumpAndSettle(); @@ -3282,6 +3292,7 @@ void main() { navigator.currentState!.push( MaterialPageRoute( builder: (BuildContext context) => const Text('third-pageless1'), + settings: null, ), ).then((_) => thirdPageless1Completed = true); await tester.pumpAndSettle(); diff --git a/packages/flutter/test/widgets/opacity_test.dart b/packages/flutter/test/widgets/opacity_test.dart index 60a00bce8b..23af74d472 100644 --- a/packages/flutter/test/widgets/opacity_test.dart +++ b/packages/flutter/test/widgets/opacity_test.dart @@ -76,6 +76,7 @@ void main() { await tester.pumpWidget( const Opacity( opacity: 0.0, + alwaysIncludeSemantics: false, child: Text('a', textDirection: TextDirection.rtl), ), ); @@ -109,6 +110,7 @@ void main() { await tester.pumpWidget( const Opacity( opacity: 0.1, + alwaysIncludeSemantics: false, child: Text('a', textDirection: TextDirection.rtl), ), ); diff --git a/packages/flutter/test/widgets/overflow_bar_test.dart b/packages/flutter/test/widgets/overflow_bar_test.dart index 229f1b1126..31ffbae12a 100644 --- a/packages/flutter/test/widgets/overflow_bar_test.dart +++ b/packages/flutter/test/widgets/overflow_bar_test.dart @@ -162,7 +162,7 @@ void main() { expect(tester.getRect(find.byKey(child3Key)), const Rect.fromLTRB(100.0 - 32, 112, 100, 144)); // Children are right aligned - await tester.pumpWidget(buildFrame(textDirection: TextDirection.rtl)); + await tester.pumpWidget(buildFrame(overflowAlignment: OverflowBarAlignment.start, textDirection: TextDirection.rtl)); expect(tester.getRect(find.byKey(child1Key)), const Rect.fromLTRB(100.0 - 48, 0, 100, 48)); expect(tester.getRect(find.byKey(child2Key)), const Rect.fromLTRB(100.0 - 64, 48, 100, 112)); expect(tester.getRect(find.byKey(child3Key)), const Rect.fromLTRB(100.0 - 32, 112, 100, 144)); diff --git a/packages/flutter/test/widgets/page_route_builder_test.dart b/packages/flutter/test/widgets/page_route_builder_test.dart index f550073a91..b24f918da1 100644 --- a/packages/flutter/test/widgets/page_route_builder_test.dart +++ b/packages/flutter/test/widgets/page_route_builder_test.dart @@ -34,6 +34,7 @@ class HomePage extends StatefulWidget { class _HomePageState extends State { void _presentModalPage() { Navigator.of(context).push(PageRouteBuilder( + transitionDuration: const Duration(milliseconds: 300), barrierColor: Colors.black54, opaque: false, pageBuilder: (BuildContext context, _, __) { diff --git a/packages/flutter/test/widgets/page_view_test.dart b/packages/flutter/test/widgets/page_view_test.dart index 7ac4b1f1f2..de7ab628c5 100644 --- a/packages/flutter/test/widgets/page_view_test.dart +++ b/packages/flutter/test/widgets/page_view_test.dart @@ -11,6 +11,8 @@ import '../rendering/rendering_tester.dart'; import 'semantics_tester.dart'; import 'states.dart'; +const Duration _frameDuration = Duration(milliseconds: 100); + void main() { testWidgets('PageView resize from zero-size viewport should not lose state', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/88956 @@ -139,13 +141,13 @@ void main() { expect(find.text('Alaska'), findsOneWidget); expect(find.text('Arizona'), findsNothing); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(_frameDuration); expect(find.text('Alabama'), findsOneWidget); expect(find.text('Alaska'), findsNothing); await tester.drag(find.byType(PageView), const Offset(-401.0, 0.0)); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(_frameDuration); expect(find.text('Alabama'), findsNothing); expect(find.text('Alaska'), findsOneWidget); @@ -156,14 +158,14 @@ void main() { log.clear(); await tester.fling(find.byType(PageView), const Offset(-200.0, 0.0), 1000.0); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(_frameDuration); expect(find.text('Alabama'), findsNothing); expect(find.text('Alaska'), findsNothing); expect(find.text('Arizona'), findsOneWidget); await tester.fling(find.byType(PageView), const Offset(200.0, 0.0), 1000.0); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(_frameDuration); expect(find.text('Alabama'), findsNothing); expect(find.text('Alaska'), findsOneWidget); @@ -223,7 +225,7 @@ void main() { expect(find.text('California'), findsOneWidget); controller.nextPage(duration: const Duration(milliseconds: 150), curve: Curves.ease); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(const Duration(milliseconds: 100)); expect(find.text('Colorado'), findsOneWidget); @@ -244,7 +246,7 @@ void main() { expect(find.text('Colorado'), findsOneWidget); controller.previousPage(duration: const Duration(milliseconds: 150), curve: Curves.ease); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(const Duration(milliseconds: 100)); expect(find.text('California'), findsOneWidget); }); @@ -266,7 +268,7 @@ void main() { expect(find.text('Alabama'), findsOneWidget); await tester.drag(find.byType(PageView), const Offset(-1250.0, 0.0)); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(const Duration(milliseconds: 100)); expect(find.text('Arizona'), findsOneWidget); @@ -730,7 +732,7 @@ void main() { 'All visible pages are able to receive touch events', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/23873. - final PageController controller = PageController(viewportFraction: 1/4); + final PageController controller = PageController(viewportFraction: 1/4, initialPage: 0); late int tappedIndex; Widget build() { @@ -1081,7 +1083,9 @@ void main() { // PageView() defaults to true. await tester.pumpWidget(Directionality( textDirection: TextDirection.ltr, - child: PageView(), + child: PageView( + children: const [], + ), )); expect(tester.widget(viewportFinder()).padEnds, true); @@ -1091,6 +1095,7 @@ void main() { textDirection: TextDirection.ltr, child: PageView( padEnds: false, + children: const [], ), )); diff --git a/packages/flutter/test/widgets/pageable_list_test.dart b/packages/flutter/test/widgets/pageable_list_test.dart index 3cab09a14c..555e15fbc7 100644 --- a/packages/flutter/test/widgets/pageable_list_test.dart +++ b/packages/flutter/test/widgets/pageable_list_test.dart @@ -25,6 +25,7 @@ Widget buildFrame({ required TextDirection textDirection, }) { final PageView child = PageView( + scrollDirection: Axis.horizontal, reverse: reverse, onPageChanged: (int page) { currentPage = page; }, children: pages.map(buildPage).toList(), diff --git a/packages/flutter/test/widgets/physical_model_test.dart b/packages/flutter/test/widgets/physical_model_test.dart index ccd8698b1c..06357f0dde 100644 --- a/packages/flutter/test/widgets/physical_model_test.dart +++ b/packages/flutter/test/widgets/physical_model_test.dart @@ -48,6 +48,7 @@ void main() { await tester.pumpWidget( MaterialApp( home: PhysicalModel( + shape: BoxShape.rectangle, color: Colors.grey, shadowColor: Colors.red, elevation: 1.0, @@ -72,7 +73,7 @@ void main() { await tester.pumpWidget( MediaQuery( key: key, - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: Padding( diff --git a/packages/flutter/test/widgets/platform_view_test.dart b/packages/flutter/test/widgets/platform_view_test.dart index 9f691a081d..b2c9890638 100644 --- a/packages/flutter/test/widgets/platform_view_test.dart +++ b/packages/flutter/test/widgets/platform_view_test.dart @@ -421,6 +421,7 @@ void main() { height: 100.0, child: AndroidView( viewType: 'webview', + hitTestBehavior: PlatformViewHitTestBehavior.opaque, layoutDirection: TextDirection.ltr, ), ), @@ -1572,6 +1573,7 @@ void main() { height: 100.0, child: UiKitView( viewType: 'webview', + hitTestBehavior: PlatformViewHitTestBehavior.opaque, layoutDirection: TextDirection.ltr, ), ), diff --git a/packages/flutter/test/widgets/raw_keyboard_listener_test.dart b/packages/flutter/test/widgets/raw_keyboard_listener_test.dart index 3bbfcbc35f..906fcba5d0 100644 --- a/packages/flutter/test/widgets/raw_keyboard_listener_test.dart +++ b/packages/flutter/test/widgets/raw_keyboard_listener_test.dart @@ -9,8 +9,8 @@ import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Can dispose without keyboard', (WidgetTester tester) async { final FocusNode focusNode = FocusNode(); - await tester.pumpWidget(RawKeyboardListener(focusNode: focusNode, child: Container())); - await tester.pumpWidget(RawKeyboardListener(focusNode: focusNode, child: Container())); + await tester.pumpWidget(RawKeyboardListener(focusNode: focusNode, onKey: null, child: Container())); + await tester.pumpWidget(RawKeyboardListener(focusNode: focusNode, onKey: null, child: Container())); await tester.pumpWidget(Container()); }); @@ -62,7 +62,7 @@ void main() { focusNode.requestFocus(); await tester.idle(); - await tester.sendKeyEvent(LogicalKeyboardKey.metaLeft, platform: 'web'); // ignore: avoid_redundant_argument_values + await tester.sendKeyEvent(LogicalKeyboardKey.metaLeft, platform: 'web'); await tester.idle(); expect(events.length, 2); diff --git a/packages/flutter/test/widgets/restoration_mixin_test.dart b/packages/flutter/test/widgets/restoration_mixin_test.dart index 237b1bbdae..0cc419e03a 100644 --- a/packages/flutter/test/widgets/restoration_mixin_test.dart +++ b/packages/flutter/test/widgets/restoration_mixin_test.dart @@ -170,7 +170,9 @@ void main() { await tester.pumpWidget( UnmanagedRestorationScope( bucket: root, - child: const _TestRestorableWidget(), + child: const _TestRestorableWidget( + restorationId: null, + ), ), ); final _TestRestorableWidgetState state = tester.state(find.byType(_TestRestorableWidget)); @@ -211,7 +213,9 @@ void main() { await tester.pumpWidget( UnmanagedRestorationScope( bucket: root, - child: const _TestRestorableWidget(), + child: const _TestRestorableWidget( + restorationId: null, + ), ), ); manager.doSerialization(); diff --git a/packages/flutter/test/widgets/restoration_scope_test.dart b/packages/flutter/test/widgets/restoration_scope_test.dart index e9550ef9bc..989f4b0aee 100644 --- a/packages/flutter/test/widgets/restoration_scope_test.dart +++ b/packages/flutter/test/widgets/restoration_scope_test.dart @@ -42,6 +42,7 @@ void main() { testWidgets('null bucket disables restoration', (WidgetTester tester) async { await tester.pumpWidget( const UnmanagedRestorationScope( + bucket: null, child: BucketSpy(), ), ); diff --git a/packages/flutter/test/widgets/rich_text_test.dart b/packages/flutter/test/widgets/rich_text_test.dart index 5cae15358c..8ea17fd612 100644 --- a/packages/flutter/test/widgets/rich_text_test.dart +++ b/packages/flutter/test/widgets/rich_text_test.dart @@ -26,15 +26,23 @@ void main() { children: [ matchesSemantics( label: 'root', + hasTapAction: false, + hasLongPressAction: false, ), matchesSemantics( label: 'one', + hasTapAction: false, + hasLongPressAction: false, ), matchesSemantics( label: 'two', + hasTapAction: false, + hasLongPressAction: false, ), matchesSemantics( label: 'three', + hasTapAction: false, + hasLongPressAction: false, ), ], )); diff --git a/packages/flutter/test/widgets/safe_area_test.dart b/packages/flutter/test/widgets/safe_area_test.dart index 2b3494648b..6456b33269 100644 --- a/packages/flutter/test/widgets/safe_area_test.dart +++ b/packages/flutter/test/widgets/safe_area_test.dart @@ -76,6 +76,7 @@ void main() { data: MediaQueryData(padding: EdgeInsets.only( left: 100.0, top: 30.0, + right: 0.0, bottom: 40.0, )), child: child, @@ -87,6 +88,7 @@ void main() { testWidgets('SafeArea - properties', (WidgetTester tester) async { final SafeArea child = SafeArea( + left: true, right: false, bottom: false, child: Container(), @@ -195,6 +197,7 @@ void main() { textDirection: TextDirection.ltr, child: Viewport( offset: ViewportOffset.fixed(0.0), + axisDirection: AxisDirection.down, slivers: [ const SliverToBoxAdapter(child: SizedBox(width: 800.0, height: 100.0, child: Text('before'))), sliver, @@ -297,6 +300,7 @@ void main() { const EdgeInsets.only( left: 100.0, top: 30.0, + right: 0.0, bottom: 40.0, ), sliver, @@ -312,6 +316,7 @@ void main() { testWidgets('SliverSafeArea - properties', (WidgetTester tester) async { const SliverSafeArea child = SliverSafeArea( + left: true, right: false, bottom: false, sliver: SliverToBoxAdapter(child: SizedBox(width: 800.0, height: 100.0, child: Text('padded'))), diff --git a/packages/flutter/test/widgets/scroll_activity_test.dart b/packages/flutter/test/widgets/scroll_activity_test.dart index 088eb591d8..c229f4df11 100644 --- a/packages/flutter/test/widgets/scroll_activity_test.dart +++ b/packages/flutter/test/widgets/scroll_activity_test.dart @@ -197,7 +197,7 @@ class _Carousel62209State extends State { void initState() { super.initState(); _pages = widget.pages.toList(); - _pageController = PageController(keepPage: false); + _pageController = PageController(initialPage: 0, keepPage: false); } @override diff --git a/packages/flutter/test/widgets/scroll_controller_test.dart b/packages/flutter/test/widgets/scroll_controller_test.dart index be7935251c..101be9a0ec 100644 --- a/packages/flutter/test/widgets/scroll_controller_test.dart +++ b/packages/flutter/test/widgets/scroll_controller_test.dart @@ -44,7 +44,7 @@ void main() { expect(realOffset(), equals(controller.offset)); controller.animateTo(326.0, duration: const Duration(milliseconds: 300), curve: Curves.ease); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(const Duration(milliseconds: 100)); expect(controller.offset, equals(326.0)); expect(realOffset(), equals(controller.offset)); diff --git a/packages/flutter/test/widgets/scroll_position_test.dart b/packages/flutter/test/widgets/scroll_position_test.dart index a2c1b3b26b..e5d8e349d6 100644 --- a/packages/flutter/test/widgets/scroll_position_test.dart +++ b/packages/flutter/test/widgets/scroll_position_test.dart @@ -168,6 +168,7 @@ void main() { await tester.pumpWidget( MaterialApp( home: ListView( + scrollDirection: Axis.vertical, controller: controller, children: items.map((int item) { return Focus( diff --git a/packages/flutter/test/widgets/scroll_view_test.dart b/packages/flutter/test/widgets/scroll_view_test.dart index 2a6f900d45..f9ac95bc1f 100644 --- a/packages/flutter/test/widgets/scroll_view_test.dart +++ b/packages/flutter/test/widgets/scroll_view_test.dart @@ -415,6 +415,7 @@ void main() { await tester.pumpWidget(textFieldBoilerplate( child: ListView( padding: EdgeInsets.zero, + keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.manual, children: focusNodes.map((FocusNode focusNode) { return Container( height: 50, @@ -447,6 +448,7 @@ void main() { await tester.pumpWidget(textFieldBoilerplate( child: ListView.builder( padding: EdgeInsets.zero, + keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.manual, itemCount: focusNodes.length, itemBuilder: (BuildContext context,int index) { return Container( @@ -480,6 +482,7 @@ void main() { await tester.pumpWidget(textFieldBoilerplate( child: ListView.custom( padding: EdgeInsets.zero, + keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.manual, childrenDelegate: SliverChildBuilderDelegate( (BuildContext context,int index) { return Container( @@ -515,6 +518,7 @@ void main() { await tester.pumpWidget(textFieldBoilerplate( child: ListView.separated( padding: EdgeInsets.zero, + keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.manual, itemCount: focusNodes.length, separatorBuilder: (BuildContext context, int index) => const Divider(), itemBuilder: (BuildContext context,int index) { @@ -550,6 +554,7 @@ void main() { child: GridView( padding: EdgeInsets.zero, gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount:2), + keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.manual, children: focusNodes.map((FocusNode focusNode) { return Container( height: 50, @@ -583,6 +588,7 @@ void main() { child: GridView.builder( padding: EdgeInsets.zero, gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount:2), + keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.manual, itemCount: focusNodes.length, itemBuilder: (BuildContext context, int index) { return Container( @@ -617,6 +623,7 @@ void main() { child: GridView.count( padding: EdgeInsets.zero, crossAxisCount: 2, + keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.manual, children: focusNodes.map((FocusNode focusNode) { return Container( height: 50, @@ -650,6 +657,7 @@ void main() { child: GridView.extent( padding: EdgeInsets.zero, maxCrossAxisExtent: 300, + keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.manual, children: focusNodes.map((FocusNode focusNode) { return Container( height: 50, @@ -683,6 +691,7 @@ void main() { child: GridView.custom( padding: EdgeInsets.zero, gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount:2), + keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.manual, childrenDelegate: SliverChildBuilderDelegate( (BuildContext context,int index) { return Container( @@ -736,7 +745,7 @@ void main() { await tester.pump(const Duration(milliseconds: 10)); await tester.pump(const Duration(milliseconds: 10)); await tester.pump(const Duration(milliseconds: 10)); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(const Duration(milliseconds: 100)); final Viewport viewport = tester.widget(find.byType(Viewport)); expect(viewport.offset.pixels, equals(2400.0)); @@ -888,17 +897,18 @@ void main() { }); testWidgets('Vertical CustomScrollViews are primary by default', (WidgetTester tester) async { - const CustomScrollView view = CustomScrollView(); + const CustomScrollView view = CustomScrollView(scrollDirection: Axis.vertical); expect(view.primary, isTrue); }); testWidgets('Vertical ListViews are primary by default', (WidgetTester tester) async { - final ListView view = ListView(); + final ListView view = ListView(scrollDirection: Axis.vertical); expect(view.primary, isTrue); }); testWidgets('Vertical GridViews are primary by default', (WidgetTester tester) async { final GridView view = GridView.count( + scrollDirection: Axis.vertical, crossAxisCount: 1, ); expect(view.primary, isTrue); @@ -925,6 +935,7 @@ void main() { testWidgets('CustomScrollViews with controllers are non-primary by default', (WidgetTester tester) async { final CustomScrollView view = CustomScrollView( controller: ScrollController(), + scrollDirection: Axis.vertical, ); expect(view.primary, isFalse); }); @@ -932,6 +943,7 @@ void main() { testWidgets('ListViews with controllers are non-primary by default', (WidgetTester tester) async { final ListView view = ListView( controller: ScrollController(), + scrollDirection: Axis.vertical, ); expect(view.primary, isFalse); }); @@ -939,6 +951,7 @@ void main() { testWidgets('GridViews with controllers are non-primary by default', (WidgetTester tester) async { final GridView view = GridView.count( controller: ScrollController(), + scrollDirection: Axis.vertical, crossAxisCount: 1, ); expect(view.primary, isFalse); @@ -1030,7 +1043,7 @@ void main() { }); testWidgets('Defaulting-to-primary ListViews are always scrollable', (WidgetTester tester) async { - final ListView view = ListView(); + final ListView view = ListView(scrollDirection: Axis.vertical); expect(view.physics, isA()); }); @@ -1051,6 +1064,7 @@ void main() { }, child: ListView( primary: true, + children: const [], ), ), ), @@ -1071,6 +1085,7 @@ void main() { }, child: ListView( primary: false, + children: const [], ), ), ), @@ -1092,6 +1107,7 @@ void main() { child: ListView( primary: false, physics: const AlwaysScrollableScrollPhysics(), + children: const [], ), ), ), @@ -1113,6 +1129,7 @@ void main() { child: ListView( primary: true, physics: const ScrollPhysics(), + children: const [], ), ), ), diff --git a/packages/flutter/test/widgets/scrollable_list_hit_testing_test.dart b/packages/flutter/test/widgets/scrollable_list_hit_testing_test.dart index e956f34bd9..b3eee56473 100644 --- a/packages/flutter/test/widgets/scrollable_list_hit_testing_test.dart +++ b/packages/flutter/test/widgets/scrollable_list_hit_testing_test.dart @@ -62,6 +62,7 @@ void main() { child: ListView( dragStartBehavior: DragStartBehavior.down, itemExtent: 290.0, + scrollDirection: Axis.vertical, children: items.map((int item) { return GestureDetector( onTap: () { tapped.add(item); }, diff --git a/packages/flutter/test/widgets/scrollable_semantics_traversal_order_test.dart b/packages/flutter/test/widgets/scrollable_semantics_traversal_order_test.dart index 57ed2578a7..c69f51df30 100644 --- a/packages/flutter/test/widgets/scrollable_semantics_traversal_order_test.dart +++ b/packages/flutter/test/widgets/scrollable_semantics_traversal_order_test.dart @@ -176,6 +176,7 @@ void main() { ), ], ), + childOrder: DebugSemanticsDumpOrder.traversalOrder, ignoreId: true, ignoreTransform: true, ignoreRect: true, @@ -315,6 +316,7 @@ void main() { ), ], ), + childOrder: DebugSemanticsDumpOrder.traversalOrder, ignoreId: true, ignoreTransform: true, ignoreRect: true, @@ -443,6 +445,7 @@ void main() { ), ], ), + childOrder: DebugSemanticsDumpOrder.traversalOrder, ignoreId: true, ignoreTransform: true, ignoreRect: true, @@ -579,6 +582,7 @@ void main() { ), ], ), + childOrder: DebugSemanticsDumpOrder.traversalOrder, ignoreId: true, ignoreTransform: true, ignoreRect: true, @@ -711,6 +715,7 @@ void main() { ), ], ), + childOrder: DebugSemanticsDumpOrder.traversalOrder, ignoreId: true, ignoreTransform: true, ignoreRect: true, diff --git a/packages/flutter/test/widgets/scrollable_test.dart b/packages/flutter/test/widgets/scrollable_test.dart index 1e21d2ba87..b0d6b4864e 100644 --- a/packages/flutter/test/widgets/scrollable_test.dart +++ b/packages/flutter/test/widgets/scrollable_test.dart @@ -335,10 +335,10 @@ void main() { // Create a hover event so that |testPointer| has a location when generating the scroll. testPointer.hover(scrollEventLocation); await tester.sendEventToBinding(testPointer.scroll(const Offset(0.0, 20.0))); - expect(getScrollOffset(tester), 20.0); + expect(getScrollOffset(tester, last: true), 20.0); // Pointer signals should not cause overscroll. await tester.sendEventToBinding(testPointer.scroll(const Offset(0.0, -30.0))); - expect(getScrollOffset(tester), 0.0); + expect(getScrollOffset(tester, last: true), 0.0); }); testWidgets('Scroll pointer signals are ignored when scrolling is disabled', (WidgetTester tester) async { @@ -1187,6 +1187,7 @@ void main() { controller: outerController, child: Row( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ Column( children: [ @@ -1294,7 +1295,7 @@ void main() { }, variant: const TargetPlatformVariant({ TargetPlatform.iOS, TargetPlatform.macOS, TargetPlatform.android })); testWidgets('Does scroll with mouse pointer drag when behavior is not configured to ignore them', (WidgetTester tester) async { - await pumpTest(tester, debugDefaultTargetPlatformOverride); + await pumpTest(tester, debugDefaultTargetPlatformOverride, enableMouseDrag: true); final TestGesture gesture = await tester.startGesture(tester.getCenter(find.byType(Scrollable), warnIfMissed: true), kind: ui.PointerDeviceKind.mouse); await gesture.moveBy(const Offset(0.0, -200)); diff --git a/packages/flutter/test/widgets/scrollbar_test.dart b/packages/flutter/test/widgets/scrollbar_test.dart index d84467343a..22d4fe7d32 100644 --- a/packages/flutter/test/widgets/scrollbar_test.dart +++ b/packages/flutter/test/widgets/scrollbar_test.dart @@ -259,6 +259,7 @@ void main() { viewportDimension: viewportDimension, ); const Size size = Size(600, viewportDimension); + const double margin = 0; for (final ScrollbarOrientation scrollbarOrientation in ScrollbarOrientation.values) { final AxisDirection axisDirection; @@ -268,6 +269,7 @@ void main() { axisDirection = AxisDirection.right; painter = _buildPainter( + crossAxisMargin: margin, scrollMetrics: startingMetrics, scrollbarOrientation: scrollbarOrientation, ); @@ -317,11 +319,14 @@ void main() { viewportDimension: viewportDimension, ); const Size size = Size(600, viewportDimension); + const double margin = 0; Rect rect; // Vertical scroll with TextDirection.ltr painter = _buildPainter( + crossAxisMargin: margin, scrollMetrics: startingMetrics, + textDirection: TextDirection.ltr, ); painter.update( startingMetrics.copyWith(axisDirection: AxisDirection.down), @@ -336,6 +341,7 @@ void main() { // Vertical scroll with TextDirection.rtl painter = _buildPainter( + crossAxisMargin: margin, scrollMetrics: startingMetrics, textDirection: TextDirection.rtl, ); @@ -352,6 +358,7 @@ void main() { // Horizontal scroll painter = _buildPainter( + crossAxisMargin: margin, scrollMetrics: startingMetrics, ); painter.update( diff --git a/packages/flutter/test/widgets/selectable_text_test.dart b/packages/flutter/test/widgets/selectable_text_test.dart index 92400bc21c..3e2dc24a63 100644 --- a/packages/flutter/test/widgets/selectable_text_test.dart +++ b/packages/flutter/test/widgets/selectable_text_test.dart @@ -277,7 +277,7 @@ void main() { testWidgets('Rich selectable text has expected defaults', (WidgetTester tester) async { await tester.pumpWidget( const MediaQuery( - data: MediaQueryData(), + data: MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: SelectableText.rich( @@ -322,7 +322,7 @@ void main() { testWidgets('Rich selectable text only support TextSpan', (WidgetTester tester) async { await tester.pumpWidget( const MediaQuery( - data: MediaQueryData(), + data: MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: SelectableText.rich( @@ -710,6 +710,7 @@ void main() { child: const SelectableText( 'a selectable text', toolbarOptions: ToolbarOptions( + copy: false, selectAll: true, ), ), @@ -1578,6 +1579,7 @@ void main() { home: Material( child: RawKeyboardListener( focusNode: focusNode, + onKey: null, child: SelectableText( text, maxLines: 3, @@ -1711,6 +1713,7 @@ void main() { home: Material( child: RawKeyboardListener( focusNode: focusNode, + onKey: null, child: const SelectableText( testValue, maxLines: 3, @@ -1759,6 +1762,7 @@ void main() { home: Material( child: RawKeyboardListener( focusNode: focusNode, + onKey: null, child: const SelectableText( testValue, maxLines: 3, @@ -1794,6 +1798,7 @@ void main() { home: Material( child: RawKeyboardListener( focusNode: focusNode, + onKey: null, child: SelectableText( testValue, maxLines: 3, @@ -1995,6 +2000,7 @@ void main() { overlay( child: const SelectableText( 'x', + maxLines: null, ), ), ); @@ -3272,6 +3278,7 @@ void main() { const TextSelection( baseOffset: 0, extentOffset: 7, + affinity: TextAffinity.downstream, ), ); // Cursor move doesn't trigger a toolbar initially. @@ -3286,6 +3293,7 @@ void main() { const TextSelection( baseOffset: 0, extentOffset: 12, + affinity: TextAffinity.downstream, ), ); // Still no toolbar. @@ -3300,6 +3308,7 @@ void main() { const TextSelection( baseOffset: 0, extentOffset: 23, + affinity: TextAffinity.downstream, ), ); // Still no toolbar. @@ -3314,6 +3323,7 @@ void main() { const TextSelection( baseOffset: 0, extentOffset: 23, + affinity: TextAffinity.downstream, ), ); // The toolbar now shows up. @@ -3350,6 +3360,7 @@ void main() { const TextSelection( baseOffset: 0, extentOffset: 7, + affinity: TextAffinity.downstream, ), ); // Cursor move doesn't trigger a toolbar initially. @@ -3364,6 +3375,7 @@ void main() { const TextSelection( baseOffset: 0, extentOffset: 8, + affinity: TextAffinity.downstream, ), ); // Still no toolbar. @@ -3378,6 +3390,7 @@ void main() { const TextSelection( baseOffset: 0, extentOffset: 12, + affinity: TextAffinity.downstream, ), ); // Still no toolbar. @@ -3392,6 +3405,7 @@ void main() { const TextSelection( baseOffset: 0, extentOffset: 12, + affinity: TextAffinity.downstream, ), ); // The toolbar now shows up. @@ -3448,6 +3462,7 @@ void main() { const TextSelection( baseOffset: 13, extentOffset: 66, + affinity: TextAffinity.downstream, ), ); // Keep moving out. @@ -3458,6 +3473,7 @@ void main() { const TextSelection( baseOffset: 13, extentOffset: 66, + affinity: TextAffinity.downstream, ), ); await gesture.moveBy(const Offset(1, 0)); @@ -3467,6 +3483,7 @@ void main() { const TextSelection( baseOffset: 13, extentOffset: 66, + affinity: TextAffinity.downstream, ), ); expect(find.byType(CupertinoButton), findsNothing); @@ -3480,6 +3497,7 @@ void main() { const TextSelection( baseOffset: 13, extentOffset: 66, + affinity: TextAffinity.downstream, ), ); // The toolbar now shows up. @@ -3674,7 +3692,7 @@ void main() { // First tap moved the cursor. expect( controller.selection, - const TextSelection.collapsed(offset: 0), + const TextSelection.collapsed(offset: 0, affinity: TextAffinity.downstream), ); await tester.tapAt(selectableTextStart + const Offset(10.0, 5.0)); await tester.pump(const Duration(milliseconds: 50)); @@ -3725,7 +3743,7 @@ void main() { pressureMin: 0.0, ), ); - await gesture.updateWithCustomEvent(PointerMoveEvent(pointer: pointerValue, position: offset + const Offset(150.0, 5.0), pressure: 0.5, pressureMin: 0)); + await gesture.updateWithCustomEvent(PointerMoveEvent(pointer: pointerValue, position: offset + const Offset(150.0, 5.0), pressure: 0.5, pressureMin: 0, pressureMax: 1)); final EditableText editableTextWidget = tester.widget(find.byType(EditableText).first); final TextEditingController controller = editableTextWidget.controller; @@ -3763,7 +3781,7 @@ void main() { ), ); - await gesture.updateWithCustomEvent(PointerMoveEvent(pointer: pointerValue, position: selectableTextStart + const Offset(150.0, 5.0), pressure: 0.5, pressureMin: 0)); + await gesture.updateWithCustomEvent(PointerMoveEvent(pointer: pointerValue, position: selectableTextStart + const Offset(150.0, 5.0), pressure: 0.5, pressureMin: 0, pressureMax: 1)); final EditableText editableTextWidget = tester.widget(find.byType(EditableText).first); final TextEditingController controller = editableTextWidget.controller; @@ -3805,7 +3823,7 @@ void main() { ), ); - await gesture.updateWithCustomEvent(PointerMoveEvent(pointer: pointerValue, position: selectableTextStart + const Offset(150.0, 5.0), pressure: 0.5, pressureMin: 0)); + await gesture.updateWithCustomEvent(PointerMoveEvent(pointer: pointerValue, position: selectableTextStart + const Offset(150.0, 5.0), pressure: 0.5, pressureMin: 0, pressureMax: 1)); await gesture.up(); final EditableText editableTextWidget = tester.widget(find.byType(EditableText).first); @@ -4925,6 +4943,7 @@ void main() { ), key: Key('field0'), selectionHeightStyle: ui.BoxHeightStyle.includeLineSpacingBottom, + selectionWidthStyle: ui.BoxWidthStyle.tight, ), ], ), diff --git a/packages/flutter/test/widgets/semantics_1_test.dart b/packages/flutter/test/widgets/semantics_1_test.dart index 20c62a4d49..4ec238d2e8 100644 --- a/packages/flutter/test/widgets/semantics_1_test.dart +++ b/packages/flutter/test/widgets/semantics_1_test.dart @@ -54,6 +54,7 @@ void main() { SizedBox( height: 10.0, child: IgnorePointer( + ignoring: true, child: Semantics( label: 'child1', textDirection: TextDirection.ltr, @@ -149,6 +150,7 @@ void main() { SizedBox( height: 10.0, child: IgnorePointer( + ignoring: true, child: Semantics( label: 'child2', textDirection: TextDirection.ltr, diff --git a/packages/flutter/test/widgets/semantics_2_test.dart b/packages/flutter/test/widgets/semantics_2_test.dart index 7a2d5912c6..21988a6667 100644 --- a/packages/flutter/test/widgets/semantics_2_test.dart +++ b/packages/flutter/test/widgets/semantics_2_test.dart @@ -88,6 +88,7 @@ void main() { SizedBox( height: 10.0, child: IgnorePointer( + ignoring: true, child: Semantics( label: 'child2', textDirection: TextDirection.ltr, diff --git a/packages/flutter/test/widgets/semantics_traversal_test.dart b/packages/flutter/test/widgets/semantics_traversal_test.dart index a509ab2d2c..d02ab63275 100644 --- a/packages/flutter/test/widgets/semantics_traversal_test.dart +++ b/packages/flutter/test/widgets/semantics_traversal_test.dart @@ -336,6 +336,7 @@ class TraversalTester { ignoreTransform: true, ignoreRect: true, ignoreId: true, + childOrder: DebugSemanticsDumpOrder.traversalOrder, )); } diff --git a/packages/flutter/test/widgets/shader_mask_test.dart b/packages/flutter/test/widgets/shader_mask_test.dart index 77df57fd6a..905b09f15f 100644 --- a/packages/flutter/test/widgets/shader_mask_test.dart +++ b/packages/flutter/test/widgets/shader_mask_test.dart @@ -33,6 +33,7 @@ void main() { } final Widget widget = Align( + alignment: Alignment.center, child: SizedBox( width: 400.0, height: 400.0, @@ -59,6 +60,7 @@ void main() { alignment: Alignment.bottomRight, child: ShaderMask( shaderCallback: (Rect bounds) => const RadialGradient( + center: Alignment.center, radius: 0.05, colors: [Color(0xFFFF0000), Color(0xFF00FF00)], tileMode: TileMode.mirror, @@ -88,6 +90,7 @@ void main() { alignment: Alignment.topLeft, child: ShaderMask( shaderCallback: (Rect bounds) => const RadialGradient( + center: Alignment.center, radius: 0.05, colors: [Color(0xFFFF0000), Color(0xFF00FF00)], tileMode: TileMode.mirror, diff --git a/packages/flutter/test/widgets/shape_decoration_test.dart b/packages/flutter/test/widgets/shape_decoration_test.dart index 0173bb66de..bc84498ec6 100644 --- a/packages/flutter/test/widgets/shape_decoration_test.dart +++ b/packages/flutter/test/widgets/shape_decoration_test.dart @@ -22,8 +22,8 @@ Future main() async { MaterialApp( home: DecoratedBox( decoration: ShapeDecoration( - shape: Border.all(color: Colors.white) + - Border.all(), + shape: Border.all(width: 1.0, color: Colors.white) + + Border.all(width: 1.0, color: Colors.black), image: DecorationImage( image: image, ), @@ -45,8 +45,8 @@ Future main() async { MaterialApp( home: DecoratedBox( decoration: ShapeDecoration( - shape: Border.all(color: Colors.white) + - Border.all(), + shape: Border.all(width: 1.0, color: Colors.white) + + Border.all(width: 1.0, color: Colors.black), color: Colors.blue, ), ), diff --git a/packages/flutter/test/widgets/single_child_scroll_view_test.dart b/packages/flutter/test/widgets/single_child_scroll_view_test.dart index f92c2fab91..e942aa4e9c 100644 --- a/packages/flutter/test/widgets/single_child_scroll_view_test.dart +++ b/packages/flutter/test/widgets/single_child_scroll_view_test.dart @@ -44,6 +44,7 @@ void main() { Directionality( textDirection: TextDirection.ltr, child: SingleChildScrollView( + scrollDirection: Axis.vertical, child: Container(height: 600.0), ), ), @@ -63,6 +64,7 @@ void main() { Directionality( textDirection: TextDirection.ltr, child: SingleChildScrollView( + scrollDirection: Axis.vertical, child: Container(height: 600.1), ), ), @@ -214,7 +216,7 @@ void main() { }); testWidgets('Vertical SingleChildScrollViews are primary by default', (WidgetTester tester) async { - const SingleChildScrollView view = SingleChildScrollView(); + const SingleChildScrollView view = SingleChildScrollView(scrollDirection: Axis.vertical); expect(view.primary, isTrue); }); @@ -226,6 +228,7 @@ void main() { testWidgets('SingleChildScrollViews with controllers are non-primary by default', (WidgetTester tester) async { final SingleChildScrollView view = SingleChildScrollView( controller: ScrollController(), + scrollDirection: Axis.vertical, ); expect(view.primary, isFalse); }); diff --git a/packages/flutter/test/widgets/sliver_fill_remaining_test.dart b/packages/flutter/test/widgets/sliver_fill_remaining_test.dart index 76c50d41bf..a0f6673ea3 100644 --- a/packages/flutter/test/widgets/sliver_fill_remaining_test.dart +++ b/packages/flutter/test/widgets/sliver_fill_remaining_test.dart @@ -259,6 +259,7 @@ void main() { key: key, color: Colors.blue[300], child: Align( + alignment: Alignment.center, child: Padding( padding: const EdgeInsets.all(50.0), child: ElevatedButton( @@ -295,6 +296,7 @@ void main() { mainAxisSize: MainAxisSize.min, children: [ const Flexible( + fit: FlexFit.loose, child: Center(child: FlutterLogo(size: 100)), ), ElevatedButton( @@ -446,6 +448,7 @@ void main() { key: key, color: Colors.blue[300], child: Align( + alignment: Alignment.center, child: Padding( padding: const EdgeInsets.all(50.0), child: ElevatedButton( @@ -565,6 +568,7 @@ void main() { mainAxisSize: MainAxisSize.min, children: [ const Flexible( + fit: FlexFit.loose, child: Center(child: FlutterLogo(size: 100)), ), ElevatedButton( @@ -724,6 +728,7 @@ void main() { key: key, color: Colors.blue[300], child: Align( + alignment: Alignment.center, child: Padding( padding: const EdgeInsets.all(50.0), child: ElevatedButton( diff --git a/packages/flutter/test/widgets/sliver_fill_viewport_test.dart b/packages/flutter/test/widgets/sliver_fill_viewport_test.dart index f636dc535a..896145bd8c 100644 --- a/packages/flutter/test/widgets/sliver_fill_viewport_test.dart +++ b/packages/flutter/test/widgets/sliver_fill_viewport_test.dart @@ -173,6 +173,7 @@ void main() { child: CustomScrollView( slivers: [ SliverFillViewport( + padEnds: true, viewportFraction: 0.5, delegate: delegate, ), diff --git a/packages/flutter/test/widgets/sliver_visibility_test.dart b/packages/flutter/test/widgets/sliver_visibility_test.dart index 9a484d4490..0e30a9f24c 100644 --- a/packages/flutter/test/widgets/sliver_visibility_test.dart +++ b/packages/flutter/test/widgets/sliver_visibility_test.dart @@ -129,6 +129,7 @@ void main() { await tester.pumpWidget(_boilerPlate(SliverVisibility( sliver: testChild, replacementSliver: const SliverToBoxAdapter(child: Placeholder()), + visible: true, ))); expect(find.byType(Text, skipOffstage: false), findsOneWidget); expect(find.text('a true', skipOffstage: false), findsOneWidget); @@ -147,6 +148,7 @@ void main() { // visible: true, maintain all await tester.pumpWidget(_boilerPlate(SliverVisibility( sliver: testChild, + visible: true, maintainState: true, maintainAnimation: true, maintainSize: true, @@ -291,7 +293,7 @@ void main() { maintainAnimation: true, ))); expect(find.byType(Text, skipOffstage: false), findsOneWidget); - expect(find.byType(Text), findsNothing); + expect(find.byType(Text, skipOffstage: true), findsNothing); expect(find.text('a true', skipOffstage: false), findsOneWidget); expect(find.byType(SliverVisibility, skipOffstage: false), findsOneWidget); expect(find.byType(SliverVisibility, skipOffstage: false), paintsNothing); @@ -311,7 +313,7 @@ void main() { maintainState: true, ))); expect(find.byType(Text, skipOffstage: false), findsOneWidget); - expect(find.byType(Text), findsNothing); + expect(find.byType(Text, skipOffstage: true), findsNothing); expect(find.text('a false', skipOffstage: false), findsOneWidget); expect(find.byType(SliverVisibility, skipOffstage: false), findsOneWidget); expect(find.byType(SliverVisibility, skipOffstage: false), paintsNothing); @@ -330,6 +332,7 @@ void main() { // visible: true, maintain state await tester.pumpWidget(_boilerPlate(SliverVisibility( sliver: testChild, + visible: true, maintainState: true, ))); expect(find.byType(Text), findsOneWidget); @@ -353,7 +356,7 @@ void main() { maintainState: true, ))); expect(find.byType(Text, skipOffstage: false), findsOneWidget); - expect(find.byType(Text), findsNothing); + expect(find.byType(Text, skipOffstage: true), findsNothing); expect(find.text('a false', skipOffstage: false), findsOneWidget); expect(find.byType(SliverVisibility, skipOffstage: false), findsOneWidget); expect(find.byType(SliverVisibility, skipOffstage: false), paintsNothing); @@ -369,6 +372,7 @@ void main() { // visible: true, maintain state. await tester.pumpWidget(_boilerPlate(SliverVisibility( sliver: testChild, + visible: true, maintainState: true, ))); expect(find.byType(Text), findsOneWidget); @@ -392,7 +396,7 @@ void main() { maintainState: true, ))); expect(find.byType(Text, skipOffstage: false), findsOneWidget); - expect(find.byType(Text), findsNothing); + expect(find.byType(Text, skipOffstage: true), findsNothing); expect(find.text('a false', skipOffstage: false), findsOneWidget); expect(find.byType(SliverVisibility, skipOffstage: false), findsOneWidget); expect(find.byType(SliverVisibility, skipOffstage: false), paintsNothing); @@ -427,6 +431,7 @@ void main() { // visible: true. await tester.pumpWidget(_boilerPlate(SliverVisibility( sliver: testChild, + visible: true, ))); expect(find.byType(Text), findsOneWidget); expect(find.text('a true', skipOffstage: false), findsOneWidget); @@ -462,6 +467,7 @@ void main() { // visible: true. await tester.pumpWidget(_boilerPlate(SliverVisibility( sliver: testChild, + visible: true, ))); expect(find.byType(Text), findsOneWidget); expect(find.text('a true', skipOffstage: false), findsOneWidget); diff --git a/packages/flutter/test/widgets/slivers_appbar_floating_pinned_test.dart b/packages/flutter/test/widgets/slivers_appbar_floating_pinned_test.dart index 5306450e89..23adceea69 100644 --- a/packages/flutter/test/widgets/slivers_appbar_floating_pinned_test.dart +++ b/packages/flutter/test/widgets/slivers_appbar_floating_pinned_test.dart @@ -391,6 +391,7 @@ void main() { physics: const BouncingScrollPhysics(), slivers: [ const SliverAppBar( + pinned: false, floating: true, expandedHeight: 100.0, ), @@ -425,6 +426,7 @@ void main() { slivers: [ const SliverAppBar( pinned: true, + floating: false, expandedHeight: 100.0, ), SliverToBoxAdapter(child: Container(key: anchor, color: Colors.red, height: 100)), diff --git a/packages/flutter/test/widgets/slivers_appbar_pinned_test.dart b/packages/flutter/test/widgets/slivers_appbar_pinned_test.dart index 3639d64094..3ef9c5f078 100644 --- a/packages/flutter/test/widgets/slivers_appbar_pinned_test.dart +++ b/packages/flutter/test/widgets/slivers_appbar_pinned_test.dart @@ -146,7 +146,7 @@ void main() { verifyPaintPosition(key4, const Offset(0.0, 950.0), false); verifyPaintPosition(key5, const Offset(0.0, 1500.0), false); position.animateTo(550.0, curve: Curves.linear, duration: const Duration(minutes: 1)); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(const Duration(milliseconds: 100)); verifyPaintPosition(key1, Offset.zero, false); verifyPaintPosition(key2, Offset.zero, true); verifyPaintPosition(key3, const Offset(0.0, 200.0), true); diff --git a/packages/flutter/test/widgets/slivers_evil_test.dart b/packages/flutter/test/widgets/slivers_evil_test.dart index 50f0bd4aae..eec0b3a918 100644 --- a/packages/flutter/test/widgets/slivers_evil_test.dart +++ b/packages/flutter/test/widgets/slivers_evil_test.dart @@ -83,9 +83,11 @@ void main() { behavior: const TestBehavior(), child: Scrollbar( child: Scrollable( + axisDirection: AxisDirection.down, physics: const TestScrollPhysics(), viewportBuilder: (BuildContext context, ViewportOffset offset) { return Viewport( + axisDirection: AxisDirection.down, anchor: 0.25, offset: offset, center: centerKey, diff --git a/packages/flutter/test/widgets/slivers_padding_test.dart b/packages/flutter/test/widgets/slivers_padding_test.dart index c1562b153a..fe074f9776 100644 --- a/packages/flutter/test/widgets/slivers_padding_test.dart +++ b/packages/flutter/test/widgets/slivers_padding_test.dart @@ -320,6 +320,7 @@ void main() { Directionality( textDirection: TextDirection.ltr, child: Viewport( + axisDirection: AxisDirection.down, offset: ViewportOffset.fixed(0.0), slivers: const [ SliverPadding(padding: EdgeInsets.fromLTRB(1.0, 2.0, 4.0, 8.0)), diff --git a/packages/flutter/test/widgets/slivers_test.dart b/packages/flutter/test/widgets/slivers_test.dart index 606d7fc9d6..19b7f66e27 100644 --- a/packages/flutter/test/widgets/slivers_test.dart +++ b/packages/flutter/test/widgets/slivers_test.dart @@ -665,6 +665,7 @@ void main() { final SemanticsTester semantics = SemanticsTester(tester); await tester.pumpWidget(_boilerPlate( const SliverOffstage( + offstage: true, sliver: SliverToBoxAdapter( child: Text('a'), ), @@ -762,6 +763,7 @@ void main() { ), ), opacity: 0.0, + alwaysIncludeSemantics: false, ), )); @@ -794,6 +796,7 @@ void main() { ), ), opacity: 0.1, + alwaysIncludeSemantics: false, ), )); @@ -827,6 +830,7 @@ void main() { final List events = []; await tester.pumpWidget(_boilerPlate( SliverIgnorePointer( + ignoring: true, ignoringSemantics: false, sliver: SliverToBoxAdapter( child: GestureDetector( @@ -870,6 +874,7 @@ void main() { final List events = []; await tester.pumpWidget(_boilerPlate( SliverIgnorePointer( + ignoring: true, ignoringSemantics: true, sliver: SliverToBoxAdapter( child: GestureDetector( diff --git a/packages/flutter/test/widgets/spacer_test.dart b/packages/flutter/test/widgets/spacer_test.dart index 93810d5ff7..dc287f04c3 100644 --- a/packages/flutter/test/widgets/spacer_test.dart +++ b/packages/flutter/test/widgets/spacer_test.dart @@ -21,7 +21,7 @@ void main() { testWidgets('Spacer takes up space proportional to flex.', (WidgetTester tester) async { const Spacer spacer1 = Spacer(); - const Spacer spacer2 = Spacer(); + const Spacer spacer2 = Spacer(flex: 1); const Spacer spacer3 = Spacer(flex: 2); const Spacer spacer4 = Spacer(flex: 4); await tester.pumpWidget(Row( diff --git a/packages/flutter/test/widgets/stack_test.dart b/packages/flutter/test/widgets/stack_test.dart index d23e76b806..00bb7e0d04 100644 --- a/packages/flutter/test/widgets/stack_test.dart +++ b/packages/flutter/test/widgets/stack_test.dart @@ -381,7 +381,7 @@ void main() { final RenderStack renderObject = tester.allRenderObjects.whereType().first; expect(renderObject.clipBehavior, equals(Clip.hardEdge)); - await tester.pumpWidget(Stack(textDirection: TextDirection.ltr)); + await tester.pumpWidget(Stack(textDirection: TextDirection.ltr, clipBehavior: Clip.hardEdge)); expect(renderObject.clipBehavior, equals(Clip.hardEdge)); }); @@ -421,6 +421,7 @@ void main() { textDirection: TextDirection.ltr, child: Center( child: Stack( + clipBehavior: Clip.hardEdge, children: const [ SizedBox( width: 100.0, @@ -628,6 +629,7 @@ void main() { ); await tester.pumpWidget( Stack( + alignment: AlignmentDirectional.topStart, textDirection: TextDirection.rtl, ), ); diff --git a/packages/flutter/test/widgets/table_test.dart b/packages/flutter/test/widgets/table_test.dart index accb83b3ba..a6dd613233 100644 --- a/packages/flutter/test/widgets/table_test.dart +++ b/packages/flutter/test/widgets/table_test.dart @@ -386,7 +386,7 @@ void main() { textDirection: TextDirection.ltr, child: Table( columnWidths: const { - 0: FlexColumnWidth(), + 0: FlexColumnWidth(1.0), 1: FlexColumnWidth(0.123), 2: FlexColumnWidth(0.123), 3: FlexColumnWidth(0.123), diff --git a/packages/flutter/test/widgets/text_editing_action_target_test.dart b/packages/flutter/test/widgets/text_editing_action_target_test.dart index 99363055a7..387c5315c3 100644 --- a/packages/flutter/test/widgets/text_editing_action_target_test.dart +++ b/packages/flutter/test/widgets/text_editing_action_target_test.dart @@ -40,6 +40,7 @@ class _FakeEditableTextState with TextSelectionDelegate, TextEditingActionTarget endHandleLayerLink: LayerLink(), text: textSpan, selection: textEditingValue.selection, + textAlign: TextAlign.start, ); return _renderEditable!; } @@ -1738,6 +1739,7 @@ void main() { ), textEditingValue: const TextEditingValue( text: text, + selection: TextSelection.collapsed(offset: -1), ), ); final RenderEditable editable = editableTextState.renderEditable; diff --git a/packages/flutter/test/widgets/text_golden_test.dart b/packages/flutter/test/widgets/text_golden_test.dart index 5db8aee82f..ce2fd45079 100644 --- a/packages/flutter/test/widgets/text_golden_test.dart +++ b/packages/flutter/test/widgets/text_golden_test.dart @@ -531,7 +531,7 @@ void main() { color: Color(0xff00ff00), ), child: ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 200, maxHeight: 100), + constraints: const BoxConstraints(minWidth: 0, maxWidth: 200, minHeight: 0, maxHeight: 100), child: const Text.rich( TextSpan( text: 'C ', @@ -624,7 +624,7 @@ void main() { color: Color(0xff00ff00), ), child: ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 200, maxHeight: 100), + constraints: const BoxConstraints(minWidth: 0, maxWidth: 200, minHeight: 0, maxHeight: 100), child: const Text.rich( TextSpan( text: 'My name is: ', @@ -670,7 +670,7 @@ void main() { color: Color(0xff00ff00), ), child: ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 200, maxHeight: 100), + constraints: const BoxConstraints(minWidth: 0, maxWidth: 200, minHeight: 0, maxHeight: 100), child: const Text.rich( TextSpan( text: 'outer', @@ -799,7 +799,7 @@ void main() { color: Color(0xff00ff00), ), child: ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 200, maxHeight: 100), + constraints: const BoxConstraints(minWidth: 0, maxWidth: 200, minHeight: 0, maxHeight: 100), child: const Text.rich( TextSpan( text: 'C ', @@ -906,7 +906,7 @@ void main() { color: Color(0xff00ff00), ), child: ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 200, maxHeight: 100), + constraints: const BoxConstraints(minWidth: 0, maxWidth: 200, minHeight: 0, maxHeight: 100), child: const Text.rich( TextSpan( text: 'C ', @@ -1013,7 +1013,7 @@ void main() { color: Color(0xff00ff00), ), child: ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 200, maxHeight: 100), + constraints: const BoxConstraints(minWidth: 0, maxWidth: 200, minHeight: 0, maxHeight: 100), child: const Text.rich( TextSpan( text: 'C ', @@ -1120,7 +1120,7 @@ void main() { color: Color(0xff00ff00), ), child: ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 200, maxHeight: 100), + constraints: const BoxConstraints(minWidth: 0, maxWidth: 200, minHeight: 0, maxHeight: 100), child: const Text.rich( TextSpan( text: 'C ', @@ -1227,7 +1227,7 @@ void main() { color: Color(0xff00ff00), ), child: ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 200, maxHeight: 100), + constraints: const BoxConstraints(minWidth: 0, maxWidth: 200, minHeight: 0, maxHeight: 100), child: const Text.rich( TextSpan( text: 'C ', diff --git a/packages/flutter/test/widgets/text_selection_test.dart b/packages/flutter/test/widgets/text_selection_test.dart index ba3b28fb85..46606fcd1c 100644 --- a/packages/flutter/test/widgets/text_selection_test.dart +++ b/packages/flutter/test/widgets/text_selection_test.dart @@ -215,8 +215,10 @@ void main() { await gesture.updateWithCustomEvent(PointerMoveEvent( pointer: pointerValue, + position: Offset.zero, pressure: 0.5, pressureMin: 0, + pressureMax: 1, )); await gesture.up(); await tester.pumpAndSettle(); @@ -233,8 +235,10 @@ void main() { ); await gesture.updateWithCustomEvent(PointerMoveEvent( pointer: pointerValue, + position: Offset.zero, pressure: 0.5, pressureMin: 0, + pressureMax: 1, )); await gesture.up(); await tester.pump(const Duration(milliseconds: 20)); @@ -251,8 +255,10 @@ void main() { ); await gesture.updateWithCustomEvent(PointerMoveEvent( pointer: pointerValue, + position: Offset.zero, pressure: 0.5, pressureMin: 0, + pressureMax: 1, )); await gesture.up(); await tester.pump(const Duration(milliseconds: 20)); @@ -269,8 +275,10 @@ void main() { ); await gesture.updateWithCustomEvent(PointerMoveEvent( pointer: pointerValue, + position: Offset.zero, pressure: 0.5, pressureMin: 0, + pressureMax: 1, )); await gesture.up(); @@ -297,8 +305,10 @@ void main() { await gesture.updateWithCustomEvent( PointerMoveEvent( pointer: pointerValue, + position: Offset.zero, pressure: 0.0, pressureMin: 0, + pressureMax: 1, ), ); await tester.pump(const Duration(milliseconds: 50)); @@ -317,8 +327,10 @@ void main() { ); await gesture.updateWithCustomEvent(PointerMoveEvent( pointer: pointerValue, + position: Offset.zero, pressure: 0.5, pressureMin: 0, + pressureMax: 1, )); expect(forcePressStartCount, 1); @@ -337,6 +349,7 @@ void main() { final TestGesture gesture = await tester.startGesture( const Offset(200.0, 200.0), pointer: pointerValue, + kind: PointerDeviceKind.touch, ); addTearDown(gesture.removePointer); await tester.pump(const Duration(seconds: 2)); @@ -374,6 +387,7 @@ void main() { final TestGesture gesture = await tester.startGesture( const Offset(200.0, 200.0), pointer: pointerValue, + kind: PointerDeviceKind.touch, ); addTearDown(gesture.removePointer); await tester.pump(); @@ -438,6 +452,7 @@ void main() { final TestGesture gesture = await tester.startGesture( const Offset(200.0, 200.0), pointer: 0, + kind: PointerDeviceKind.touch, ); addTearDown(gesture.removePointer); await tester.pump(const Duration(seconds: 2)); @@ -498,6 +513,7 @@ void main() { final TestGesture gesture = await tester.startGesture( const Offset(200.0, 200.0), pointer: 0, + kind: PointerDeviceKind.touch, ); addTearDown(gesture.removePointer); await gesture.up(); @@ -514,6 +530,7 @@ void main() { final TestGesture gesture = await tester.startGesture( const Offset(200.0, 200.0), pointer: 0, + kind: PointerDeviceKind.touch, ); addTearDown(gesture.removePointer); await tester.pump(const Duration(milliseconds: 50)); @@ -536,6 +553,7 @@ void main() { await gesture.downWithCustomEvent( const Offset(200.0, 200.0), const PointerDownEvent( + pointer: 0, position: Offset(200.0, 200.0), pressure: 3.0, pressureMax: 6.0, @@ -544,7 +562,9 @@ void main() { ); await gesture.updateWithCustomEvent( const PointerUpEvent( + pointer: 0, position: Offset(200.0, 200.0), + pressure: 0.0, pressureMax: 6.0, pressureMin: 0.0, ), @@ -625,6 +645,7 @@ void main() { final TestGesture gesture = await tester.startGesture( const Offset(200.0, 200.0), pointer: 0, + kind: PointerDeviceKind.touch, ); addTearDown(gesture.removePointer); await tester.pump(const Duration(seconds: 2)); @@ -661,6 +682,7 @@ void main() { await gesture.downWithCustomEvent( const Offset(200.0, 200.0), const PointerDownEvent( + pointer: 0, position: Offset(200.0, 200.0), pressure: 3.0, pressureMax: 6.0, diff --git a/packages/flutter/test/widgets/text_selection_toolbar_layout_delegate_test.dart b/packages/flutter/test/widgets/text_selection_toolbar_layout_delegate_test.dart index 1fc67c761d..e01685358f 100644 --- a/packages/flutter/test/widgets/text_selection_toolbar_layout_delegate_test.dart +++ b/packages/flutter/test/widgets/text_selection_toolbar_layout_delegate_test.dart @@ -14,7 +14,7 @@ void main() { await tester.pumpWidget( MediaQuery( - data: const MediaQueryData(), + data: const MediaQueryData(devicePixelRatio: 1.0), child: Directionality( textDirection: TextDirection.ltr, child: StatefulBuilder( diff --git a/packages/flutter/test/widgets/text_test.dart b/packages/flutter/test/widgets/text_test.dart index cd7d011f0b..0acef5ffd7 100644 --- a/packages/flutter/test/widgets/text_test.dart +++ b/packages/flutter/test/widgets/text_test.dart @@ -1045,7 +1045,7 @@ void main() { ), ], ))); - }, skip: isBrowser); // https://github.com/flutter/flutter/issues/87877 + }, semanticsEnabled: true, skip: isBrowser); // https://github.com/flutter/flutter/issues/87877 // Regression test for https://github.com/flutter/flutter/issues/69787 testWidgets('WidgetSpans with no semantic information are elided from semantics - case 2', (WidgetTester tester) async { @@ -1091,7 +1091,7 @@ void main() { ignoreRect: true, ignoreTransform: true, )); - }, skip: isBrowser); // https://github.com/flutter/flutter/issues/87877 + }, semanticsEnabled: true, skip: isBrowser); // https://github.com/flutter/flutter/issues/87877 // Regression test for https://github.com/flutter/flutter/issues/69787 testWidgets('WidgetSpans with no semantic information are elided from semantics - case 3', (WidgetTester tester) async { @@ -1149,7 +1149,7 @@ void main() { ignoreRect: true, ignoreTransform: true, )); - }, skip: isBrowser); // https://github.com/flutter/flutter/issues/87877 + }, semanticsEnabled: true, skip: isBrowser); // https://github.com/flutter/flutter/issues/87877 // Regression test for https://github.com/flutter/flutter/issues/69787 testWidgets('WidgetSpans with no semantic information are elided from semantics - case 4', (WidgetTester tester) async { @@ -1215,7 +1215,7 @@ void main() { ignoreRect: true, ignoreTransform: true, )); - }, skip: isBrowser); // https://github.com/flutter/flutter/issues/87877 + }, semanticsEnabled: true, skip: isBrowser); // https://github.com/flutter/flutter/issues/87877 testWidgets('RenderParagraph intrinsic width', (WidgetTester tester) async { await tester.pumpWidget( diff --git a/packages/flutter/test/widgets/texture_test.dart b/packages/flutter/test/widgets/texture_test.dart index 4a5b1b774a..cf654a67c8 100644 --- a/packages/flutter/test/widgets/texture_test.dart +++ b/packages/flutter/test/widgets/texture_test.dart @@ -94,7 +94,7 @@ void main() { testWidgets('Texture with FilterQuality.low', (WidgetTester tester) async { await tester.pumpWidget( - const Center(child: Texture(textureId: 1)), + const Center(child: Texture(textureId: 1, filterQuality: FilterQuality.low)), ); final Texture texture = tester.firstWidget(find.byType(Texture)); diff --git a/packages/flutter/test/widgets/transitions_test.dart b/packages/flutter/test/widgets/transitions_test.dart index a419517728..f27ac4804c 100644 --- a/packages/flutter/test/widgets/transitions_test.dart +++ b/packages/flutter/test/widgets/transitions_test.dart @@ -23,9 +23,12 @@ void main() { begin: BoxDecoration( color: const Color(0xFFFFFFFF), border: Border.all( + color: const Color(0xFF000000), + style: BorderStyle.solid, width: 4.0, ), borderRadius: BorderRadius.zero, + shape: BoxShape.rectangle, boxShadow: const [BoxShadow( color: Color(0x66000000), blurRadius: 10.0, @@ -36,8 +39,11 @@ void main() { color: const Color(0xFF000000), border: Border.all( color: const Color(0xFF202020), + style: BorderStyle.solid, + width: 1.0, ), borderRadius: const BorderRadius.all(Radius.circular(10.0)), + shape: BoxShape.rectangle, // No shadow. ), ); @@ -243,6 +249,7 @@ void main() { final Widget widget = Directionality( textDirection: TextDirection.ltr, child: SizeTransition( + axis: Axis.vertical, sizeFactor: animation, child: const Text('Ready'), ), diff --git a/packages/flutter/test/widgets/visibility_test.dart b/packages/flutter/test/widgets/visibility_test.dart index 342481961a..7f8da4afc9 100644 --- a/packages/flutter/test/widgets/visibility_test.dart +++ b/packages/flutter/test/widgets/visibility_test.dart @@ -125,6 +125,7 @@ void main() { child: Visibility( child: testChild, replacement: const Placeholder(), + visible: true, ), )); expect(find.byType(Text, skipOffstage: false), findsOneWidget); @@ -140,6 +141,7 @@ void main() { await tester.pumpWidget(Center( child: Visibility( + visible: true, maintainState: true, maintainAnimation: true, maintainSize: true, @@ -252,7 +254,7 @@ void main() { ), )); expect(find.byType(Text, skipOffstage: false), findsOneWidget); - expect(find.byType(Text), findsNothing); + expect(find.byType(Text, skipOffstage: true), findsNothing); expect(find.text('a true', skipOffstage: false), findsOneWidget); expect(find.byType(Placeholder), findsNothing); expect(find.byType(Visibility), paintsNothing); @@ -271,7 +273,7 @@ void main() { ), )); expect(find.byType(Text, skipOffstage: false), findsOneWidget); - expect(find.byType(Text), findsNothing); + expect(find.byType(Text, skipOffstage: true), findsNothing); expect(find.text('a false', skipOffstage: false), findsOneWidget); expect(find.byType(Placeholder), findsNothing); expect(find.byType(Visibility), paintsNothing); @@ -286,6 +288,7 @@ void main() { await tester.pumpWidget(Center( child: Visibility( + visible: true, maintainState: true, child: testChild, ), @@ -309,7 +312,7 @@ void main() { ), )); expect(find.byType(Text, skipOffstage: false), findsOneWidget); - expect(find.byType(Text), findsNothing); + expect(find.byType(Text, skipOffstage: true), findsNothing); expect(find.text('a false', skipOffstage: false), findsOneWidget); expect(find.byType(Placeholder), findsNothing); expect(find.byType(Visibility), paintsNothing); @@ -322,6 +325,7 @@ void main() { await tester.pumpWidget(Center( child: Visibility( + visible: true, maintainState: true, child: testChild, ), @@ -345,7 +349,7 @@ void main() { ), )); expect(find.byType(Text, skipOffstage: false), findsOneWidget); - expect(find.byType(Text), findsNothing); + expect(find.byType(Text, skipOffstage: true), findsNothing); expect(find.text('a false', skipOffstage: false), findsOneWidget); expect(find.byType(Placeholder), findsNothing); expect(find.byType(Visibility), paintsNothing); @@ -376,6 +380,7 @@ void main() { await tester.pumpWidget(Center( child: Visibility( + visible: true, child: testChild, ), )); @@ -408,6 +413,7 @@ void main() { await tester.pumpWidget(Center( child: Visibility( + visible: true, child: testChild, ), )); diff --git a/packages/flutter/test/widgets/widget_inspector_test.dart b/packages/flutter/test/widgets/widget_inspector_test.dart index 47a6ef8b13..2f08f20456 100644 --- a/packages/flutter/test/widgets/widget_inspector_test.dart +++ b/packages/flutter/test/widgets/widget_inspector_test.dart @@ -498,6 +498,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { child: Overlay( initialEntries: [ OverlayEntry( + opaque: false, maintainState: true, builder: (BuildContext _) => createSubtree(width: 94.0), ), @@ -507,6 +508,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { builder: (BuildContext _) => createSubtree(width: 95.0), ), OverlayEntry( + opaque: false, maintainState: true, builder: (BuildContext _) => createSubtree(width: 96.0, key: clickTarget), ), @@ -815,7 +817,9 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { elementA.toDiagnosticsNode().toJsonMap( InspectorSerializationDelegate( service: service, + summaryTree: false, includeProperties: true, + addAdditionalPropertiesCallback: null, ), ), isNotNull, @@ -2927,6 +2931,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { final InspectorSerializationDelegate delegate = InspectorSerializationDelegate( service: service, + summaryTree: false, includeProperties: true, addAdditionalPropertiesCallback: (DiagnosticsNode node, InspectorSerializationDelegate delegate) { @@ -2955,6 +2960,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { final InspectorSerializationDelegate emptyDelegate = InspectorSerializationDelegate( service: service, + summaryTree: false, includeProperties: true, addAdditionalPropertiesCallback: (DiagnosticsNode node, InspectorSerializationDelegate delegate) { @@ -2964,7 +2970,9 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { final InspectorSerializationDelegate defaultDelegate = InspectorSerializationDelegate( service: service, + summaryTree: false, includeProperties: true, + addAdditionalPropertiesCallback: null, ); expect(node.toJsonMap(emptyDelegate), node.toJsonMap(defaultDelegate)); }); diff --git a/packages/flutter/test/widgets/wrap_test.dart b/packages/flutter/test/widgets/wrap_test.dart index 1d32f6cf46..8d096aee18 100644 --- a/packages/flutter/test/widgets/wrap_test.dart +++ b/packages/flutter/test/widgets/wrap_test.dart @@ -19,6 +19,7 @@ void main() { testWidgets('Basic Wrap test (LTR)', (WidgetTester tester) async { await tester.pumpWidget( Wrap( + alignment: WrapAlignment.start, textDirection: TextDirection.ltr, children: const [ SizedBox(width: 300.0, height: 100.0), @@ -75,6 +76,8 @@ void main() { await tester.pumpWidget( Wrap( + alignment: WrapAlignment.start, + crossAxisAlignment: WrapCrossAlignment.start, textDirection: TextDirection.ltr, children: const [ SizedBox(width: 300.0, height: 50.0), @@ -93,6 +96,7 @@ void main() { await tester.pumpWidget( Wrap( + alignment: WrapAlignment.start, crossAxisAlignment: WrapCrossAlignment.center, textDirection: TextDirection.ltr, children: const [ @@ -112,6 +116,7 @@ void main() { await tester.pumpWidget( Wrap( + alignment: WrapAlignment.start, crossAxisAlignment: WrapCrossAlignment.end, textDirection: TextDirection.ltr, children: const [ @@ -134,6 +139,7 @@ void main() { testWidgets('Basic Wrap test (RTL)', (WidgetTester tester) async { await tester.pumpWidget( Wrap( + alignment: WrapAlignment.start, textDirection: TextDirection.rtl, children: const [ SizedBox(width: 300.0, height: 100.0), @@ -190,6 +196,8 @@ void main() { await tester.pumpWidget( Wrap( + alignment: WrapAlignment.start, + crossAxisAlignment: WrapCrossAlignment.start, textDirection: TextDirection.ltr, verticalDirection: VerticalDirection.up, children: const [ @@ -209,6 +217,7 @@ void main() { await tester.pumpWidget( Wrap( + alignment: WrapAlignment.start, crossAxisAlignment: WrapCrossAlignment.center, textDirection: TextDirection.ltr, verticalDirection: VerticalDirection.up, @@ -229,6 +238,7 @@ void main() { await tester.pumpWidget( Wrap( + alignment: WrapAlignment.start, crossAxisAlignment: WrapCrossAlignment.end, textDirection: TextDirection.ltr, verticalDirection: VerticalDirection.up, @@ -628,6 +638,8 @@ void main() { alignment: Alignment.topLeft, child: Wrap( runSpacing: 10.0, + alignment: WrapAlignment.start, + crossAxisAlignment: WrapCrossAlignment.start, textDirection: TextDirection.ltr, children: const [ SizedBox(width: 500.0, height: 10.0), @@ -655,6 +667,8 @@ void main() { direction: Axis.vertical, spacing: 10.0, runSpacing: 15.0, + alignment: WrapAlignment.start, + crossAxisAlignment: WrapCrossAlignment.start, textDirection: TextDirection.ltr, children: const [ SizedBox(width: 10.0, height: 250.0), @@ -681,6 +695,7 @@ void main() { Align( alignment: Alignment.topLeft, child: Wrap( + direction: Axis.horizontal, spacing: 12.0, runSpacing: 8.0, textDirection: TextDirection.ltr, @@ -819,6 +834,7 @@ void main() { testWidgets('Spacing with slight overflow', (WidgetTester tester) async { await tester.pumpWidget(Wrap( + direction: Axis.horizontal, textDirection: TextDirection.ltr, spacing: 10.0, runSpacing: 10.0, @@ -844,6 +860,7 @@ void main() { Column( children: [ Wrap( + direction: Axis.horizontal, textDirection: TextDirection.ltr, spacing: 10.0, runSpacing: 10.0, @@ -862,6 +879,7 @@ void main() { Column( children: [ Wrap( + direction: Axis.horizontal, textDirection: TextDirection.ltr, spacing: 10.0, runSpacing: 10.0, diff --git a/packages/flutter_driver/lib/src/common/handler_factory.dart b/packages/flutter_driver/lib/src/common/handler_factory.dart index ef822791e6..41ccd3a0d7 100644 --- a/packages/flutter_driver/lib/src/common/handler_factory.dart +++ b/packages/flutter_driver/lib/src/common/handler_factory.dart @@ -367,7 +367,7 @@ mixin CommandHandlerFactory { final Duration pause = scrollCommand.duration ~/ totalMoves; final Offset startLocation = _prober.getCenter(target); Offset currentLocation = startLocation; - final TestPointer pointer = TestPointer(); + final TestPointer pointer = TestPointer(1); _prober.binding.handlePointerEvent(pointer.down(startLocation)); await Future.value(); // so that down and move don't happen in the same microtask for (int moves = 0; moves < totalMoves; moves += 1) { diff --git a/packages/flutter_driver/lib/src/driver/vmservice_driver.dart b/packages/flutter_driver/lib/src/driver/vmservice_driver.dart index a11bfd4b81..cbe460441f 100644 --- a/packages/flutter_driver/lib/src/driver/vmservice_driver.dart +++ b/packages/flutter_driver/lib/src/driver/vmservice_driver.dart @@ -556,6 +556,7 @@ Future _waitAndConnect(String url, Map? headers) final vms.VmService service = vms.VmService( controller.stream, socket.add, + log: null, disposeHandler: () => socket!.close(), streamClosed: streamClosedCompleter.future ); diff --git a/packages/flutter_driver/test/src/real_tests/extension_test.dart b/packages/flutter_driver/test/src/real_tests/extension_test.dart index d613ead1f7..b3d7a83bb4 100644 --- a/packages/flutter_driver/test/src/real_tests/extension_test.dart +++ b/packages/flutter_driver/test/src/real_tests/extension_test.dart @@ -848,7 +848,7 @@ void main() { ); // Widget - Map result = await getDiagnosticsTree(DiagnosticsType.widget, ByValueKey('Text')); + Map result = await getDiagnosticsTree(DiagnosticsType.widget, ByValueKey('Text'), depth: 0); expect(result['children'], isNull); // depth: 0 expect(result['widgetRuntimeType'], 'Text'); @@ -857,7 +857,7 @@ void main() { expect(stringProperty['description'], '"Hello World"'); expect(stringProperty['propertyType'], 'String'); - result = await getDiagnosticsTree(DiagnosticsType.widget, ByValueKey('Text'), properties: false); + result = await getDiagnosticsTree(DiagnosticsType.widget, ByValueKey('Text'), depth: 0, properties: false); expect(result['widgetRuntimeType'], 'Text'); expect(result['properties'], isNull); // properties: false @@ -870,12 +870,12 @@ void main() { expect(children.single['children'], isEmpty); // RenderObject - result = await getDiagnosticsTree(DiagnosticsType.renderObject, ByValueKey('Text')); + result = await getDiagnosticsTree(DiagnosticsType.renderObject, ByValueKey('Text'), depth: 0); expect(result['children'], isNull); // depth: 0 expect(result['properties'], isNotNull); expect(result['description'], startsWith('RenderParagraph')); - result = await getDiagnosticsTree(DiagnosticsType.renderObject, ByValueKey('Text'), properties: false); + result = await getDiagnosticsTree(DiagnosticsType.renderObject, ByValueKey('Text'), depth: 0, properties: false); expect(result['properties'], isNull); // properties: false expect(result['description'], startsWith('RenderParagraph')); diff --git a/packages/flutter_driver/test/src/real_tests/flutter_driver_test.dart b/packages/flutter_driver/test/src/real_tests/flutter_driver_test.dart index ff7661ebce..5403899864 100644 --- a/packages/flutter_driver/test/src/real_tests/flutter_driver_test.dart +++ b/packages/flutter_driver/test/src/real_tests/flutter_driver_test.dart @@ -82,7 +82,7 @@ void main() { }); test('logFilePathName was set when a new driver was created', () { - driver = VMServiceFlutterDriver.connectedTo(fakeClient, fakeIsolate); + driver = VMServiceFlutterDriver.connectedTo(fakeClient, fakeIsolate, logCommunicationToFile: true); logFile = File(driver.logFilePathName); expect(logFile.path, endsWith('.log')); }); @@ -113,7 +113,7 @@ void main() { }); test('printCommunication = false', () async { - driver = VMServiceFlutterDriver.connectedTo(fakeClient, fakeIsolate); + driver = VMServiceFlutterDriver.connectedTo(fakeClient, fakeIsolate, printCommunication: false); await driver.waitFor(find.byTooltip('foo'), timeout: _kTestTimeout); expect(log, []); }); @@ -783,7 +783,7 @@ void main() { }); test('printCommunication = false', () async { - driver = WebFlutterDriver.connectedTo(fakeConnection); + driver = WebFlutterDriver.connectedTo(fakeConnection, printCommunication: false); await driver.waitFor(find.byTooltip('printCommunication test'), timeout: _kTestTimeout); expect(log, []); }); diff --git a/packages/flutter_driver/test/src/real_tests/timeline_summary_test.dart b/packages/flutter_driver/test/src/real_tests/timeline_summary_test.dart index b7456cf8ad..ad645c222f 100644 --- a/packages/flutter_driver/test/src/real_tests/timeline_summary_test.dart +++ b/packages/flutter_driver/test/src/real_tests/timeline_summary_test.dart @@ -502,6 +502,7 @@ void main() { ]).writeTimelineToFile( 'test', destinationDirectory: tempDir.path, + includeSummary: true, ); final String written = await fs.file(path.join(tempDir.path, 'test.timeline.json')).readAsString(); diff --git a/packages/flutter_localizations/test/cupertino/translations_test.dart b/packages/flutter_localizations/test/cupertino/translations_test.dart index 73d8ec3770..b2004f60d5 100644 --- a/packages/flutter_localizations/test/cupertino/translations_test.dart +++ b/packages/flutter_localizations/test/cupertino/translations_test.dart @@ -144,7 +144,7 @@ void main() { if (noCupertinoArbFile.existsSync() && !nbCupertinoArbFile.existsSync()) { - Locale locale = const Locale.fromSubtags(languageCode: 'no'); + Locale locale = const Locale.fromSubtags(languageCode: 'no', scriptCode: null, countryCode: null); expect(GlobalCupertinoLocalizations.delegate.isSupported(locale), isTrue); CupertinoLocalizations localizations = await GlobalCupertinoLocalizations.delegate.load(locale); expect(localizations, isA()); @@ -153,7 +153,7 @@ void main() { final String copyButtonLabelNo = localizations.copyButtonLabel; final String cutButtonLabelNo = localizations.cutButtonLabel; - locale = const Locale.fromSubtags(languageCode: 'nb'); + locale = const Locale.fromSubtags(languageCode: 'nb', scriptCode: null, countryCode: null); expect(GlobalCupertinoLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalCupertinoLocalizations.delegate.load(locale); expect(localizations, isA()); diff --git a/packages/flutter_localizations/test/material/date_picker_test.dart b/packages/flutter_localizations/test/material/date_picker_test.dart index 5872eba389..adfbdbbeae 100644 --- a/packages/flutter_localizations/test/material/date_picker_test.dart +++ b/packages/flutter_localizations/test/material/date_picker_test.dart @@ -13,7 +13,7 @@ void main() { late DateTime initialDate; setUp(() { - firstDate = DateTime(2001, DateTime.january); + firstDate = DateTime(2001, DateTime.january, 1); lastDate = DateTime(2031, DateTime.december, 31); initialDate = DateTime(2016, DateTime.january, 15); }); @@ -140,6 +140,9 @@ void main() { testWidgets('textDirection parameter overrides ambient textDirection', (WidgetTester tester) async { await tester.pumpWidget(MaterialApp( locale: const Locale('en', 'US'), + supportedLocales: const [ + Locale('en', 'US'), + ], home: Material( child: Builder( builder: (BuildContext context) { diff --git a/packages/flutter_localizations/test/material/date_time_test.dart b/packages/flutter_localizations/test/material/date_time_test.dart index 0c5c9dc2e8..39f56f4e38 100644 --- a/packages/flutter_localizations/test/material/date_time_test.dart +++ b/packages/flutter_localizations/test/material/date_time_test.dart @@ -144,7 +144,7 @@ void main() { } testWidgets('formats dates in English', (WidgetTester tester) async { - final Map formatted = await formatDate(tester, const Locale('en'), DateTime(2018, 8)); + final Map formatted = await formatDate(tester, const Locale('en'), DateTime(2018, 8, 1)); expect(formatted[DateType.year], '2018'); expect(formatted[DateType.medium], 'Wed, Aug 1'); expect(formatted[DateType.full], 'Wednesday, August 1, 2018'); @@ -152,7 +152,7 @@ void main() { }); testWidgets('formats dates in German', (WidgetTester tester) async { - final Map formatted = await formatDate(tester, const Locale('de'), DateTime(2018, 8)); + final Map formatted = await formatDate(tester, const Locale('de'), DateTime(2018, 8, 1)); expect(formatted[DateType.year], '2018'); expect(formatted[DateType.medium], 'Mi., 1. Aug.'); expect(formatted[DateType.full], 'Mittwoch, 1. August 2018'); @@ -160,7 +160,7 @@ void main() { }); testWidgets('formats dates in Serbian', (WidgetTester tester) async { - final Map formatted = await formatDate(tester, const Locale('sr'), DateTime(2018, 8)); + final Map formatted = await formatDate(tester, const Locale('sr'), DateTime(2018, 8, 1)); expect(formatted[DateType.year], '2018.'); expect(formatted[DateType.medium], 'сре 1. авг'); expect(formatted[DateType.full], 'среда, 1. август 2018.'); @@ -169,7 +169,7 @@ void main() { testWidgets('formats dates in Serbian (Latin)', (WidgetTester tester) async { final Map formatted = await formatDate(tester, - const Locale.fromSubtags(languageCode:'sr', scriptCode: 'Latn'), DateTime(2018, 8)); + const Locale.fromSubtags(languageCode:'sr', scriptCode: 'Latn'), DateTime(2018, 8, 1)); expect(formatted[DateType.year], '2018.'); expect(formatted[DateType.medium], 'sre 1. avg'); expect(formatted[DateType.full], 'sreda, 1. avgust 2018.'); @@ -183,6 +183,9 @@ void main() { late DateFormat dateFormat; await tester.pumpWidget(MaterialApp( + supportedLocales: const [ + Locale('en', 'US'), + ], locale: const Locale('en', 'US'), localizationsDelegates: const >[ GlobalMaterialLocalizations.delegate, diff --git a/packages/flutter_localizations/test/material/tabs_test.dart b/packages/flutter_localizations/test/material/tabs_test.dart index e4e16647f3..25c739cab6 100644 --- a/packages/flutter_localizations/test/material/tabs_test.dart +++ b/packages/flutter_localizations/test/material/tabs_test.dart @@ -14,6 +14,7 @@ void main() { final TabController controller = TabController( vsync: const TestVSync(), length: 2, + initialIndex: 0, ); await tester.pumpWidget( diff --git a/packages/flutter_localizations/test/material/translations_test.dart b/packages/flutter_localizations/test/material/translations_test.dart index 38583e8245..c31792e972 100644 --- a/packages/flutter_localizations/test/material/translations_test.dart +++ b/packages/flutter_localizations/test/material/translations_test.dart @@ -88,10 +88,10 @@ void main() { expect(localizations.formatHour(const TimeOfDay(hour: 10, minute: 0)), isNotNull); expect(localizations.formatMinute(const TimeOfDay(hour: 10, minute: 0)), isNotNull); - expect(localizations.formatYear(DateTime(2018, 8)), isNotNull); - expect(localizations.formatMediumDate(DateTime(2018, 8)), isNotNull); - expect(localizations.formatFullDate(DateTime(2018, 8)), isNotNull); - expect(localizations.formatMonthYear(DateTime(2018, 8)), isNotNull); + expect(localizations.formatYear(DateTime(2018, 8, 1)), isNotNull); + expect(localizations.formatMediumDate(DateTime(2018, 8, 1)), isNotNull); + expect(localizations.formatFullDate(DateTime(2018, 8, 1)), isNotNull); + expect(localizations.formatMonthYear(DateTime(2018, 8, 1)), isNotNull); expect(localizations.narrowWeekdays, isNotNull); expect(localizations.narrowWeekdays.length, 7); expect(localizations.formatDecimal(123), isNotNull); @@ -100,14 +100,14 @@ void main() { } testWidgets('translations spot check', (WidgetTester tester) async { - Locale locale = const Locale.fromSubtags(languageCode: 'zh'); + Locale locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: null, countryCode: null); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); MaterialLocalizations localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); expect(localizations.firstPageTooltip, '第一页'); expect(localizations.lastPageTooltip, '最后一页'); - locale = const Locale.fromSubtags(languageCode: 'zu'); + locale = const Locale.fromSubtags(languageCode: 'zu', scriptCode: null, countryCode: null); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); expect(localizations.firstPageTooltip, 'Ikhasi lokuqala'); @@ -181,7 +181,7 @@ void main() { }); testWidgets('Chinese resolution', (WidgetTester tester) async { - Locale locale = const Locale.fromSubtags(languageCode: 'zh'); + Locale locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: null, countryCode: null); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); MaterialLocalizations localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); @@ -191,22 +191,22 @@ void main() { localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'zh', countryCode: 'HK'); + locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: null, countryCode: 'HK'); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW'); + locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: null, countryCode: 'TW'); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hans'); + locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hans', countryCode: null); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant'); + locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant', countryCode: null); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); @@ -236,7 +236,7 @@ void main() { localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'zh', countryCode: 'US'); + locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: null, countryCode: 'US'); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); @@ -251,7 +251,7 @@ void main() { localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'en', countryCode: 'TW'); + locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: null, countryCode: 'TW'); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); @@ -261,34 +261,34 @@ void main() { localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'zh', countryCode: 'RU'); + locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: null, countryCode: 'RU'); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Cyrl'); + locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Cyrl', countryCode: null); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); }); testWidgets('Serbian resolution', (WidgetTester tester) async { - Locale locale = const Locale.fromSubtags(languageCode: 'sr'); + Locale locale = const Locale.fromSubtags(languageCode: 'sr', scriptCode: null, countryCode: null); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); MaterialLocalizations localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'sr', scriptCode: 'Cyrl'); + locale = const Locale.fromSubtags(languageCode: 'sr', scriptCode: 'Cyrl', countryCode: null); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'sr', scriptCode: 'Latn'); + locale = const Locale.fromSubtags(languageCode: 'sr', scriptCode: 'Latn', countryCode: null); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'sr', countryCode: 'SR'); + locale = const Locale.fromSubtags(languageCode: 'sr', scriptCode: null, countryCode: 'SR'); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); @@ -313,49 +313,49 @@ void main() { localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'sr', countryCode: 'US'); + locale = const Locale.fromSubtags(languageCode: 'sr', scriptCode: null, countryCode: 'US'); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); }); testWidgets('Misc resolution', (WidgetTester tester) async { - Locale locale = const Locale.fromSubtags(languageCode: 'en'); + Locale locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: null, countryCode: null); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); MaterialLocalizations localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: 'Cyrl'); + locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: 'Cyrl', countryCode: null); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'en', countryCode: 'US'); + locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: null, countryCode: 'US'); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'en', countryCode: 'AU'); + locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: null, countryCode: 'AU'); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'en', countryCode: 'GB'); + locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: null, countryCode: 'GB'); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'en', countryCode: 'SG'); + locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: null, countryCode: 'SG'); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'en', countryCode: 'MX'); + locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: null, countryCode: 'MX'); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: 'Hant'); + locale = const Locale.fromSubtags(languageCode: 'en', scriptCode: 'Hant', countryCode: null); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); @@ -370,37 +370,37 @@ void main() { localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'es'); + locale = const Locale.fromSubtags(languageCode: 'es', scriptCode: null, countryCode: null); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'es', countryCode: '419'); + locale = const Locale.fromSubtags(languageCode: 'es', scriptCode: null, countryCode: '419'); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'es', countryCode: 'MX'); + locale = const Locale.fromSubtags(languageCode: 'es', scriptCode: null, countryCode: 'MX'); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'es', countryCode: 'US'); + locale = const Locale.fromSubtags(languageCode: 'es', scriptCode: null, countryCode: 'US'); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'es', countryCode: 'AR'); + locale = const Locale.fromSubtags(languageCode: 'es', scriptCode: null, countryCode: 'AR'); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'es', countryCode: 'ES'); + locale = const Locale.fromSubtags(languageCode: 'es', scriptCode: null, countryCode: 'ES'); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'es', scriptCode: 'Latn'); + locale = const Locale.fromSubtags(languageCode: 'es', scriptCode: 'Latn', countryCode: null); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); @@ -410,39 +410,39 @@ void main() { localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'fr'); + locale = const Locale.fromSubtags(languageCode: 'fr', scriptCode: null, countryCode: null); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'fr', countryCode: 'CA'); + locale = const Locale.fromSubtags(languageCode: 'fr', scriptCode: null, countryCode: 'CA'); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'de'); + locale = const Locale.fromSubtags(languageCode: 'de', scriptCode: null, countryCode: null); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'de', countryCode: 'CH'); + locale = const Locale.fromSubtags(languageCode: 'de', scriptCode: null, countryCode: 'CH'); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'th'); + locale = const Locale.fromSubtags(languageCode: 'th', scriptCode: null, countryCode: null); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); - locale = const Locale.fromSubtags(languageCode: 'ru'); + locale = const Locale.fromSubtags(languageCode: 'ru', scriptCode: null, countryCode: null); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); }); testWidgets('Chinese translations spot check', (WidgetTester tester) async { - Locale locale = const Locale.fromSubtags(languageCode: 'zh'); + Locale locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: null, countryCode: null); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); MaterialLocalizations localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); @@ -451,7 +451,7 @@ void main() { expect(localizations.closeButtonLabel, '关闭'); expect(localizations.okButtonLabel, '确定'); - locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hans'); + locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hans', countryCode: null); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); @@ -460,7 +460,7 @@ void main() { expect(localizations.closeButtonLabel, '关闭'); expect(localizations.okButtonLabel, '确定'); - locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant'); + locale = const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant', countryCode: null); expect(GlobalMaterialLocalizations.delegate.isSupported(locale), isTrue); localizations = await GlobalMaterialLocalizations.delegate.load(locale); expect(localizations, isA()); diff --git a/packages/flutter_localizations/test/override_test.dart b/packages/flutter_localizations/test/override_test.dart index f977bb111b..2600fec78e 100644 --- a/packages/flutter_localizations/test/override_test.dart +++ b/packages/flutter_localizations/test/override_test.dart @@ -241,7 +241,7 @@ void main() { await tester.pumpWidget( buildFrame( delegates: [ - const FooMaterialLocalizationsDelegate(), + const FooMaterialLocalizationsDelegate(supportedLanguage: 'en'), ], // supportedLocales not specified, so all locales resolve to 'en' buildContent: (BuildContext context) { diff --git a/packages/flutter_test/lib/src/binding.dart b/packages/flutter_test/lib/src/binding.dart index 0283f59d3e..13e0db7976 100644 --- a/packages/flutter_test/lib/src/binding.dart +++ b/packages/flutter_test/lib/src/binding.dart @@ -1173,7 +1173,7 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { final FakeAsync fakeAsync = FakeAsync(); _currentFakeAsync = fakeAsync; // reset in postTest - _clock = fakeAsync.getClock(DateTime.utc(2015)); + _clock = fakeAsync.getClock(DateTime.utc(2015, 1, 1)); late Future testBodyResult; fakeAsync.run((FakeAsync localFakeAsync) { assert(fakeAsync == _currentFakeAsync); diff --git a/packages/flutter_test/lib/src/controller.dart b/packages/flutter_test/lib/src/controller.dart index cb20e2992d..a6466a3358 100644 --- a/packages/flutter_test/lib/src/controller.dart +++ b/packages/flutter_test/lib/src/controller.dart @@ -705,9 +705,11 @@ abstract class WidgetController { final List records = [ PointerEventRecord(Duration.zero, [ PointerAddedEvent( + timeStamp: Duration.zero, position: startLocation, ), PointerDownEvent( + timeStamp: Duration.zero, position: startLocation, pointer: pointer, buttons: buttons, diff --git a/packages/flutter_test/lib/src/event_simulation.dart b/packages/flutter_test/lib/src/event_simulation.dart index f1667558af..bf865961ff 100644 --- a/packages/flutter_test/lib/src/event_simulation.dart +++ b/packages/flutter_test/lib/src/event_simulation.dart @@ -757,7 +757,7 @@ class KeyEventSimulator { Future _simulateByRawEvent() { return _simulateKeyEventByRawEvent(() { platform ??= _defaultPlatform; - return getKeyData(key, platform: platform!, physicalKey: physicalKey, character: character); + return getKeyData(key, platform: platform!, isDown: true, physicalKey: physicalKey, character: character); }); } switch (_transitMode) { @@ -848,7 +848,7 @@ class KeyEventSimulator { Future _simulateByRawEvent() { return _simulateKeyEventByRawEvent(() { platform ??= _defaultPlatform; - return getKeyData(key, platform: platform!, physicalKey: physicalKey, character: character); + return getKeyData(key, platform: platform!, isDown: true, physicalKey: physicalKey, character: character); }); } switch (_transitMode) { diff --git a/packages/flutter_test/lib/src/image.dart b/packages/flutter_test/lib/src/image.dart index 55ca49295a..7df2e392ce 100644 --- a/packages/flutter_test/lib/src/image.dart +++ b/packages/flutter_test/lib/src/image.dart @@ -50,7 +50,7 @@ Future createTestImage({ Future _createImage(int width, int height) async { final Completer completer = Completer(); ui.decodeImageFromPixels( - Uint8List.fromList(List.filled(width * height * 4, 0)), + Uint8List.fromList(List.filled(width * height * 4, 0, growable: false)), width, height, ui.PixelFormat.rgba8888, diff --git a/packages/flutter_test/lib/src/test_default_binary_messenger.dart b/packages/flutter_test/lib/src/test_default_binary_messenger.dart index ba227d6e40..d0e18ac5a6 100644 --- a/packages/flutter_test/lib/src/test_default_binary_messenger.dart +++ b/packages/flutter_test/lib/src/test_default_binary_messenger.dart @@ -86,7 +86,7 @@ class TestDefaultBinaryMessenger extends BinaryMessenger { Future? result; if (_inboundHandlers.containsKey(channel)) result = _inboundHandlers[channel]!(data); - result ??= Future.value(); + result ??= Future.value(null); if (callback != null) result = result.then((ByteData? result) { callback(result); return result; }); return result; @@ -281,7 +281,7 @@ class TestDefaultBinaryMessenger extends BinaryMessenger { } on MissingPluginException { return null; } catch (error) { - return channel.codec.encodeErrorEnvelope(code: 'error', message: '$error'); + return channel.codec.encodeErrorEnvelope(code: 'error', message: '$error', details: null); } }, handler); } diff --git a/packages/flutter_test/test/controller_test.dart b/packages/flutter_test/test/controller_test.dart index 3513e9b426..25f33e6776 100644 --- a/packages/flutter_test/test/controller_test.dart +++ b/packages/flutter_test/test/controller_test.dart @@ -94,7 +94,7 @@ void main() { expect(semantics.label, 'hello'); expect(semantics.hasAction(SemanticsAction.tap), true); expect(semantics.hasFlag(SemanticsFlag.isButton), true); - }); + }, semanticsEnabled: true); testWidgets('Returns merged SemanticsData', (WidgetTester tester) async { final SemanticsHandle semanticsHandle = tester.ensureSemantics(); @@ -663,12 +663,12 @@ void main() { ); // Make sure widget isn't on screen - expect(find.text('Item 15'), findsNothing); + expect(find.text('Item 15', skipOffstage: true), findsNothing); await tester.ensureVisible(find.text('Item 15', skipOffstage: false)); await tester.pumpAndSettle(); - expect(find.text('Item 15'), findsOneWidget); + expect(find.text('Item 15', skipOffstage: true), findsOneWidget); }, ); @@ -698,7 +698,7 @@ void main() { await tester.pumpAndSettle(); // Now the widget is on screen. - expect(find.text('Item 45'), findsOneWidget); + expect(find.text('Item 45', skipOffstage: true), findsOneWidget); }, ); @@ -729,7 +729,7 @@ void main() { await tester.pumpAndSettle(); // Now the widget is on screen. - expect(find.text('Item 45'), findsOneWidget); + expect(find.text('Item 45', skipOffstage: true), findsOneWidget); }, ); @@ -799,7 +799,7 @@ void main() { await tester.pumpAndSettle(); // Now the widget is on screen. - expect(find.text('Item b-45'), findsOneWidget); + expect(find.text('Item b-45', skipOffstage: true), findsOneWidget); }); }); } diff --git a/packages/flutter_test/test/finders_test.dart b/packages/flutter_test/test/finders_test.dart index 1c4342b3d1..fc8923b6ed 100644 --- a/packages/flutter_test/test/finders_test.dart +++ b/packages/flutter_test/test/finders_test.dart @@ -12,16 +12,16 @@ void main() { group('image', () { testWidgets('finds Image widgets', (WidgetTester tester) async { await tester.pumpWidget(_boilerplate( - Image(image: FileImage(File('test'))) + Image(image: FileImage(File('test'), scale: 1.0)) )); - expect(find.image(FileImage(File('test'))), findsOneWidget); + expect(find.image(FileImage(File('test'), scale: 1.0)), findsOneWidget); }); testWidgets('finds Button widgets with Image', (WidgetTester tester) async { await tester.pumpWidget(_boilerplate( - ElevatedButton(onPressed: null, child: Image(image: FileImage(File('test'))),) + ElevatedButton(onPressed: null, child: Image(image: FileImage(File('test'), scale: 1.0)),) )); - expect(find.widgetWithImage(ElevatedButton, FileImage(File('test'))), findsOneWidget); + expect(find.widgetWithImage(ElevatedButton, FileImage(File('test'), scale: 1.0)), findsOneWidget); }); }); @@ -79,7 +79,7 @@ void main() { ), ))); - expect(find.text('test'), findsNothing); + expect(find.text('test', findRichText: false), findsNothing); }); testWidgets( @@ -120,7 +120,7 @@ void main() { ), ))); - expect(find.text('test3'), findsOneWidget); + expect(find.text('test3', findRichText: false), findsOneWidget); }); }); }); @@ -234,7 +234,7 @@ void main() { )), ); expect(find.byType(GestureDetector), findsNWidgets(2)); - final Finder hitTestable = find.byType(GestureDetector).hitTestable(); + final Finder hitTestable = find.byType(GestureDetector).hitTestable(at: Alignment.center); expect(hitTestable, findsOneWidget); expect(tester.widget(hitTestable).key, const ValueKey(0)); }); diff --git a/packages/flutter_test/test/goldens_test.dart b/packages/flutter_test/test/goldens_test.dart index 6082843534..74f2f947e4 100644 --- a/packages/flutter_test/test/goldens_test.dart +++ b/packages/flutter_test/test/goldens_test.dart @@ -162,7 +162,7 @@ void main() { ..writeAsBytesSync(_kExpectedPngBytes); fs.currentDirectory = fix('/foo/bar'); comparator = LocalFileComparator(Uri.parse('local_test.dart'), pathStyle: fs.path.style); - final bool success = await doComparison(); + final bool success = await doComparison('golden.png'); expect(success, isTrue); }); diff --git a/packages/flutter_test/test/live_widget_controller_test.dart b/packages/flutter_test/test/live_widget_controller_test.dart index 00fdd76c48..96908277c8 100644 --- a/packages/flutter_test/test/live_widget_controller_test.dart +++ b/packages/flutter_test/test/live_widget_controller_test.dart @@ -111,9 +111,11 @@ void main() { // Typically PointerAddedEvent is not used in testers, but for records // captured on a device it is usually what start a gesture. PointerAddedEvent( + timeStamp: Duration.zero, position: location, ), PointerDownEvent( + timeStamp: Duration.zero, position: location, buttons: kSecondaryMouseButton, pointer: 1, diff --git a/packages/flutter_test/test/widget_tester_live_device_test.dart b/packages/flutter_test/test/widget_tester_live_device_test.dart index 070fbcf9e6..34db4e36b0 100644 --- a/packages/flutter_test/test/widget_tester_live_device_test.dart +++ b/packages/flutter_test/test/widget_tester_live_device_test.dart @@ -127,7 +127,7 @@ class _MockLiveTestWidgetsFlutterBinding extends LiveTestWidgetsFlutterBinding { // See the documentation of [handlePointerEventForSource] for details. if (source == TestBindingEventSource.test) { final PointerEvent globalEvent = event.copyWith(position: localToGlobal(event.position)); - return super.handlePointerEventForSource(globalEvent); + return super.handlePointerEventForSource(globalEvent, source: TestBindingEventSource.device); } return super.handlePointerEventForSource(event, source: source); } diff --git a/packages/flutter_test/test/widget_tester_test.dart b/packages/flutter_test/test/widget_tester_test.dart index ae3b2820d5..ceeeace9b9 100644 --- a/packages/flutter_test/test/widget_tester_test.dart +++ b/packages/flutter_test/test/widget_tester_test.dart @@ -508,9 +508,11 @@ void main() { // Typically PointerAddedEvent is not used in testers, but for records // captured on a device it is usually what start a gesture. PointerAddedEvent( + timeStamp: Duration.zero, position: location, ), PointerDownEvent( + timeStamp: Duration.zero, position: location, buttons: kSecondaryMouseButton, pointer: 1, diff --git a/packages/flutter_tools/bin/fuchsia_attach.dart b/packages/flutter_tools/bin/fuchsia_attach.dart index 1000c5e805..b4e3b5590c 100644 --- a/packages/flutter_tools/bin/fuchsia_attach.dart +++ b/packages/flutter_tools/bin/fuchsia_attach.dart @@ -108,6 +108,8 @@ Future main(List args) async { _FuchsiaDoctorCommand(), // If attach fails the tool will attempt to run doctor. ], verbose: verbose, + muteCommandLogging: false, + verboseHelp: false, overrides: { FeatureFlags: () => const _FuchsiaFeatureFlags(), DeviceManager: () => _FuchsiaDeviceManager(), diff --git a/packages/flutter_tools/bin/fuchsia_tester.dart b/packages/flutter_tools/bin/fuchsia_tester.dart index 072f930545..305aab2f91 100644 --- a/packages/flutter_tools/bin/fuchsia_tester.dart +++ b/packages/flutter_tools/bin/fuchsia_tester.dart @@ -151,6 +151,7 @@ Future run(List args) async { ), ), watcher: collector, + ipv6: false, enableObservatory: collector != null, precompiledDillFiles: tests, concurrency: math.max(1, globals.platform.numberOfProcessors - 2), diff --git a/packages/flutter_tools/lib/runner.dart b/packages/flutter_tools/lib/runner.dart index 965f2f7d63..4d3da3ada8 100644 --- a/packages/flutter_tools/lib/runner.dart +++ b/packages/flutter_tools/lib/runner.dart @@ -229,7 +229,7 @@ Future _doctorText() async { ); final Doctor doctor = Doctor(logger: logger); - await doctor.diagnose(showColor: false); + await doctor.diagnose(verbose: true, showColor: false); return logger.statusText; } on Exception catch (error, trace) { diff --git a/packages/flutter_tools/lib/src/android/deferred_components_gen_snapshot_validator.dart b/packages/flutter_tools/lib/src/android/deferred_components_gen_snapshot_validator.dart index 6396943948..9299ba1223 100644 --- a/packages/flutter_tools/lib/src/android/deferred_components_gen_snapshot_validator.dart +++ b/packages/flutter_tools/lib/src/android/deferred_components_gen_snapshot_validator.dart @@ -279,6 +279,7 @@ class DeferredComponentsGenSnapshotValidator extends DeferredComponentsValidator loadingUnits.add( LoadingUnit( id: loadingUnitDataMap!['id'] as int, + path: null, libraries: libraries, )); } diff --git a/packages/flutter_tools/lib/src/base/config.dart b/packages/flutter_tools/lib/src/base/config.dart index b14f9abf29..57d6455756 100644 --- a/packages/flutter_tools/lib/src/base/config.dart +++ b/packages/flutter_tools/lib/src/base/config.dart @@ -38,7 +38,8 @@ class Config { name, fileSystem: fileSystem, logger: logger, - platform: platform + platform: platform, + managed: false ); } diff --git a/packages/flutter_tools/lib/src/base/error_handling_io.dart b/packages/flutter_tools/lib/src/base/error_handling_io.dart index 4675a889e6..3678e45fe2 100644 --- a/packages/flutter_tools/lib/src/base/error_handling_io.dart +++ b/packages/flutter_tools/lib/src/base/error_handling_io.dart @@ -312,7 +312,7 @@ class ErrorHandlingFile // First check if the source file can be read. If not, bail through error // handling. _runSync( - () => delegate.openSync().closeSync(), + () => delegate.openSync(mode: FileMode.read).closeSync(), platform: _platform, failureMessage: 'Flutter failed to copy $path to $newPath due to source location error', posixPermissionSuggestion: _posixPermissionSuggestion([path]), @@ -337,7 +337,7 @@ class ErrorHandlingFile RandomAccessFile? source; RandomAccessFile? sink; try { - source = delegate.openSync(); + source = delegate.openSync(mode: FileMode.read); sink = resultFile.openSync(mode: FileMode.writeOnly); // 64k is the same sized buffer used by dart:io for `File.openRead`. final Uint8List buffer = Uint8List(64 * 1024); diff --git a/packages/flutter_tools/lib/src/build_system/build_system.dart b/packages/flutter_tools/lib/src/build_system/build_system.dart index 557f4f4a91..7994a6e6bd 100644 --- a/packages/flutter_tools/lib/src/build_system/build_system.dart +++ b/packages/flutter_tools/lib/src/build_system/build_system.dart @@ -191,7 +191,7 @@ abstract class Target { /// Resolve the set of input patterns and functions into a concrete list of /// files. ResolvedFiles resolveInputs(Environment environment) { - return _resolveConfiguration(inputs, depfiles, environment); + return _resolveConfiguration(inputs, depfiles, environment, implicit: true, inputs: true); } /// Find the current set of declared outputs, including wildcard directories. @@ -236,11 +236,8 @@ abstract class Target { return environment.buildDir.childFile(fileName); } - static ResolvedFiles _resolveConfiguration( - List config, - List depfiles, - Environment environment, { - bool inputs = true, + static ResolvedFiles _resolveConfiguration(List config, + List depfiles, Environment environment, { bool implicit = true, bool inputs = true, }) { final SourceVisitor collector = SourceVisitor(environment, inputs); for (final Source source in config) { diff --git a/packages/flutter_tools/lib/src/build_system/file_store.dart b/packages/flutter_tools/lib/src/build_system/file_store.dart index 5045370a60..48d8ef8247 100644 --- a/packages/flutter_tools/lib/src/build_system/file_store.dart +++ b/packages/flutter_tools/lib/src/build_system/file_store.dart @@ -236,7 +236,7 @@ class FileStore { final Md5Hash hash = Md5Hash(); RandomAccessFile? openFile; try { - openFile = file.openSync(); + openFile = file.openSync(mode: FileMode.read); int bytes = 0; while (bytes < fileBytes) { final int bytesRead = openFile.readIntoSync(_readBuffer); diff --git a/packages/flutter_tools/lib/src/build_system/targets/android.dart b/packages/flutter_tools/lib/src/build_system/targets/android.dart index d17efc4e32..da264a832b 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/android.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/android.dart @@ -207,6 +207,7 @@ class AndroidAot extends AotElfBase { @override Future build(Environment environment) async { final AOTSnapshotter snapshotter = AOTSnapshotter( + reportTimings: false, fileSystem: environment.fileSystem, logger: environment.logger, xcode: globals.xcode, diff --git a/packages/flutter_tools/lib/src/build_system/targets/assets.dart b/packages/flutter_tools/lib/src/build_system/targets/assets.dart index 68a4cd0257..5a01c65059 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/assets.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/assets.dart @@ -50,6 +50,7 @@ Future copyAssets(Environment environment, Directory outputDirectory, { final int resultCode = await assetBundle.build( manifestPath: pubspecFile.path, packagesPath: environment.projectDir.childFile('.packages').path, + assetDirPath: null, deferredComponentsEnabled: environment.defines[kDeferredComponents] == 'true', targetPlatform: targetPlatform, ); diff --git a/packages/flutter_tools/lib/src/build_system/targets/common.dart b/packages/flutter_tools/lib/src/build_system/targets/common.dart index f3b6dd5e63..590b3c50f8 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/common.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/common.dart @@ -154,6 +154,7 @@ class KernelSnapshot extends Target { processManager: environment.processManager, artifacts: environment.artifacts, fileSystemRoots: [], + fileSystemScheme: null, ); final String? buildModeEnvironment = environment.defines[kBuildMode]; if (buildModeEnvironment == null) { @@ -241,6 +242,7 @@ abstract class AotElfBase extends Target { @override Future build(Environment environment) async { final AOTSnapshotter snapshotter = AOTSnapshotter( + reportTimings: false, fileSystem: environment.fileSystem, logger: environment.logger, xcode: globals.xcode!, diff --git a/packages/flutter_tools/lib/src/build_system/targets/dart_plugin_registrant.dart b/packages/flutter_tools/lib/src/build_system/targets/dart_plugin_registrant.dart index c3054f6be6..d5f2fb0e86 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/dart_plugin_registrant.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/dart_plugin_registrant.dart @@ -51,6 +51,7 @@ class DartPluginRegistrantTarget extends Target { packageConfig, mainFileUriString, mainFile, + throwOnPluginPubspecError: false, ); } diff --git a/packages/flutter_tools/lib/src/build_system/targets/ios.dart b/packages/flutter_tools/lib/src/build_system/targets/ios.dart index 94d53a0cf6..a61609cb2b 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/ios.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/ios.dart @@ -35,6 +35,7 @@ abstract class AotAssemblyBase extends Target { @override Future build(Environment environment) async { final AOTSnapshotter snapshotter = AOTSnapshotter( + reportTimings: false, fileSystem: environment.fileSystem, logger: environment.logger, xcode: globals.xcode, diff --git a/packages/flutter_tools/lib/src/build_system/targets/macos.dart b/packages/flutter_tools/lib/src/build_system/targets/macos.dart index 9672906db8..8e2ef25f9d 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/macos.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/macos.dart @@ -254,6 +254,7 @@ class CompileMacOSFramework extends Target { } final AOTSnapshotter snapshotter = AOTSnapshotter( + reportTimings: false, fileSystem: environment.fileSystem, logger: environment.logger, xcode: globals.xcode, diff --git a/packages/flutter_tools/lib/src/commands/build_appbundle.dart b/packages/flutter_tools/lib/src/commands/build_appbundle.dart index 329267a9ae..4eb512db66 100644 --- a/packages/flutter_tools/lib/src/commands/build_appbundle.dart +++ b/packages/flutter_tools/lib/src/commands/build_appbundle.dart @@ -119,6 +119,7 @@ class BuildAppBundleCommand extends BuildSubCommand { globals.logger, globals.platform, title: 'Deferred components prebuild validation', + exitOnFail: true, ); validator.clearOutputDir(); await validator.checkAndroidDynamicFeature(FlutterProject.current().manifest.deferredComponents); diff --git a/packages/flutter_tools/lib/src/commands/build_bundle.dart b/packages/flutter_tools/lib/src/commands/build_bundle.dart index 52f67b52b0..f8fa4ad040 100644 --- a/packages/flutter_tools/lib/src/commands/build_bundle.dart +++ b/packages/flutter_tools/lib/src/commands/build_bundle.dart @@ -131,6 +131,7 @@ class BuildBundleCommand extends BuildSubCommand { platform: platform, buildInfo: buildInfo, mainPath: targetFile, + manifestPath: defaultManifestPath, depfilePath: stringArg('depfile'), assetDirPath: stringArg('asset-dir'), ); diff --git a/packages/flutter_tools/lib/src/commands/build_ios.dart b/packages/flutter_tools/lib/src/commands/build_ios.dart index eeeee80ab8..76685506a3 100644 --- a/packages/flutter_tools/lib/src/commands/build_ios.dart +++ b/packages/flutter_tools/lib/src/commands/build_ios.dart @@ -186,7 +186,7 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand { _BuildIOSSubCommand({ @required bool verboseHelp }) { addTreeShakeIconsFlag(); addSplitDebugInfoOption(); - addBuildModeFlags(verboseHelp: verboseHelp); + addBuildModeFlags(verboseHelp: verboseHelp, defaultToRelease: true); usesTargetOption(); usesFlavorOption(); usesPubOption(); diff --git a/packages/flutter_tools/lib/src/commands/build_ios_framework.dart b/packages/flutter_tools/lib/src/commands/build_ios_framework.dart index 2855277b1d..6369b176a5 100644 --- a/packages/flutter_tools/lib/src/commands/build_ios_framework.dart +++ b/packages/flutter_tools/lib/src/commands/build_ios_framework.dart @@ -359,7 +359,7 @@ end projectDir: globals.fs.currentDirectory, outputDir: outputBuildDirectory, buildDir: _project.dartTool.childDirectory('flutter_build'), - cacheDir: globals.cache.getRoot(), + cacheDir: null, flutterRootDir: globals.fs.directory(Cache.flutterRoot), defines: { kTargetFile: targetFile, diff --git a/packages/flutter_tools/lib/src/commands/build_web.dart b/packages/flutter_tools/lib/src/commands/build_web.dart index 8cb8b06a27..06dbab3764 100644 --- a/packages/flutter_tools/lib/src/commands/build_web.dart +++ b/packages/flutter_tools/lib/src/commands/build_web.dart @@ -29,7 +29,7 @@ class BuildWebCommand extends BuildSubCommand { usesWebRendererOption(); addEnableExperimentation(hide: !verboseHelp); addNullSafetyModeOptions(hide: !verboseHelp); - addNativeNullAssertions(); + addNativeNullAssertions(hide: false); argParser.addFlag('csp', defaultsTo: false, negatable: false, diff --git a/packages/flutter_tools/lib/src/commands/custom_devices.dart b/packages/flutter_tools/lib/src/commands/custom_devices.dart index 4c144e1a35..91c820338c 100644 --- a/packages/flutter_tools/lib/src/commands/custom_devices.dart +++ b/packages/flutter_tools/lib/src/commands/custom_devices.dart @@ -635,6 +635,7 @@ class CustomDevicesAddCommand extends CustomDevicesCommandBase { final bool enabled = await askForBool( 'enabled', description: 'Should the device be enabled?', + defaultsTo: true, ); final String targetStr = await askForString( @@ -673,6 +674,7 @@ class CustomDevicesAddCommand extends CustomDevicesCommandBase { 'remote device has a static IP address and you have a way of ' 'specifying the "--observatory-host=" engine option, you might prefer ' 'not using port forwarding.', + defaultsTo: true, ); final String screenshotCommand = await askForString( @@ -700,8 +702,9 @@ class CustomDevicesAddCommand extends CustomDevicesCommandBase { // host-platform specific, filled out later pingCommand: const [], + pingSuccessRegex: null, - postBuildCommand: const [], + postBuildCommand: null, // just install to /tmp/${appName} by default installCommand: [ diff --git a/packages/flutter_tools/lib/src/commands/daemon.dart b/packages/flutter_tools/lib/src/commands/daemon.dart index 83c5883163..3e99d24829 100644 --- a/packages/flutter_tools/lib/src/commands/daemon.dart +++ b/packages/flutter_tools/lib/src/commands/daemon.dart @@ -1135,7 +1135,7 @@ class EmulatorDomain extends Domain { } Future> create(Map args) async { - final String name = _getStringArg(args, 'name'); + final String name = _getStringArg(args, 'name', required: false); final CreateEmulatorResult res = await emulators.createEmulator(name: name); return { 'success': res.success, diff --git a/packages/flutter_tools/lib/src/commands/run.dart b/packages/flutter_tools/lib/src/commands/run.dart index ef9999a958..c56742dc6b 100644 --- a/packages/flutter_tools/lib/src/commands/run.dart +++ b/packages/flutter_tools/lib/src/commands/run.dart @@ -248,7 +248,7 @@ class RunCommand extends RunCommandBase { // By default, the app should to publish the VM service port over mDNS. // This will allow subsequent "flutter attach" commands to connect to the VM // without needing to know the port. - addPublishPort(verboseHelp: verboseHelp); + addPublishPort(enabledByDefault: true, verboseHelp: verboseHelp); argParser ..addFlag('enable-software-rendering', negatable: false, @@ -563,6 +563,7 @@ class RunCommand extends RunCommandBase { packagesFilePath: globalResults['packages'] as String, dillOutputPath: stringArg('output-dill'), ipv6: ipv6, + machine: true, ); } on Exception catch (error) { throwToolExit(error.toString()); diff --git a/packages/flutter_tools/lib/src/commands/upgrade.dart b/packages/flutter_tools/lib/src/commands/upgrade.dart index f67689deda..038a02969a 100644 --- a/packages/flutter_tools/lib/src/commands/upgrade.dart +++ b/packages/flutter_tools/lib/src/commands/upgrade.dart @@ -10,6 +10,7 @@ import '../base/common.dart'; import '../base/io.dart'; import '../base/os.dart'; import '../base/process.dart'; +import '../base/time.dart'; import '../cache.dart'; import '../dart/pub.dart'; import '../globals_null_migrated.dart' as globals; @@ -78,7 +79,7 @@ class UpgradeCommand extends FlutterCommand { gitTagVersion: GitTagVersion.determine(globals.processUtils), flutterVersion: stringArg('working-directory') == null ? globals.flutterVersion - : FlutterVersion(workingDirectory: _commandRunner.workingDirectory), + : FlutterVersion(clock: const SystemClock(), workingDirectory: _commandRunner.workingDirectory), verifyOnly: boolArg('verify-only'), ); } diff --git a/packages/flutter_tools/lib/src/compile.dart b/packages/flutter_tools/lib/src/compile.dart index f09cce3667..731829c999 100644 --- a/packages/flutter_tools/lib/src/compile.dart +++ b/packages/flutter_tools/lib/src/compile.dart @@ -908,7 +908,7 @@ class DefaultResidentCompiler implements ResidentCompiler { Future _reject() async { if (!_compileRequestNeedsConfirmation) { - return Future.value(); + return Future.value(null); } _stdoutHandler.reset(expectSources: false); _server?.stdin.writeln('reject'); diff --git a/packages/flutter_tools/lib/src/context_runner.dart b/packages/flutter_tools/lib/src/context_runner.dart index 463113ac6f..d3488d8004 100644 --- a/packages/flutter_tools/lib/src/context_runner.dart +++ b/packages/flutter_tools/lib/src/context_runner.dart @@ -232,7 +232,7 @@ Future runInContext( config: globals.config, platform: globals.platform, ), - FlutterVersion: () => FlutterVersion(), + FlutterVersion: () => FlutterVersion(clock: const SystemClock()), FuchsiaArtifacts: () => FuchsiaArtifacts.find(), FuchsiaDeviceTools: () => FuchsiaDeviceTools(), FuchsiaSdk: () => FuchsiaSdk(), diff --git a/packages/flutter_tools/lib/src/custom_devices/custom_device_config.dart b/packages/flutter_tools/lib/src/custom_devices/custom_device_config.dart index 1fda61d791..cc2c158520 100644 --- a/packages/flutter_tools/lib/src/custom_devices/custom_device_config.dart +++ b/packages/flutter_tools/lib/src/custom_devices/custom_device_config.dart @@ -284,7 +284,8 @@ class CustomDeviceConfig { '-c', '1', 'raspberrypi' ], - explicitPingSuccessRegex: true + explicitPingSuccessRegex: true, + pingSuccessRegex: null ); /// Returns an example custom device config that works on the given host platform. diff --git a/packages/flutter_tools/lib/src/devfs.dart b/packages/flutter_tools/lib/src/devfs.dart index e8670eb92d..4aea017f70 100644 --- a/packages/flutter_tools/lib/src/devfs.dart +++ b/packages/flutter_tools/lib/src/devfs.dart @@ -639,7 +639,7 @@ class DevFS { } final CompilerOutput? compilerOutput = await pendingCompilerOutput; if (compilerOutput == null || compilerOutput.errorCount > 0) { - return UpdateFSReport(); + return UpdateFSReport(success: false); } // Only update the last compiled time if we successfully compiled. _previousCompiled = lastCompiled; diff --git a/packages/flutter_tools/lib/src/drive/web_driver_service.dart b/packages/flutter_tools/lib/src/drive/web_driver_service.dart index 4b3d12ac81..71284dde7f 100644 --- a/packages/flutter_tools/lib/src/drive/web_driver_service.dart +++ b/packages/flutter_tools/lib/src/drive/web_driver_service.dart @@ -91,6 +91,7 @@ class WebDriverService extends DriverService { final Completer appStartedCompleter = Completer.sync(); final Future runFuture = _residentRunner.run( appStartedCompleter: appStartedCompleter, + enableDevTools: false, route: route, ); diff --git a/packages/flutter_tools/lib/src/features.dart b/packages/flutter_tools/lib/src/features.dart index e338073d45..fb4494ddbe 100644 --- a/packages/flutter_tools/lib/src/features.dart +++ b/packages/flutter_tools/lib/src/features.dart @@ -101,15 +101,19 @@ const Feature flutterMacOSDesktopFeature = Feature( extraHelpText: 'Newer beta versions are available on the beta channel.', master: FeatureChannelSetting( available: true, + enabledByDefault: false, ), dev: FeatureChannelSetting( available: true, + enabledByDefault: false, ), beta: FeatureChannelSetting( available: true, + enabledByDefault: false, ), stable: FeatureChannelSetting( available: true, + enabledByDefault: false, ), ); @@ -121,15 +125,19 @@ const Feature flutterLinuxDesktopFeature = Feature( extraHelpText: 'Newer beta versions are available on the beta channel.', master: FeatureChannelSetting( available: true, + enabledByDefault: false, ), dev: FeatureChannelSetting( available: true, + enabledByDefault: false, ), beta: FeatureChannelSetting( available: true, + enabledByDefault: false, ), stable: FeatureChannelSetting( available: true, + enabledByDefault: false, ), ); @@ -141,15 +149,19 @@ const Feature flutterWindowsDesktopFeature = Feature( extraHelpText: 'Newer beta versions are available on the beta channel.', master: FeatureChannelSetting( available: true, + enabledByDefault: false, ), dev: FeatureChannelSetting( available: true, + enabledByDefault: false, ), beta: FeatureChannelSetting( available: true, + enabledByDefault: false, ), stable: FeatureChannelSetting( available: true, + enabledByDefault: false, ), ); @@ -205,6 +217,7 @@ const Feature flutterFuchsiaFeature = Feature( environmentOverride: 'FLUTTER_FUCHSIA', master: FeatureChannelSetting( available: true, + enabledByDefault: false, ), ); @@ -214,9 +227,19 @@ const Feature flutterCustomDevicesFeature = Feature( environmentOverride: 'FLUTTER_CUSTOM_DEVICES', master: FeatureChannelSetting( available: true, + enabledByDefault: false, ), dev: FeatureChannelSetting( available: true, + enabledByDefault: false, + ), + beta: FeatureChannelSetting( + available: false, + enabledByDefault: false, + ), + stable: FeatureChannelSetting( + available: false, + enabledByDefault: false, ) ); @@ -231,9 +254,15 @@ const Feature singleWidgetReload = Feature( ), dev: FeatureChannelSetting( available: true, + enabledByDefault: false, ), beta: FeatureChannelSetting( available: true, + enabledByDefault: false, + ), + stable: FeatureChannelSetting( + available: false, + enabledByDefault: false, ), ); @@ -243,9 +272,11 @@ const Feature windowsUwpEmbedding = Feature( configSetting: 'enable-windows-uwp-desktop', master: FeatureChannelSetting( available: true, + enabledByDefault: false, ), dev: FeatureChannelSetting( available: true, + enabledByDefault: false, ), ); diff --git a/packages/flutter_tools/lib/src/flutter_cache.dart b/packages/flutter_tools/lib/src/flutter_cache.dart index 7f21f8313c..13a37fad26 100644 --- a/packages/flutter_tools/lib/src/flutter_cache.dart +++ b/packages/flutter_tools/lib/src/flutter_cache.dart @@ -119,6 +119,7 @@ class PubDependencies extends ArtifactSet { await _pub().get( context: PubContext.pubGet, directory: fileSystem.path.join(_flutterRoot(), 'packages', 'flutter_tools'), + generateSyntheticPackage: false, ); } } diff --git a/packages/flutter_tools/lib/src/flutter_plugins.dart b/packages/flutter_tools/lib/src/flutter_plugins.dart index 9215167c90..2f0d7ad44c 100644 --- a/packages/flutter_tools/lib/src/flutter_plugins.dart +++ b/packages/flutter_tools/lib/src/flutter_plugins.dart @@ -27,7 +27,7 @@ import 'project.dart'; void _renderTemplateToFile(String template, Object? context, File file, TemplateRenderer templateRenderer) { final String renderedTemplate = templateRenderer - .renderString(template, context); + .renderString(template, context, htmlEscapeValues: false); file.createSync(recursive: true); file.writeAsStringSync(renderedTemplate); } diff --git a/packages/flutter_tools/lib/src/ios/code_signing.dart b/packages/flutter_tools/lib/src/ios/code_signing.dart index 5a958f3a3f..f3096a6d3a 100644 --- a/packages/flutter_tools/lib/src/ios/code_signing.dart +++ b/packages/flutter_tools/lib/src/ios/code_signing.dart @@ -151,6 +151,7 @@ Future getCodeSigningIdentityDevelopmentTeam({ logger: logger, config: config, terminal: terminal, + shouldExitOnNoCerts: false, ); /// Set [shouldExitOnNoCerts] to show instructions for how to add a cert when none are found, then [toolExit]. @@ -301,6 +302,7 @@ Future _chooseSigningIdentity( List.generate(count, (int number) => '${number + 1}') ..add('a'), prompt: 'Please select a certificate for code signing', + displayAcceptedCharacters: true, defaultChoiceIndex: 0, // Just pressing enter chooses the first one. logger: logger, ); diff --git a/packages/flutter_tools/lib/src/isolated/devfs_web.dart b/packages/flutter_tools/lib/src/isolated/devfs_web.dart index 750915466a..ebba406ec2 100644 --- a/packages/flutter_tools/lib/src/isolated/devfs_web.dart +++ b/packages/flutter_tools/lib/src/isolated/devfs_web.dart @@ -854,7 +854,7 @@ class WebDevFS implements DevFS { fs: globals.fs, ); if (compilerOutput == null || compilerOutput.errorCount > 0) { - return UpdateFSReport(); + return UpdateFSReport(success: false); } // Only update the last compiled time if we successfully compiled. diff --git a/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart b/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart index 0ac5ce2f33..41d5f6266d 100644 --- a/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart +++ b/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart @@ -356,7 +356,7 @@ class ResidentWebRunner extends ResidentRunner { if (debuggingOptions.buildInfo.isDebug) { await runSourceGenerators(); // Full restart is always false for web, since the extra recompile is wasteful. - final UpdateFSReport report = await _updateDevFS(); + final UpdateFSReport report = await _updateDevFS(fullRestart: false); if (report.success) { device.generator.accept(); } else { @@ -415,7 +415,7 @@ class ResidentWebRunner extends ResidentRunner { fullRestart: true, reason: reason, overallTimeInMs: elapsed.inMilliseconds, - fastReassemble: false, + fastReassemble: null, ).send(); } return OperationResult.ok; @@ -498,7 +498,7 @@ class ResidentWebRunner extends ResidentRunner { targetPlatform: TargetPlatform.web_javascript, ); if (result != 0) { - return UpdateFSReport(); + return UpdateFSReport(success: false); } } final InvalidationResult invalidationResult = await projectFileInvalidator.findInvalidated( @@ -589,7 +589,7 @@ class ResidentWebRunner extends ResidentRunner { bool force, bool pause, }) async { - await restart(pause: pause); + await restart(benchmarkMode: false, pause: pause, fullRestart: false); }, null, null, diff --git a/packages/flutter_tools/lib/src/localizations/gen_l10n.dart b/packages/flutter_tools/lib/src/localizations/gen_l10n.dart index 40cd33c7e9..a45d69beed 100644 --- a/packages/flutter_tools/lib/src/localizations/gen_l10n.dart +++ b/packages/flutter_tools/lib/src/localizations/gen_l10n.dart @@ -132,7 +132,7 @@ String generateDateFormattingLogic(Message message) { .replaceAll('@(format)', generateString(placeholderFormat)); }); - return formatStatements.isEmpty ? '@(none)' : formatStatements.join(); + return formatStatements.isEmpty ? '@(none)' : formatStatements.join(''); } String generateNumberFormattingLogic(Message message) { @@ -174,7 +174,7 @@ String generateNumberFormattingLogic(Message message) { } }); - return formatStatements.isEmpty ? '@(none)' : formatStatements.join(); + return formatStatements.isEmpty ? '@(none)' : formatStatements.join(''); } String _generatePluralMethod(Message message, String translationForMessage) { diff --git a/packages/flutter_tools/lib/src/localizations/localizations_utils.dart b/packages/flutter_tools/lib/src/localizations/localizations_utils.dart index 19298f2737..fd435e74fe 100644 --- a/packages/flutter_tools/lib/src/localizations/localizations_utils.dart +++ b/packages/flutter_tools/lib/src/localizations/localizations_utils.dart @@ -119,7 +119,7 @@ class LocaleInfo implements Comparable { return originalString .split('_') .map((String part) => part.substring(0, 1).toUpperCase() + part.substring(1).toLowerCase()) - .join(); + .join(''); } @override diff --git a/packages/flutter_tools/lib/src/project.dart b/packages/flutter_tools/lib/src/project.dart index 01bd45ef80..3d120bf73e 100644 --- a/packages/flutter_tools/lib/src/project.dart +++ b/packages/flutter_tools/lib/src/project.dart @@ -550,6 +550,7 @@ to migrate your project. 'androidX': usesAndroidX, }, printStatusWhenWriting: false, + overwriteExisting: true, ); } diff --git a/packages/flutter_tools/lib/src/reporting/usage.dart b/packages/flutter_tools/lib/src/reporting/usage.dart index 8c3e78be1f..303ca501f8 100644 --- a/packages/flutter_tools/lib/src/reporting/usage.dart +++ b/packages/flutter_tools/lib/src/reporting/usage.dart @@ -369,35 +369,35 @@ class LogToFileAnalytics extends AnalyticsMock { Map? parameters, }) { if (!enabled) { - return Future.value(); + return Future.value(null); } parameters ??= {}; parameters['viewName'] = viewName; parameters.addAll(_sessionValues); _sendController.add(parameters); logFile.writeAsStringSync('screenView $parameters\n', mode: FileMode.append); - return Future.value(); + return Future.value(null); } @override Future sendEvent(String category, String action, {String? label, int? value, Map? parameters}) { if (!enabled) { - return Future.value(); + return Future.value(null); } parameters ??= {}; parameters['category'] = category; parameters['action'] = action; _sendController.add(parameters); logFile.writeAsStringSync('event $parameters\n', mode: FileMode.append); - return Future.value(); + return Future.value(null); } @override Future sendTiming(String variableName, int time, {String? category, String? label}) { if (!enabled) { - return Future.value(); + return Future.value(null); } final Map parameters = { 'variableName': variableName, @@ -407,7 +407,7 @@ class LogToFileAnalytics extends AnalyticsMock { }; _sendController.add(parameters); logFile.writeAsStringSync('timing $parameters\n', mode: FileMode.append); - return Future.value(); + return Future.value(null); } @override diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart index eef7a2ecf9..e59cd5527d 100644 --- a/packages/flutter_tools/lib/src/resident_runner.dart +++ b/packages/flutter_tools/lib/src/resident_runner.dart @@ -560,7 +560,7 @@ class FlutterDevice { ); } on DevFSException { devFSStatus.cancel(); - return UpdateFSReport(); + return UpdateFSReport(success: false); } devFSStatus.stop(); globals.printTrace('Synced ${getSizeAsMB(report.syncedBytes)}.'); @@ -1607,7 +1607,7 @@ class TerminalHandler { if (!residentRunner.canHotReload) { return false; } - final OperationResult result = await residentRunner.restart(); + final OperationResult result = await residentRunner.restart(fullRestart: false); if (result.fatal) { throwToolExit(result.message); } diff --git a/packages/flutter_tools/lib/src/run_hot.dart b/packages/flutter_tools/lib/src/run_hot.dart index e81bf73d64..cf4677f00c 100644 --- a/packages/flutter_tools/lib/src/run_hot.dart +++ b/packages/flutter_tools/lib/src/run_hot.dart @@ -324,7 +324,7 @@ class HotRunner extends ResidentRunner { globals.printStatus('Benchmarking hot reload'); // Measure time to perform a hot reload. - await restart(); + await restart(fullRestart: false); if (stayResident) { await waitForAppToFinish(); } else { @@ -411,8 +411,8 @@ class HotRunner extends ResidentRunner { targetPlatform: _targetPlatform, sdkName: _sdkName, emulator: _emulator, - fullRestart: false, - fastReassemble: false, + fullRestart: null, + fastReassemble: null, overallTimeInMs: appStartedTimer.elapsed.inMilliseconds, compileTimeInMs: totalCompileTime.inMilliseconds, transferTimeInMs: totalLaunchAppTime.inMilliseconds, @@ -456,7 +456,7 @@ class HotRunner extends ResidentRunner { globals.printTrace('Updating assets'); final int result = await assetBundle.build(packagesPath: '.packages'); if (result != 0) { - return UpdateFSReport(); + return UpdateFSReport(success: false); } } @@ -760,7 +760,7 @@ class HotRunner extends ResidentRunner { emulator: emulator, fullRestart: true, reason: reason, - fastReassemble: false, + fastReassemble: null, overallTimeInMs: restartTimer.elapsed.inMilliseconds, syncedBytes: result.updateFSReport?.syncedBytes, invalidatedSourcesCount: result.updateFSReport?.invalidatedSourcesCount, @@ -786,7 +786,7 @@ class HotRunner extends ResidentRunner { emulator: emulator, fullRestart: true, reason: reason, - fastReassemble: false, + fastReassemble: null, ).send(); } status?.cancel(); @@ -836,7 +836,7 @@ class HotRunner extends ResidentRunner { emulator: emulator, fullRestart: false, reason: reason, - fastReassemble: false, + fastReassemble: null, ).send(); } else { HotEvent('exception', @@ -845,7 +845,7 @@ class HotRunner extends ResidentRunner { emulator: emulator, fullRestart: false, reason: reason, - fastReassemble: false, + fastReassemble: null, ).send(); } return OperationResult(errorCode, errorMessage, fatal: true); @@ -1142,7 +1142,7 @@ Future _defaultReloadSourcesHelper( emulator: emulator, fullRestart: false, reason: reason, - fastReassemble: false, + fastReassemble: null, ).send(); // Reset devFS lastCompileTime to ensure the file will still be marked // as dirty on subsequent reloads. diff --git a/packages/flutter_tools/lib/src/test/test_compiler.dart b/packages/flutter_tools/lib/src/test/test_compiler.dart index 13a2404d8a..ec90fa970f 100644 --- a/packages/flutter_tools/lib/src/test/test_compiler.dart +++ b/packages/flutter_tools/lib/src/test/test_compiler.dart @@ -81,7 +81,7 @@ class TestCompiler { Future compile(Uri mainDart) { final Completer completer = Completer(); if (compilerController.isClosed) { - return Future.value(); + return Future.value(null); } compilerController.add(CompilationRequest(mainDart, completer)); return completer.future; diff --git a/packages/flutter_tools/lib/src/version.dart b/packages/flutter_tools/lib/src/version.dart index abfbfc9239..502727cb41 100644 --- a/packages/flutter_tools/lib/src/version.dart +++ b/packages/flutter_tools/lib/src/version.dart @@ -67,7 +67,7 @@ class FlutterVersion { globals.processUtils, _workingDirectory, ); - _gitTagVersion = GitTagVersion.determine(globals.processUtils, workingDirectory: _workingDirectory, gitRef: _frameworkRevision); + _gitTagVersion = GitTagVersion.determine(globals.processUtils, workingDirectory: _workingDirectory, fetchTags: false, gitRef: _frameworkRevision); _frameworkVersion = gitTagVersion.frameworkVersionFor(_frameworkRevision); } @@ -231,7 +231,9 @@ class FlutterVersion { } DateTime localFrameworkCommitDate; try { - localFrameworkCommitDate = DateTime.parse(_latestGitCommitDate()); + localFrameworkCommitDate = DateTime.parse(_latestGitCommitDate( + lenient: false + )); } on VersionCheckError { // Don't perform the update check if the version check failed. return; @@ -274,6 +276,7 @@ class FlutterVersion { await _run(['git', 'fetch', _versionCheckRemote, branch]); return _latestGitCommitDate( branch: '$_versionCheckRemote/$branch', + lenient: false, ); } on VersionCheckError catch (error) { if (globals.platform.environment.containsKey('FLUTTER_GIT_URL')) { diff --git a/packages/flutter_tools/lib/src/vmservice.dart b/packages/flutter_tools/lib/src/vmservice.dart index 678a4f9b4e..89866f2146 100644 --- a/packages/flutter_tools/lib/src/vmservice.dart +++ b/packages/flutter_tools/lib/src/vmservice.dart @@ -333,6 +333,7 @@ Future createVmServiceDelegate( return vm_service.VmService( channel, channel.add, + log: null, disposeHandler: () async { await channel.close(); }, diff --git a/packages/flutter_tools/lib/src/xcode_project.dart b/packages/flutter_tools/lib/src/xcode_project.dart index fa0222a6cb..9b4c1da657 100644 --- a/packages/flutter_tools/lib/src/xcode_project.dart +++ b/packages/flutter_tools/lib/src/xcode_project.dart @@ -495,6 +495,7 @@ class IosProject extends XcodeBasedProject { 'iosDevelopmentTeam': iosDevelopmentTeam ?? '', }, printStatusWhenWriting: false, + overwriteExisting: true, ); } } diff --git a/packages/flutter_tools/test/commands.shard/hermetic/analyze_continuously_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/analyze_continuously_test.dart index e77906a0fb..36d67c3ae4 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/analyze_continuously_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/analyze_continuously_test.dart @@ -198,7 +198,7 @@ void main() { terminal: Terminal.test(), artifacts: artifacts, logger: BufferLogger.test(), - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), fileSystem: MemoryFileSystem.test(), processManager: processManager, ); @@ -236,7 +236,7 @@ void main() { terminal: Terminal.test(), artifacts: artifacts, logger: BufferLogger.test(), - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), fileSystem: MemoryFileSystem.test(), processManager: processManager, ); diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_fuchsia_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_fuchsia_test.dart index de6c528321..047e4aa7ad 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_fuchsia_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_fuchsia_test.dart @@ -33,6 +33,7 @@ void main() { Cache.disableLocking(); final Platform linuxPlatform = FakePlatform( + operatingSystem: 'linux', environment: const { 'FLUTTER_ROOT': '/', }, @@ -66,7 +67,7 @@ void main() { Platform: () => linuxPlatform, FileSystem: () => fileSystem, ProcessManager: () => FakeProcessManager.any(), - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isFuchsiaEnabled: false), }); testUsingContext('there is no Fuchsia project', () async { final BuildCommand command = BuildCommand(); diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_ios_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_ios_test.dart index dcdc96b2fe..3eb6075e86 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_ios_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_ios_test.dart @@ -42,6 +42,7 @@ final Platform macosPlatform = FakePlatform( } ); final Platform notMacosPlatform = FakePlatform( + operatingSystem: 'linux', environment: { 'FLUTTER_ROOT': '/', } diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_ipa_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_ipa_test.dart index 8226fc1bbd..17f6761afa 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_ipa_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_ipa_test.dart @@ -41,6 +41,7 @@ final Platform macosPlatform = FakePlatform( } ); final Platform notMacosPlatform = FakePlatform( + operatingSystem: 'linux', environment: { 'FLUTTER_ROOT': '/', } diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_linux_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_linux_test.dart index a3d18ba31c..5f2451d114 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_linux_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_linux_test.dart @@ -28,6 +28,7 @@ import '../../src/test_flutter_command_runner.dart'; const String _kTestFlutterRoot = '/flutter'; final Platform linuxPlatform = FakePlatform( + operatingSystem: 'linux', environment: { 'FLUTTER_ROOT': _kTestFlutterRoot, 'HOME': '/', @@ -148,7 +149,7 @@ void main() { Platform: () => linuxPlatform, FileSystem: () => fileSystem, ProcessManager: () => FakeProcessManager.any(), - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false), }); testUsingContext('Linux build invokes CMake and ninja, and writes temporary files', () async { @@ -492,13 +493,13 @@ set(BINARY_NAME "fizz_bar") expect(() => runner.run(['build', 'linux', '--no-pub']), throwsToolExit()); }, overrides: { - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false), }); testUsingContext('hidden when not enabled on Linux host', () { expect(BuildLinuxCommand(operatingSystemUtils: FakeOperatingSystemUtils()).hidden, true); }, overrides: { - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false), Platform: () => notLinuxPlatform, }); diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart index febf95159d..8dab217cb8 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart @@ -55,6 +55,7 @@ final FakePlatform macosPlatformCustomEnv = FakePlatform( ); final Platform notMacosPlatform = FakePlatform( + operatingSystem: 'linux', environment: { 'FLUTTER_ROOT': '/', } @@ -169,7 +170,7 @@ void main() { Platform: () => macosPlatform, FileSystem: () => fileSystem, ProcessManager: () => FakeProcessManager.any(), - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: false), }); testUsingContext('macOS build forwards error stdout to status logger error', () async { @@ -393,13 +394,13 @@ void main() { expect(() => runner.run(['build', 'macos', '--no-pub']), supported ? throwsToolExit() : throwsA(isA())); }, overrides: { - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: false), }); testUsingContext('hidden when not enabled on macOS host', () { expect(BuildMacosCommand(verboseHelp: false).hidden, true); }, overrides: { - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: false), Platform: () => macosPlatform, }); diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_web_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_web_test.dart index e783ab8ef4..f4247eb4c7 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_web_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_web_test.dart @@ -25,6 +25,7 @@ import '../../src/test_flutter_command_runner.dart'; void main() { FileSystem fileSystem; final Platform fakePlatform = FakePlatform( + operatingSystem: 'linux', environment: { 'FLUTTER_ROOT': '/' } @@ -82,7 +83,7 @@ void main() { }, overrides: { Platform: () => fakePlatform, FileSystem: () => fileSystem, - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isWebEnabled: false), ProcessManager: () => FakeProcessManager.any(), }); @@ -121,7 +122,7 @@ void main() { }, overrides: { Platform: () => fakePlatform, FileSystem: () => fileSystem, - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isWebEnabled: false), ProcessManager: () => FakeProcessManager.any(), }); diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_windows_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_windows_test.dart index 7640690047..75d3d62f82 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_windows_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_windows_test.dart @@ -36,6 +36,7 @@ final Platform windowsPlatform = FakePlatform( } ); final Platform notWindowsPlatform = FakePlatform( + operatingSystem: 'linux', environment: { 'FLUTTER_ROOT': flutterRoot, } @@ -194,7 +195,7 @@ void main() { Platform: () => windowsPlatform, FileSystem: () => fileSystem, ProcessManager: () => FakeProcessManager.any(), - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: false), }); testUsingContext('Windows build does not spew stdout to status logger', () async { @@ -395,7 +396,7 @@ C:\foo\windows\runner\main.cpp(17,1): error C2065: 'Baz': undeclared identifier testUsingContext('hidden when not enabled on Windows host', () { expect(BuildWindowsCommand().hidden, true); }, overrides: { - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: false), Platform: () => windowsPlatform, }); @@ -536,7 +537,7 @@ C:\foo\windows\runner\main.cpp(17,1): error C2065: 'Baz': undeclared identifier Platform: () => windowsPlatform, FileSystem: () => fileSystem, ProcessManager: () => FakeProcessManager.any(), - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isWindowsUwpEnabled: false), }); testUsingContext('Windows UWP build completes successfully', () async { diff --git a/packages/flutter_tools/test/commands.shard/hermetic/custom_devices.dart b/packages/flutter_tools/test/commands.shard/hermetic/custom_devices.dart index e8321e17e5..b9b0a3f99e 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/custom_devices.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/custom_devices.dart @@ -162,6 +162,7 @@ const String defaultConfigLinux2 = r''' '''; final Platform linuxPlatform = FakePlatform( + operatingSystem: 'linux', environment: { 'FLUTTER_ROOT': linuxFlutterRoot, 'HOME': '/', @@ -461,7 +462,9 @@ void main() { testUsingContext( 'custom-devices add command fails when feature is not enabled', () async { - final CommandRunner runner = createCustomDevicesCommandRunner(); + final CommandRunner runner = createCustomDevicesCommandRunner( + featureEnabled: false + ); expect( runner.run(const ['custom-devices', 'add']), throwsToolExit(message: featureNotEnabledMessage), @@ -552,7 +555,7 @@ void main() { '-w', '1', 'testhostname' ], - postBuildCommand: const [], + postBuildCommand: null, installCommand: const [ 'scp', '-r', @@ -641,7 +644,7 @@ void main() { '-w', '1', '192.168.178.1' ], - postBuildCommand: const [], + postBuildCommand: null, installCommand: const [ 'scp', '-r', @@ -730,7 +733,7 @@ void main() { '-w', '1', '::1' ], - postBuildCommand: const [], + postBuildCommand: null, installCommand: const [ 'scp', '-r', @@ -823,7 +826,7 @@ void main() { '-w', '1', 'testhostname' ], - postBuildCommand: [], + postBuildCommand: null, installCommand: [ 'scp', '-r', @@ -903,7 +906,7 @@ void main() { '-w', '1', 'testhostname' ], - postBuildCommand: const [], + postBuildCommand: null, installCommand: const [ 'scp', '-r', @@ -1227,7 +1230,7 @@ void main() { 'testhostname' ], pingSuccessRegex: RegExp(r'[<=]\d+ms'), - postBuildCommand: const [], + postBuildCommand: null, installCommand: const [ 'scp', '-r', diff --git a/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart index 936b97c241..85d9737b72 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart @@ -347,7 +347,7 @@ void main() { }); testUsingContext('validate verbose output format contains trace for run with crash', () async { - expect(await FakeCrashingDoctor(logger).diagnose(), isFalse); + expect(await FakeCrashingDoctor(logger).diagnose(verbose: true), isFalse); expect(logger.statusText, contains('#0 CrashingValidator.validate')); }); @@ -428,7 +428,7 @@ void main() { }); testUsingContext('validate verbose output format', () async { - expect(await FakeDoctor(logger).diagnose(), isFalse); + expect(await FakeDoctor(logger).diagnose(verbose: true), isFalse); expect(logger.statusText, equals( '[✓] Passing Validator (with statusInfo)\n' ' • A helpful message\n' @@ -495,7 +495,7 @@ void main() { final BufferLogger wrapLogger = BufferLogger.test( outputPreferences: OutputPreferences(wrapText: true, wrapColumn: 30), ); - expect(await FakeDoctor(wrapLogger).diagnose(), isFalse); + expect(await FakeDoctor(wrapLogger).diagnose(verbose: true), isFalse); expect(wrapLogger.statusText, equals( '[✓] Passing Validator (with\n' ' statusInfo)\n' diff --git a/packages/flutter_tools/test/commands.shard/hermetic/downgrade_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/downgrade_test.dart index 3f0c113bbe..d87506a374 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/downgrade_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/downgrade_test.dart @@ -43,7 +43,7 @@ void main() { }); testUsingContext('Downgrade exits on unknown channel', () async { - final FakeFlutterVersion fakeFlutterVersion = FakeFlutterVersion(); + final FakeFlutterVersion fakeFlutterVersion = FakeFlutterVersion(channel: 'unknown'); fileSystem.currentDirectory.childFile('.flutter_tool_state') .writeAsStringSync('{"last-active-master-version":"invalid"}'); final DowngradeCommand command = DowngradeCommand( @@ -70,6 +70,7 @@ void main() { command: [ 'git', 'describe', '--tags', 'abcd' ], + exitCode: 0, stdout: 'v1.2.3' ) ]), diff --git a/packages/flutter_tools/test/commands.shard/hermetic/drive_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/drive_test.dart index 7688ca80d5..53f4f2c73c 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/drive_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/drive_test.dart @@ -26,7 +26,7 @@ void main() { setUp(() { fileSystem = MemoryFileSystem.test(); logger = BufferLogger.test(); - platform = FakePlatform(); + platform = FakePlatform(operatingSystem: 'linux'); }); setUpAll(() { diff --git a/packages/flutter_tools/test/commands.shard/hermetic/precache_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/precache_test.dart index bc2806fb86..44a4d1d599 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/precache_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/precache_test.dart @@ -74,7 +74,7 @@ void main() { final PrecacheCommand command = PrecacheCommand( cache: cache, logger: BufferLogger.test(), - featureFlags: TestFeatureFlags(), + featureFlags: TestFeatureFlags(isWebEnabled: false), platform: FakePlatform(environment: {}), ); await createTestCommandRunner(command).run(const ['precache', '--web', '--no-android', '--no-ios']); @@ -103,7 +103,7 @@ void main() { final PrecacheCommand command = PrecacheCommand( cache: cache, logger: BufferLogger.test(), - featureFlags: TestFeatureFlags(), + featureFlags: TestFeatureFlags(isMacOSEnabled: false), platform: FakePlatform(environment: {}), ); await createTestCommandRunner(command).run(const ['precache', '--macos', '--no-android', '--no-ios']); @@ -132,7 +132,7 @@ void main() { final PrecacheCommand command = PrecacheCommand( cache: cache, logger: BufferLogger.test(), - featureFlags: TestFeatureFlags(), + featureFlags: TestFeatureFlags(isWindowsEnabled: false), platform: FakePlatform(environment: {}), ); await createTestCommandRunner(command).run(const ['precache', '--windows', '--no-android', '--no-ios']); @@ -161,7 +161,7 @@ void main() { final PrecacheCommand command = PrecacheCommand( cache: cache, logger: BufferLogger.test(), - featureFlags: TestFeatureFlags(), + featureFlags: TestFeatureFlags(isLinuxEnabled: false), platform: FakePlatform(environment: {}), ); await createTestCommandRunner(command).run(const ['precache', '--linux', '--no-android', '--no-ios']); @@ -175,7 +175,7 @@ void main() { final PrecacheCommand command = PrecacheCommand( cache: cache, logger: BufferLogger.test(), - featureFlags: TestFeatureFlags(), + featureFlags: TestFeatureFlags(isWebEnabled: false), platform: FakePlatform(environment: {}), ); diff --git a/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart index 96afec3551..225d208ef0 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart @@ -258,7 +258,7 @@ void main() { testUsingContext('passes device target platform to usage', () async { final RunCommand command = RunCommand(); - final FakeDevice mockDevice = FakeDevice(sdkNameAndVersion: 'iOS 13') + final FakeDevice mockDevice = FakeDevice(targetPlatform: TargetPlatform.ios, sdkNameAndVersion: 'iOS 13') ..startAppSuccess = false; mockDeviceManager @@ -302,7 +302,7 @@ void main() { DevelopmentArtifact.androidGenSnapshot, })); - mockDeviceManager.devices = [FakeDevice()]; + mockDeviceManager.devices = [FakeDevice(targetPlatform: TargetPlatform.ios)]; expect(await RunCommand().requiredArtifacts, unorderedEquals({ DevelopmentArtifact.universal, @@ -310,7 +310,7 @@ void main() { })); mockDeviceManager.devices = [ - FakeDevice(), + FakeDevice(targetPlatform: TargetPlatform.ios), FakeDevice(targetPlatform: TargetPlatform.android_arm), ]; diff --git a/packages/flutter_tools/test/commands.shard/hermetic/test_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/test_test.dart index f77b30da3b..5815e919e9 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/test_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/test_test.dart @@ -538,7 +538,7 @@ dev_dependencies: FileSystem: () => fs, ProcessManager: () => FakeProcessManager.any(), DeviceManager: () => _FakeDeviceManager([ - FakeDevice('ephemeral', 'ephemeral', type: PlatformType.android), + FakeDevice('ephemeral', 'ephemeral', ephemeral: true, isSupported: true, type: PlatformType.android), ]), }); }); @@ -576,7 +576,7 @@ dev_dependencies: FileSystem: () => fs, ProcessManager: () => FakeProcessManager.any(), DeviceManager: () => _FakeDeviceManager([ - FakeDevice('ephemeral', 'ephemeral'), + FakeDevice('ephemeral', 'ephemeral', ephemeral: true, isSupported: true, type: PlatformType.web), ]), }); @@ -600,7 +600,7 @@ dev_dependencies: FileSystem: () => fs, ProcessManager: () => FakeProcessManager.any(), DeviceManager: () => _FakeDeviceManager([ - FakeDevice('ephemeral', 'ephemeral', type: PlatformType.android), + FakeDevice('ephemeral', 'ephemeral', ephemeral: true, isSupported: true, type: PlatformType.android), ]), }); diff --git a/packages/flutter_tools/test/commands.shard/permeable/build_apk_test.dart b/packages/flutter_tools/test/commands.shard/permeable/build_apk_test.dart index 1112552096..12b1f6dffe 100644 --- a/packages/flutter_tools/test/commands.shard/permeable/build_apk_test.dart +++ b/packages/flutter_tools/test/commands.shard/permeable/build_apk_test.dart @@ -340,6 +340,7 @@ void main() { '-Ptree-shake-icons=true', 'assembleRelease', ], + exitCode: 0, )); // The command throws a [ToolExit] because it expects an APK in the file system. @@ -386,6 +387,7 @@ void main() { '-Ptree-shake-icons=true', 'assembleRelease', ], + exitCode: 0, )); // The command throws a [ToolExit] because it expects an APK in the file system. diff --git a/packages/flutter_tools/test/commands.shard/permeable/build_bundle_test.dart b/packages/flutter_tools/test/commands.shard/permeable/build_bundle_test.dart index de3aea4996..c725e32aba 100644 --- a/packages/flutter_tools/test/commands.shard/permeable/build_bundle_test.dart +++ b/packages/flutter_tools/test/commands.shard/permeable/build_bundle_test.dart @@ -100,7 +100,7 @@ void main() { }, overrides: { FileSystem: () => MemoryFileSystem.test(), ProcessManager: () => FakeProcessManager.any(), - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: false), }); testUsingContext('bundle fails to build for Linux if feature is disabled', () async { @@ -118,7 +118,7 @@ void main() { }, overrides: { FileSystem: () => MemoryFileSystem.test(), ProcessManager: () => FakeProcessManager.any(), - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false), }); testUsingContext('bundle fails to build for macOS if feature is disabled', () async { @@ -136,7 +136,7 @@ void main() { }, overrides: { FileSystem: () => MemoryFileSystem.test(), ProcessManager: () => FakeProcessManager.any(), - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: false), }); testUsingContext('bundle --tree-shake-icons fails', () async { diff --git a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart index 3d6963edef..f741e5607d 100755 --- a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart +++ b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart @@ -1950,7 +1950,7 @@ void main() { ], pluginClass: 'somePluginClass', unexpectedPlatforms: [ 'ios', 'android', 'web', 'linux', 'windows', 'macos']); }, overrides: { - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false), }); testUsingContext('plugin supports ios if requested', () async { @@ -1969,7 +1969,7 @@ void main() { unexpectedPlatforms: ['some_platform']); expect(logger.errorText, isNot(contains(_kNoPlatformsMessage))); }, overrides: { - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false), Logger: () => logger, }); @@ -1991,7 +1991,7 @@ void main() { androidIdentifier: 'com.example.flutter_project'); expect(logger.errorText, isNot(contains(_kNoPlatformsMessage))); }, overrides: { - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false), Logger: () => logger, }); @@ -2033,7 +2033,7 @@ void main() { unexpectedPlatforms: ['web']); expect(logger.errorText, contains(_kNoPlatformsMessage)); }, overrides: { - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isWebEnabled: false), Logger: () => logger, }); @@ -2048,7 +2048,7 @@ void main() { expect(projectDir.childDirectory('ios'), exists); expect(projectDir.childDirectory('example').childDirectory('ios'), exists); }, overrides: { - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false), }); testUsingContext('create an empty plugin, then add android', () async { @@ -2063,7 +2063,7 @@ void main() { expect( projectDir.childDirectory('example').childDirectory('android'), exists); }, overrides: { - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false), }); testUsingContext('create an empty plugin, then add linux', () async { @@ -2531,7 +2531,7 @@ void main() { expect(logger.statusText, contains('For more information, see https://flutter.dev/go/plugin-platforms.')); }, overrides: { - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false), Logger: ()=> logger, }); @@ -2546,7 +2546,7 @@ void main() { expect(logger.errorText, isNot(contains(_kNoPlatformsMessage))); }, overrides: { - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false), Logger: () => logger, }); diff --git a/packages/flutter_tools/test/commands.shard/permeable/devices_test.dart b/packages/flutter_tools/test/commands.shard/permeable/devices_test.dart index 8df718fa17..f66b5589f1 100644 --- a/packages/flutter_tools/test/commands.shard/permeable/devices_test.dart +++ b/packages/flutter_tools/test/commands.shard/permeable/devices_test.dart @@ -42,7 +42,7 @@ void main() { isEmpty, ); }, overrides: { - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags(isWebEnabled: false), Logger: () => logger, }); diff --git a/packages/flutter_tools/test/commands.shard/permeable/packages_test.dart b/packages/flutter_tools/test/commands.shard/permeable/packages_test.dart index da0f49d4df..90714e9df7 100644 --- a/packages/flutter_tools/test/commands.shard/permeable/packages_test.dart +++ b/packages/flutter_tools/test/commands.shard/permeable/packages_test.dart @@ -458,7 +458,7 @@ void main() { expect(processManager, hasNoRemainingExpectations); }, overrides: { FileSystem: () => MemoryFileSystem.test(), - Platform: () => FakePlatform(environment: {}), + Platform: () => FakePlatform(operatingSystem: 'linux', environment: {}), ProcessManager: () => processManager, Stdio: () => mockStdio, BotDetector: () => const FakeBotDetector(false), @@ -483,7 +483,7 @@ void main() { expect(processManager, hasNoRemainingExpectations); }, overrides: { FileSystem: () => MemoryFileSystem.test(), - Platform: () => FakePlatform(environment: {}), + Platform: () => FakePlatform(operatingSystem: 'linux', environment: {}), ProcessManager: () => processManager, Stdio: () => mockStdio, BotDetector: () => const FakeBotDetector(true), @@ -512,7 +512,7 @@ void main() { expect(processManager, hasNoRemainingExpectations); }, overrides: { FileSystem: () => MemoryFileSystem.test(), - Platform: () => FakePlatform(environment: {}), + Platform: () => FakePlatform(operatingSystem: 'linux', environment: {}), ProcessManager: () => processManager, Stdio: () => mockStdio, Pub: () => Pub( @@ -538,7 +538,7 @@ void main() { expect(processManager, hasNoRemainingExpectations); }, overrides: { FileSystem: () => MemoryFileSystem.test(), - Platform: () => FakePlatform(environment: {}), + Platform: () => FakePlatform(operatingSystem: 'linux', environment: {}), ProcessManager: () => processManager, Stdio: () => mockStdio, Pub: () => Pub( diff --git a/packages/flutter_tools/test/commands.shard/permeable/upgrade_test.dart b/packages/flutter_tools/test/commands.shard/permeable/upgrade_test.dart index 745dcd07fb..c21a69e17b 100644 --- a/packages/flutter_tools/test/commands.shard/permeable/upgrade_test.dart +++ b/packages/flutter_tools/test/commands.shard/permeable/upgrade_test.dart @@ -165,7 +165,8 @@ void main() { stdout: revision), const FakeCommand(command: [ 'git', 'tag', '--points-at', revision, - ]), + ], + stdout: ''), const FakeCommand(command: [ 'git', 'describe', '--match', '*.*.*', '--long', '--tags', revision, ], @@ -266,6 +267,7 @@ void main() { testUsingContext('does not throw toolExit at standard remote url with FLUTTER_GIT_URL unset', () async { final FakeFlutterVersion flutterVersion = FakeFlutterVersion( channel: 'dev', + repositoryUrl: flutterStandardUrlDotGit, ); expect(() => realCommandRunner.verifyStandardRemote(flutterVersion), returnsNormally); expect(processManager, hasNoRemainingExpectations); @@ -542,6 +544,7 @@ void main() { command: [ 'git', 'tag', '--points-at', 'HEAD', ], + stdout: '', ), const FakeCommand( command: [ diff --git a/packages/flutter_tools/test/general.shard/analytics_test.dart b/packages/flutter_tools/test/general.shard/analytics_test.dart index cfb551fdce..c53da5d877 100644 --- a/packages/flutter_tools/test/general.shard/analytics_test.dart +++ b/packages/flutter_tools/test/general.shard/analytics_test.dart @@ -74,7 +74,7 @@ void main() { expect(count, 0); }, overrides: { - FlutterVersion: () => FlutterVersion(), + FlutterVersion: () => FlutterVersion(clock: const SystemClock()), Usage: () => Usage( configDirOverride: tempDir.path, logFile: tempDir.childFile('analytics.log').path, @@ -98,7 +98,7 @@ void main() { expect(count, 0); }, overrides: { - FlutterVersion: () => FlutterVersion(), + FlutterVersion: () => FlutterVersion(clock: const SystemClock()), Usage: () => Usage( configDirOverride: tempDir.path, logFile: tempDir.childFile('analytics.log').path, @@ -115,7 +115,7 @@ void main() { expect(globals.fs.file('test').readAsStringSync(), contains('$featuresKey: enable-web')); }, overrides: { - FlutterVersion: () => FlutterVersion(), + FlutterVersion: () => FlutterVersion(clock: const SystemClock()), Config: () => testConfig, Platform: () => FakePlatform(environment: { 'FLUTTER_ANALYTICS_LOG_FILE': 'test', @@ -138,7 +138,7 @@ void main() { contains('$featuresKey: enable-web,enable-linux-desktop,enable-macos-desktop'), ); }, overrides: { - FlutterVersion: () => FlutterVersion(), + FlutterVersion: () => FlutterVersion(clock: const SystemClock()), Config: () => testConfig, Platform: () => FakePlatform(environment: { 'FLUTTER_ANALYTICS_LOG_FILE': 'test', diff --git a/packages/flutter_tools/test/general.shard/android/android_device_discovery_test.dart b/packages/flutter_tools/test/general.shard/android/android_device_discovery_test.dart index dbf6680f04..76b5b2f287 100644 --- a/packages/flutter_tools/test/general.shard/android/android_device_discovery_test.dart +++ b/packages/flutter_tools/test/general.shard/android/android_device_discovery_test.dart @@ -55,7 +55,7 @@ void main() { androidSdk: FakeAndroidSdk(), logger: BufferLogger.test(), androidWorkflow: AndroidWorkflow( - androidSdk: FakeAndroidSdk(), + androidSdk: FakeAndroidSdk('adb'), featureFlags: TestFeatureFlags(), operatingSystemUtils: FakeOperatingSystemUtils(), ), diff --git a/packages/flutter_tools/test/general.shard/android/android_device_port_forwarder_test.dart b/packages/flutter_tools/test/general.shard/android/android_device_port_forwarder_test.dart index 29b5546aca..f639c099cc 100644 --- a/packages/flutter_tools/test/general.shard/android/android_device_port_forwarder_test.dart +++ b/packages/flutter_tools/test/general.shard/android/android_device_port_forwarder_test.dart @@ -37,6 +37,7 @@ void main() { processManager: FakeProcessManager.list([ const FakeCommand( command: ['adb', '-s', '1', 'forward', 'tcp:456', 'tcp:123'], + stdout: '', ) ]), logger: BufferLogger.test(), diff --git a/packages/flutter_tools/test/general.shard/android/android_device_start_test.dart b/packages/flutter_tools/test/general.shard/android/android_device_start_test.dart index 13b1ec6dda..c7c3d53505 100644 --- a/packages/flutter_tools/test/general.shard/android/android_device_start_test.dart +++ b/packages/flutter_tools/test/general.shard/android/android_device_start_test.dart @@ -64,7 +64,7 @@ void main() { fileSystem: fileSystem, processManager: processManager, logger: BufferLogger.test(), - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), androidSdk: androidSdk, ); final File apkFile = fileSystem.file('app.apk')..createSync(); @@ -130,7 +130,7 @@ void main() { fileSystem: fileSystem, processManager: processManager, logger: BufferLogger.test(), - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), androidSdk: androidSdk, ); final File apkFile = fileSystem.file('app.apk')..createSync(); @@ -168,7 +168,7 @@ void main() { fileSystem: fileSystem, processManager: processManager, logger: BufferLogger.test(), - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), androidSdk: androidSdk, ); final File apkFile = fileSystem.file('app.apk')..createSync(); diff --git a/packages/flutter_tools/test/general.shard/android/android_device_stop_test.dart b/packages/flutter_tools/test/general.shard/android/android_device_stop_test.dart index 3af7ea53f6..6d1e459035 100644 --- a/packages/flutter_tools/test/general.shard/android/android_device_stop_test.dart +++ b/packages/flutter_tools/test/general.shard/android/android_device_stop_test.dart @@ -20,7 +20,7 @@ void main() { androidSdk: FakeAndroidSdk(), fileSystem: MemoryFileSystem.test(), logger: BufferLogger.test(), - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), processManager: FakeProcessManager.any(), ); diff --git a/packages/flutter_tools/test/general.shard/android/android_device_test.dart b/packages/flutter_tools/test/general.shard/android/android_device_test.dart index f89f93b7ae..93266bc1cb 100644 --- a/packages/flutter_tools/test/general.shard/android/android_device_test.dart +++ b/packages/flutter_tools/test/general.shard/android/android_device_test.dart @@ -56,7 +56,7 @@ void main() { ); final AndroidDevice linuxDevice = setUpAndroidDevice( processManager: FakeProcessManager.list(commands.toList()), - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), ); final AndroidDevice macOsDevice = setUpAndroidDevice( processManager: FakeProcessManager.list(commands.toList()), @@ -469,7 +469,7 @@ AndroidDevice setUpAndroidDevice({ androidSdk ??= FakeAndroidSdk(); return AndroidDevice(id ?? '1234', logger: BufferLogger.test(), - platform: platform ?? FakePlatform(), + platform: platform ?? FakePlatform(operatingSystem: 'linux'), androidSdk: androidSdk, fileSystem: fileSystem ?? MemoryFileSystem.test(), processManager: processManager ?? FakeProcessManager.any(), diff --git a/packages/flutter_tools/test/general.shard/android/android_emulator_test.dart b/packages/flutter_tools/test/general.shard/android/android_emulator_test.dart index a09b3e326a..61a51ace9d 100644 --- a/packages/flutter_tools/test/general.shard/android/android_emulator_test.dart +++ b/packages/flutter_tools/test/general.shard/android/android_emulator_test.dart @@ -187,6 +187,7 @@ void main() { FakeCommand( command: kEmulatorLaunchCommand, exitCode: 1, + stderr: '', stdout: 'dummy text', completer: Completer(), ), diff --git a/packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart b/packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart index c0d50db4ac..12f87afaf4 100644 --- a/packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart +++ b/packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart @@ -407,6 +407,7 @@ void main() { '-Ptree-shake-icons=false', 'assembleRelease', ], + exitCode: 0, )); fileSystem.directory('android') @@ -494,6 +495,7 @@ void main() { '-Pcode-size-directory=foo', 'assembleRelease', ], + exitCode: 0, )); fileSystem.directory('android') @@ -653,6 +655,7 @@ void main() { '-Ptarget-platform=android-arm,android-arm64,android-x64', 'assembleAarRelease', ], + exitCode: 0, )); final File manifestFile = fileSystem.file('pubspec.yaml'); @@ -770,6 +773,7 @@ void main() { '-Ptree-shake-icons=false', 'assembleRelease', ], + exitCode: 0, )); fileSystem.file('out/android_arm/flutter_embedding_release.pom') @@ -843,6 +847,7 @@ void main() { '-Ptree-shake-icons=false', 'assembleRelease', ], + exitCode: 0, )); fileSystem.file('out/android_arm64/flutter_embedding_release.pom') @@ -916,6 +921,7 @@ void main() { '-Ptree-shake-icons=false', 'assembleRelease', ], + exitCode: 0, )); fileSystem.file('out/android_x86/flutter_embedding_release.pom') @@ -1122,6 +1128,7 @@ void main() { '-Ptarget-platform=android-arm', 'assembleAarRelease' ], + exitCode: 0, )); fileSystem.file('out/android_arm/flutter_embedding_release.pom') @@ -1206,6 +1213,7 @@ void main() { '-Ptarget-platform=android-arm64', 'assembleAarRelease' ], + exitCode: 0, )); fileSystem.file('out/android_arm64/flutter_embedding_release.pom') @@ -1290,6 +1298,7 @@ void main() { '-Ptarget-platform=android-x86', 'assembleAarRelease' ], + exitCode: 0, )); fileSystem.file('out/android_x86/flutter_embedding_release.pom') @@ -1374,6 +1383,7 @@ void main() { '-Ptarget-platform=android-x64', 'assembleAarRelease' ], + exitCode: 0, )); fileSystem.file('out/android_x64/flutter_embedding_release.pom') diff --git a/packages/flutter_tools/test/general.shard/android/android_install_test.dart b/packages/flutter_tools/test/general.shard/android/android_install_test.dart index bd6d56b7a9..f0a20da9e5 100644 --- a/packages/flutter_tools/test/general.shard/android/android_install_test.dart +++ b/packages/flutter_tools/test/general.shard/android/android_install_test.dart @@ -56,7 +56,7 @@ void main() { androidSdk ??= FakeAndroidSdk(); return AndroidDevice('1234', logger: logger, - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), androidSdk: androidSdk, fileSystem: fileSystem ?? MemoryFileSystem.test(), processManager: processManager ?? FakeProcessManager.any(), diff --git a/packages/flutter_tools/test/general.shard/android/android_sdk_test.dart b/packages/flutter_tools/test/general.shard/android/android_sdk_test.dart index f9e8da857b..296512eeb4 100644 --- a/packages/flutter_tools/test/general.shard/android/android_sdk_test.dart +++ b/packages/flutter_tools/test/general.shard/android/android_sdk_test.dart @@ -75,7 +75,7 @@ void main() { }, overrides: { FileSystem: () => fileSystem, ProcessManager: () => FakeProcessManager.any(), - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), Config: () => config, }); @@ -95,7 +95,7 @@ void main() { }, overrides: { FileSystem: () => fileSystem, ProcessManager: () => FakeProcessManager.any(), - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), Config: () => config, }); @@ -112,7 +112,7 @@ void main() { }, overrides: { FileSystem: () => fileSystem, ProcessManager: () => FakeProcessManager.any(), - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), Config: () => config, }); @@ -129,7 +129,7 @@ void main() { }, overrides: { FileSystem: () => fileSystem, ProcessManager: () => FakeProcessManager.any(), - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), Config: () => config, }); @@ -191,7 +191,7 @@ void main() { FileSystem: () => fileSystem, ProcessManager: () => processManager, Config: () => config, - Platform: () => FakePlatform(environment: {}), + Platform: () => FakePlatform(operatingSystem: 'linux', environment: {}), }); testUsingContext('returns validate sdk is well formed', () { @@ -214,7 +214,7 @@ void main() { FileSystem: () => fileSystem, ProcessManager: () => processManager, Config: () => config, - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), }); testUsingContext('does not throw on sdkmanager version check failure', () { @@ -239,7 +239,7 @@ void main() { FileSystem: () => fileSystem, ProcessManager: () => processManager, Config: () => config, - Platform: () => FakePlatform(environment: {}), + Platform: () => FakePlatform(operatingSystem: 'linux', environment: {}), }); testUsingContext('throws on sdkmanager version check if sdkmanager not found', () { @@ -253,7 +253,7 @@ void main() { FileSystem: () => fileSystem, ProcessManager: () => processManager, Config: () => config, - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), }); testUsingContext('returns avdmanager path under cmdline tools', () { @@ -269,7 +269,7 @@ void main() { }, overrides: { FileSystem: () => fileSystem, ProcessManager: () => FakeProcessManager.any(), - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), Config: () => config, }); @@ -303,7 +303,7 @@ void main() { }, overrides: { FileSystem: () => fileSystem, ProcessManager: () => FakeProcessManager.any(), - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), Config: () => config, }); diff --git a/packages/flutter_tools/test/general.shard/android/android_studio_test.dart b/packages/flutter_tools/test/general.shard/android/android_studio_test.dart index 787f2ec52d..aeade943c5 100644 --- a/packages/flutter_tools/test/general.shard/android/android_studio_test.dart +++ b/packages/flutter_tools/test/general.shard/android/android_studio_test.dart @@ -59,6 +59,7 @@ const Map macStudioInfoPlist2020_3 = { }; final Platform linuxPlatform = FakePlatform( + operatingSystem: 'linux', environment: {'HOME': homeLinux}, ); diff --git a/packages/flutter_tools/test/general.shard/android/android_studio_validator_test.dart b/packages/flutter_tools/test/general.shard/android/android_studio_validator_test.dart index e12eaac1df..e46260cdfe 100644 --- a/packages/flutter_tools/test/general.shard/android/android_studio_validator_test.dart +++ b/packages/flutter_tools/test/general.shard/android/android_studio_validator_test.dart @@ -20,6 +20,7 @@ import '../../src/context.dart'; const String home = '/home/me'; final Platform linuxPlatform = FakePlatform( + operatingSystem: 'linux', environment: {'HOME': home} ); diff --git a/packages/flutter_tools/test/general.shard/android/android_workflow_test.dart b/packages/flutter_tools/test/general.shard/android/android_workflow_test.dart index d36225135a..e5df2217c3 100644 --- a/packages/flutter_tools/test/general.shard/android/android_workflow_test.dart +++ b/packages/flutter_tools/test/general.shard/android/android_workflow_test.dart @@ -6,7 +6,6 @@ import 'package:file/memory.dart'; import 'package:flutter_tools/src/android/android_sdk.dart'; -import 'package:flutter_tools/src/android/android_studio.dart'; import 'package:flutter_tools/src/android/android_workflow.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; @@ -40,7 +39,7 @@ void main() { testWithoutContext('AndroidWorkflow handles a null AndroidSDK', () { final AndroidWorkflow androidWorkflow = AndroidWorkflow( featureFlags: TestFeatureFlags(), - androidSdk: null, // ignore: avoid_redundant_argument_values + androidSdk: null, operatingSystemUtils: FakeOperatingSystemUtils(), ); @@ -136,7 +135,7 @@ void main() { stdio: stdio, logger: BufferLogger.test(), userMessages: UserMessages(), - androidStudio: FakeAndroidStudio(), + androidStudio: null, operatingSystemUtils: FakeOperatingSystemUtils(), ); final LicensesAccepted licenseStatus = await licenseValidator.licensesAccepted; @@ -155,7 +154,7 @@ void main() { stdio: stdio, logger: BufferLogger.test(), userMessages: UserMessages(), - androidStudio: FakeAndroidStudio(), + androidStudio: null, operatingSystemUtils: FakeOperatingSystemUtils(), ); final LicensesAccepted licenseStatus = await licenseValidator.licensesAccepted; @@ -179,7 +178,7 @@ void main() { stdio: stdio, logger: BufferLogger.test(), userMessages: UserMessages(), - androidStudio: FakeAndroidStudio(), + androidStudio: null, operatingSystemUtils: FakeOperatingSystemUtils(), ); final LicensesAccepted result = await licenseValidator.licensesAccepted; @@ -208,7 +207,7 @@ All SDK package licenses accepted. stdio: stdio, logger: BufferLogger.test(), userMessages: UserMessages(), - androidStudio: FakeAndroidStudio(), + androidStudio: null, operatingSystemUtils: FakeOperatingSystemUtils(), ); final LicensesAccepted result = await licenseValidator.licensesAccepted; @@ -238,7 +237,7 @@ Review licenses that have not been accepted (y/N)? stdio: stdio, logger: BufferLogger.test(), userMessages: UserMessages(), - androidStudio: FakeAndroidStudio(), + androidStudio: null, operatingSystemUtils: FakeOperatingSystemUtils(), ); final LicensesAccepted result = await licenseValidator.licensesAccepted; @@ -268,7 +267,7 @@ Review licenses that have not been accepted (y/N)? stdio: stdio, logger: BufferLogger.test(), userMessages: UserMessages(), - androidStudio: FakeAndroidStudio(), + androidStudio: null, operatingSystemUtils: FakeOperatingSystemUtils(), ); final LicensesAccepted result = await licenseValidator.licensesAccepted; @@ -283,7 +282,7 @@ Review licenses that have not been accepted (y/N)? command: [ '/foo/bar/sdkmanager', '--licenses', - ], + ], stdout: '', )); final AndroidLicenseValidator licenseValidator = AndroidLicenseValidator( @@ -294,7 +293,7 @@ Review licenses that have not been accepted (y/N)? stdio: stdio, logger: BufferLogger.test(), userMessages: UserMessages(), - androidStudio: FakeAndroidStudio(), + androidStudio: null, operatingSystemUtils: FakeOperatingSystemUtils(), ); @@ -313,7 +312,7 @@ Review licenses that have not been accepted (y/N)? stdio: stdio, logger: BufferLogger.test(), userMessages: UserMessages(), - androidStudio: FakeAndroidStudio(), + androidStudio: null, operatingSystemUtils: FakeOperatingSystemUtils(), ); @@ -332,7 +331,7 @@ Review licenses that have not been accepted (y/N)? stdio: stdio, logger: BufferLogger.test(), userMessages: UserMessages(), - androidStudio: FakeAndroidStudio(), + androidStudio: null, operatingSystemUtils: FakeOperatingSystemUtils(), ); @@ -346,7 +345,7 @@ Review licenses that have not been accepted (y/N)? ..cmdlineToolsAvailable = true ..directory = fileSystem.directory('/foo/bar'); final ValidationResult validationResult = await AndroidValidator( - androidStudio: FakeAndroidStudio(), + androidStudio: null, androidSdk: sdk, fileSystem: fileSystem, logger: logger, @@ -393,7 +392,7 @@ Review licenses that have not been accepted (y/N)? ); final AndroidValidator androidValidator = AndroidValidator( - androidStudio: null, // ignore: avoid_redundant_argument_values + androidStudio: null, androidSdk: sdk, fileSystem: fileSystem, logger: logger, @@ -441,7 +440,7 @@ Review licenses that have not been accepted (y/N)? ..directory = fileSystem.directory('/foo/bar'); final AndroidValidator androidValidator = AndroidValidator( - androidStudio: null, // ignore: avoid_redundant_argument_values + androidStudio: null, androidSdk: sdk, fileSystem: fileSystem, logger: logger, @@ -490,7 +489,7 @@ Review licenses that have not been accepted (y/N)? final ValidationResult validationResult = await AndroidValidator( androidSdk: sdk, - androidStudio: null, // ignore: avoid_redundant_argument_values + androidStudio: null, fileSystem: fileSystem, logger: logger, platform: FakePlatform()..environment = {'HOME': '/home/me', 'JAVA_HOME': 'home/java'}, @@ -512,8 +511,8 @@ Review licenses that have not been accepted (y/N)? testWithoutContext('Mentions `flutter config --android-sdk if user has no AndroidSdk`', () async { final ValidationResult validationResult = await AndroidValidator( - androidSdk: null, // ignore: avoid_redundant_argument_values - androidStudio: null, // ignore: avoid_redundant_argument_values + androidSdk: null, + androidStudio: null, fileSystem: fileSystem, logger: logger, platform: FakePlatform()..environment = {'HOME': '/home/me', 'JAVA_HOME': 'home/java'}, @@ -592,8 +591,3 @@ class CustomFakeOperatingSystemUtils extends Fake implements OperatingSystemUtil @override HostPlatform get hostPlatform => _hostPlatform; } - -class FakeAndroidStudio extends Fake implements AndroidStudio { - @override - String get javaPath => 'java'; -} diff --git a/packages/flutter_tools/test/general.shard/android/gradle_test.dart b/packages/flutter_tools/test/general.shard/android/gradle_test.dart index 7bd9322309..8bc6fe4ad6 100644 --- a/packages/flutter_tools/test/general.shard/android/gradle_test.dart +++ b/packages/flutter_tools/test/general.shard/android/gradle_test.dart @@ -206,7 +206,7 @@ void main() { void testUsingAndroidContext(String description, dynamic Function() testMethod) { testUsingContext(description, testMethod, overrides: { Artifacts: () => localEngineArtifacts, - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), FileSystem: () => fs, ProcessManager: () => FakeProcessManager.any(), }); @@ -274,6 +274,7 @@ flutter: manifest: manifest, buildInfo: buildInfo, expectedBuildName: '1.0.0', + expectedBuildNumber: null, ); }); @@ -376,7 +377,9 @@ flutter: '''; await checkBuildVersion( manifest: manifest, - buildInfo: const BuildInfo(BuildMode.release, null, treeShakeIcons: false), + buildInfo: const BuildInfo(BuildMode.release, null, buildName: null, buildNumber: null, treeShakeIcons: false), + expectedBuildName: null, + expectedBuildNumber: null, ); await checkBuildVersion( manifest: manifest, @@ -393,13 +396,16 @@ flutter: // Values don't get unset. await checkBuildVersion( manifest: manifest, + buildInfo: null, expectedBuildName: '1.0.3', expectedBuildNumber: '4', ); // Values get unset. await checkBuildVersion( manifest: manifest, - buildInfo: const BuildInfo(BuildMode.release, null, treeShakeIcons: false), + buildInfo: const BuildInfo(BuildMode.release, null, buildName: null, buildNumber: null, treeShakeIcons: false), + expectedBuildName: null, + expectedBuildNumber: null, ); }); }); diff --git a/packages/flutter_tools/test/general.shard/android/gradle_utils_test.dart b/packages/flutter_tools/test/general.shard/android/gradle_utils_test.dart index 46b937a50b..acdc11d90e 100644 --- a/packages/flutter_tools/test/general.shard/android/gradle_utils_test.dart +++ b/packages/flutter_tools/test/general.shard/android/gradle_utils_test.dart @@ -38,7 +38,7 @@ void main() { gradleUtils = GradleUtils( cache: Cache.test(processManager: FakeProcessManager.any(), fileSystem: fileSystem), fileSystem: fileSystem, - platform: FakePlatform(environment: {}), + platform: FakePlatform(environment: {}, operatingSystem: 'linux'), logger: BufferLogger.test(), operatingSystemUtils: FakeOperatingSystemUtils(), ); diff --git a/packages/flutter_tools/test/general.shard/artifact_updater_test.dart b/packages/flutter_tools/test/general.shard/artifact_updater_test.dart index 9946e80327..6a3f56ded7 100644 --- a/packages/flutter_tools/test/general.shard/artifact_updater_test.dart +++ b/packages/flutter_tools/test/general.shard/artifact_updater_test.dart @@ -17,7 +17,7 @@ import '../src/common.dart'; import '../src/fake_http_client.dart'; import '../src/fakes.dart'; -final Platform testPlatform = FakePlatform(); +final Platform testPlatform = FakePlatform(environment: const {}); void main() { testWithoutContext('ArtifactUpdater can download a zip archive', () async { diff --git a/packages/flutter_tools/test/general.shard/artifacts_test.dart b/packages/flutter_tools/test/general.shard/artifacts_test.dart index b1451277d4..5a25df9e9f 100644 --- a/packages/flutter_tools/test/general.shard/artifacts_test.dart +++ b/packages/flutter_tools/test/general.shard/artifacts_test.dart @@ -25,7 +25,7 @@ void main() { fileSystem = MemoryFileSystem.test(); final Directory cacheRoot = fileSystem.directory('root') ..createSync(); - platform = FakePlatform(); + platform = FakePlatform(operatingSystem: 'linux'); cache = Cache( rootOverride: cacheRoot, fileSystem: fileSystem, @@ -192,7 +192,7 @@ void main() { fileSystem = MemoryFileSystem.test(); final Directory cacheRoot = fileSystem.directory('root') ..createSync(); - platform = FakePlatform(); + platform = FakePlatform(operatingSystem: 'linux'); cache = Cache( rootOverride: cacheRoot, fileSystem: fileSystem, diff --git a/packages/flutter_tools/test/general.shard/asset_bundle_test.dart b/packages/flutter_tools/test/general.shard/asset_bundle_test.dart index 45d965372c..692f4d7b60 100644 --- a/packages/flutter_tools/test/general.shard/asset_bundle_test.dart +++ b/packages/flutter_tools/test/general.shard/asset_bundle_test.dart @@ -419,7 +419,7 @@ flutter: }, overrides: { FileSystem: () => MemoryFileSystem.test(), ProcessManager: () => FakeProcessManager.any(), - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), }); testUsingContext('does not track wildcard directories from dependencies', () async { @@ -461,7 +461,7 @@ flutter: }, overrides: { FileSystem: () => MemoryFileSystem.test(), ProcessManager: () => FakeProcessManager.any(), - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), }); testUsingContext('reports package that causes asset bundle error when it is ' @@ -495,7 +495,7 @@ flutter: }, overrides: { FileSystem: () => MemoryFileSystem.test(), ProcessManager: () => FakeProcessManager.any(), - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), }); testUsingContext('does not report package that causes asset bundle error ' @@ -518,7 +518,7 @@ flutter: }, overrides: { FileSystem: () => MemoryFileSystem.test(), ProcessManager: () => FakeProcessManager.any(), - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), }); testUsingContext('does not include material design assets if uses-material-design: true is ' @@ -556,7 +556,7 @@ flutter: }, overrides: { FileSystem: () => MemoryFileSystem.test(), ProcessManager: () => FakeProcessManager.any(), - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), }); testUsingContext('does not include assets in project directories as asset variants', () async { @@ -589,7 +589,7 @@ flutter: }, overrides: { FileSystem: () => MemoryFileSystem.test(), ProcessManager: () => FakeProcessManager.any(), - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), }); testUsingContext('deferred and regular assets are included in manifest alphabetically', () async { @@ -626,6 +626,6 @@ flutter: }, overrides: { FileSystem: () => MemoryFileSystem.test(), ProcessManager: () => FakeProcessManager.any(), - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), }); } diff --git a/packages/flutter_tools/test/general.shard/base/build_test.dart b/packages/flutter_tools/test/general.shard/base/build_test.dart index 149d0cb3cc..8a869cdc65 100644 --- a/packages/flutter_tools/test/general.shard/base/build_test.dart +++ b/packages/flutter_tools/test/general.shard/base/build_test.dart @@ -83,6 +83,7 @@ void main() { final int result = await genSnapshot.run( snapshotType: SnapshotType(TargetPlatform.android_x64, BuildMode.release), + darwinArch: null, additionalArgs: ['--additional_arg'], ); expect(result, 0); @@ -140,6 +141,7 @@ void main() { final int result = await genSnapshot.run( snapshotType: SnapshotType(TargetPlatform.android_x64, BuildMode.release), + darwinArch: null, additionalArgs: ['--strip'], ); @@ -184,6 +186,7 @@ void main() { mainPath: 'main.dill', outputPath: outputPath, bitcode: false, + splitDebugInfo: null, dartObfuscation: false, ), isNot(equals(0))); }); @@ -197,6 +200,7 @@ void main() { mainPath: 'main.dill', outputPath: outputPath, bitcode: false, + splitDebugInfo: null, dartObfuscation: false, ), isNot(0)); }); @@ -210,6 +214,7 @@ void main() { mainPath: 'main.dill', outputPath: outputPath, bitcode: false, + splitDebugInfo: null, dartObfuscation: false, ), isNot(0)); }); @@ -283,6 +288,7 @@ void main() { darwinArch: DarwinArch.armv7, sdkRoot: 'path/to/sdk', bitcode: true, + splitDebugInfo: null, dartObfuscation: false, ); @@ -404,6 +410,7 @@ void main() { darwinArch: DarwinArch.armv7, sdkRoot: 'path/to/sdk', bitcode: false, + splitDebugInfo: null, dartObfuscation: true, ); @@ -461,6 +468,7 @@ void main() { darwinArch: DarwinArch.armv7, sdkRoot: 'path/to/sdk', bitcode: false, + splitDebugInfo: null, dartObfuscation: false, ); @@ -516,6 +524,7 @@ void main() { darwinArch: DarwinArch.arm64, sdkRoot: 'path/to/sdk', bitcode: false, + splitDebugInfo: null, dartObfuscation: false, ); @@ -544,6 +553,7 @@ void main() { mainPath: 'main.dill', outputPath: outputPath, bitcode: false, + splitDebugInfo: null, dartObfuscation: false, ); @@ -605,6 +615,7 @@ void main() { mainPath: 'main.dill', outputPath: outputPath, bitcode: false, + splitDebugInfo: null, dartObfuscation: true, ); @@ -660,6 +671,7 @@ void main() { mainPath: 'main.dill', outputPath: outputPath, bitcode: false, + splitDebugInfo: null, dartObfuscation: false, ); @@ -685,6 +697,7 @@ void main() { mainPath: 'main.dill', outputPath: outputPath, bitcode: false, + splitDebugInfo: null, dartObfuscation: false, extraGenSnapshotOptions: const ['--no-strip'], ); diff --git a/packages/flutter_tools/test/general.shard/base/error_handling_io_test.dart b/packages/flutter_tools/test/general.shard/base/error_handling_io_test.dart index 5a3ca56d73..16bdda97a4 100644 --- a/packages/flutter_tools/test/general.shard/base/error_handling_io_test.dart +++ b/packages/flutter_tools/test/general.shard/base/error_handling_io_test.dart @@ -25,6 +25,7 @@ final Platform windowsPlatform = FakePlatform( ); final Platform linuxPlatform = FakePlatform( + operatingSystem: 'linux', environment: {} ); @@ -888,8 +889,8 @@ void main() { testWithoutContext('when PackageProcess throws an exception without containing non-executable bits', () { final FakeProcessManager fakeProcessManager = FakeProcessManager.list([ - const FakeCommand(command: ['foo'], exception: ProcessPackageExecutableNotFoundException('')), - const FakeCommand(command: ['foo'], exception: ProcessPackageExecutableNotFoundException('')), + const FakeCommand(command: ['foo'], exception: ProcessPackageExecutableNotFoundException('', candidates: [])), + const FakeCommand(command: ['foo'], exception: ProcessPackageExecutableNotFoundException('', candidates: [])), ]); final ProcessManager processManager = ErrorHandlingProcessManager( @@ -1113,7 +1114,7 @@ void main() { platform: linuxPlatform, ); - expect(processManager.killPid(1), true); + expect(processManager.killPid(1, io.ProcessSignal.sigterm), true); expect(processManager.killPid(3, io.ProcessSignal.sigkill), true); expect(fakeProcessManager.killedProcesses, { 1: io.ProcessSignal.sigterm, diff --git a/packages/flutter_tools/test/general.shard/base/file_system_test.dart b/packages/flutter_tools/test/general.shard/base/file_system_test.dart index 0e1235a6eb..fcd710cc05 100644 --- a/packages/flutter_tools/test/general.shard/base/file_system_test.dart +++ b/packages/flutter_tools/test/general.shard/base/file_system_test.dart @@ -137,7 +137,7 @@ void main() { final MemoryFileSystem fileSystem = MemoryFileSystem.test(); final FileSystemUtils fsUtils = FileSystemUtils( fileSystem: fileSystem, - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), ); expect(fsUtils.escapePath('/foo/bar/cool.dart'), '/foo/bar/cool.dart'); expect(fsUtils.escapePath('foo/bar/cool.dart'), 'foo/bar/cool.dart'); diff --git a/packages/flutter_tools/test/general.shard/base/io_test.dart b/packages/flutter_tools/test/general.shard/base/io_test.dart index a3fd727596..e6b1482b36 100644 --- a/packages/flutter_tools/test/general.shard/base/io_test.dart +++ b/packages/flutter_tools/test/general.shard/base/io_test.dart @@ -102,7 +102,7 @@ void main() { testWithoutContext('Does not listen to Posix process signals on windows', () async { final FakePlatform windows = FakePlatform(operatingSystem: 'windows'); - final FakePlatform linux = FakePlatform(); + final FakePlatform linux = FakePlatform(operatingSystem: 'linux'); final FakeProcessSignal fakeSignalA = FakeProcessSignal(); final FakeProcessSignal fakeSignalB = FakeProcessSignal(); fakeSignalA.controller.add(fakeSignalA); diff --git a/packages/flutter_tools/test/general.shard/base/logger_test.dart b/packages/flutter_tools/test/general.shard/base/logger_test.dart index 3fc06cb5b8..a4c404af58 100644 --- a/packages/flutter_tools/test/general.shard/base/logger_test.dart +++ b/packages/flutter_tools/test/general.shard/base/logger_test.dart @@ -19,7 +19,7 @@ import 'package:test/fake.dart'; import '../../src/common.dart'; import '../../src/fakes.dart'; -final Platform _kNoAnsiPlatform = FakePlatform(); +final Platform _kNoAnsiPlatform = FakePlatform(stdoutSupportsAnsi: false); final String red = RegExp.escape(AnsiTerminal.red); final String bold = RegExp.escape(AnsiTerminal.bold); final String resetBold = RegExp.escape(AnsiTerminal.resetBold); @@ -240,7 +240,7 @@ void main() { testWithoutContext('error', () async { final BufferLogger mockLogger = BufferLogger.test( - outputPreferences: OutputPreferences.test(), + outputPreferences: OutputPreferences.test(showColor: false), ); final VerboseLogger verboseLogger = VerboseLogger( mockLogger, @@ -346,6 +346,7 @@ void main() { int called; final List testPlatforms = [ FakePlatform( + operatingSystem: 'linux', environment: {}, executableArguments: [], ), @@ -398,7 +399,7 @@ void main() { SpinnerStatus spinnerStatus; setUp(() { - platform = FakePlatform(); + platform = FakePlatform(stdoutSupportsAnsi: false); ansiPlatform = FakePlatform(stdoutSupportsAnsi: true); terminal = AnsiTerminal( @@ -669,7 +670,7 @@ void main() { platform: _kNoAnsiPlatform, ), stdio: fakeStdio, - outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40), + outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false), ); logger.printError('0123456789' * 15); final List lines = outputStderr(); @@ -698,7 +699,7 @@ void main() { platform: _kNoAnsiPlatform, ), stdio: fakeStdio, - outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40), + outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false), ); logger.printError('0123456789' * 15, indent: 5); final List lines = outputStderr(); @@ -721,7 +722,7 @@ void main() { platform: _kNoAnsiPlatform, ), stdio: fakeStdio, - outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40), + outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false), ); logger.printError('0123456789' * 15, hangingIndent: 5); final List lines = outputStderr(); @@ -744,7 +745,7 @@ void main() { platform: _kNoAnsiPlatform, ), stdio: fakeStdio, - outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40), + outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false), ); logger.printError('0123456789' * 15, indent: 4, hangingIndent: 5); final List lines = outputStderr(); @@ -767,7 +768,7 @@ void main() { platform: _kNoAnsiPlatform, ), stdio: fakeStdio, - outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40), + outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false), ); logger.printStatus('0123456789' * 15); final List lines = outputStdout(); @@ -787,7 +788,7 @@ void main() { platform: _kNoAnsiPlatform, ), stdio: fakeStdio, - outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40), + outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false), ); logger.printStatus('0123456789' * 15, indent: 5); final List lines = outputStdout(); @@ -810,7 +811,7 @@ void main() { platform: _kNoAnsiPlatform, ), stdio: fakeStdio, - outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40) + outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false) ); logger.printStatus('0123456789' * 15, hangingIndent: 5); final List lines = outputStdout(); @@ -833,7 +834,7 @@ void main() { platform: _kNoAnsiPlatform, ), stdio: fakeStdio, - outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40), + outputPreferences: OutputPreferences.test(wrapText: true, wrapColumn: 40, showColor: false), ); logger.printStatus('0123456789' * 15, indent: 4, hangingIndent: 5); final List lines = outputStdout(); @@ -913,7 +914,7 @@ void main() { platform: _kNoAnsiPlatform, ), stdio: fakeStdio, - outputPreferences: OutputPreferences.test(), + outputPreferences: OutputPreferences.test(showColor: false), ); logger.printStatus( null, @@ -936,7 +937,7 @@ void main() { platform: _kNoAnsiPlatform, ), stdio: fakeStdio, - outputPreferences: OutputPreferences.test(), + outputPreferences: OutputPreferences.test(showColor: false), stopwatchFactory: FakeStopwatchFactory(stopwatch: fakeStopwatch), ); final Status status = logger.startProgress( @@ -1006,7 +1007,7 @@ void main() { platform: _kNoAnsiPlatform, ), stdio: fakeStdio, - outputPreferences: OutputPreferences.test(), + outputPreferences: OutputPreferences.test(showColor: false), ); logger.startProgress('AAA').stop(); logger.startProgress('BBB').stop(); diff --git a/packages/flutter_tools/test/general.shard/base/net_test.dart b/packages/flutter_tools/test/general.shard/base/net_test.dart index 05bd1df11a..e03315099c 100644 --- a/packages/flutter_tools/test/general.shard/base/net_test.dart +++ b/packages/flutter_tools/test/general.shard/base/net_test.dart @@ -150,10 +150,10 @@ void main() { final Uri invalid = Uri.parse('http://example.invalid/'); final Net net = createNet( FakeHttpClient.list([ - FakeRequest(invalid, responseError: const io.HandshakeException()), - FakeRequest(invalid, responseError: const io.HandshakeException()), - FakeRequest(invalid, responseError: const io.HandshakeException()), - FakeRequest(invalid, responseError: const io.HandshakeException()), + FakeRequest(invalid, responseError: const io.HandshakeException('')), + FakeRequest(invalid, responseError: const io.HandshakeException('')), + FakeRequest(invalid, responseError: const io.HandshakeException('')), + FakeRequest(invalid, responseError: const io.HandshakeException('')), ]) ); String? error; diff --git a/packages/flutter_tools/test/general.shard/base/os_test.dart b/packages/flutter_tools/test/general.shard/base/os_test.dart index 3621c619c5..2b5219b727 100644 --- a/packages/flutter_tools/test/general.shard/base/os_test.dart +++ b/packages/flutter_tools/test/general.shard/base/os_test.dart @@ -44,7 +44,7 @@ void main() { exitCode: 1, ), ); - final OperatingSystemUtils utils = createOSUtils(FakePlatform()); + final OperatingSystemUtils utils = createOSUtils(FakePlatform(operatingSystem: 'linux')); expect(utils.which(kExecutable), isNull); }); @@ -58,7 +58,7 @@ void main() { stdout: kPath1, ), ); - final OperatingSystemUtils utils = createOSUtils(FakePlatform()); + final OperatingSystemUtils utils = createOSUtils(FakePlatform(operatingSystem: 'linux')); expect(utils.which(kExecutable)!.path, kPath1); }); @@ -73,7 +73,7 @@ void main() { stdout: '$kPath1\n$kPath2', ), ); - final OperatingSystemUtils utils = createOSUtils(FakePlatform()); + final OperatingSystemUtils utils = createOSUtils(FakePlatform(operatingSystem: 'linux')); final List result = utils.whichAll(kExecutable); expect(result, hasLength(2)); expect(result[0].path, kPath1); @@ -177,7 +177,7 @@ void main() { ); final OperatingSystemUtils utils = - createOSUtils(FakePlatform()); + createOSUtils(FakePlatform(operatingSystem: 'linux')); expect(utils.hostPlatform, HostPlatform.linux_x64); }); @@ -193,7 +193,7 @@ void main() { ); final OperatingSystemUtils utils = - createOSUtils(FakePlatform()); + createOSUtils(FakePlatform(operatingSystem: 'linux')); expect(utils.hostPlatform, HostPlatform.linux_arm64); }); @@ -410,6 +410,7 @@ void main() { fileSystem: fileSystem, logger: BufferLogger.test(), platform: FakePlatform( + operatingSystem: 'linux', operatingSystemVersion: 'Linux 1.2.3-abcd #1 SMP PREEMPT Sat Jan 1 00:00:00 UTC 2000', ), processManager: fakeProcessManager, @@ -441,6 +442,7 @@ void main() { fileSystem: fileSystem, logger: BufferLogger.test(), platform: FakePlatform( + operatingSystem: 'linux', operatingSystemVersion: 'Linux 1.2.3-abcd #1 SMP PREEMPT Sat Jan 1 00:00:00 UTC 2000', ), processManager: fakeProcessManager, @@ -461,6 +463,7 @@ void main() { fileSystem: fileSystem, logger: BufferLogger.test(), platform: FakePlatform( + operatingSystem: 'linux', operatingSystemVersion: 'Linux 1.2.3-abcd #1 SMP PREEMPT Sat Jan 1 00:00:00 UTC 2000', ), processManager: fakeProcessManager, @@ -490,6 +493,7 @@ void main() { fileSystem: fileSystem, logger: BufferLogger.test(), platform: FakePlatform( + operatingSystem: 'linux', operatingSystemVersion: 'undefinedOperatingSystemVersion', ), processManager: fakeProcessManager, @@ -523,7 +527,7 @@ void main() { final OperatingSystemUtils osUtils = OperatingSystemUtils( fileSystem: fileSystem, logger: BufferLogger.test(), - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), processManager: fakeProcessManager, ); @@ -614,7 +618,7 @@ void main() { final OperatingSystemUtils linuxOsUtils = OperatingSystemUtils( fileSystem: fileSystem, logger: BufferLogger.test(), - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), processManager: fakeProcessManager, ); diff --git a/packages/flutter_tools/test/general.shard/base/process_test.dart b/packages/flutter_tools/test/general.shard/base/process_test.dart index 208ceb22e2..22b2b38669 100644 --- a/packages/flutter_tools/test/general.shard/base/process_test.dart +++ b/packages/flutter_tools/test/general.shard/base/process_test.dart @@ -72,8 +72,8 @@ void main() { final List testString = ['0123456789' * 10]; processManager.addCommand(FakeCommand( command: const ['command'], - stdout: testString.join(), - stderr: testString.join(), + stdout: testString.join(''), + stderr: testString.join(''), )); await processUtils.stream(['command']); @@ -187,7 +187,7 @@ void main() { testLogger = BufferLogger( terminal: AnsiTerminal( stdio: FakeStdio(), - platform: FakePlatform(), + platform: FakePlatform(stdinSupportsAnsi: false), ), outputPreferences: OutputPreferences(wrapText: true, wrapColumn: 40), ); diff --git a/packages/flutter_tools/test/general.shard/base/terminal_test.dart b/packages/flutter_tools/test/general.shard/base/terminal_test.dart index b602fdc366..4458c6f7d3 100644 --- a/packages/flutter_tools/test/general.shard/base/terminal_test.dart +++ b/packages/flutter_tools/test/general.shard/base/terminal_test.dart @@ -24,7 +24,7 @@ void main() { testWithoutContext('can turn off wrapping', () async { final BufferLogger bufferLogger = BufferLogger( - outputPreferences: OutputPreferences.test(), + outputPreferences: OutputPreferences.test(wrapText: false), terminal: TestTerminal(platform: FakePlatform()..stdoutSupportsAnsi = true), ); final String testString = '0123456789' * 20; @@ -184,7 +184,7 @@ void main() { final Stdio stdio = FakeStdio(); expect(AnsiTerminal(stdio: stdio, platform: const LocalPlatform()).preferredStyle, 0); // Defaults to 0 for backwards compatibility. - expect(AnsiTerminal(stdio: stdio, platform: const LocalPlatform(), now: DateTime(2018)).preferredStyle, 0); + expect(AnsiTerminal(stdio: stdio, platform: const LocalPlatform(), now: DateTime(2018, 1, 1)).preferredStyle, 0); expect(AnsiTerminal(stdio: stdio, platform: const LocalPlatform(), now: DateTime(2018, 1, 2)).preferredStyle, 1); expect(AnsiTerminal(stdio: stdio, platform: const LocalPlatform(), now: DateTime(2018, 1, 3)).preferredStyle, 2); expect(AnsiTerminal(stdio: stdio, platform: const LocalPlatform(), now: DateTime(2018, 1, 4)).preferredStyle, 3); diff --git a/packages/flutter_tools/test/general.shard/base/user_messages_test.dart b/packages/flutter_tools/test/general.shard/base/user_messages_test.dart index b67302013c..4b50070198 100644 --- a/packages/flutter_tools/test/general.shard/base/user_messages_test.dart +++ b/packages/flutter_tools/test/general.shard/base/user_messages_test.dart @@ -11,7 +11,7 @@ typedef _InstallationMessage = String Function(Platform); void main() { final FakePlatform macPlatform = FakePlatform(operatingSystem: 'macos'); - final FakePlatform linuxPlatform = FakePlatform(); + final FakePlatform linuxPlatform = FakePlatform(operatingSystem: 'linux'); final FakePlatform windowsPlatform = FakePlatform(operatingSystem: 'windows'); void _checkInstallationURL(_InstallationMessage message) { diff --git a/packages/flutter_tools/test/general.shard/build_system/build_system_test.dart b/packages/flutter_tools/test/general.shard/build_system/build_system_test.dart index c5bd533f12..0d62bc1de7 100644 --- a/packages/flutter_tools/test/general.shard/build_system/build_system_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/build_system_test.dart @@ -648,6 +648,7 @@ void main() { testWithoutContext('Build completes all dependencies before failing', () async { final MemoryFileSystem fileSystem = MemoryFileSystem.test(); final BuildSystem buildSystem = setUpBuildSystem(fileSystem, FakePlatform( + operatingSystem: 'linux', numberOfProcessors: 10, // Ensure the tool will process tasks concurrently. )); final Completer startB = Completer(); @@ -686,7 +687,7 @@ BuildSystem setUpBuildSystem(FileSystem fileSystem, [FakePlatform? platform]) { return FlutterBuildSystem( fileSystem: fileSystem, logger: BufferLogger.test(), - platform: platform ?? FakePlatform(), + platform: platform ?? FakePlatform(operatingSystem: 'linux'), ); } diff --git a/packages/flutter_tools/test/general.shard/build_system/source_test.dart b/packages/flutter_tools/test/general.shard/build_system/source_test.dart index fe3d0ae034..5ad4f27cb5 100644 --- a/packages/flutter_tools/test/general.shard/build_system/source_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/source_test.dart @@ -36,8 +36,8 @@ void main() { artifacts: globals.artifacts, // using real artifacts processManager: FakeProcessManager.any(), fileSystem: globals.fs, - // engineVersion being null simulates a local engine. logger: globals.logger, + engineVersion: null, // simulate a local engine. ); visitor = SourceVisitor(environment); environment.buildDir.createSync(recursive: true); diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart index 23000156be..fa67e55b19 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart @@ -21,7 +21,7 @@ import '../../../src/common.dart'; import '../../../src/context.dart'; import '../../../src/fake_process_manager.dart'; -final Platform platform = FakePlatform(); +final Platform platform = FakePlatform(operatingSystem: 'linux', environment: const {}); void main() { FakeProcessManager processManager; FileSystem fileSystem; diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/assets_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/assets_test.dart index 4d5f6a266d..b071d2b44d 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/assets_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/assets_test.dart @@ -69,7 +69,7 @@ flutter: expect(depfile, exists); final DepfileService depfileService = DepfileService( - logger: BufferLogger.test(), + logger: null, fileSystem: fileSystem, ); final Depfile dependencies = depfileService.parse(depfile); diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart index b9d2afde5e..acc1a65b72 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart @@ -37,7 +37,7 @@ void main() { processManager = FakeProcessManager.empty(); logger = BufferLogger.test(); artifacts = Artifacts.test(); - fileSystem = MemoryFileSystem.test(); + fileSystem = MemoryFileSystem.test(style: FileSystemStyle.posix); androidEnvironment = Environment.test( fileSystem.currentDirectory, defines: { diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/dart_plugin_registrant_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/dart_plugin_registrant_test.dart index 9a1a018656..01a47e8a62 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/dart_plugin_registrant_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/dart_plugin_registrant_test.dart @@ -11,7 +11,6 @@ @Tags(['no-shuffle']) import 'package:file/memory.dart'; -import 'package:flutter_tools/src/artifacts.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/build_info.dart'; @@ -106,18 +105,18 @@ void main() { testWithoutContext('skipped based on environment.generateDartPluginRegistry', () async { final Environment environment = Environment.test( - fileSystem.currentDirectory, - artifacts: Artifacts.test(), - fileSystem: fileSystem, - logger: BufferLogger.test(), - processManager: FakeProcessManager.any(), - ); + fileSystem.currentDirectory, + artifacts: null, + fileSystem: fileSystem, + logger: BufferLogger.test(), + processManager: FakeProcessManager.any(), + generateDartPluginRegistry: false); expect(const DartPluginRegistrantTarget().canSkip(environment), isTrue); final Environment environment2 = Environment.test( fileSystem.currentDirectory, - artifacts: Artifacts.test(), + artifacts: null, fileSystem: fileSystem, logger: BufferLogger.test(), processManager: FakeProcessManager.any(), @@ -144,7 +143,7 @@ void main() { const DartPluginRegistrantTarget().canSkip( Environment.test( fileSystem.currentDirectory, - artifacts: Artifacts.test(), + artifacts: null, fileSystem: fileSystem, logger: BufferLogger.test(), processManager: FakeProcessManager.any(), @@ -164,7 +163,7 @@ void main() { final Environment environment = Environment.test( fileSystem.currentDirectory, projectDir: projectDir, - artifacts: Artifacts.test(), + artifacts: null, fileSystem: fileSystem, logger: BufferLogger.test(), processManager: FakeProcessManager.any(), @@ -198,7 +197,7 @@ void main() { final Environment environment = Environment.test( fileSystem.currentDirectory, projectDir: projectDir, - artifacts: Artifacts.test(), + artifacts: null, fileSystem: fileSystem, logger: BufferLogger.test(), processManager: FakeProcessManager.any(), @@ -291,7 +290,7 @@ void main() { final Environment environment = Environment.test( fileSystem.currentDirectory, projectDir: projectDir, - artifacts: Artifacts.test(), + artifacts: null, fileSystem: fileSystem, logger: BufferLogger.test(), processManager: FakeProcessManager.any(), @@ -338,7 +337,7 @@ void main() { final Environment environment = Environment.test( fileSystem.currentDirectory, projectDir: projectDir, - artifacts: Artifacts.test(), + artifacts: null, fileSystem: fileSystem, logger: BufferLogger.test(), processManager: FakeProcessManager.any(), diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/deferred_components_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/deferred_components_test.dart index 5964744bc3..dbb2dd8bdc 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/deferred_components_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/deferred_components_test.dart @@ -5,7 +5,6 @@ // @dart = 2.8 import 'package:file/memory.dart'; -import 'package:flutter_tools/src/artifacts.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/build_info.dart'; @@ -36,8 +35,8 @@ void main() { defines: { kDeferredComponents: 'true', }, - artifacts: Artifacts.test(), - processManager: FakeProcessManager.empty(), + artifacts: null, + processManager: null, fileSystem: fileSystem, logger: logger, ); @@ -69,8 +68,8 @@ void main() { defines: { kDeferredComponents: 'true', }, - artifacts: Artifacts.test(), - processManager: FakeProcessManager.empty(), + artifacts: null, + processManager: null, fileSystem: fileSystem, logger: logger, ); @@ -101,8 +100,8 @@ void main() { defines: { kDeferredComponents: 'true', }, - artifacts: Artifacts.test(), - processManager: FakeProcessManager.empty(), + artifacts: null, + processManager: null, fileSystem: fileSystem, logger: logger, ); diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/icon_tree_shaker_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/icon_tree_shaker_test.dart index f8050347cb..8a7f68b9ab 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/icon_tree_shaker_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/icon_tree_shaker_test.dart @@ -16,7 +16,7 @@ import '../../../src/common.dart'; import '../../../src/fake_process_manager.dart'; import '../../../src/fakes.dart'; -final Platform kNoAnsiPlatform = FakePlatform(); +final Platform kNoAnsiPlatform = FakePlatform(stdoutSupportsAnsi: false); const List _kTtfHeaderBytes = [0, 1, 0, 0, 0, 15, 0, 128, 0, 3, 0, 112]; const String inputPath = '/input/fonts/MaterialIcons-Regular.otf'; diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart index e536d4824f..d5a5aed5dc 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart @@ -30,6 +30,7 @@ void main() { Environment environment; FakeProcessManager processManager; final Platform linux = FakePlatform( + operatingSystem: 'linux', environment: {}, ); final Platform windows = FakePlatform( diff --git a/packages/flutter_tools/test/general.shard/cache_test.dart b/packages/flutter_tools/test/general.shard/cache_test.dart index 859966169c..cd6ee10a2b 100644 --- a/packages/flutter_tools/test/general.shard/cache_test.dart +++ b/packages/flutter_tools/test/general.shard/cache_test.dart @@ -448,7 +448,7 @@ void main() { final FlutterRunnerDebugSymbols flutterRunnerDebugSymbols = FlutterRunnerDebugSymbols( cache, packageResolver: packageResolver, - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), ); await flutterRunnerDebugSymbols.updateInner(FakeArtifactUpdater(), fileSystem, FakeOperatingSystemUtils()); @@ -461,7 +461,7 @@ void main() { testWithoutContext('FontSubset in universal artifacts', () { final Cache cache = Cache.test(processManager: FakeProcessManager.any()); - final FontSubsetArtifacts artifacts = FontSubsetArtifacts(cache, platform: FakePlatform()); + final FontSubsetArtifacts artifacts = FontSubsetArtifacts(cache, platform: FakePlatform(operatingSystem: 'linux')); expect(artifacts.developmentArtifact, DevelopmentArtifact.universal); }); @@ -469,8 +469,8 @@ void main() { testWithoutContext('FontSubset artifacts on x64 linux', () { fakeProcessManager.addCommand(unameCommandForX64); - final Cache cache = createCache(FakePlatform()); - final FontSubsetArtifacts artifacts = FontSubsetArtifacts(cache, platform: FakePlatform()); + final Cache cache = createCache(FakePlatform(operatingSystem: 'linux')); + final FontSubsetArtifacts artifacts = FontSubsetArtifacts(cache, platform: FakePlatform(operatingSystem: 'linux')); cache.includeAllPlatforms = false; expect(artifacts.getBinaryDirs(), >[['linux-x64', 'linux-x64/font-subset.zip']]); @@ -479,8 +479,8 @@ void main() { testWithoutContext('FontSubset artifacts on arm64 linux', () { fakeProcessManager.addCommand(unameCommandForArm64); - final Cache cache = createCache(FakePlatform()); - final FontSubsetArtifacts artifacts = FontSubsetArtifacts(cache, platform: FakePlatform()); + final Cache cache = createCache(FakePlatform(operatingSystem: 'linux')); + final FontSubsetArtifacts artifacts = FontSubsetArtifacts(cache, platform: FakePlatform(operatingSystem: 'linux')); cache.includeAllPlatforms = false; expect(artifacts.getBinaryDirs(), >[['linux-arm64', 'linux-arm64/font-subset.zip']]); @@ -559,7 +559,7 @@ void main() { testWithoutContext('macOS desktop artifacts ignore filtering when requested', () { final Cache cache = Cache.test(processManager: FakeProcessManager.any()); - final MacOSEngineArtifacts artifacts = MacOSEngineArtifacts(cache, platform: FakePlatform()); + final MacOSEngineArtifacts artifacts = MacOSEngineArtifacts(cache, platform: FakePlatform(operatingSystem: 'linux')); cache.includeAllPlatforms = false; cache.platformOverrideArtifacts = {'macos'}; @@ -570,7 +570,7 @@ void main() { final Cache cache = Cache.test(processManager: FakeProcessManager.any()); final WindowsEngineArtifacts artifacts = WindowsEngineArtifacts( cache, - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), ); cache.includeAllPlatforms = false; cache.platformOverrideArtifacts = {'windows'}; @@ -608,7 +608,7 @@ void main() { testWithoutContext('Linux desktop artifacts ignore filtering when requested', () { fakeProcessManager.addCommand(unameCommandForX64); - final Cache cache = createCache(FakePlatform()); + final Cache cache = createCache(FakePlatform(operatingSystem: 'linux')); final LinuxEngineArtifacts artifacts = LinuxEngineArtifacts( cache, platform: FakePlatform(operatingSystem: 'macos'), @@ -622,10 +622,10 @@ void main() { testWithoutContext('Linux desktop artifacts for x64 include profile and release artifacts', () { fakeProcessManager.addCommand(unameCommandForX64); - final Cache cache = createCache(FakePlatform()); + final Cache cache = createCache(FakePlatform(operatingSystem: 'linux')); final LinuxEngineArtifacts artifacts = LinuxEngineArtifacts( cache, - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), ); expect(artifacts.getBinaryDirs(), >[ @@ -638,10 +638,10 @@ void main() { testWithoutContext('Linux desktop artifacts for arm64 include profile and release artifacts', () { fakeProcessManager.addCommand(unameCommandForArm64); - final Cache cache = createCache(FakePlatform()); + final Cache cache = createCache(FakePlatform(operatingSystem: 'linux')); final LinuxEngineArtifacts artifacts = LinuxEngineArtifacts( cache, - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), ); expect(artifacts.getBinaryDirs(), >[ @@ -733,7 +733,7 @@ void main() { final Cache cache = Cache.test(processManager: FakeProcessManager.any(), fileSystem: fileSystem); final Directory webCacheDirectory = cache.getWebSdkDirectory(); final FakeArtifactUpdater artifactUpdater = FakeArtifactUpdater(); - final FlutterWebSdk webSdk = FlutterWebSdk(cache, platform: FakePlatform()); + final FlutterWebSdk webSdk = FlutterWebSdk(cache, platform: FakePlatform(operatingSystem: 'linux')); artifactUpdater.onDownloadZipArchive = (String message, Uri uri, Directory location) { location.createSync(recursive: true); @@ -753,7 +753,7 @@ void main() { final Cache cache = Cache.test(processManager: FakeProcessManager.any(), fileSystem: fileSystem); final Directory webCacheDirectory = cache.getWebSdkDirectory(); final FakeArtifactUpdater artifactUpdater = FakeArtifactUpdater(); - final FlutterWebSdk webSdk = FlutterWebSdk(cache, platform: FakePlatform()); + final FlutterWebSdk webSdk = FlutterWebSdk(cache, platform: FakePlatform(operatingSystem: 'linux')); artifactUpdater.onDownloadZipArchive = (String message, Uri uri, Directory location) { location.createSync(recursive: true); @@ -889,13 +889,13 @@ void main() { }); testWithoutContext('AndroidMavenArtifacts has a specified development artifact', () async { - final AndroidMavenArtifacts mavenArtifacts = AndroidMavenArtifacts(cache, platform: FakePlatform()); + final AndroidMavenArtifacts mavenArtifacts = AndroidMavenArtifacts(cache, platform: FakePlatform(operatingSystem: 'linux')); expect(mavenArtifacts.developmentArtifact, DevelopmentArtifact.androidMaven); }); testUsingContext('AndroidMavenArtifacts can invoke Gradle resolve dependencies if Android SDK is present', () async { Cache.flutterRoot = ''; - final AndroidMavenArtifacts mavenArtifacts = AndroidMavenArtifacts(cache, platform: FakePlatform()); + final AndroidMavenArtifacts mavenArtifacts = AndroidMavenArtifacts(cache, platform: FakePlatform(operatingSystem: 'linux')); expect(await mavenArtifacts.isUpToDate(memoryFileSystem), isFalse); final Directory gradleWrapperDir = cache.getArtifactDirectory('gradle_wrapper')..createSync(recursive: true); @@ -909,7 +909,7 @@ void main() { }, overrides: { Cache: () => cache, FileSystem: () => memoryFileSystem, - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), ProcessManager: () => FakeProcessManager.list([ const FakeCommand(command: [ '/cache/bin/cache/flutter_gradle_wrapper.rand0/gradlew', @@ -924,7 +924,7 @@ void main() { }); testUsingContext('AndroidMavenArtifacts is a no-op if the Android SDK is absent', () async { - final AndroidMavenArtifacts mavenArtifacts = AndroidMavenArtifacts(cache, platform: FakePlatform()); + final AndroidMavenArtifacts mavenArtifacts = AndroidMavenArtifacts(cache, platform: FakePlatform(operatingSystem: 'linux')); expect(await mavenArtifacts.isUpToDate(memoryFileSystem), isFalse); await mavenArtifacts.update(FakeArtifactUpdater(), BufferLogger.test(), memoryFileSystem, FakeOperatingSystemUtils()); diff --git a/packages/flutter_tools/test/general.shard/cold_test.dart b/packages/flutter_tools/test/general.shard/cold_test.dart index 60eb67a4c4..2a05890aae 100644 --- a/packages/flutter_tools/test/general.shard/cold_test.dart +++ b/packages/flutter_tools/test/general.shard/cold_test.dart @@ -42,7 +42,9 @@ void main() { final int exitCode = await ColdRunner(devices, debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug), target: 'main.dart', - ).attach(); + ).attach( + enableDevTools: false, + ); expect(exitCode, 2); }); @@ -86,7 +88,9 @@ void main() { applicationBinary: applicationBinary, debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug), target: 'main.dart', - ).run(); + ).run( + enableDevTools: false, + ); expect(result, 1); }); @@ -102,7 +106,9 @@ void main() { debuggingOptions: DebuggingOptions.disabled(BuildInfo.debug), target: 'main.dart', traceStartup: true, - ).run(); + ).run( + enableDevTools: false, + ); expect(result, 0); expect(memoryFileSystem.directory(getBuildDirectory()).childFile('start_up_info.json').existsSync(), true); @@ -125,7 +131,9 @@ void main() { debuggingOptions: DebuggingOptions.disabled(BuildInfo.debug), target: 'main.dart', traceStartup: true, - ).run(); + ).run( + enableDevTools: false, + ); expect(result, 0); expect(memoryFileSystem.directory('test_output_dir').childFile('start_up_info.json').existsSync(), true); diff --git a/packages/flutter_tools/test/general.shard/commands/build_test.dart b/packages/flutter_tools/test/general.shard/commands/build_test.dart index 17e661aafe..d5463e3a43 100644 --- a/packages/flutter_tools/test/general.shard/commands/build_test.dart +++ b/packages/flutter_tools/test/general.shard/commands/build_test.dart @@ -28,18 +28,18 @@ import '../../src/context.dart'; void main() { testUsingContext('All build commands support null safety options', () { final List commands = [ - BuildWindowsCommand(), - BuildLinuxCommand(operatingSystemUtils: globals.os), + BuildWindowsCommand(verboseHelp: false), + BuildLinuxCommand(verboseHelp: false, operatingSystemUtils: globals.os), BuildMacosCommand(verboseHelp: false), BuildWebCommand(verboseHelp: false), - BuildApkCommand(), + BuildApkCommand(verboseHelp: false), BuildIOSCommand(verboseHelp: false), BuildIOSArchiveCommand(verboseHelp: false), - BuildAppBundleCommand(), + BuildAppBundleCommand(verboseHelp: false), BuildFuchsiaCommand(verboseHelp: false), BuildAarCommand(verboseHelp: false), BuildIOSFrameworkCommand(verboseHelp: false, buildSystem: globals.buildSystem), - AttachCommand(), + AttachCommand(verboseHelp: false), ]; for (final FlutterCommand command in commands) { @@ -57,12 +57,15 @@ void main() { const BuildInfo unsound = BuildInfo( BuildMode.debug, '', + trackWidgetCreation: false, nullSafetyMode: NullSafetyMode.unsound, treeShakeIcons: false, ); const BuildInfo sound = BuildInfo( BuildMode.debug, '', + trackWidgetCreation: false, + nullSafetyMode: NullSafetyMode.sound, treeShakeIcons: false, ); diff --git a/packages/flutter_tools/test/general.shard/compile_expression_test.dart b/packages/flutter_tools/test/general.shard/compile_expression_test.dart index 981989eb1f..d4a455945e 100644 --- a/packages/flutter_tools/test/general.shard/compile_expression_test.dart +++ b/packages/flutter_tools/test/general.shard/compile_expression_test.dart @@ -40,7 +40,7 @@ void main() { artifacts: Artifacts.test(), processManager: processManager, logger: testLogger, - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), fileSystem: fileSystem, ); diff --git a/packages/flutter_tools/test/general.shard/compile_incremental_test.dart b/packages/flutter_tools/test/general.shard/compile_incremental_test.dart index 1a1c5eda43..acecafdb7b 100644 --- a/packages/flutter_tools/test/general.shard/compile_incremental_test.dart +++ b/packages/flutter_tools/test/general.shard/compile_incremental_test.dart @@ -58,7 +58,7 @@ void main() { logger: testLogger, processManager: fakeProcessManager, artifacts: Artifacts.test(), - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), fileSystem: MemoryFileSystem.test(), stdoutHandler: generatorStdoutHandler, ); @@ -68,7 +68,7 @@ void main() { logger: testLogger, processManager: fakeProcessManager, artifacts: Artifacts.test(), - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), fileSystemRoots: [ '/foo/bar/fizz', ], diff --git a/packages/flutter_tools/test/general.shard/config_test.dart b/packages/flutter_tools/test/general.shard/config_test.dart index 1e0ac6a978..c4f95ca0a2 100644 --- a/packages/flutter_tools/test/general.shard/config_test.dart +++ b/packages/flutter_tools/test/general.shard/config_test.dart @@ -21,6 +21,7 @@ void main() { setUp(() { memoryFileSystem = MemoryFileSystem.test(); fakePlatform = FakePlatform( + operatingSystem: 'linux', environment: { 'HOME': '/', }, @@ -95,7 +96,7 @@ void main() { testWithoutContext('Config does not error on a normally fatal file system exception', () { final BufferLogger bufferLogger = BufferLogger.test(); final File file = ErrorHandlingFile( - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), fileSystem: MemoryFileSystem.test(), delegate: FakeFile('testfile'), ); diff --git a/packages/flutter_tools/test/general.shard/crash_reporting_test.dart b/packages/flutter_tools/test/general.shard/crash_reporting_test.dart index 1ad00b61cd..89bcdd4eeb 100644 --- a/packages/flutter_tools/test/general.shard/crash_reporting_test.dart +++ b/packages/flutter_tools/test/general.shard/crash_reporting_test.dart @@ -36,7 +36,7 @@ void main() { fs = MemoryFileSystem.test(); testUsage = TestUsage(); - platform = FakePlatform(environment: {}); + platform = FakePlatform(environment: {}, operatingSystem: 'linux'); operatingSystemUtils = OperatingSystemUtils( fileSystem: fs, logger: logger, @@ -290,6 +290,7 @@ void main() { }); final Platform environmentPlatform = FakePlatform( + operatingSystem: 'linux', environment: { 'HOME': '/', 'FLUTTER_CRASH_SERVER_BASE_URL': 'https://localhost:12345/fake_server', diff --git a/packages/flutter_tools/test/general.shard/custom_devices/custom_device_test.dart b/packages/flutter_tools/test/general.shard/custom_devices/custom_device_test.dart index f1b8683bff..e981640eff 100644 --- a/packages/flutter_tools/test/general.shard/custom_devices/custom_device_test.dart +++ b/packages/flutter_tools/test/general.shard/custom_devices/custom_device_test.dart @@ -179,7 +179,7 @@ void main() { _writeCustomDevicesConfigFile(dir, [testConfig]); expect(await CustomDevices( - featureFlags: TestFeatureFlags(), + featureFlags: TestFeatureFlags(areCustomDevicesEnabled: false), logger: BufferLogger.test(), processManager: FakeProcessManager.any(), config: CustomDevicesConfig.test( @@ -285,6 +285,8 @@ void main() { processManager: FakeProcessManager.list([ FakeCommand( command: testConfig.pingCommand, + exitCode: 0, + stdout: '', ), ]), config: CustomDevicesConfig.test( @@ -352,7 +354,7 @@ void main() { ); // this should start the command - expect(await forwarder.forward(12345), 12345); + expect(await forwarder.forward(12345, hostPort: null), 12345); expect(forwardPortCommandCompleter.isCompleted, false); // this should terminate it diff --git a/packages/flutter_tools/test/general.shard/custom_devices/custom_device_workflow_test.dart b/packages/flutter_tools/test/general.shard/custom_devices/custom_device_workflow_test.dart index 3f54ecd481..319ca9f6e0 100644 --- a/packages/flutter_tools/test/general.shard/custom_devices/custom_device_workflow_test.dart +++ b/packages/flutter_tools/test/general.shard/custom_devices/custom_device_workflow_test.dart @@ -9,7 +9,7 @@ import '../../src/fakes.dart'; void main() { testWithoutContext('CustomDeviceWorkflow reports false when custom devices feature is disabled', () { - final CustomDeviceWorkflow workflow = CustomDeviceWorkflow(featureFlags: TestFeatureFlags()); + final CustomDeviceWorkflow workflow = CustomDeviceWorkflow(featureFlags: TestFeatureFlags(areCustomDevicesEnabled: false)); expect(workflow.appliesToHostPlatform, false); expect(workflow.canLaunchDevices, false); expect(workflow.canListDevices, false); diff --git a/packages/flutter_tools/test/general.shard/custom_devices/custom_devices_config_test.dart b/packages/flutter_tools/test/general.shard/custom_devices/custom_devices_config_test.dart index 38eefe97c5..ee9000b861 100644 --- a/packages/flutter_tools/test/general.shard/custom_devices/custom_devices_config_test.dart +++ b/packages/flutter_tools/test/general.shard/custom_devices/custom_devices_config_test.dart @@ -23,7 +23,8 @@ void main() { final Directory directory = fileSystem.directory('custom_devices_config'); writeCustomDevicesConfigFile( - directory + directory, + json: null ); final CustomDevicesConfig customDevicesConfig = CustomDevicesConfig.test( diff --git a/packages/flutter_tools/test/general.shard/dart/language_version_test.dart b/packages/flutter_tools/test/general.shard/dart/language_version_test.dart index fb0134856b..c974e821dd 100644 --- a/packages/flutter_tools/test/general.shard/dart/language_version_test.dart +++ b/packages/flutter_tools/test/general.shard/dart/language_version_test.dart @@ -287,6 +287,7 @@ library funstuff; final Package package = Package( 'foo', Uri.parse('file://foo/'), + languageVersion: null, ); expect(determineLanguageVersion(file, package, flutterRoot), testCurrentLanguageVersion); diff --git a/packages/flutter_tools/test/general.shard/dart/pub_get_test.dart b/packages/flutter_tools/test/general.shard/dart/pub_get_test.dart index 819f5f11eb..761af195ac 100644 --- a/packages/flutter_tools/test/general.shard/dart/pub_get_test.dart +++ b/packages/flutter_tools/test/general.shard/dart/pub_get_test.dart @@ -36,7 +36,9 @@ void main() { logger: logger, processManager: processManager, usage: TestUsage(), - platform: FakePlatform(), + platform: FakePlatform( + environment: const {}, + ), botDetector: const BotDetectorAlwaysNo(), ); @@ -80,7 +82,9 @@ void main() { logger: logger, processManager: processManager, usage: TestUsage(), - platform: FakePlatform(), + platform: FakePlatform( + environment: const {}, + ), botDetector: const BotDetectorAlwaysNo(), ); @@ -128,7 +132,9 @@ void main() { logger: logger, processManager: processManager, usage: TestUsage(), - platform: FakePlatform(), + platform: FakePlatform( + environment: const {}, + ), botDetector: const BotDetectorAlwaysNo(), ); @@ -175,7 +181,9 @@ void main() { logger: logger, processManager: processManager, usage: TestUsage(), - platform: FakePlatform(), + platform: FakePlatform( + environment: const {}, + ), botDetector: const BotDetectorAlwaysNo(), ); @@ -205,7 +213,9 @@ void main() { logger: logger, processManager: processManager, usage: TestUsage(), - platform: FakePlatform(), + platform: FakePlatform( + environment: const {}, + ), botDetector: const BotDetectorAlwaysNo(), ); @@ -238,7 +248,9 @@ void main() { logger: logger, processManager: processManager, usage: TestUsage(), - platform: FakePlatform(), + platform: FakePlatform( + environment: const {}, + ), botDetector: const BotDetectorAlwaysNo(), ); @@ -275,7 +287,9 @@ void main() { logger: logger, processManager: processManager, usage: TestUsage(), - platform: FakePlatform(), + platform: FakePlatform( + environment: const {}, + ), botDetector: const BotDetectorAlwaysNo(), ); @@ -312,7 +326,9 @@ void main() { logger: logger, processManager: processManager, usage: TestUsage(), - platform: FakePlatform(), + platform: FakePlatform( + environment: const {}, + ), botDetector: const BotDetectorAlwaysNo(), ); @@ -349,7 +365,9 @@ void main() { logger: logger, processManager: processManager, usage: TestUsage(), - platform: FakePlatform(), + platform: FakePlatform( + environment: const {}, + ), botDetector: const BotDetectorAlwaysNo(), ); @@ -385,7 +403,9 @@ void main() { logger: logger, processManager: processManager, usage: TestUsage(), - platform: FakePlatform(), + platform: FakePlatform( + environment: const {}, + ), botDetector: const BotDetectorAlwaysNo(), ); @@ -423,7 +443,9 @@ void main() { logger: logger, processManager: processManager, usage: TestUsage(), - platform: FakePlatform(), + platform: FakePlatform( + environment: const {}, + ), botDetector: const BotDetectorAlwaysNo(), ); @@ -463,7 +485,9 @@ void main() { logger: logger, processManager: processManager, usage: TestUsage(), - platform: FakePlatform(), + platform: FakePlatform( + environment: const {}, + ), botDetector: const BotDetectorAlwaysNo(), ); @@ -509,7 +533,9 @@ void main() { logger: logger, processManager: processManager, usage: TestUsage(), - platform: FakePlatform(), + platform: FakePlatform( + environment: const {}, + ), botDetector: const BotDetectorAlwaysNo(), ); @@ -594,7 +620,9 @@ void main() { logger: logger, processManager: processManager, usage: TestUsage(), - platform: FakePlatform(), + platform: FakePlatform( + environment: const {}, + ), botDetector: const BotDetectorAlwaysNo(), ); @@ -636,7 +664,7 @@ void main() { ]); final Pub pub = Pub( - platform: FakePlatform(), + platform: FakePlatform(environment: const {}), fileSystem: fileSystem, logger: logger, usage: TestUsage(), @@ -746,7 +774,7 @@ void main() { ]); final Pub pub = Pub( - platform: FakePlatform(), + platform: FakePlatform(environment: const {}), usage: TestUsage(), fileSystem: fileSystem, logger: BufferLogger.test(), @@ -1029,6 +1057,7 @@ void main() { logger: logger, processManager: processManager, platform: FakePlatform( + operatingSystem: 'linux', // so that the command executed is consistent environment: {}, ), botDetector: const BotDetectorAlwaysNo() diff --git a/packages/flutter_tools/test/general.shard/desktop_device_test.dart b/packages/flutter_tools/test/general.shard/desktop_device_test.dart index 451fb5dc92..17a33c598f 100644 --- a/packages/flutter_tools/test/general.shard/desktop_device_test.dart +++ b/packages/flutter_tools/test/general.shard/desktop_device_test.dart @@ -182,6 +182,7 @@ void main() { BuildInfo.debug, startPaused: true, disableServiceAuthCodes: true, + dartFlags: '', enableSoftwareRendering: true, skiaDeterministicRendering: true, traceSkia: true, diff --git a/packages/flutter_tools/test/general.shard/device_test.dart b/packages/flutter_tools/test/general.shard/device_test.dart index 4c36c91707..515db621d4 100644 --- a/packages/flutter_tools/test/general.shard/device_test.dart +++ b/packages/flutter_tools/test/general.shard/device_test.dart @@ -483,7 +483,7 @@ void main() { testWithoutContext('computeDartVmFlags handles various combinations of Dart VM flags and null_assertions', () { expect(computeDartVmFlags(DebuggingOptions.enabled(BuildInfo.debug)), ''); expect(computeDartVmFlags(DebuggingOptions.enabled(BuildInfo.debug, dartFlags: '--foo')), '--foo'); - expect(computeDartVmFlags(DebuggingOptions.enabled(BuildInfo.debug, nullAssertions: true)), '--null_assertions'); + expect(computeDartVmFlags(DebuggingOptions.enabled(BuildInfo.debug, dartFlags: '', nullAssertions: true)), '--null_assertions'); expect(computeDartVmFlags(DebuggingOptions.enabled(BuildInfo.debug, dartFlags: '--foo', nullAssertions: true)), '--foo,--null_assertions'); }); } diff --git a/packages/flutter_tools/test/general.shard/doctor.dart b/packages/flutter_tools/test/general.shard/doctor.dart index 3dfb68ad9b..8462e1e45e 100644 --- a/packages/flutter_tools/test/general.shard/doctor.dart +++ b/packages/flutter_tools/test/general.shard/doctor.dart @@ -39,7 +39,10 @@ void main() { expect(DoctorValidatorsProvider.defaultInstance.validators, isNot(contains(isA()))); }, overrides: { - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags( + isLinuxEnabled: false, + isWindowsEnabled: false, + ), })); test('doctor validators includes web when feature is enabled', () => testbed.run(() { @@ -55,6 +58,8 @@ void main() { expect(DoctorValidatorsProvider.defaultInstance.validators, isNot(contains(isA()))); }, overrides: { - FeatureFlags: () => TestFeatureFlags(), + FeatureFlags: () => TestFeatureFlags( + isWebEnabled: false, + ), })); } diff --git a/packages/flutter_tools/test/general.shard/drive/drive_service_test.dart b/packages/flutter_tools/test/general.shard/drive/drive_service_test.dart index 372527cec2..c9bd8dfefd 100644 --- a/packages/flutter_tools/test/general.shard/drive/drive_service_test.dart +++ b/packages/flutter_tools/test/general.shard/drive/drive_service_test.dart @@ -339,7 +339,9 @@ void main() { 'data': {'A': 'B'} }); }, overrides: { - FlutterVersion: () => FakeFlutterVersion() + FlutterVersion: () => FakeFlutterVersion( + engineRevision: 'abcdefghijklmnopqrstuvwxyz', + ) }); testWithoutContext('Can connect to existing application and stop it during cleanup', () async { diff --git a/packages/flutter_tools/test/general.shard/emulator_test.dart b/packages/flutter_tools/test/general.shard/emulator_test.dart index d2aaa6989b..2d17323601 100644 --- a/packages/flutter_tools/test/general.shard/emulator_test.dart +++ b/packages/flutter_tools/test/general.shard/emulator_test.dart @@ -99,7 +99,7 @@ void main() { ]), androidSdk: null, androidWorkflow: AndroidWorkflow( - androidSdk: sdk, + androidSdk: null, featureFlags: TestFeatureFlags(), operatingSystemUtils: FakeOperatingSystemUtils(), ), diff --git a/packages/flutter_tools/test/general.shard/flutter_manifest_test.dart b/packages/flutter_tools/test/general.shard/flutter_manifest_test.dart index 77f1de0639..1dd1574a59 100644 --- a/packages/flutter_tools/test/general.shard/flutter_manifest_test.dart +++ b/packages/flutter_tools/test/general.shard/flutter_manifest_test.dart @@ -630,8 +630,8 @@ flutter: expect(flutterManifest, matchesManifest( appVersion: '1.0.0+2', buildName: '1.0.0', - buildNumber: '2', - )); + buildNumber: '2'), + ); }); testWithoutContext('FlutterManifest parses major.minor.patch with no build version', () { @@ -652,7 +652,8 @@ flutter: expect(flutterManifest, matchesManifest( appVersion: '0.0.1', buildName: '0.0.1', - )); + buildNumber: null), + ); }); testWithoutContext('FlutterManifest parses major.minor.patch+build version clause 2', () { @@ -673,8 +674,8 @@ flutter: expect(flutterManifest, matchesManifest( appVersion: '1.0.0-beta+exp.sha.5114f85', buildName: '1.0.0-beta', - buildNumber: 'exp.sha.5114f85', - )); + buildNumber: 'exp.sha.5114f85'), + ); }); testWithoutContext('FlutterManifest parses major.minor+build version clause', () { @@ -695,8 +696,8 @@ flutter: expect(flutterManifest, matchesManifest( appVersion: '1.0+2', buildName: '1.0', - buildNumber: '2', - )); + buildNumber: '2'), + ); }); testWithoutContext('FlutterManifest parses empty version clause', () { @@ -714,7 +715,11 @@ flutter: logger: logger, ); - expect(flutterManifest, matchesManifest()); + expect(flutterManifest, matchesManifest( + appVersion: null, + buildName: null, + buildNumber: null), + ); }); testWithoutContext('FlutterManifest parses no version clause', () { @@ -731,7 +736,11 @@ flutter: logger: logger, ); - expect(flutterManifest, matchesManifest()); + expect(flutterManifest, matchesManifest( + appVersion: null, + buildName: null, + buildNumber: null), + ); }); // Regression test for https://github.com/flutter/flutter/issues/31764 diff --git a/packages/flutter_tools/test/general.shard/flutter_platform_test.dart b/packages/flutter_tools/test/general.shard/flutter_platform_test.dart index b94c003dc9..08c940753b 100644 --- a/packages/flutter_tools/test/general.shard/flutter_platform_test.dart +++ b/packages/flutter_tools/test/general.shard/flutter_platform_test.dart @@ -69,6 +69,7 @@ void main() { BuildInfo.debug, startPaused: true, ), + enableObservatory: false, ), throwsAssertionError); expect(() => installHook( @@ -78,6 +79,7 @@ void main() { startPaused: true, hostVmServicePort: 123, ), + enableObservatory: false, ), throwsAssertionError); FlutterPlatform capturedPlatform; diff --git a/packages/flutter_tools/test/general.shard/flutter_tester_device_test.dart b/packages/flutter_tools/test/general.shard/flutter_tester_device_test.dart index df75015aa4..34020c43dd 100644 --- a/packages/flutter_tools/test/general.shard/flutter_tester_device_test.dart +++ b/packages/flutter_tools/test/general.shard/flutter_tester_device_test.dart @@ -34,6 +34,7 @@ void main() { fileSystem = MemoryFileSystem.test(); // Not Windows. platform = FakePlatform( + operatingSystem: 'linux', environment: {}, ); processManager = FakeProcessManager.any(); @@ -146,6 +147,7 @@ void main() { ], stdout: 'success', stderr: 'failure', + exitCode: 0, ) ]); device = createDevice(dartEntrypointArgs: ['--foo', '--bar']); @@ -178,6 +180,7 @@ void main() { ], stdout: 'Observatory listening on http://localhost:1234', stderr: 'failure', + exitCode: 0, ) ]); device = createDevice(enableObservatory: true); @@ -217,7 +220,11 @@ class TestFlutterTesterDevice extends FlutterTesterTestDevice { treeShakeIcons: false, packagesPath: '.dart_tool/package_config.json', ), + startPaused: false, + enableDds: true, + disableServiceAuthCodes: false, hostVmServicePort: 1234, + nullAssertions: false, dartEntrypointArgs: dartEntrypointArgs, ), enableObservatory: enableObservatory, diff --git a/packages/flutter_tools/test/general.shard/flutter_validator_test.dart b/packages/flutter_tools/test/general.shard/flutter_validator_test.dart index 05abf80a10..bfc9d276db 100644 --- a/packages/flutter_tools/test/general.shard/flutter_validator_test.dart +++ b/packages/flutter_tools/test/general.shard/flutter_validator_test.dart @@ -40,6 +40,7 @@ void main() { final Artifacts artifacts = Artifacts.test(); final FlutterValidator flutterValidator = FlutterValidator( platform: FakePlatform( + operatingSystem: 'linux', localeName: 'en_US.UTF-8', environment: {}, ), diff --git a/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_dev_finder_test.dart b/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_dev_finder_test.dart index f2e689f893..9bf1342e3e 100644 --- a/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_dev_finder_test.dart +++ b/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_dev_finder_test.dart @@ -87,6 +87,7 @@ void main() { final ProcessManager processManager = FakeProcessManager.list([ FakeCommand( command: [ deviceFinder.path, 'list', '-full' ], + exitCode: 0, stdout: 'device1\ndevice2', ), ]); @@ -113,6 +114,7 @@ void main() { '-timeout', '2000ms', ], + exitCode: 0, stdout: 'device1', ), ]); diff --git a/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_start_test.dart b/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_start_test.dart index b3418732b1..efcc9b704e 100644 --- a/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_start_test.dart +++ b/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_start_test.dart @@ -354,7 +354,7 @@ void main() { Artifacts: () => artifacts, FileSystem: () => memoryFileSystem, ProcessManager: () => FakeProcessManager.any(), - FuchsiaArtifacts: () => FuchsiaArtifacts(), + FuchsiaArtifacts: () => FuchsiaArtifacts(sshConfig: null), OperatingSystemUtils: () => osUtils, }); @@ -369,7 +369,9 @@ void main() { FuchsiaDeviceTools: () => fuchsiaDeviceTools, FuchsiaArtifacts: () => FuchsiaArtifacts(sshConfig: sshConfig), OperatingSystemUtils: () => osUtils, - Platform: () => FakePlatform(), + Platform: () => FakePlatform( + operatingSystem: 'linux', + ), }); testUsingContext('fail with correct LaunchResult when pm fails', () async { diff --git a/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart b/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart index 26c4050ff8..50c8c3ac10 100644 --- a/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart +++ b/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart @@ -91,7 +91,7 @@ void main() { testWithoutContext('lists nothing when workflow cannot list devices', () async { final FakeFuchsiaWorkflow fuchsiaWorkflow = FakeFuchsiaWorkflow(canListDevices: false); final FuchsiaDevices fuchsiaDevices = FuchsiaDevices( - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), fuchsiaSdk: null, fuchsiaWorkflow: fuchsiaWorkflow, logger: BufferLogger.test(), @@ -102,10 +102,10 @@ void main() { }); testWithoutContext('can parse ffx output for single device', () async { - final FakeFuchsiaWorkflow fuchsiaWorkflow = FakeFuchsiaWorkflow(shouldUseDeviceFinder: false); + final FakeFuchsiaWorkflow fuchsiaWorkflow = FakeFuchsiaWorkflow(shouldUseDeviceFinder: false, canListDevices: true); final FakeFuchsiaSdk fuchsiaSdk = FakeFuchsiaSdk(devices: '2001:0db8:85a3:0000:0000:8a2e:0370:7334 paper-pulp-bush-angel'); final FuchsiaDevices fuchsiaDevices = FuchsiaDevices( - platform: FakePlatform(environment: {}), + platform: FakePlatform(operatingSystem: 'linux', environment: {},), fuchsiaSdk: fuchsiaSdk, fuchsiaWorkflow: fuchsiaWorkflow, logger: BufferLogger.test(), @@ -118,10 +118,10 @@ void main() { }); testWithoutContext('can parse device-finder output for single device', () async { - final FakeFuchsiaWorkflow fuchsiaWorkflow = FakeFuchsiaWorkflow(); + final FakeFuchsiaWorkflow fuchsiaWorkflow = FakeFuchsiaWorkflow(shouldUseDeviceFinder: true, canListDevices: true); final FakeFuchsiaSdk fuchsiaSdk = FakeFuchsiaSdk(devFinderDevices: '2001:0db8:85a3:0000:0000:8a2e:0370:7334 paper-pulp-bush-angel'); final FuchsiaDevices fuchsiaDevices = FuchsiaDevices( - platform: FakePlatform(environment: {'FUCHSIA_DISABLED_ffx_discovery': '1'}), + platform: FakePlatform(operatingSystem: 'linux', environment: {'FUCHSIA_DISABLED_ffx_discovery': '1'},), fuchsiaSdk: fuchsiaSdk, fuchsiaWorkflow: fuchsiaWorkflow, logger: BufferLogger.test(), @@ -134,13 +134,13 @@ void main() { }); testWithoutContext('can parse ffx output for multiple devices', () async { - final FakeFuchsiaWorkflow fuchsiaWorkflow = FakeFuchsiaWorkflow(shouldUseDeviceFinder: false); + final FakeFuchsiaWorkflow fuchsiaWorkflow = FakeFuchsiaWorkflow(shouldUseDeviceFinder: false, canListDevices: true); final FakeFuchsiaSdk fuchsiaSdk = FakeFuchsiaSdk(devices: '2001:0db8:85a3:0000:0000:8a2e:0370:7334 paper-pulp-bush-angel\n' '2001:0db8:85a3:0000:0000:8a2e:0370:7335 foo-bar-fiz-buzz' ); final FuchsiaDevices fuchsiaDevices = FuchsiaDevices( - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), fuchsiaSdk: fuchsiaSdk, fuchsiaWorkflow: fuchsiaWorkflow, logger: BufferLogger.test(), @@ -155,13 +155,13 @@ void main() { }); testWithoutContext('can parse device-finder output for multiple devices', () async { - final FakeFuchsiaWorkflow fuchsiaWorkflow = FakeFuchsiaWorkflow(); + final FakeFuchsiaWorkflow fuchsiaWorkflow = FakeFuchsiaWorkflow(shouldUseDeviceFinder: true, canListDevices: true); final FakeFuchsiaSdk fuchsiaSdk = FakeFuchsiaSdk(devFinderDevices: '2001:0db8:85a3:0000:0000:8a2e:0370:7334 paper-pulp-bush-angel\n' '2001:0db8:85a3:0000:0000:8a2e:0370:7335 foo-bar-fiz-buzz' ); final FuchsiaDevices fuchsiaDevices = FuchsiaDevices( - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), fuchsiaSdk: fuchsiaSdk, fuchsiaWorkflow: fuchsiaWorkflow, logger: BufferLogger.test(), @@ -179,7 +179,7 @@ void main() { final FakeFuchsiaWorkflow fuchsiaWorkflow = FakeFuchsiaWorkflow(shouldUseDeviceFinder: false, canListDevices: false); final FakeFuchsiaSdk fuchsiaSdk = FakeFuchsiaSdk(devices: 'junk', devFinderDevices: 'junk'); final FuchsiaDevices fuchsiaDevices = FuchsiaDevices( - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), fuchsiaSdk: fuchsiaSdk, fuchsiaWorkflow: fuchsiaWorkflow, logger: BufferLogger.test(), @@ -191,10 +191,10 @@ void main() { }); testWithoutContext('can parse junk output from device-finder', () async { - final FakeFuchsiaWorkflow fuchsiaWorkflow = FakeFuchsiaWorkflow(); + final FakeFuchsiaWorkflow fuchsiaWorkflow = FakeFuchsiaWorkflow(shouldUseDeviceFinder: true, canListDevices: true); final FakeFuchsiaSdk fuchsiaSdk = FakeFuchsiaSdk(devices: 'junk', devFinderDevices: 'junk'); final FuchsiaDevices fuchsiaDevices = FuchsiaDevices( - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), fuchsiaSdk: fuchsiaSdk, fuchsiaWorkflow: fuchsiaWorkflow, logger: BufferLogger.test(), @@ -254,7 +254,7 @@ void main() { expect(await device.targetPlatform, TargetPlatform.fuchsia_arm64); }, overrides: { - FuchsiaArtifacts: () => FuchsiaArtifacts(), + FuchsiaArtifacts: () => FuchsiaArtifacts(sshConfig: null), FuchsiaSdk: () => FakeFuchsiaSdk(), ProcessManager: () => processManager, }); @@ -479,7 +479,9 @@ void main() { final FuchsiaDevice device = FuchsiaDevice('id', name: 'tester'); expect(device.supportsScreenshot, true); }, overrides: { - Platform: () => FakePlatform(), + Platform: () => FakePlatform( + operatingSystem: 'linux', + ), }); testUsingContext('is not supported on Windows', () { @@ -525,6 +527,7 @@ void main() { environment: { 'FUCHSIA_SSH_CONFIG': '/fuchsia/out/default/.ssh', }, + operatingSystem: 'linux', ), }); @@ -571,6 +574,7 @@ void main() { environment: { 'FUCHSIA_SSH_CONFIG': '/fuchsia/out/default/.ssh', }, + operatingSystem: 'linux', ), }); @@ -618,6 +622,7 @@ void main() { environment: { 'FUCHSIA_SSH_CONFIG': '/fuchsia/out/default/.ssh', }, + operatingSystem: 'linux', ), }, testOn: 'posix'); @@ -659,6 +664,7 @@ void main() { environment: { 'FUCHSIA_SSH_CONFIG': '/fuchsia/out/default/.ssh', }, + operatingSystem: 'linux', ), }); }); @@ -724,7 +730,7 @@ void main() { const String expectedIsolateName = 'foobar'; final Uri uri = await findUri([ // no ui isolate. - FlutterView(id: '1', uiIsolate: fakeIsolate), + FlutterView(id: '1', uiIsolate: null), // wrong name. FlutterView( id: '2', @@ -750,7 +756,7 @@ void main() { const String expectedIsolateName = 'foobar'; final Future uri = findUri([ // no ui isolate. - FlutterView(id: '1', uiIsolate: fakeIsolate), + FlutterView(id: '1', uiIsolate: null), // wrong name. FlutterView(id: '2', uiIsolate: vm_service.Isolate.parse({ ...fakeIsolate.toJson(), @@ -764,7 +770,7 @@ void main() { testUsingContext('can handle non flutter view', () async { const String expectedIsolateName = 'foobar'; final Future uri = findUri([ - FlutterView(id: '1', uiIsolate: fakeIsolate), // no ui isolate. + FlutterView(id: '1', uiIsolate: null), // no ui isolate. ], expectedIsolateName); expect(uri, throwsException); @@ -779,7 +785,7 @@ void main() { final CachedArtifacts artifacts = CachedArtifacts( cache: cache, fileSystem: fileSystem, - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), operatingSystemUtils: globals.os, ); expect(artifacts.getArtifactPath( @@ -827,7 +833,7 @@ void main() { expect(await device.sdkNameAndVersion, equals('Fuchsia')); }, overrides: { ProcessManager: () => processManager, - FuchsiaArtifacts: () => FuchsiaArtifacts(), + FuchsiaArtifacts: () => FuchsiaArtifacts(sshConfig: null), FuchsiaSdk: () => FakeFuchsiaSdk(), }); diff --git a/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_ffx_test.dart b/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_ffx_test.dart index 34bccd0662..4e46ecf437 100644 --- a/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_ffx_test.dart +++ b/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_ffx_test.dart @@ -46,6 +46,7 @@ void main() { FakeProcessManager.list([ FakeCommand( command: [ffx.path, 'target', 'list', '--format', 's'], + exitCode: 0, stderr: 'No devices found.', ), ]); @@ -89,6 +90,7 @@ void main() { FakeProcessManager.list([ FakeCommand( command: [ffx.path, 'target', 'list', '--format', 's'], + exitCode: 0, stdout: 'device1\ndevice2', ), ]); @@ -110,6 +112,7 @@ void main() { FakeProcessManager.list([ FakeCommand( command: [ffx.path, '-T', '2', 'target', 'list', '--format', 's'], + exitCode: 0, stdout: 'device1', ), ]); @@ -188,6 +191,7 @@ void main() { FakeProcessManager.list([ FakeCommand( command: [ffx.path, 'target', 'list', '--format', 'a', 'known-device'], + exitCode: 0, stdout: '1234-1234-1234-1234', ), ]); diff --git a/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_workflow_test.dart b/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_workflow_test.dart index 2002cf096c..00a6e553bd 100644 --- a/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_workflow_test.dart +++ b/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_workflow_test.dart @@ -19,9 +19,9 @@ void main() { testWithoutContext('Fuchsia workflow does not apply to host platform if feature is disabled', () { final FuchsiaWorkflow fuchsiaWorkflow = FuchsiaWorkflow( - featureFlags: TestFeatureFlags(), + featureFlags: TestFeatureFlags(isFuchsiaEnabled: false), fuchsiaArtifacts: FuchsiaArtifacts(devFinder: devFinder, sshConfig: sshConfig), - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), ); expect(fuchsiaWorkflow.appliesToHostPlatform, false); @@ -40,8 +40,8 @@ void main() { testWithoutContext('Fuchsia workflow can not list and launch devices if there is no ffx when using default workflow', () { final FuchsiaWorkflow fuchsiaWorkflow = FuchsiaWorkflow( featureFlags: TestFeatureFlags(), - fuchsiaArtifacts: FuchsiaArtifacts(devFinder: devFinder, sshConfig: sshConfig), - platform: FakePlatform(environment: {}), + fuchsiaArtifacts: FuchsiaArtifacts(devFinder: devFinder, sshConfig: sshConfig, ffx: null), + platform: FakePlatform(operatingSystem: 'linux', environment: {}), ); expect(fuchsiaWorkflow.canLaunchDevices, false); @@ -52,8 +52,8 @@ void main() { testWithoutContext('Fuchsia workflow can not list and launch devices if there is no dev finder when ffx is disabled', () { final FuchsiaWorkflow fuchsiaWorkflow = FuchsiaWorkflow( featureFlags: TestFeatureFlags(), - fuchsiaArtifacts: FuchsiaArtifacts(sshConfig: sshConfig, ffx: ffx), - platform: FakePlatform(environment: {'FUCHSIA_DISABLED_ffx_discovery': '1'}), + fuchsiaArtifacts: FuchsiaArtifacts(devFinder: null, sshConfig: sshConfig, ffx: ffx), + platform: FakePlatform(operatingSystem: 'linux', environment: {'FUCHSIA_DISABLED_ffx_discovery': '1'}), ); expect(fuchsiaWorkflow.canLaunchDevices, false); @@ -64,8 +64,8 @@ void main() { testWithoutContext('Fuchsia workflow can not launch devices if there is no ssh config when using default workflow', () { final FuchsiaWorkflow fuchsiaWorkflow = FuchsiaWorkflow( featureFlags: TestFeatureFlags(), - fuchsiaArtifacts: FuchsiaArtifacts(ffx: ffx), - platform: FakePlatform(environment: {}), + fuchsiaArtifacts: FuchsiaArtifacts(sshConfig: null, ffx: ffx), + platform: FakePlatform(operatingSystem: 'linux', environment: {}), ); expect(fuchsiaWorkflow.canLaunchDevices, false); @@ -76,8 +76,8 @@ void main() { testWithoutContext('Fuchsia workflow can not launch devices if there is no ssh config when ffx is disabled', () { final FuchsiaWorkflow fuchsiaWorkflow = FuchsiaWorkflow( featureFlags: TestFeatureFlags(), - fuchsiaArtifacts: FuchsiaArtifacts(devFinder: devFinder), - platform: FakePlatform(environment: {'FUCHSIA_DISABLED_ffx_discovery': '1'}), + fuchsiaArtifacts: FuchsiaArtifacts(sshConfig: null, devFinder: devFinder), + platform: FakePlatform(operatingSystem: 'linux', environment: {'FUCHSIA_DISABLED_ffx_discovery': '1'}), ); expect(fuchsiaWorkflow.canLaunchDevices, false); @@ -88,8 +88,8 @@ void main() { testWithoutContext('Fuchsia workflow can list and launch devices supported with sufficient SDK artifacts when using default workflow', () { final FuchsiaWorkflow fuchsiaWorkflow = FuchsiaWorkflow( featureFlags: TestFeatureFlags(), - fuchsiaArtifacts: FuchsiaArtifacts(sshConfig: sshConfig, ffx: ffx), - platform: FakePlatform(environment: {}), + fuchsiaArtifacts: FuchsiaArtifacts(devFinder: null, sshConfig: sshConfig, ffx: ffx), + platform: FakePlatform(operatingSystem: 'linux', environment: {}), ); expect(fuchsiaWorkflow.canLaunchDevices, true); @@ -100,8 +100,8 @@ void main() { testWithoutContext('Fuchsia workflow can list and launch devices supported with sufficient SDK artifacts when ffx is disabled', () { final FuchsiaWorkflow fuchsiaWorkflow = FuchsiaWorkflow( featureFlags: TestFeatureFlags(), - fuchsiaArtifacts: FuchsiaArtifacts(devFinder: devFinder, sshConfig: sshConfig), - platform: FakePlatform(environment: {'FUCHSIA_DISABLED_ffx_discovery': '1'}), + fuchsiaArtifacts: FuchsiaArtifacts(devFinder: devFinder, sshConfig: sshConfig, ffx: null), + platform: FakePlatform(operatingSystem: 'linux', environment: {'FUCHSIA_DISABLED_ffx_discovery': '1'}), ); expect(fuchsiaWorkflow.canLaunchDevices, true); diff --git a/packages/flutter_tools/test/general.shard/generate_localizations_test.dart b/packages/flutter_tools/test/general.shard/generate_localizations_test.dart index b31e2f3c19..69399069b9 100644 --- a/packages/flutter_tools/test/general.shard/generate_localizations_test.dart +++ b/packages/flutter_tools/test/general.shard/generate_localizations_test.dart @@ -823,6 +823,8 @@ flutter: preferredSupportedLocales: ['en_US'], templateArbFile: Uri.file('example.arb', windows: false), untranslatedMessagesFile: Uri.file('untranslated', windows: false), + // Set synthetic package to true. + useSyntheticPackage: true, ); expect( @@ -2061,6 +2063,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e templateArbFileName: defaultTemplateArbFileName, outputFileString: defaultOutputFileString, classNameString: defaultClassNameString, + useDeferredLoading: false, ) ..loadResources() ..writeOutputFiles(BufferLogger.test()); @@ -2117,6 +2120,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e templateArbFileName: defaultTemplateArbFileName, outputFileString: defaultOutputFileString, classNameString: defaultClassNameString, + useDeferredLoading: false, ) ..loadResources() ..writeOutputFiles(BufferLogger.test()); diff --git a/packages/flutter_tools/test/general.shard/hot_test.dart b/packages/flutter_tools/test/general.shard/hot_test.dart index 3c69d05a58..f469ac8ac5 100644 --- a/packages/flutter_tools/test/general.shard/hot_test.dart +++ b/packages/flutter_tools/test/general.shard/hot_test.dart @@ -187,7 +187,7 @@ void main() { HotRunnerConfig: () => failingTestingConfig, Artifacts: () => Artifacts.test(), FileSystem: () => fileSystem, - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), ProcessManager: () => FakeProcessManager.any(), }); @@ -216,7 +216,7 @@ void main() { false, true, ), - ).restart(); + ).restart(fullRestart: false); expect(result.isOk, false); expect(result.message, 'setupHotReload failed'); expect(failingTestingConfig.updateDevFSCompleteCalled, false); @@ -224,7 +224,7 @@ void main() { HotRunnerConfig: () => failingTestingConfig, Artifacts: () => Artifacts.test(), FileSystem: () => fileSystem, - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), ProcessManager: () => FakeProcessManager.any(), }); }); @@ -254,7 +254,7 @@ void main() { HotRunnerConfig: () => shutdownTestingConfig, Artifacts: () => Artifacts.test(), FileSystem: () => fileSystem, - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), ProcessManager: () => FakeProcessManager.any(), }); @@ -276,7 +276,7 @@ void main() { HotRunnerConfig: () => shutdownTestingConfig, Artifacts: () => Artifacts.test(), FileSystem: () => fileSystem, - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), ProcessManager: () => FakeProcessManager.any(), }); }); @@ -328,7 +328,6 @@ void main() { hotEventSdkName: 'Tester', hotEventEmulator: false, hotEventFullRestart: true, - fastReassemble: false, hotEventOverallTimeInMs: 64000, hotEventSyncedBytes: 4, hotEventInvalidatedSourcesCount: 2, @@ -343,7 +342,7 @@ void main() { HotRunnerConfig: () => testingConfig, Artifacts: () => Artifacts.test(), FileSystem: () => fileSystem, - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), ProcessManager: () => FakeProcessManager.any(), Usage: () => testUsage, }); @@ -416,7 +415,7 @@ void main() { false, true, ), - ).restart(); + ).restart(fullRestart: false); expect(result.isOk, true); expect(testUsage.events, [ @@ -446,7 +445,7 @@ void main() { HotRunnerConfig: () => testingConfig, Artifacts: () => Artifacts.test(), FileSystem: () => fileSystem, - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), ProcessManager: () => FakeProcessManager.any(), Usage: () => testUsage, }); @@ -480,7 +479,7 @@ void main() { HotRunnerConfig: () => testingConfig, Artifacts: () => Artifacts.test(), FileSystem: () => fileSystem, - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), ProcessManager: () => FakeProcessManager.any(), Usage: () => testUsage, }); @@ -508,13 +507,13 @@ void main() { devtoolsHandler: createNoOpHandler, ); - await expectLater(runner.restart(), throwsA('updateDevFS failed')); + await expectLater(runner.restart(fullRestart: false), throwsA('updateDevFS failed')); expect(testingConfig.updateDevFSCompleteCalled, true); }, overrides: { HotRunnerConfig: () => testingConfig, Artifacts: () => Artifacts.test(), FileSystem: () => fileSystem, - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), ProcessManager: () => FakeProcessManager.any(), Usage: () => testUsage, }); @@ -548,13 +547,15 @@ void main() { final int exitCode = await HotRunner(devices, debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug), target: 'main.dart', - ).attach(); + ).attach( + enableDevTools: false, + ); expect(exitCode, 2); }, overrides: { HotRunnerConfig: () => TestHotRunnerConfig(), Artifacts: () => Artifacts.test(), FileSystem: () => fileSystem, - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), ProcessManager: () => FakeProcessManager.any(), }); }); diff --git a/packages/flutter_tools/test/general.shard/integration_test_device_test.dart b/packages/flutter_tools/test/general.shard/integration_test_device_test.dart index 90c450fbac..a318ed9893 100644 --- a/packages/flutter_tools/test/general.shard/integration_test_device_test.dart +++ b/packages/flutter_tools/test/general.shard/integration_test_device_test.dart @@ -164,7 +164,7 @@ void main() { 'ephemeral', 'ephemeral', type: PlatformType.android, - launchResult: LaunchResult.succeeded(), + launchResult: LaunchResult.succeeded(observatoryUri: null), ), debuggingOptions: DebuggingOptions.enabled( BuildInfo.debug, diff --git a/packages/flutter_tools/test/general.shard/intellij/intellij_validator_test.dart b/packages/flutter_tools/test/general.shard/intellij/intellij_validator_test.dart index 0bb90fbac2..675ae2d193 100644 --- a/packages/flutter_tools/test/general.shard/intellij/intellij_validator_test.dart +++ b/packages/flutter_tools/test/general.shard/intellij/intellij_validator_test.dart @@ -21,6 +21,7 @@ final Platform macPlatform = FakePlatform( environment: {'HOME': '/foo/bar'} ); final Platform linuxPlatform = FakePlatform( + operatingSystem: 'linux', environment: { 'HOME': '/foo/bar' }, diff --git a/packages/flutter_tools/test/general.shard/ios/code_signing_test.dart b/packages/flutter_tools/test/general.shard/ios/code_signing_test.dart index 0b7208922e..0a4ee2da87 100644 --- a/packages/flutter_tools/test/general.shard/ios/code_signing_test.dart +++ b/packages/flutter_tools/test/general.shard/ios/code_signing_test.dart @@ -138,7 +138,7 @@ void main() { final String? developmentTeam = await getCodeSigningIdentityDevelopmentTeam( processManager: processManager, - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), logger: logger, config: testConfig, terminal: testTerminal, diff --git a/packages/flutter_tools/test/general.shard/ios/devices_test.dart b/packages/flutter_tools/test/general.shard/ios/devices_test.dart index b956d6e074..db7c73a671 100644 --- a/packages/flutter_tools/test/general.shard/ios/devices_test.dart +++ b/packages/flutter_tools/test/general.shard/ios/devices_test.dart @@ -34,7 +34,7 @@ import '../../src/fake_process_manager.dart'; void main() { final FakePlatform macPlatform = FakePlatform(operatingSystem: 'macos'); - final FakePlatform linuxPlatform = FakePlatform(); + final FakePlatform linuxPlatform = FakePlatform(operatingSystem: 'linux'); final FakePlatform windowsPlatform = FakePlatform(operatingSystem: 'windows'); group('IOSDevice', () { diff --git a/packages/flutter_tools/test/general.shard/ios/ios_device_install_test.dart b/packages/flutter_tools/test/general.shard/ios/ios_device_install_test.dart index e6b055e7d5..cc27bb1035 100644 --- a/packages/flutter_tools/test/general.shard/ios/ios_device_install_test.dart +++ b/packages/flutter_tools/test/general.shard/ios/ios_device_install_test.dart @@ -161,7 +161,7 @@ void main() { ], environment: const { 'PATH': '/usr/bin:null', ...kDyLdLibEntry, - }) + }, exitCode: 0) ]); final IOSDevice device = setUpIOSDevice(processManager: processManager, artifacts: artifacts); final bool isAppInstalled = await device.isAppInstalled(iosApp); diff --git a/packages/flutter_tools/test/general.shard/ios/ios_device_port_forwarder_test.dart b/packages/flutter_tools/test/general.shard/ios/ios_device_port_forwarder_test.dart index a1c2ac48e5..673895b0a1 100644 --- a/packages/flutter_tools/test/general.shard/ios/ios_device_port_forwarder_test.dart +++ b/packages/flutter_tools/test/general.shard/ios/ios_device_port_forwarder_test.dart @@ -21,15 +21,16 @@ void main() { // we timeout on a port testWithoutContext('IOSDevicePortForwarder.forward will kill iproxy processes before invoking a second', () async { final FakeProcessManager processManager = FakeProcessManager.list([ - // iproxy does not exit with 0 when it cannot forward; - // the FakeCommands below expect an exitCode of 0. const FakeCommand( command: ['iproxy', '12345:456', '--udid', '1234'], + // iproxy does not exit with 0 when it cannot forward. + exitCode: 0, stdout: null, // no stdout indicates failure. environment: kDyLdLibEntry, ), const FakeCommand( command: ['iproxy', '12346:456', '--udid', '1234'], + exitCode: 0, stdout: 'not empty', environment: kDyLdLibEntry, ), diff --git a/packages/flutter_tools/test/general.shard/ios/ios_workflow_test.dart b/packages/flutter_tools/test/general.shard/ios/ios_workflow_test.dart index 688b36094b..0ef988a308 100644 --- a/packages/flutter_tools/test/general.shard/ios/ios_workflow_test.dart +++ b/packages/flutter_tools/test/general.shard/ios/ios_workflow_test.dart @@ -27,9 +27,9 @@ void main() { testWithoutContext('iOS workflow is disabled on Linux', () { final IOSWorkflow iosWorkflow = IOSWorkflow( - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), xcode: Xcode.test(processManager: FakeProcessManager.any()), - featureFlags: TestFeatureFlags(), + featureFlags: TestFeatureFlags(isIOSEnabled: true), ); expect(iosWorkflow.appliesToHostPlatform, false); @@ -41,7 +41,7 @@ void main() { final IOSWorkflow iosWorkflow = IOSWorkflow( platform: FakePlatform(operatingSystem: 'windows'), xcode: Xcode.test(processManager: FakeProcessManager.any()), - featureFlags: TestFeatureFlags(), + featureFlags: TestFeatureFlags(isIOSEnabled: true), ); expect(iosWorkflow.appliesToHostPlatform, false); @@ -58,7 +58,7 @@ void main() { version: null, ), ), - featureFlags: TestFeatureFlags(), + featureFlags: TestFeatureFlags(isIOSEnabled: true), ); expect(iosWorkflow.appliesToHostPlatform, true); @@ -79,7 +79,7 @@ void main() { final IOSWorkflow iosWorkflow = IOSWorkflow( platform: FakePlatform(operatingSystem: 'macos'), xcode: xcode, - featureFlags: TestFeatureFlags(), + featureFlags: TestFeatureFlags(isIOSEnabled: true), ); // Make sure we're testing the right Xcode state. diff --git a/packages/flutter_tools/test/general.shard/ios/xcodeproj_test.dart b/packages/flutter_tools/test/general.shard/ios/xcodeproj_test.dart index 93a4acd1df..13dbaf3000 100644 --- a/packages/flutter_tools/test/general.shard/ios/xcodeproj_test.dart +++ b/packages/flutter_tools/test/general.shard/ios/xcodeproj_test.dart @@ -73,7 +73,7 @@ void main() { fileSystem: fileSystem, platform: platform, processManager: fakeProcessManager, - usage: TestUsage(), + usage: null, ); }); diff --git a/packages/flutter_tools/test/general.shard/linux/linux_device_test.dart b/packages/flutter_tools/test/general.shard/linux/linux_device_test.dart index fcf9558e1a..6ec411a7d8 100644 --- a/packages/flutter_tools/test/general.shard/linux/linux_device_test.dart +++ b/packages/flutter_tools/test/general.shard/linux/linux_device_test.dart @@ -20,7 +20,9 @@ import '../../src/common.dart'; import '../../src/fake_process_manager.dart'; import '../../src/fakes.dart'; -final FakePlatform linux = FakePlatform(); +final FakePlatform linux = FakePlatform( + operatingSystem: 'linux', +); final FakePlatform windows = FakePlatform( operatingSystem: 'windows', ); @@ -76,7 +78,7 @@ void main() { expect(await LinuxDevices( fileSystem: MemoryFileSystem.test(), platform: linux, - featureFlags: TestFeatureFlags(), + featureFlags: TestFeatureFlags(isLinuxEnabled: false), logger: BufferLogger.test(), processManager: FakeProcessManager.any(), operatingSystemUtils: FakeOperatingSystemUtils(), diff --git a/packages/flutter_tools/test/general.shard/linux/linux_workflow_test.dart b/packages/flutter_tools/test/general.shard/linux/linux_workflow_test.dart index 3e164b20a8..fd037b4454 100644 --- a/packages/flutter_tools/test/general.shard/linux/linux_workflow_test.dart +++ b/packages/flutter_tools/test/general.shard/linux/linux_workflow_test.dart @@ -11,6 +11,7 @@ import '../../src/fakes.dart'; void main() { final Platform linux = FakePlatform( + operatingSystem: 'linux', environment: {}, ); final Platform notLinux = FakePlatform( @@ -20,7 +21,7 @@ void main() { final FeatureFlags enabledFlags = TestFeatureFlags( isLinuxEnabled: true, ); - final FeatureFlags disabledFlags = TestFeatureFlags(); + final FeatureFlags disabledFlags = TestFeatureFlags(isLinuxEnabled: false); testWithoutContext('Applies to Linux platform', () { final LinuxWorkflow linuxWorkflow = LinuxWorkflow( diff --git a/packages/flutter_tools/test/general.shard/macos/macos_device_test.dart b/packages/flutter_tools/test/general.shard/macos/macos_device_test.dart index fd5f4da1ef..a72fa767ae 100644 --- a/packages/flutter_tools/test/general.shard/macos/macos_device_test.dart +++ b/packages/flutter_tools/test/general.shard/macos/macos_device_test.dart @@ -27,7 +27,9 @@ final FakePlatform macOS = FakePlatform( operatingSystem: 'macos', ); -final FakePlatform linux = FakePlatform(); +final FakePlatform linux = FakePlatform( + operatingSystem: 'linux', +); void main() { testWithoutContext('default configuration', () async { @@ -106,7 +108,7 @@ void main() { platform: macOS, operatingSystemUtils: FakeOperatingSystemUtils(), macOSWorkflow: MacOSWorkflow( - featureFlags: TestFeatureFlags(), + featureFlags: TestFeatureFlags(isMacOSEnabled: false), platform: macOS, ), ); diff --git a/packages/flutter_tools/test/general.shard/macos/macos_workflow_test.dart b/packages/flutter_tools/test/general.shard/macos/macos_workflow_test.dart index 8ed185a419..bf323e018b 100644 --- a/packages/flutter_tools/test/general.shard/macos/macos_workflow_test.dart +++ b/packages/flutter_tools/test/general.shard/macos/macos_workflow_test.dart @@ -12,7 +12,9 @@ final FakePlatform macOS = FakePlatform( operatingSystem: 'macos', ); -final FakePlatform linux = FakePlatform(); +final FakePlatform linux = FakePlatform( + operatingSystem: 'linux', +); void main() { testWithoutContext('Applies to macOS platform', () { @@ -42,7 +44,7 @@ void main() { testWithoutContext('Does not apply when feature is disabled', () { final MacOSWorkflow macOSWorkflow = MacOSWorkflow( platform: macOS, - featureFlags: TestFeatureFlags(), + featureFlags: TestFeatureFlags(isMacOSEnabled: false), ); expect(macOSWorkflow.appliesToHostPlatform, false); diff --git a/packages/flutter_tools/test/general.shard/plugins_test.dart b/packages/flutter_tools/test/general.shard/plugins_test.dart index 4e7a4fbd50..5cf640a26a 100644 --- a/packages/flutter_tools/test/general.shard/plugins_test.dart +++ b/packages/flutter_tools/test/general.shard/plugins_test.dart @@ -119,7 +119,7 @@ void main() { fs = MemoryFileSystem.test(); fsWindows = MemoryFileSystem(style: FileSystemStyle.windows); systemClock = FakeSystemClock() - ..currentTime = DateTime(1970); + ..currentTime = DateTime(1970, 1, 1); flutterVersion = FakeFlutterVersion(frameworkVersion: '1.0.0'); // Add basic properties to the Flutter project and subprojects @@ -424,7 +424,7 @@ dependencies: final Directory pluginC = createPluginWithDependencies(name: 'plugin-c', dependencies: const []); iosProject.testExists = true; - final DateTime dateCreated = DateTime(1970); + final DateTime dateCreated = DateTime(1970, 1, 1); systemClock.currentTime = dateCreated; await refreshPluginsList(flutterProject); diff --git a/packages/flutter_tools/test/general.shard/reporting/events_test.dart b/packages/flutter_tools/test/general.shard/reporting/events_test.dart index d20e669aa0..6ad207915e 100644 --- a/packages/flutter_tools/test/general.shard/reporting/events_test.dart +++ b/packages/flutter_tools/test/general.shard/reporting/events_test.dart @@ -107,7 +107,7 @@ void main() { testWithoutContext('a null language version is treated as unmigrated', () { final TestUsage usage = TestUsage(); final PackageConfig packageConfig = PackageConfig([ - Package('foo', Uri.parse('file:///foo/lib/')), + Package('foo', Uri.parse('file:///foo/lib/'), languageVersion: null), ]); NullSafetyAnalysisEvent( diff --git a/packages/flutter_tools/test/general.shard/resident_runner_test.dart b/packages/flutter_tools/test/general.shard/resident_runner_test.dart index 6084bec0c7..cd1735fe83 100644 --- a/packages/flutter_tools/test/general.shard/resident_runner_test.dart +++ b/packages/flutter_tools/test/general.shard/resident_runner_test.dart @@ -405,7 +405,7 @@ void main() { await futureAppStart.future; flutterDevice.reportError = vm_service.RPCError('something bad happened', 666, ''); - final OperationResult result = await residentRunner.restart(); + final OperationResult result = await residentRunner.restart(fullRestart: false); expect(result.fatal, true); expect(result.code, 1); expect((globals.flutterUsage as TestUsage).events, contains( @@ -414,7 +414,6 @@ void main() { hotEventSdkName: 'Android', hotEventEmulator: false, hotEventFullRestart: false, - fastReassemble: false, )), )); expect(fakeVmServiceHost.hasRemainingExpectations, false); @@ -436,7 +435,7 @@ void main() { await futureAppStart.future; flutterDevice._devFS = null; - final OperationResult result = await residentRunner.restart(); + final OperationResult result = await residentRunner.restart(fullRestart: false); expect(result.fatal, false); expect(result.code, 1); expect(result.message, contains('Device initialization has not completed.')); @@ -459,7 +458,7 @@ void main() { await futureAppStart.future; flutterDevice.reportError = vm_service.RPCError('something bad happened', kIsolateReloadBarred, ''); - final OperationResult result = await residentRunner.restart(); + final OperationResult result = await residentRunner.restart(fullRestart: false); expect(result.fatal, true); expect(result.code, kIsolateReloadBarred); expect(result.message, contains('Unable to hot reload application due to an unrecoverable error')); @@ -470,7 +469,6 @@ void main() { hotEventSdkName: 'Android', hotEventEmulator: false, hotEventFullRestart: false, - fastReassemble: false, )), )); expect(fakeVmServiceHost.hasRemainingExpectations, false); @@ -507,7 +505,7 @@ void main() { await futureAppStart.future; flutterDevice.reportError = vm_service.RPCError('something bad happened', 666, ''); - final OperationResult result = await residentRunner.restart(); + final OperationResult result = await residentRunner.restart(fullRestart: false); expect(result.fatal, true); expect(result.code, 1); @@ -517,7 +515,6 @@ void main() { hotEventSdkName: 'Android', hotEventEmulator: false, hotEventFullRestart: false, - fastReassemble: false, )), )); expect(fakeVmServiceHost.hasRemainingExpectations, false); @@ -561,9 +558,9 @@ void main() { enableDevTools: true, )); await futureAppStart.future; - flutterDevice.report = UpdateFSReport(success: true); + flutterDevice.report = UpdateFSReport(success: true, invalidatedSourcesCount: 0); - final OperationResult result = await residentRunner.restart(); + final OperationResult result = await residentRunner.restart(fullRestart: false); expect(result.code, 0); expect(fakeVmServiceHost.hasRemainingExpectations, false); @@ -621,7 +618,7 @@ void main() { await futureAppStart.future; flutterDevice.report = UpdateFSReport(success: true, invalidatedSourcesCount: 1); - final OperationResult result = await residentRunner.restart(); + final OperationResult result = await residentRunner.restart(fullRestart: false); expect(globals.fs.file(globals.fs.path.join('lib', 'main.dart')), isNot(exists)); expect(testLogger.errorText, contains('The entrypoint file (i.e. the file with main())')); @@ -685,7 +682,7 @@ void main() { await futureAppStart.future; flutterDevice.report = UpdateFSReport(success: true, invalidatedSourcesCount: 1); - final OperationResult result = await residentRunner.restart(); + final OperationResult result = await residentRunner.restart(fullRestart: false); expect(result.fatal, false); expect(result.message, contains('Reload rejected: Failed to hot reload')); // contains error message from reload report. @@ -744,7 +741,7 @@ void main() { )); await futureAppStart.future; - final OperationResult result = await residentRunner.restart(); + final OperationResult result = await residentRunner.restart(fullRestart: false); expect(result.fatal, false); expect(result.code, 0); @@ -829,7 +826,7 @@ void main() { )); await futureAppStart.future; - final OperationResult result = await residentRunner.restart(); + final OperationResult result = await residentRunner.restart(fullRestart: false); expect(result.fatal, false); expect(result.code, 0); @@ -840,7 +837,7 @@ void main() { expect(event.parameters.fastReassemble, true); }, overrides: { FileSystem: () => MemoryFileSystem.test(), - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), ProjectFileInvalidator: () => FakeProjectFileInvalidator(), Usage: () => TestUsage(), FeatureFlags: () => TestFeatureFlags(isSingleWidgetReloadEnabled: true), @@ -1119,7 +1116,6 @@ void main() { hotEventSdkName: 'Android', hotEventEmulator: false, hotEventFullRestart: true, - fastReassemble: false, )), )); expect(fakeVmServiceHost.hasRemainingExpectations, false); @@ -1426,7 +1422,7 @@ void main() { devtoolsHandler: createNoOpHandler, ); - final Future result = residentRunner.attach(); + final Future result = residentRunner.attach(enableDevTools: false); expect(await result, 0); })); @@ -1685,7 +1681,7 @@ void main() { nullSafetyMode: NullSafetyMode.unsound, ), target: null, - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), )).generator as DefaultResidentCompiler; expect(residentCompiler.initializeFromDill, @@ -1716,7 +1712,7 @@ void main() { extraFrontEndOptions: ['--enable-experiment=non-nullable'], ), target: null, - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), )).generator as DefaultResidentCompiler; expect(residentCompiler.initializeFromDill, @@ -1736,7 +1732,7 @@ void main() { testUsingContext('FlutterDevice passes flutter-widget-cache flag when feature is enabled', () async { fakeVmServiceHost = FakeVmServiceHost(requests: []); - final FakeDevice device = FakeDevice(); + final FakeDevice device = FakeDevice(targetPlatform: TargetPlatform.android_arm); final DefaultResidentCompiler residentCompiler = (await FlutterDevice.create( device, @@ -1760,7 +1756,7 @@ void main() { testUsingContext('FlutterDevice passes alternative-invalidation-strategy flag', () async { fakeVmServiceHost = FakeVmServiceHost(requests: []); - final FakeDevice device = FakeDevice(); + final FakeDevice device = FakeDevice(targetPlatform: TargetPlatform.android_arm); final DefaultResidentCompiler residentCompiler = (await FlutterDevice.create( @@ -1784,7 +1780,7 @@ void main() { testUsingContext('FlutterDevice passes initializeFromDill parameter if specified', () async { fakeVmServiceHost = FakeVmServiceHost(requests: []); - final FakeDevice device = FakeDevice(); + final FakeDevice device = FakeDevice(targetPlatform: TargetPlatform.android_arm); final DefaultResidentCompiler residentCompiler = (await FlutterDevice.create( device, @@ -2057,6 +2053,7 @@ class FakeFlutterDevice extends Fake implements FlutterDevice { Uri testUri; UpdateFSReport report = UpdateFSReport( success: true, + syncedBytes: 0, invalidatedSourcesCount: 1, ); Object reportError; diff --git a/packages/flutter_tools/test/general.shard/resident_web_runner_cold_test.dart b/packages/flutter_tools/test/general.shard/resident_web_runner_cold_test.dart index 57ed1ab981..c97a0688b2 100644 --- a/packages/flutter_tools/test/general.shard/resident_web_runner_cold_test.dart +++ b/packages/flutter_tools/test/general.shard/resident_web_runner_cold_test.dart @@ -53,6 +53,7 @@ void main() { flutterProject: project, debuggingOptions: DebuggingOptions.disabled(BuildInfo.release), ipv6: true, + stayResident: true, urlTunneller: null, fileSystem: fileSystem, logger: BufferLogger.test(), @@ -81,6 +82,7 @@ void main() { flutterProject: project, debuggingOptions: DebuggingOptions.disabled(BuildInfo.release), ipv6: true, + stayResident: true, urlTunneller: null, fileSystem: fileSystem, logger: BufferLogger.test(), @@ -104,6 +106,7 @@ void main() { flutterProject: project, debuggingOptions: DebuggingOptions.disabled(BuildInfo.release), ipv6: true, + stayResident: true, urlTunneller: null, fileSystem: fileSystem, logger: BufferLogger.test(), @@ -126,6 +129,7 @@ void main() { flutterProject: project, debuggingOptions: DebuggingOptions.disabled(BuildInfo.release), ipv6: true, + stayResident: true, urlTunneller: null, fileSystem: fileSystem, logger: BufferLogger.test(), @@ -153,6 +157,7 @@ void main() { flutterProject: project, debuggingOptions: DebuggingOptions.disabled(BuildInfo.release), ipv6: true, + stayResident: true, urlTunneller: null, fileSystem: fileSystem, logger: BufferLogger.test(), diff --git a/packages/flutter_tools/test/general.shard/resident_web_runner_test.dart b/packages/flutter_tools/test/general.shard/resident_web_runner_test.dart index 4678173114..ddb81efa4e 100644 --- a/packages/flutter_tools/test/general.shard/resident_web_runner_test.dart +++ b/packages/flutter_tools/test/general.shard/resident_web_runner_test.dart @@ -138,7 +138,7 @@ void main() { fileSystem.file('pubspec.yaml').createSync(); fileSystem.file('lib/main.dart').createSync(recursive: true); fileSystem.file('web/index.html').createSync(recursive: true); - webDevFS.report = UpdateFSReport(success: true); + webDevFS.report = UpdateFSReport(success: true, syncedBytes: 0); debugConnection.fakeVmServiceHost = () => fakeVmServiceHost; webDevFS.result = ConnectionResult( appConnection, @@ -160,6 +160,7 @@ void main() { flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory), debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug), ipv6: true, + stayResident: true, urlTunneller: null, fileSystem: fileSystem, logger: BufferLogger.test(), @@ -189,6 +190,7 @@ void main() { flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory), debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug, startPaused: true), ipv6: true, + stayResident: true, urlTunneller: null, fileSystem: fileSystem, logger: BufferLogger.test(), @@ -208,6 +210,7 @@ void main() { flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory), debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug), ipv6: true, + stayResident: true, urlTunneller: null, fileSystem: fileSystem, logger: BufferLogger.test(), @@ -221,6 +224,7 @@ void main() { flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory), debuggingOptions: DebuggingOptions.enabled(BuildInfo.profile), ipv6: true, + stayResident: true, urlTunneller: null, fileSystem: fileSystem, logger: BufferLogger.test(), @@ -280,7 +284,7 @@ void main() { final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice); fileSystem.file(globals.fs.path.join('lib', 'main.dart')) .createSync(recursive: true); - webDevFS.report = UpdateFSReport(); + webDevFS.report = UpdateFSReport(success: false, syncedBytes: 0); expect(await residentWebRunner.run(), 1); // Completing this future ensures that the daemon can exit correctly. @@ -443,6 +447,7 @@ void main() { flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory), debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug, startPaused: true), ipv6: true, + stayResident: true, urlTunneller: null, fileSystem: fileSystem, logger: BufferLogger.test(), @@ -469,7 +474,7 @@ void main() { final ResidentRunner residentWebRunner = setUpResidentRunner( flutterDevice, logger: logger, - systemClock: SystemClock.fixed(DateTime(2001)), + systemClock: SystemClock.fixed(DateTime(2001, 1, 1)), ); fakeVmServiceHost = FakeVmServiceHost(requests: [ ...kAttachExpectations, @@ -495,7 +500,7 @@ void main() { fileSystem: fileSystem, chromiumLauncher: chromiumLauncher, logger: BufferLogger.test(), - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), processManager: FakeProcessManager.any(), ); webDevFS.report = UpdateFSReport(success: true); @@ -508,7 +513,7 @@ void main() { expect(debugConnectionInfo, isNotNull); - final OperationResult result = await residentWebRunner.restart(); + final OperationResult result = await residentWebRunner.restart(fullRestart: false); expect(logger.statusText, contains('Restarted application in')); expect(result.code, 0); @@ -516,7 +521,7 @@ void main() { // ensure that analytics are sent. expect(testUsage.events, [ - TestUsageEvent('hot', 'restart', parameters: CustomDimensions.fromMap({'cd27': 'web-javascript', 'cd28': '', 'cd29': 'false', 'cd30': 'true', 'cd13': '0', 'cd48': 'false'})), + TestUsageEvent('hot', 'restart', parameters: CustomDimensions.fromMap({'cd27': 'web-javascript', 'cd28': '', 'cd29': 'false', 'cd30': 'true', 'cd13': '0'})), ]); expect(testUsage.timings, const [ TestTimingEvent('hot', 'web-incremental-restart', Duration.zero), @@ -532,7 +537,7 @@ void main() { final ResidentRunner residentWebRunner = setUpResidentRunner( flutterDevice, logger: logger, - systemClock: SystemClock.fixed(DateTime(2001)), + systemClock: SystemClock.fixed(DateTime(2001, 1, 1)), ); fakeVmServiceHost = FakeVmServiceHost(requests: [ ...kAttachExpectations, @@ -552,7 +557,7 @@ void main() { fileSystem: fileSystem, chromiumLauncher: chromiumLauncher, logger: BufferLogger.test(), - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), processManager: FakeProcessManager.any(), ); webDevFS.report = UpdateFSReport(success: true); @@ -576,7 +581,7 @@ void main() { // ensure that analytics are sent. expect(testUsage.events, [ - TestUsageEvent('hot', 'restart', parameters: CustomDimensions.fromMap({'cd27': 'web-javascript', 'cd28': '', 'cd29': 'false', 'cd30': 'true', 'cd13': '0', 'cd48': 'false'})), + TestUsageEvent('hot', 'restart', parameters: CustomDimensions.fromMap({'cd27': 'web-javascript', 'cd28': '', 'cd29': 'false', 'cd30': 'true', 'cd13': '0'})), ]); expect(testUsage.timings, const [ TestTimingEvent('hot', 'web-incremental-restart', Duration.zero), @@ -592,7 +597,7 @@ void main() { final ResidentRunner residentWebRunner = setUpResidentRunner( flutterDevice, logger: logger, - systemClock: SystemClock.fixed(DateTime(2001)), + systemClock: SystemClock.fixed(DateTime(2001, 1, 1)), ); fakeVmServiceHost = FakeVmServiceHost(requests :kAttachExpectations); _setupMocks(); @@ -632,7 +637,7 @@ void main() { final ResidentRunner residentWebRunner = setUpResidentRunner(flutterDevice); fakeVmServiceHost = FakeVmServiceHost(requests: []); _setupMocks(); - webDevFS.report = UpdateFSReport(); + webDevFS.report = UpdateFSReport(success: false, syncedBytes: 0); final Completer connectionInfoCompleter = Completer(); unawaited(residentWebRunner.run( @@ -689,7 +694,7 @@ void main() { connectionInfoCompleter: connectionInfoCompleter, )); await connectionInfoCompleter.future; - webDevFS.report = UpdateFSReport(); + webDevFS.report = UpdateFSReport(success: false, syncedBytes: 0); final OperationResult result = await residentWebRunner.restart(fullRestart: true); @@ -721,7 +726,7 @@ void main() { )); await connectionInfoCompleter.future; - final OperationResult result = await residentWebRunner.restart(); + final OperationResult result = await residentWebRunner.restart(fullRestart: false); expect(result.code, 0); }, overrides: { @@ -745,7 +750,7 @@ void main() { connectionInfoCompleter: connectionInfoCompleter, )); await connectionInfoCompleter.future; - final OperationResult result = await residentWebRunner.restart(); + final OperationResult result = await residentWebRunner.restart(fullRestart: false); expect(result.code, 1); expect(result.message, @@ -849,7 +854,7 @@ void main() { fileSystem: fileSystem, chromiumLauncher: chromiumLauncher, logger: logger, - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), processManager: FakeProcessManager.any(), ); webDevFS.baseUri = Uri.parse('http://localhost:8765/app/'); @@ -862,6 +867,7 @@ void main() { flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory), debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug), ipv6: true, + stayResident: true, urlTunneller: null, fileSystem: fileSystem, logger: logger, @@ -905,6 +911,7 @@ void main() { flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory), debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug), ipv6: true, + stayResident: true, urlTunneller: null, fileSystem: fileSystem, logger: logger, @@ -1054,6 +1061,7 @@ ResidentRunner setUpResidentRunner(FlutterDevice flutterDevice, { flutterProject: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory), debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug), ipv6: true, + stayResident: true, urlTunneller: null, usage: globals.flutterUsage, systemClock: systemClock ?? SystemClock.fixed(DateTime.now()), @@ -1297,6 +1305,7 @@ class FakeFlutterDevice extends Fake implements FlutterDevice { Uri testUri; UpdateFSReport report = UpdateFSReport( success: true, + syncedBytes: 0, invalidatedSourcesCount: 1, ); Object reportError; diff --git a/packages/flutter_tools/test/general.shard/runner/flutter_command_test.dart b/packages/flutter_tools/test/general.shard/runner/flutter_command_test.dart index e770c183fd..8e3e503bed 100644 --- a/packages/flutter_tools/test/general.shard/runner/flutter_command_test.dart +++ b/packages/flutter_tools/test/general.shard/runner/flutter_command_test.dart @@ -55,7 +55,7 @@ void main() { }); testUsingContext('honors shouldUpdateCache false', () async { - final DummyFlutterCommand flutterCommand = DummyFlutterCommand(); + final DummyFlutterCommand flutterCommand = DummyFlutterCommand(shouldUpdateCache: false); await flutterCommand.run(); expect(cache.artifacts, isEmpty); diff --git a/packages/flutter_tools/test/general.shard/runner/runner_test.dart b/packages/flutter_tools/test/general.shard/runner/runner_test.dart index 752ffd13d0..f460fe6a33 100644 --- a/packages/flutter_tools/test/general.shard/runner/runner_test.dart +++ b/packages/flutter_tools/test/general.shard/runner/runner_test.dart @@ -190,7 +190,8 @@ void main() { environment: { 'FLUTTER_ANALYTICS_LOG_FILE': 'test', 'FLUTTER_ROOT': '/', - } + }, + operatingSystem: 'linux' ), FileSystem: () => MemoryFileSystem.test(), ProcessManager: () => FakeProcessManager.any(), diff --git a/packages/flutter_tools/test/general.shard/terminal_handler_test.dart b/packages/flutter_tools/test/general.shard/terminal_handler_test.dart index bc86f07a01..986ed07033 100644 --- a/packages/flutter_tools/test/general.shard/terminal_handler_test.dart +++ b/packages/flutter_tools/test/general.shard/terminal_handler_test.dart @@ -791,7 +791,9 @@ void main() { }); testWithoutContext('v - launchDevToolsInBrowser', () async { - final TerminalHandler terminalHandler = setUpTerminalHandler([]); + final TerminalHandler terminalHandler = setUpTerminalHandler( + [], + supportsServiceProtocol: true); final FakeResidentRunner runner = terminalHandler.residentRunner as FakeResidentRunner; final FakeResidentDevtoolsHandler devtoolsHandler = runner.residentDevtoolsHandler as FakeResidentDevtoolsHandler; @@ -1005,7 +1007,7 @@ void main() { 'enabled': 'true', }, ) - ], logger: logger, fileSystem: fileSystem); + ], logger: logger, supportsScreenshot: false, fileSystem: fileSystem); await terminalHandler.processTerminalInput('s'); @@ -1039,7 +1041,7 @@ void main() { 'enabled': 'true', }, ) - ], logger: logger, web: true, fileSystem: fileSystem); + ], logger: logger, supportsScreenshot: false, web: true, fileSystem: fileSystem); await terminalHandler.processTerminalInput('s'); @@ -1070,6 +1072,7 @@ void main() { final TerminalHandler terminalHandler = setUpTerminalHandler( [], logger: logger, + supportsScreenshot: false, supportsServiceProtocol: false, fileSystem: fileSystem, ); @@ -1086,6 +1089,7 @@ void main() { final TerminalHandler terminalHandler = setUpTerminalHandler( [], logger: logger, + supportsScreenshot: false, supportsServiceProtocol: false, web: true, fileSystem: fileSystem, @@ -1114,6 +1118,7 @@ void main() { ), ], logger: logger, + supportsScreenshot: false, fileSystem: fileSystem, ); @@ -1149,6 +1154,7 @@ void main() { ), ], logger: logger, + supportsScreenshot: false, fileSystem: fileSystem, ); @@ -1184,6 +1190,7 @@ void main() { ), ], logger: logger, + supportsScreenshot: false, web: true, fileSystem: fileSystem, ); diff --git a/packages/flutter_tools/test/general.shard/test/test_compiler_test.dart b/packages/flutter_tools/test/general.shard/test/test_compiler_test.dart index f2eced8994..5eebf9611f 100644 --- a/packages/flutter_tools/test/general.shard/test/test_compiler_test.dart +++ b/packages/flutter_tools/test/general.shard/test/test_compiler_test.dart @@ -20,6 +20,7 @@ import '../../src/common.dart'; import '../../src/context.dart'; final Platform linuxPlatform = FakePlatform( + operatingSystem: 'linux', environment: {}, ); diff --git a/packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart b/packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart index f4e7ae8acf..0e70e08122 100644 --- a/packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart +++ b/packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart @@ -82,7 +82,7 @@ void main() { TestBuildSystem buildSystem; final Map startOverrides = { - Platform: () => FakePlatform(), + Platform: () => FakePlatform(operatingSystem: 'linux'), FileSystem: () => fileSystem, ProcessManager: () => fakeProcessManager, Artifacts: () => Artifacts.test(), diff --git a/packages/flutter_tools/test/general.shard/version_test.dart b/packages/flutter_tools/test/general.shard/version_test.dart index ba1ef1c223..a891edc139 100644 --- a/packages/flutter_tools/test/general.shard/version_test.dart +++ b/packages/flutter_tools/test/general.shard/version_test.dart @@ -19,7 +19,7 @@ import '../src/common.dart'; import '../src/context.dart'; import '../src/fake_process_manager.dart'; -final SystemClock _testClock = SystemClock.fixed(DateTime(2015)); +final SystemClock _testClock = SystemClock.fixed(DateTime(2015, 1, 1)); final DateTime _stampUpToDate = _testClock.ago(checkAgeConsideredUpToDate ~/ 2); final DateTime _stampOutOfDate = _testClock.ago(checkAgeConsideredUpToDate * 2); @@ -477,7 +477,7 @@ void main() { [ const FakeCommand( command: ['git', 'tag', '--points-at', 'HEAD'], - // no output, since there's no tag + stdout: '', // no tag ), const FakeCommand( command: ['git', 'describe', '--match', '*.*.*', '--long', '--tags', 'HEAD'], diff --git a/packages/flutter_tools/test/general.shard/vscode/vscode_test.dart b/packages/flutter_tools/test/general.shard/vscode/vscode_test.dart index 2998f90cef..2e7b3cfbe2 100644 --- a/packages/flutter_tools/test/general.shard/vscode/vscode_test.dart +++ b/packages/flutter_tools/test/general.shard/vscode/vscode_test.dart @@ -44,7 +44,7 @@ void main() { testWithoutContext('can locate VS Code installed via Snap', () { final FileSystem fileSystem = MemoryFileSystem.test(); const String home = '/home/me'; - final Platform platform = FakePlatform(environment: {'HOME': home}); + final Platform platform = FakePlatform(operatingSystem: 'linux', environment: {'HOME': home}); fileSystem.directory(fileSystem.path.join('/snap/code/current/', '.vscode')).createSync(recursive: true); diff --git a/packages/flutter_tools/test/general.shard/web/devfs_web_test.dart b/packages/flutter_tools/test/general.shard/web/devfs_web_test.dart index af2e5d36cd..6e5475e230 100644 --- a/packages/flutter_tools/test/general.shard/web/devfs_web_test.dart +++ b/packages/flutter_tools/test/general.shard/web/devfs_web_test.dart @@ -48,7 +48,7 @@ void main() { setUp(() { httpServer = FakeHttpServer(); - linux = FakePlatform(environment: {}); + linux = FakePlatform(operatingSystem: 'linux', environment: {}); windows = FakePlatform(operatingSystem: 'windows', environment: {}); testbed = Testbed(setup: () { webAssetServer = WebAssetServer( @@ -741,6 +741,7 @@ void main() { BuildMode.debug, '', treeShakeIcons: false, + nullSafetyMode: NullSafetyMode.sound, ), enableDwds: false, enableDds: false, diff --git a/packages/flutter_tools/test/general.shard/web/devices_test.dart b/packages/flutter_tools/test/general.shard/web/devices_test.dart index 617d83b8fb..d17f9992d5 100644 --- a/packages/flutter_tools/test/general.shard/web/devices_test.dart +++ b/packages/flutter_tools/test/general.shard/web/devices_test.dart @@ -19,10 +19,11 @@ import '../../src/fakes.dart'; void main() { testWithoutContext('No web devices listed if feature is disabled', () async { final WebDevices webDevices = WebDevices( - featureFlags: TestFeatureFlags(), + featureFlags: TestFeatureFlags(isWebEnabled: false), fileSystem: MemoryFileSystem.test(), logger: BufferLogger.test(), platform: FakePlatform( + operatingSystem: 'linux', environment: {} ), processManager: FakeProcessManager.any(), @@ -36,7 +37,7 @@ void main() { chromiumLauncher: null, fileSystem: MemoryFileSystem.test(), logger: BufferLogger.test(), - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), processManager: FakeProcessManager.any(), ); @@ -113,6 +114,7 @@ void main() { fileSystem: MemoryFileSystem.test(), logger: BufferLogger.test(), platform: FakePlatform( + operatingSystem: 'linux', environment: {} ), processManager: FakeProcessManager.any(), @@ -128,6 +130,7 @@ void main() { fileSystem: MemoryFileSystem.test(), logger: BufferLogger.test(), platform: FakePlatform( + operatingSystem: 'linux', environment: {} ), processManager: FakeProcessManager.any(), @@ -144,6 +147,7 @@ void main() { fileSystem: MemoryFileSystem.test(), logger: BufferLogger.test(), platform: FakePlatform( + operatingSystem: 'linux', environment: {} ), processManager: processManager, @@ -160,6 +164,7 @@ void main() { fileSystem: MemoryFileSystem.test(), logger: BufferLogger.test(), platform: FakePlatform( + operatingSystem: 'linux', environment: {} ), processManager: FakeProcessManager.any(), @@ -176,6 +181,7 @@ void main() { fileSystem: MemoryFileSystem.test(), logger: BufferLogger.test(), platform: FakePlatform( + operatingSystem: 'linux', environment: {} ), processManager: FakeProcessManager.any(), @@ -200,6 +206,7 @@ void main() { fileSystem: MemoryFileSystem.test(), logger: BufferLogger.test(), platform: FakePlatform( + operatingSystem: 'linux', environment: {} ), processManager: processManager, @@ -273,7 +280,7 @@ void main() { fileSystem: MemoryFileSystem.test(), platform: platform, processManager: processManager, - operatingSystemUtils: FakeOperatingSystemUtils(), + operatingSystemUtils: null, browserFinder: findChromeExecutable, logger: BufferLogger.test(), ); @@ -332,6 +339,7 @@ void main() { fileSystem: MemoryFileSystem.test(), logger: BufferLogger.test(), platform: FakePlatform( + operatingSystem: 'linux', environment: {} ), processManager: FakeProcessManager.empty(), diff --git a/packages/flutter_tools/test/general.shard/web/web_asset_server_test.dart b/packages/flutter_tools/test/general.shard/web/web_asset_server_test.dart index 38764b78b7..c8c561fc49 100644 --- a/packages/flutter_tools/test/general.shard/web/web_asset_server_test.dart +++ b/packages/flutter_tools/test/general.shard/web/web_asset_server_test.dart @@ -22,6 +22,7 @@ const List kTransparentImage = [ ]; final Platform platform = FakePlatform( + operatingSystem: 'linux', environment: { 'HOME': '/' }, diff --git a/packages/flutter_tools/test/general.shard/web/workflow_test.dart b/packages/flutter_tools/test/general.shard/web/workflow_test.dart index ab6c6fbfaf..3d291cf8ac 100644 --- a/packages/flutter_tools/test/general.shard/web/workflow_test.dart +++ b/packages/flutter_tools/test/general.shard/web/workflow_test.dart @@ -11,7 +11,7 @@ import '../../src/fakes.dart'; void main() { testWithoutContext('WebWorkflow applies on Linux', () { final WebWorkflow workflow = WebWorkflow( - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), featureFlags: TestFeatureFlags(isWebEnabled: true), ); @@ -56,7 +56,7 @@ void main() { testWithoutContext('WebWorkflow does not apply if feature flag is disabled', () { final WebWorkflow workflow = WebWorkflow( - platform: FakePlatform(), + platform: FakePlatform(operatingSystem: 'linux'), featureFlags: TestFeatureFlags(), ); diff --git a/packages/flutter_tools/test/general.shard/windows/windows_device_test.dart b/packages/flutter_tools/test/general.shard/windows/windows_device_test.dart index 4646884aec..67f2d11326 100644 --- a/packages/flutter_tools/test/general.shard/windows/windows_device_test.dart +++ b/packages/flutter_tools/test/general.shard/windows/windows_device_test.dart @@ -73,10 +73,10 @@ void main() { testWithoutContext('WindowsDevices does not list devices if the workflow is unsupported', () async { expect(await WindowsDevices( windowsWorkflow: WindowsWorkflow( - featureFlags: TestFeatureFlags(), + featureFlags: TestFeatureFlags(isWindowsEnabled: false), platform: FakePlatform(operatingSystem: 'windows'), ), - featureFlags: TestFeatureFlags(), + featureFlags: TestFeatureFlags(isWindowsEnabled: false), operatingSystemUtils: FakeOperatingSystemUtils(), logger: BufferLogger.test(), processManager: FakeProcessManager.any(), diff --git a/packages/flutter_tools/test/general.shard/windows/windows_workflow_test.dart b/packages/flutter_tools/test/general.shard/windows/windows_workflow_test.dart index 396cd7be0e..d580127980 100644 --- a/packages/flutter_tools/test/general.shard/windows/windows_workflow_test.dart +++ b/packages/flutter_tools/test/general.shard/windows/windows_workflow_test.dart @@ -10,7 +10,7 @@ import '../../src/fakes.dart'; void main() { final FakePlatform windows = FakePlatform(operatingSystem: 'windows'); - final FakePlatform notWindows = FakePlatform(); + final FakePlatform notWindows = FakePlatform(operatingSystem: 'linux'); testWithoutContext('Windows workflow configuration when feature is enabled on Windows host machine', () { final WindowsWorkflow windowsWorkflow = WindowsWorkflow( @@ -27,7 +27,7 @@ void main() { testWithoutContext('Windows workflow configuration when feature is disabled on Windows host machine', () { final WindowsWorkflow windowsWorkflow = WindowsWorkflow( platform: windows, - featureFlags: TestFeatureFlags(), + featureFlags: TestFeatureFlags(isWindowsEnabled: false), ); expect(windowsWorkflow.appliesToHostPlatform, false); @@ -51,7 +51,7 @@ void main() { testWithoutContext('Windows workflow configuration when feature is disabled on non-Windows host machine', () { final WindowsWorkflow windowsWorkflow = WindowsWorkflow( platform: notWindows, - featureFlags: TestFeatureFlags(), + featureFlags: TestFeatureFlags(isWindowsEnabled: false), ); expect(windowsWorkflow.appliesToHostPlatform, false); diff --git a/packages/flutter_tools/test/integration.shard/analyze_once_test.dart b/packages/flutter_tools/test/integration.shard/analyze_once_test.dart index c679cffd9b..95bd0f4d59 100644 --- a/packages/flutter_tools/test/integration.shard/analyze_once_test.dart +++ b/packages/flutter_tools/test/integration.shard/analyze_once_test.dart @@ -266,6 +266,7 @@ int analyze() {} 'missing_return', ], exitMessageContains: '1 issue found.', + exitCode: 0, ); }); @@ -282,6 +283,7 @@ int analyze() {} 'missing_return', ], exitMessageContains: '1 issue found.', + exitCode: 0, ); }); diff --git a/packages/flutter_tools/test/integration.shard/plist_parser_test.dart b/packages/flutter_tools/test/integration.shard/plist_parser_test.dart index 3f43ed2874..1445c7eee3 100644 --- a/packages/flutter_tools/test/integration.shard/plist_parser_test.dart +++ b/packages/flutter_tools/test/integration.shard/plist_parser_test.dart @@ -13,7 +13,6 @@ import 'package:flutter_tools/src/base/terminal.dart'; import 'package:flutter_tools/src/ios/plist_parser.dart'; import '../src/common.dart'; -import '../src/fakes.dart'; import 'test_utils.dart'; const String base64PlistXml = @@ -47,7 +46,7 @@ void main() { outputPreferences: OutputPreferences.test(), terminal: AnsiTerminal( platform: const LocalPlatform(), - stdio: FakeStdio(), + stdio: null, ), ); parser = PlistParser( diff --git a/packages/flutter_tools/test/integration.shard/test_driver.dart b/packages/flutter_tools/test/integration.shard/test_driver.dart index b34061ec7f..c9a0e98eb6 100644 --- a/packages/flutter_tools/test/integration.shard/test_driver.dart +++ b/packages/flutter_tools/test/integration.shard/test_driver.dart @@ -613,7 +613,7 @@ class FlutterRunTestDriver extends FlutterTestDriver { _vmServiceWsUri = Uri.parse(wsUriString); await connectToVmService(pauseOnExceptions: pauseOnExceptions); if (!startPaused) { - await resume(); + await resume(waitForNextPause: false); } } @@ -638,7 +638,7 @@ class FlutterRunTestDriver extends FlutterTestDriver { Future hotRestart({ bool pause = false, bool debounce = false}) => _restart(fullRestart: true, pause: pause); Future hotReload({ bool debounce = false, int debounceDurationOverrideMs }) => - _restart(debounce: debounce, debounceDurationOverrideMs: debounceDurationOverrideMs); + _restart(fullRestart: false, debounce: debounce, debounceDurationOverrideMs: debounceDurationOverrideMs); Future scheduleFrame() async { if (_currentRunningAppId == null) { @@ -807,7 +807,7 @@ class FlutterTestTestDriver extends FlutterTestDriver { if (beforeStart != null) { await beforeStart(); } - await resume(); + await resume(waitForNextPause: false); } } diff --git a/packages/flutter_tools/test/src/custom_devices_common.dart b/packages/flutter_tools/test/src/custom_devices_common.dart index 18c2178a23..4e62ee3405 100644 --- a/packages/flutter_tools/test/src/custom_devices_common.dart +++ b/packages/flutter_tools/test/src/custom_devices_common.dart @@ -43,7 +43,9 @@ const String testConfigForwardPortSuccessOutput = 'testforwardportsuccess\n'; final CustomDeviceConfig disabledTestConfig = testConfig.copyWith(enabled: false); final CustomDeviceConfig testConfigNonForwarding = testConfig.copyWith( explicitForwardPortCommand: true, + forwardPortCommand: null, explicitForwardPortSuccessRegex: true, + forwardPortSuccessRegex: null, ); const Map testConfigJson = { diff --git a/packages/flutter_tools/test/src/fake_process_manager.dart b/packages/flutter_tools/test/src/fake_process_manager.dart index 43d232f8b2..b064a3d3bc 100644 --- a/packages/flutter_tools/test/src/fake_process_manager.dart +++ b/packages/flutter_tools/test/src/fake_process_manager.dart @@ -368,6 +368,11 @@ class _FakeAnyProcessManager extends FakeProcessManager { workingDirectory: workingDirectory, environment: environment, encoding: encoding, + duration: Duration.zero, + exitCode: 0, + stdout: '', + stderr: '', + outputFollowsExit: false, ); } diff --git a/packages/flutter_tools/test/web.shard/chrome_test.dart b/packages/flutter_tools/test/web.shard/chrome_test.dart index ada39d994e..10b1c25010 100644 --- a/packages/flutter_tools/test/web.shard/chrome_test.dart +++ b/packages/flutter_tools/test/web.shard/chrome_test.dart @@ -541,6 +541,8 @@ void main() { await expectToolExitLater( chromiumLauncher.launch( 'example_url', + skipCheck: false, + headless: false, ), contains('Unable to connect to Chrome debug port:'), ); diff --git a/packages/flutter_tools/test/web.shard/vm_service_web_test.dart b/packages/flutter_tools/test/web.shard/vm_service_web_test.dart index d8c8e41a92..63f05fba54 100644 --- a/packages/flutter_tools/test/web.shard/vm_service_web_test.dart +++ b/packages/flutter_tools/test/web.shard/vm_service_web_test.dart @@ -25,7 +25,7 @@ void main() { setUp(() async { tempDir = createResolvedTempDirectorySync('run_test.'); await project.setUpIn(tempDir); - flutter = FlutterRunTestDriver(tempDir); + flutter = FlutterRunTestDriver(tempDir, spawnDdsInstance: true); }); tearDown(() async { diff --git a/packages/flutter_web_plugins/test/plugin_registry_test.dart b/packages/flutter_web_plugins/test/plugin_registry_test.dart index 1c158e9705..73cb681e07 100644 --- a/packages/flutter_web_plugins/test/plugin_registry_test.dart +++ b/packages/flutter_web_plugins/test/plugin_registry_test.dart @@ -44,7 +44,7 @@ void main() { TestPlugin.calledMethods.clear(); const MethodChannel frameworkChannel = - MethodChannel('test_plugin'); + MethodChannel('test_plugin', StandardMethodCodec()); frameworkChannel.invokeMethod('test1'); expect(TestPlugin.calledMethods, equals(['test1'])); @@ -57,7 +57,7 @@ void main() { ServicesBinding.instance!.defaultBinaryMessenger .setMessageHandler('test_send', (ByteData? data) { loggedMessages.add(codec.decodeMessage(data)! as String); - return Future.value(); + return Future.value(null); }); await pluginBinaryMessenger.send( diff --git a/packages/fuchsia_remote_debug_protocol/lib/src/dart/dart_vm.dart b/packages/fuchsia_remote_debug_protocol/lib/src/dart/dart_vm.dart index 29000213ac..cb55ec05e8 100644 --- a/packages/fuchsia_remote_debug_protocol/lib/src/dart/dart_vm.dart +++ b/packages/fuchsia_remote_debug_protocol/lib/src/dart/dart_vm.dart @@ -46,6 +46,7 @@ Future _waitAndConnect( final vms.VmService service = vms.VmService( controller.stream, socket.add, + log: null, disposeHandler: () => socket.close(), streamClosed: streamClosedCompleter.future ); diff --git a/packages/fuchsia_remote_debug_protocol/lib/src/fuchsia_remote_connection.dart b/packages/fuchsia_remote_debug_protocol/lib/src/fuchsia_remote_connection.dart index a40e4727b5..409c2d9d5f 100644 --- a/packages/fuchsia_remote_debug_protocol/lib/src/fuchsia_remote_connection.dart +++ b/packages/fuchsia_remote_debug_protocol/lib/src/fuchsia_remote_connection.dart @@ -260,7 +260,8 @@ class FuchsiaRemoteConnection { if (event.eventType == DartVmEventType.started) { _log.fine('New VM found on port: ${event.servicePort}. Searching ' 'for Isolate: $pattern'); - final DartVm? vmService = await _getDartVm(event.uri); + final DartVm? vmService = await _getDartVm(event.uri, + timeout: _kDartVmConnectionTimeout); // If the VM service is null, set the result to the empty list. final List result = await vmService?.getMainIsolatesByPattern(pattern!) ?? []; if (result.isNotEmpty) {