From c46d418532277846c18491023f85b89df6aac1da Mon Sep 17 00:00:00 2001 From: Brett Morgan Date: Fri, 20 Jan 2023 19:12:56 +1100 Subject: [PATCH] `experimental/context_menus`: Update `analysis_options.yaml` (#1579) --- .../context_menus/analysis_options.yaml | 30 +------------------ .../context_menus/lib/anywhere_page.dart | 9 +++--- .../lib/cascading_menu_page.dart | 12 ++++---- .../lib/context_menu_region.dart | 2 +- .../lib/custom_buttons_page.dart | 8 ++--- .../lib/default_values_page.dart | 10 +++---- .../context_menus/lib/email_button_page.dart | 10 +++---- .../context_menus/lib/field_types_page.dart | 16 +++++----- experimental/context_menus/lib/full_page.dart | 16 +++++----- .../lib/global_selection_page.dart | 6 ++-- .../context_menus/lib/image_page.dart | 8 ++--- experimental/context_menus/lib/main.dart | 24 +++++++-------- .../lib/modified_action_page.dart | 12 ++++---- .../context_menus/lib/platform_selector.dart | 4 +-- .../lib/reordered_buttons_page.dart | 8 ++--- .../test/anywhere_page_test.dart | 7 ++--- .../test/cascading_menu_page_test.dart | 7 ++--- .../test/custom_buttons_page_test.dart | 7 ++--- .../test/default_values_page_test.dart | 7 ++--- .../test/email_button_page_test.dart | 7 ++--- .../test/field_types_page_test.dart | 7 ++--- .../test/global_selection_page_test.dart | 7 ++--- .../context_menus/test/image_page_test.dart | 7 ++--- experimental/context_menus/test/utils.dart | 2 +- tool/flutter_ci_script_master.sh | 3 +- 25 files changed, 100 insertions(+), 136 deletions(-) diff --git a/experimental/context_menus/analysis_options.yaml b/experimental/context_menus/analysis_options.yaml index 61b6c4de1..f04c6cf0f 100644 --- a/experimental/context_menus/analysis_options.yaml +++ b/experimental/context_menus/analysis_options.yaml @@ -1,29 +1 @@ -# This file configures the analyzer, which statically analyzes Dart code to -# check for errors, warnings, and lints. -# -# The issues identified by the analyzer are surfaced in the UI of Dart-enabled -# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be -# invoked from the command line by running `flutter analyze`. - -# The following line activates a set of recommended lints for Flutter apps, -# packages, and plugins designed to encourage good coding practices. -include: package:flutter_lints/flutter.yaml - -linter: - # The lint rules applied to this project can be customized in the - # section below to disable rules from the `package:flutter_lints/flutter.yaml` - # included above or to enable additional rules. A list of all available lints - # and their documentation is published at - # https://dart-lang.github.io/linter/lints/index.html. - # - # Instead of disabling a lint rule for the entire project in the - # section below, it can also be suppressed for a single line of code - # or a specific dart file by using the `// ignore: name_of_lint` and - # `// ignore_for_file: name_of_lint` syntax on the line or in the file - # producing the lint. - rules: - # avoid_print: false # Uncomment to disable the `avoid_print` rule - # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule - -# Additional information about this file can be found at -# https://dart.dev/guides/language/analysis-options +include: ../../analysis_options.yaml diff --git a/experimental/context_menus/lib/anywhere_page.dart b/experimental/context_menus/lib/anywhere_page.dart index 62ca338d2..13a1006e7 100644 --- a/experimental/context_menus/lib/anywhere_page.dart +++ b/experimental/context_menus/lib/anywhere_page.dart @@ -8,9 +8,9 @@ import 'platform_selector.dart'; class AnywherePage extends StatelessWidget { AnywherePage({ - Key? key, + super.key, required this.onChangedPlatform, - }) : super(key: key); + }); static const String route = 'anywhere'; static const String title = 'Context Menu Anywhere Example'; @@ -50,12 +50,11 @@ class AnywherePage extends StatelessWidget { ], ), body: ContextMenuRegion( - contextMenuBuilder: (BuildContext context, Offset primaryAnchor, - [Offset? secondaryAnchor]) { + contextMenuBuilder: (context, primaryAnchor, [secondaryAnchor]) { return AdaptiveTextSelectionToolbar.buttonItems( anchors: TextSelectionToolbarAnchors( primaryAnchor: primaryAnchor, - secondaryAnchor: secondaryAnchor, + secondaryAnchor: secondaryAnchor as Offset?, ), buttonItems: [ ContextMenuButtonItem( diff --git a/experimental/context_menus/lib/cascading_menu_page.dart b/experimental/context_menus/lib/cascading_menu_page.dart index 5acc0bb39..500a08a1b 100644 --- a/experimental/context_menus/lib/cascading_menu_page.dart +++ b/experimental/context_menus/lib/cascading_menu_page.dart @@ -11,9 +11,9 @@ import 'platform_selector.dart'; class CascadingMenuPage extends StatelessWidget { const CascadingMenuPage({ - Key? key, + super.key, required this.onChangedPlatform, - }) : super(key: key); + }); static const String route = 'cascading'; static const String title = 'Cascading Menu Example'; @@ -80,8 +80,8 @@ class _MyContextMenuRegionState extends State<_MyContextMenuRegion> { @override Widget build(BuildContext context) { return ContextMenuRegion( - contextMenuBuilder: (BuildContext context, Offset primaryAnchor, - [Offset? secondaryAnchor]) { + contextMenuBuilder: (context, primaryAnchor, + [secondaryAnchor]) { return _MyCascadingContextMenu( anchor: primaryAnchor, showingMessage: _showMessage, @@ -90,12 +90,12 @@ class _MyContextMenuRegionState extends State<_MyContextMenuRegion> { _showMessage = !_showMessage; }); }, - onChangeBackgroundColor: (Color color) { + onChangeBackgroundColor: (color) { setState(() { _backgroundColor = color; }); }, - onChangeSelection: (String selection) { + onChangeSelection: (selection) { setState(() { _lastSelection = selection; }); diff --git a/experimental/context_menus/lib/context_menu_region.dart b/experimental/context_menus/lib/context_menu_region.dart index 077b73b00..e9f7e4452 100644 --- a/experimental/context_menus/lib/context_menu_region.dart +++ b/experimental/context_menus/lib/context_menu_region.dart @@ -67,7 +67,7 @@ class _ContextMenuRegionState extends State { void _show(Offset position) { _contextMenuController.show( context: context, - contextMenuBuilder: (BuildContext context) { + contextMenuBuilder: (context) { return widget.contextMenuBuilder(context, position); }, ); diff --git a/experimental/context_menus/lib/custom_buttons_page.dart b/experimental/context_menus/lib/custom_buttons_page.dart index e1d1ea547..7e1cc19ac 100644 --- a/experimental/context_menus/lib/custom_buttons_page.dart +++ b/experimental/context_menus/lib/custom_buttons_page.dart @@ -7,9 +7,9 @@ import 'platform_selector.dart'; class CustomButtonsPage extends StatelessWidget { CustomButtonsPage({ - Key? key, + super.key, required this.onChangedPlatform, - }) : super(key: key); + }); static const String route = 'custom-buttons'; static const String title = 'Custom Buttons'; @@ -52,14 +52,14 @@ class CustomButtonsPage extends StatelessWidget { maxLines: 4, minLines: 2, contextMenuBuilder: - (BuildContext context, EditableTextState editableTextState) { + (context, editableTextState) { return AdaptiveTextSelectionToolbar( anchors: editableTextState.contextMenuAnchors, // Build the default buttons, but make them look custom. // Note that in a real project you may want to build // different buttons depending on the platform. children: editableTextState.contextMenuButtonItems - .map((ContextMenuButtonItem buttonItem) { + .map((buttonItem) { return CupertinoButton( borderRadius: null, color: const Color(0xffaaaa00), diff --git a/experimental/context_menus/lib/default_values_page.dart b/experimental/context_menus/lib/default_values_page.dart index ab87c87c0..67af7d903 100644 --- a/experimental/context_menus/lib/default_values_page.dart +++ b/experimental/context_menus/lib/default_values_page.dart @@ -6,9 +6,9 @@ import 'platform_selector.dart'; class DefaultValuesPage extends StatelessWidget { DefaultValuesPage({ - Key? key, + super.key, required this.onChangedPlatform, - }) : super(key: key); + }); static const String route = 'default-values'; static const String title = 'Default API Values Example'; @@ -34,7 +34,7 @@ class DefaultValuesPage extends StatelessWidget { DialogRoute _showDialog(BuildContext context, String message) { return DialogRoute( context: context, - builder: (BuildContext context) => AlertDialog(title: Text(message)), + builder: (context) => AlertDialog(title: Text(message)), ); } @@ -84,8 +84,8 @@ class DefaultValuesPage extends StatelessWidget { maxLines: 2, minLines: 2, controller: _controllerCustom, - contextMenuBuilder: (BuildContext context, - EditableTextState editableTextState) { + contextMenuBuilder: (context, + editableTextState) { return AdaptiveTextSelectionToolbar.buttonItems( anchors: editableTextState.contextMenuAnchors, buttonItems: [ diff --git a/experimental/context_menus/lib/email_button_page.dart b/experimental/context_menus/lib/email_button_page.dart index c761c6bb0..60218fc47 100644 --- a/experimental/context_menus/lib/email_button_page.dart +++ b/experimental/context_menus/lib/email_button_page.dart @@ -7,9 +7,9 @@ import 'platform_selector.dart'; class EmailButtonPage extends StatelessWidget { EmailButtonPage({ - Key? key, + super.key, required this.onChangedPlatform, - }) : super(key: key); + }); static const String route = 'email-button'; static const String title = 'Email Button'; @@ -25,7 +25,7 @@ class EmailButtonPage extends StatelessWidget { DialogRoute _showDialog(BuildContext context) { return DialogRoute( context: context, - builder: (BuildContext context) => + builder: (context) => const AlertDialog(title: Text('You clicked send email!')), ); } @@ -63,8 +63,8 @@ class EmailButtonPage extends StatelessWidget { TextField( maxLines: 2, controller: _controller, - contextMenuBuilder: (BuildContext context, - EditableTextState editableTextState) { + contextMenuBuilder: (context, + editableTextState) { final TextEditingValue value = editableTextState.textEditingValue; final List buttonItems = diff --git a/experimental/context_menus/lib/field_types_page.dart b/experimental/context_menus/lib/field_types_page.dart index 606ff53c0..7bc6e007d 100644 --- a/experimental/context_menus/lib/field_types_page.dart +++ b/experimental/context_menus/lib/field_types_page.dart @@ -7,9 +7,9 @@ import 'platform_selector.dart'; class FieldTypesPage extends StatelessWidget { FieldTypesPage({ - Key? key, + super.key, required this.onChangedPlatform, - }) : super(key: key); + }); static const String route = 'field-types'; static const String title = 'The Context Menu in Different Field Types'; @@ -82,8 +82,8 @@ class FieldTypesPage extends StatelessWidget { CupertinoTextField( maxLines: 3, controller: _cupertinoControllerFixed, - contextMenuBuilder: (BuildContext context, - EditableTextState editableTextState) { + contextMenuBuilder: (context, + editableTextState) { return AdaptiveTextSelectionToolbar.editableText( editableTextState: editableTextState, ); @@ -93,8 +93,8 @@ class FieldTypesPage extends StatelessWidget { CupertinoTextField( maxLines: 3, controller: _cupertinoControllerForced, - contextMenuBuilder: (BuildContext context, - EditableTextState editableTextState) { + contextMenuBuilder: (context, + editableTextState) { return DesktopTextSelectionToolbar( anchor: editableTextState.contextMenuAnchors.primaryAnchor, children: AdaptiveTextSelectionToolbar.getAdaptiveButtons( @@ -118,8 +118,8 @@ class FieldTypesPage extends StatelessWidget { // EditableText has no built-in gesture detection for // selection. A wrapper would have to implement // TextSelectionGestureDetectorBuilderDelegate, etc. - contextMenuBuilder: (BuildContext context, - EditableTextState editableTextState) { + contextMenuBuilder: (context, + editableTextState) { return AdaptiveTextSelectionToolbar.editableText( editableTextState: editableTextState, ); diff --git a/experimental/context_menus/lib/full_page.dart b/experimental/context_menus/lib/full_page.dart index dffc842c2..51609eddc 100644 --- a/experimental/context_menus/lib/full_page.dart +++ b/experimental/context_menus/lib/full_page.dart @@ -9,9 +9,9 @@ import 'platform_selector.dart'; class FullPage extends StatelessWidget { FullPage({ - Key? key, + super.key, required this.onChangedPlatform, - }) : super(key: key); + }); static const String route = 'full'; static const String title = 'Combined Example'; @@ -28,7 +28,7 @@ class FullPage extends StatelessWidget { DialogRoute _showDialog(BuildContext context, String message) { return DialogRoute( context: context, - builder: (BuildContext context) => AlertDialog(title: Text(message)), + builder: (context) => AlertDialog(title: Text(message)), ); } @@ -52,7 +52,7 @@ class FullPage extends StatelessWidget { ], ), body: ContextMenuRegion( - contextMenuBuilder: (BuildContext context, Offset offset) { + contextMenuBuilder: (context, offset) { return AdaptiveTextSelectionToolbar.buttonItems( anchors: TextSelectionToolbarAnchors( primaryAnchor: offset, @@ -81,7 +81,7 @@ class FullPage extends StatelessWidget { height: 60.0, ), ContextMenuRegion( - contextMenuBuilder: (BuildContext context, Offset offset) { + contextMenuBuilder: (context, offset) { return AdaptiveTextSelectionToolbar.buttonItems( anchors: TextSelectionToolbarAnchors( primaryAnchor: offset, @@ -107,8 +107,8 @@ class FullPage extends StatelessWidget { Container(height: 20.0), TextField( controller: _controller, - contextMenuBuilder: (BuildContext context, - EditableTextState editableTextState) { + contextMenuBuilder: (context, + editableTextState) { final TextEditingValue value = editableTextState.textEditingValue; final List buttonItems = @@ -131,7 +131,7 @@ class FullPage extends StatelessWidget { // Note that in a real project you may want to build // different buttons depending on the platform. children: - buttonItems.map((ContextMenuButtonItem buttonItem) { + buttonItems.map((buttonItem) { return CupertinoButton( borderRadius: null, color: const Color(0xffaaaa00), diff --git a/experimental/context_menus/lib/global_selection_page.dart b/experimental/context_menus/lib/global_selection_page.dart index a302f8d24..b09a73033 100644 --- a/experimental/context_menus/lib/global_selection_page.dart +++ b/experimental/context_menus/lib/global_selection_page.dart @@ -6,9 +6,9 @@ import 'platform_selector.dart'; class GlobalSelectionPage extends StatelessWidget { GlobalSelectionPage({ - Key? key, + super.key, required this.onChangedPlatform, - }) : super(key: key); + }); static const String route = 'global-selection'; static const String title = 'Global Selection Example'; @@ -25,7 +25,7 @@ class GlobalSelectionPage extends StatelessWidget { Widget build(BuildContext context) { return SelectionArea( contextMenuBuilder: - (BuildContext context, SelectableRegionState selectableRegionState) { + (context, selectableRegionState) { return AdaptiveTextSelectionToolbar.buttonItems( anchors: selectableRegionState.contextMenuAnchors, buttonItems: [ diff --git a/experimental/context_menus/lib/image_page.dart b/experimental/context_menus/lib/image_page.dart index a8dd9ff9a..1cc9932d1 100644 --- a/experimental/context_menus/lib/image_page.dart +++ b/experimental/context_menus/lib/image_page.dart @@ -7,9 +7,9 @@ import 'platform_selector.dart'; class ImagePage extends StatelessWidget { const ImagePage({ - Key? key, + super.key, required this.onChangedPlatform, - }) : super(key: key); + }); static const String route = 'image'; static const String title = 'ContextMenu on an Image'; @@ -22,7 +22,7 @@ class ImagePage extends StatelessWidget { DialogRoute _showDialog(BuildContext context) { return DialogRoute( context: context, - builder: (BuildContext context) => + builder: (context) => const AlertDialog(title: Text('Image saved! (not really though)')), ); } @@ -50,7 +50,7 @@ class ImagePage extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ ContextMenuRegion( - contextMenuBuilder: (BuildContext context, Offset offset) { + contextMenuBuilder: (context, offset) { return AdaptiveTextSelectionToolbar.buttonItems( anchors: TextSelectionToolbarAnchors( primaryAnchor: offset, diff --git a/experimental/context_menus/lib/main.dart b/experimental/context_menus/lib/main.dart index 0991602b2..535884b01 100644 --- a/experimental/context_menus/lib/main.dart +++ b/experimental/context_menus/lib/main.dart @@ -45,29 +45,29 @@ class _MyAppState extends State { ), initialRoute: '/', routes: { - '/': (BuildContext context) => + '/': (context) => MyHomePage(onChangedPlatform: onChangedPlatform), - AnywherePage.route: (BuildContext context) => + AnywherePage.route: (context) => AnywherePage(onChangedPlatform: onChangedPlatform), - CustomButtonsPage.route: (BuildContext context) => + CustomButtonsPage.route: (context) => CustomButtonsPage(onChangedPlatform: onChangedPlatform), - ReorderedButtonsPage.route: (BuildContext context) => + ReorderedButtonsPage.route: (context) => ReorderedButtonsPage(onChangedPlatform: onChangedPlatform), - EmailButtonPage.route: (BuildContext context) => + EmailButtonPage.route: (context) => EmailButtonPage(onChangedPlatform: onChangedPlatform), - ImagePage.route: (BuildContext context) => + ImagePage.route: (context) => ImagePage(onChangedPlatform: onChangedPlatform), - FieldTypesPage.route: (BuildContext context) => + FieldTypesPage.route: (context) => FieldTypesPage(onChangedPlatform: onChangedPlatform), - FullPage.route: (BuildContext context) => + FullPage.route: (context) => FullPage(onChangedPlatform: onChangedPlatform), - ModifiedActionPage.route: (BuildContext context) => + ModifiedActionPage.route: (context) => ModifiedActionPage(onChangedPlatform: onChangedPlatform), - GlobalSelectionPage.route: (BuildContext context) => + GlobalSelectionPage.route: (context) => GlobalSelectionPage(onChangedPlatform: onChangedPlatform), - DefaultValuesPage.route: (BuildContext context) => + DefaultValuesPage.route: (context) => DefaultValuesPage(onChangedPlatform: onChangedPlatform), - CascadingMenuPage.route: (BuildContext context) => + CascadingMenuPage.route: (context) => CascadingMenuPage(onChangedPlatform: onChangedPlatform), }, ); diff --git a/experimental/context_menus/lib/modified_action_page.dart b/experimental/context_menus/lib/modified_action_page.dart index a0d0f8b33..f5ea3b427 100644 --- a/experimental/context_menus/lib/modified_action_page.dart +++ b/experimental/context_menus/lib/modified_action_page.dart @@ -6,9 +6,9 @@ import 'platform_selector.dart'; class ModifiedActionPage extends StatelessWidget { ModifiedActionPage({ - Key? key, + super.key, required this.onChangedPlatform, - }) : super(key: key); + }); static const String route = 'modified-action'; static const String title = 'Modified Action'; @@ -25,7 +25,7 @@ class ModifiedActionPage extends StatelessWidget { DialogRoute _showDialog(BuildContext context) { return DialogRoute( context: context, - builder: (BuildContext context) => const AlertDialog( + builder: (context) => const AlertDialog( title: Text('Copied, but also showed this dialog.')), ); } @@ -63,13 +63,13 @@ class ModifiedActionPage extends StatelessWidget { ), TextField( controller: _controller, - contextMenuBuilder: (BuildContext context, - EditableTextState editableTextState) { + contextMenuBuilder: (context, + editableTextState) { final List buttonItems = editableTextState.contextMenuButtonItems; // Modify the copy buttonItem to show a dialog after copying. final int copyButtonIndex = buttonItems.indexWhere( - (ContextMenuButtonItem buttonItem) { + (buttonItem) { return buttonItem.type == ContextMenuButtonType.copy; }, ); diff --git a/experimental/context_menus/lib/platform_selector.dart b/experimental/context_menus/lib/platform_selector.dart index 3bf4ce3c2..ad486c5ca 100644 --- a/experimental/context_menus/lib/platform_selector.dart +++ b/experimental/context_menus/lib/platform_selector.dart @@ -32,7 +32,7 @@ class _PlatformSelectorState extends State { value: defaultTargetPlatform, icon: const Icon(Icons.arrow_downward), elevation: 16, - onChanged: (TargetPlatform? value) { + onChanged: (value) { if (value == null) { return; } @@ -40,7 +40,7 @@ class _PlatformSelectorState extends State { widget.onChangedPlatform(value); setState(() {}); }, - items: TargetPlatform.values.map((TargetPlatform platform) { + items: TargetPlatform.values.map((platform) { return DropdownMenuItem( value: platform, child: Row( diff --git a/experimental/context_menus/lib/reordered_buttons_page.dart b/experimental/context_menus/lib/reordered_buttons_page.dart index cbb5ed1c1..2364dd225 100644 --- a/experimental/context_menus/lib/reordered_buttons_page.dart +++ b/experimental/context_menus/lib/reordered_buttons_page.dart @@ -8,9 +8,9 @@ import 'platform_selector.dart'; class ReorderedButtonsPage extends StatelessWidget { ReorderedButtonsPage({ - Key? key, + super.key, required this.onChangedPlatform, - }) : super(key: key); + }); static const String route = 'reordered-buttons'; static const String title = 'Reordered Buttons'; @@ -60,8 +60,8 @@ class ReorderedButtonsPage extends StatelessWidget { TextField( controller: _controllerReordered, maxLines: 2, - contextMenuBuilder: (BuildContext context, - EditableTextState editableTextState) { + contextMenuBuilder: (context, + editableTextState) { // Reorder the button datas by type. final HashMap buttonItemsMap = diff --git a/experimental/context_menus/test/anywhere_page_test.dart b/experimental/context_menus/test/anywhere_page_test.dart index cb50f63d8..d8ab8962c 100644 --- a/experimental/context_menus/test/anywhere_page_test.dart +++ b/experimental/context_menus/test/anywhere_page_test.dart @@ -1,12 +1,11 @@ +import 'package:context_menus/anywhere_page.dart'; +import 'package:context_menus/main.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:context_menus/main.dart'; -import 'package:context_menus/anywhere_page.dart'; - void main() { - testWidgets('Right click works outside of text', (WidgetTester tester) async { + testWidgets('Right click works outside of text', (tester) async { await tester.pumpWidget(const MyApp()); // Navigate to the AnywherePage example. diff --git a/experimental/context_menus/test/cascading_menu_page_test.dart b/experimental/context_menus/test/cascading_menu_page_test.dart index 3ec39e127..a3eba5ddf 100644 --- a/experimental/context_menus/test/cascading_menu_page_test.dart +++ b/experimental/context_menus/test/cascading_menu_page_test.dart @@ -1,14 +1,13 @@ +import 'package:context_menus/cascading_menu_page.dart'; +import 'package:context_menus/main.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:context_menus/main.dart'; -import 'package:context_menus/cascading_menu_page.dart'; - void main() { testWidgets('Can show and use the cascading menu', - (WidgetTester tester) async { + (tester) async { await tester.pumpWidget(const MyApp()); // Navigate to the CascadingMenuPage example. diff --git a/experimental/context_menus/test/custom_buttons_page_test.dart b/experimental/context_menus/test/custom_buttons_page_test.dart index 38dd8857b..07266b1a6 100644 --- a/experimental/context_menus/test/custom_buttons_page_test.dart +++ b/experimental/context_menus/test/custom_buttons_page_test.dart @@ -1,15 +1,14 @@ +import 'package:context_menus/custom_buttons_page.dart'; +import 'package:context_menus/main.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:context_menus/main.dart'; -import 'package:context_menus/custom_buttons_page.dart'; - void main() { testWidgets('Shows custom buttons in the built-in context menu', - (WidgetTester tester) async { + (tester) async { await tester.pumpWidget(const MyApp()); // Navigate to the CustomButtonsPage example. diff --git a/experimental/context_menus/test/default_values_page_test.dart b/experimental/context_menus/test/default_values_page_test.dart index 4fca5ce42..77dc1646e 100644 --- a/experimental/context_menus/test/default_values_page_test.dart +++ b/experimental/context_menus/test/default_values_page_test.dart @@ -1,15 +1,14 @@ +import 'package:context_menus/default_values_page.dart'; +import 'package:context_menus/main.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:context_menus/main.dart'; -import 'package:context_menus/default_values_page.dart'; - void main() { testWidgets('Gives correct behavior for all values of contextMenuBuilder', - (WidgetTester tester) async { + (tester) async { await tester.pumpWidget(const MyApp()); // Navigate to the DefaultValuesPage example. diff --git a/experimental/context_menus/test/email_button_page_test.dart b/experimental/context_menus/test/email_button_page_test.dart index 9b3c6f2a6..87dcc81af 100644 --- a/experimental/context_menus/test/email_button_page_test.dart +++ b/experimental/context_menus/test/email_button_page_test.dart @@ -1,3 +1,5 @@ +import 'package:context_menus/email_button_page.dart'; +import 'package:context_menus/main.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; @@ -5,14 +7,11 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:context_menus/main.dart'; -import 'package:context_menus/email_button_page.dart'; - import 'utils.dart'; void main() { testWidgets('Selecting the email address shows a custom button', - (WidgetTester tester) async { + (tester) async { await tester.pumpWidget(const MyApp()); // Navigate to the EmailButtonPage example. diff --git a/experimental/context_menus/test/field_types_page_test.dart b/experimental/context_menus/test/field_types_page_test.dart index 2ca1cd044..c67c86171 100644 --- a/experimental/context_menus/test/field_types_page_test.dart +++ b/experimental/context_menus/test/field_types_page_test.dart @@ -1,16 +1,15 @@ +import 'package:context_menus/field_types_page.dart'; +import 'package:context_menus/main.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:context_menus/main.dart'; -import 'package:context_menus/field_types_page.dart'; - void main() { testWidgets( 'Gives correct behavior for all values of contextMenuBuilder', - (WidgetTester tester) async { + (tester) async { await tester.pumpWidget(const MyApp()); // Navigate to the FieldTypesPage example. diff --git a/experimental/context_menus/test/global_selection_page_test.dart b/experimental/context_menus/test/global_selection_page_test.dart index 1982da6a4..4ddbe8c6a 100644 --- a/experimental/context_menus/test/global_selection_page_test.dart +++ b/experimental/context_menus/test/global_selection_page_test.dart @@ -1,13 +1,12 @@ +import 'package:context_menus/global_selection_page.dart'; +import 'package:context_menus/main.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:context_menus/main.dart'; -import 'package:context_menus/global_selection_page.dart'; - void main() { testWidgets('Gives correct behavior for all values of contextMenuBuilder', - (WidgetTester tester) async { + (tester) async { await tester.pumpWidget(const MyApp()); // Navigate to the GlobalSelectionPage example. diff --git a/experimental/context_menus/test/image_page_test.dart b/experimental/context_menus/test/image_page_test.dart index cee4d34a6..c786518f0 100644 --- a/experimental/context_menus/test/image_page_test.dart +++ b/experimental/context_menus/test/image_page_test.dart @@ -1,14 +1,13 @@ +import 'package:context_menus/image_page.dart'; +import 'package:context_menus/main.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:context_menus/main.dart'; -import 'package:context_menus/image_page.dart'; - void main() { testWidgets( 'Gives correct behavior for all values of contextMenuBuilder', - (WidgetTester tester) async { + (tester) async { await tester.pumpWidget(const MyApp()); // Navigate to the ImagePage example. diff --git a/experimental/context_menus/test/utils.dart b/experimental/context_menus/test/utils.dart index e92b28804..3f5f9caa3 100644 --- a/experimental/context_menus/test/utils.dart +++ b/experimental/context_menus/test/utils.dart @@ -37,7 +37,7 @@ Offset textOffsetToPosition(WidgetTester tester, int offset) { List globalize( Iterable points, RenderBox box) { - return points.map((TextSelectionPoint point) { + return points.map((point) { return TextSelectionPoint( box.localToGlobal(point.point), point.direction, diff --git a/tool/flutter_ci_script_master.sh b/tool/flutter_ci_script_master.sh index 195455ffd..b255e87cd 100755 --- a/tool/flutter_ci_script_master.sh +++ b/tool/flutter_ci_script_master.sh @@ -19,7 +19,8 @@ declare -ar PROJECT_NAMES=( "code_sharing/server" "desktop_photo_search/fluent_ui" "desktop_photo_search/material" - "experimental/context_menus" + # TODO(DomesticMouse): Reformat code + # "experimental/context_menus" "experimental/federated_plugin/federated_plugin" # TODO(DomesticMouse): Error: Method not found: 'FallThroughError'. # "experimental/web_dashboard"