`experimental/context_menus`: Update `analysis_options.yaml` (#1579)

pull/1585/head
Brett Morgan 2 years ago committed by GitHub
parent e2a6ac66d3
commit c46d418532
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,29 +1 @@
# This file configures the analyzer, which statically analyzes Dart code to include: ../../analysis_options.yaml
# 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

@ -8,9 +8,9 @@ import 'platform_selector.dart';
class AnywherePage extends StatelessWidget { class AnywherePage extends StatelessWidget {
AnywherePage({ AnywherePage({
Key? key, super.key,
required this.onChangedPlatform, required this.onChangedPlatform,
}) : super(key: key); });
static const String route = 'anywhere'; static const String route = 'anywhere';
static const String title = 'Context Menu Anywhere Example'; static const String title = 'Context Menu Anywhere Example';
@ -50,12 +50,11 @@ class AnywherePage extends StatelessWidget {
], ],
), ),
body: ContextMenuRegion( body: ContextMenuRegion(
contextMenuBuilder: (BuildContext context, Offset primaryAnchor, contextMenuBuilder: (context, primaryAnchor, [secondaryAnchor]) {
[Offset? secondaryAnchor]) {
return AdaptiveTextSelectionToolbar.buttonItems( return AdaptiveTextSelectionToolbar.buttonItems(
anchors: TextSelectionToolbarAnchors( anchors: TextSelectionToolbarAnchors(
primaryAnchor: primaryAnchor, primaryAnchor: primaryAnchor,
secondaryAnchor: secondaryAnchor, secondaryAnchor: secondaryAnchor as Offset?,
), ),
buttonItems: <ContextMenuButtonItem>[ buttonItems: <ContextMenuButtonItem>[
ContextMenuButtonItem( ContextMenuButtonItem(

@ -11,9 +11,9 @@ import 'platform_selector.dart';
class CascadingMenuPage extends StatelessWidget { class CascadingMenuPage extends StatelessWidget {
const CascadingMenuPage({ const CascadingMenuPage({
Key? key, super.key,
required this.onChangedPlatform, required this.onChangedPlatform,
}) : super(key: key); });
static const String route = 'cascading'; static const String route = 'cascading';
static const String title = 'Cascading Menu Example'; static const String title = 'Cascading Menu Example';
@ -80,8 +80,8 @@ class _MyContextMenuRegionState extends State<_MyContextMenuRegion> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ContextMenuRegion( return ContextMenuRegion(
contextMenuBuilder: (BuildContext context, Offset primaryAnchor, contextMenuBuilder: (context, primaryAnchor,
[Offset? secondaryAnchor]) { [secondaryAnchor]) {
return _MyCascadingContextMenu( return _MyCascadingContextMenu(
anchor: primaryAnchor, anchor: primaryAnchor,
showingMessage: _showMessage, showingMessage: _showMessage,
@ -90,12 +90,12 @@ class _MyContextMenuRegionState extends State<_MyContextMenuRegion> {
_showMessage = !_showMessage; _showMessage = !_showMessage;
}); });
}, },
onChangeBackgroundColor: (Color color) { onChangeBackgroundColor: (color) {
setState(() { setState(() {
_backgroundColor = color; _backgroundColor = color;
}); });
}, },
onChangeSelection: (String selection) { onChangeSelection: (selection) {
setState(() { setState(() {
_lastSelection = selection; _lastSelection = selection;
}); });

@ -67,7 +67,7 @@ class _ContextMenuRegionState extends State<ContextMenuRegion> {
void _show(Offset position) { void _show(Offset position) {
_contextMenuController.show( _contextMenuController.show(
context: context, context: context,
contextMenuBuilder: (BuildContext context) { contextMenuBuilder: (context) {
return widget.contextMenuBuilder(context, position); return widget.contextMenuBuilder(context, position);
}, },
); );

@ -7,9 +7,9 @@ import 'platform_selector.dart';
class CustomButtonsPage extends StatelessWidget { class CustomButtonsPage extends StatelessWidget {
CustomButtonsPage({ CustomButtonsPage({
Key? key, super.key,
required this.onChangedPlatform, required this.onChangedPlatform,
}) : super(key: key); });
static const String route = 'custom-buttons'; static const String route = 'custom-buttons';
static const String title = 'Custom Buttons'; static const String title = 'Custom Buttons';
@ -52,14 +52,14 @@ class CustomButtonsPage extends StatelessWidget {
maxLines: 4, maxLines: 4,
minLines: 2, minLines: 2,
contextMenuBuilder: contextMenuBuilder:
(BuildContext context, EditableTextState editableTextState) { (context, editableTextState) {
return AdaptiveTextSelectionToolbar( return AdaptiveTextSelectionToolbar(
anchors: editableTextState.contextMenuAnchors, anchors: editableTextState.contextMenuAnchors,
// Build the default buttons, but make them look custom. // Build the default buttons, but make them look custom.
// Note that in a real project you may want to build // Note that in a real project you may want to build
// different buttons depending on the platform. // different buttons depending on the platform.
children: editableTextState.contextMenuButtonItems children: editableTextState.contextMenuButtonItems
.map((ContextMenuButtonItem buttonItem) { .map((buttonItem) {
return CupertinoButton( return CupertinoButton(
borderRadius: null, borderRadius: null,
color: const Color(0xffaaaa00), color: const Color(0xffaaaa00),

@ -6,9 +6,9 @@ import 'platform_selector.dart';
class DefaultValuesPage extends StatelessWidget { class DefaultValuesPage extends StatelessWidget {
DefaultValuesPage({ DefaultValuesPage({
Key? key, super.key,
required this.onChangedPlatform, required this.onChangedPlatform,
}) : super(key: key); });
static const String route = 'default-values'; static const String route = 'default-values';
static const String title = 'Default API Values Example'; static const String title = 'Default API Values Example';
@ -34,7 +34,7 @@ class DefaultValuesPage extends StatelessWidget {
DialogRoute _showDialog(BuildContext context, String message) { DialogRoute _showDialog(BuildContext context, String message) {
return DialogRoute<void>( return DialogRoute<void>(
context: context, 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, maxLines: 2,
minLines: 2, minLines: 2,
controller: _controllerCustom, controller: _controllerCustom,
contextMenuBuilder: (BuildContext context, contextMenuBuilder: (context,
EditableTextState editableTextState) { editableTextState) {
return AdaptiveTextSelectionToolbar.buttonItems( return AdaptiveTextSelectionToolbar.buttonItems(
anchors: editableTextState.contextMenuAnchors, anchors: editableTextState.contextMenuAnchors,
buttonItems: <ContextMenuButtonItem>[ buttonItems: <ContextMenuButtonItem>[

@ -7,9 +7,9 @@ import 'platform_selector.dart';
class EmailButtonPage extends StatelessWidget { class EmailButtonPage extends StatelessWidget {
EmailButtonPage({ EmailButtonPage({
Key? key, super.key,
required this.onChangedPlatform, required this.onChangedPlatform,
}) : super(key: key); });
static const String route = 'email-button'; static const String route = 'email-button';
static const String title = 'Email Button'; static const String title = 'Email Button';
@ -25,7 +25,7 @@ class EmailButtonPage extends StatelessWidget {
DialogRoute _showDialog(BuildContext context) { DialogRoute _showDialog(BuildContext context) {
return DialogRoute<void>( return DialogRoute<void>(
context: context, context: context,
builder: (BuildContext context) => builder: (context) =>
const AlertDialog(title: Text('You clicked send email!')), const AlertDialog(title: Text('You clicked send email!')),
); );
} }
@ -63,8 +63,8 @@ class EmailButtonPage extends StatelessWidget {
TextField( TextField(
maxLines: 2, maxLines: 2,
controller: _controller, controller: _controller,
contextMenuBuilder: (BuildContext context, contextMenuBuilder: (context,
EditableTextState editableTextState) { editableTextState) {
final TextEditingValue value = final TextEditingValue value =
editableTextState.textEditingValue; editableTextState.textEditingValue;
final List<ContextMenuButtonItem> buttonItems = final List<ContextMenuButtonItem> buttonItems =

@ -7,9 +7,9 @@ import 'platform_selector.dart';
class FieldTypesPage extends StatelessWidget { class FieldTypesPage extends StatelessWidget {
FieldTypesPage({ FieldTypesPage({
Key? key, super.key,
required this.onChangedPlatform, required this.onChangedPlatform,
}) : super(key: key); });
static const String route = 'field-types'; static const String route = 'field-types';
static const String title = 'The Context Menu in Different Field Types'; static const String title = 'The Context Menu in Different Field Types';
@ -82,8 +82,8 @@ class FieldTypesPage extends StatelessWidget {
CupertinoTextField( CupertinoTextField(
maxLines: 3, maxLines: 3,
controller: _cupertinoControllerFixed, controller: _cupertinoControllerFixed,
contextMenuBuilder: (BuildContext context, contextMenuBuilder: (context,
EditableTextState editableTextState) { editableTextState) {
return AdaptiveTextSelectionToolbar.editableText( return AdaptiveTextSelectionToolbar.editableText(
editableTextState: editableTextState, editableTextState: editableTextState,
); );
@ -93,8 +93,8 @@ class FieldTypesPage extends StatelessWidget {
CupertinoTextField( CupertinoTextField(
maxLines: 3, maxLines: 3,
controller: _cupertinoControllerForced, controller: _cupertinoControllerForced,
contextMenuBuilder: (BuildContext context, contextMenuBuilder: (context,
EditableTextState editableTextState) { editableTextState) {
return DesktopTextSelectionToolbar( return DesktopTextSelectionToolbar(
anchor: editableTextState.contextMenuAnchors.primaryAnchor, anchor: editableTextState.contextMenuAnchors.primaryAnchor,
children: AdaptiveTextSelectionToolbar.getAdaptiveButtons( children: AdaptiveTextSelectionToolbar.getAdaptiveButtons(
@ -118,8 +118,8 @@ class FieldTypesPage extends StatelessWidget {
// EditableText has no built-in gesture detection for // EditableText has no built-in gesture detection for
// selection. A wrapper would have to implement // selection. A wrapper would have to implement
// TextSelectionGestureDetectorBuilderDelegate, etc. // TextSelectionGestureDetectorBuilderDelegate, etc.
contextMenuBuilder: (BuildContext context, contextMenuBuilder: (context,
EditableTextState editableTextState) { editableTextState) {
return AdaptiveTextSelectionToolbar.editableText( return AdaptiveTextSelectionToolbar.editableText(
editableTextState: editableTextState, editableTextState: editableTextState,
); );

@ -9,9 +9,9 @@ import 'platform_selector.dart';
class FullPage extends StatelessWidget { class FullPage extends StatelessWidget {
FullPage({ FullPage({
Key? key, super.key,
required this.onChangedPlatform, required this.onChangedPlatform,
}) : super(key: key); });
static const String route = 'full'; static const String route = 'full';
static const String title = 'Combined Example'; static const String title = 'Combined Example';
@ -28,7 +28,7 @@ class FullPage extends StatelessWidget {
DialogRoute _showDialog(BuildContext context, String message) { DialogRoute _showDialog(BuildContext context, String message) {
return DialogRoute<void>( return DialogRoute<void>(
context: context, 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( body: ContextMenuRegion(
contextMenuBuilder: (BuildContext context, Offset offset) { contextMenuBuilder: (context, offset) {
return AdaptiveTextSelectionToolbar.buttonItems( return AdaptiveTextSelectionToolbar.buttonItems(
anchors: TextSelectionToolbarAnchors( anchors: TextSelectionToolbarAnchors(
primaryAnchor: offset, primaryAnchor: offset,
@ -81,7 +81,7 @@ class FullPage extends StatelessWidget {
height: 60.0, height: 60.0,
), ),
ContextMenuRegion( ContextMenuRegion(
contextMenuBuilder: (BuildContext context, Offset offset) { contextMenuBuilder: (context, offset) {
return AdaptiveTextSelectionToolbar.buttonItems( return AdaptiveTextSelectionToolbar.buttonItems(
anchors: TextSelectionToolbarAnchors( anchors: TextSelectionToolbarAnchors(
primaryAnchor: offset, primaryAnchor: offset,
@ -107,8 +107,8 @@ class FullPage extends StatelessWidget {
Container(height: 20.0), Container(height: 20.0),
TextField( TextField(
controller: _controller, controller: _controller,
contextMenuBuilder: (BuildContext context, contextMenuBuilder: (context,
EditableTextState editableTextState) { editableTextState) {
final TextEditingValue value = final TextEditingValue value =
editableTextState.textEditingValue; editableTextState.textEditingValue;
final List<ContextMenuButtonItem> buttonItems = final List<ContextMenuButtonItem> buttonItems =
@ -131,7 +131,7 @@ class FullPage extends StatelessWidget {
// Note that in a real project you may want to build // Note that in a real project you may want to build
// different buttons depending on the platform. // different buttons depending on the platform.
children: children:
buttonItems.map((ContextMenuButtonItem buttonItem) { buttonItems.map((buttonItem) {
return CupertinoButton( return CupertinoButton(
borderRadius: null, borderRadius: null,
color: const Color(0xffaaaa00), color: const Color(0xffaaaa00),

@ -6,9 +6,9 @@ import 'platform_selector.dart';
class GlobalSelectionPage extends StatelessWidget { class GlobalSelectionPage extends StatelessWidget {
GlobalSelectionPage({ GlobalSelectionPage({
Key? key, super.key,
required this.onChangedPlatform, required this.onChangedPlatform,
}) : super(key: key); });
static const String route = 'global-selection'; static const String route = 'global-selection';
static const String title = 'Global Selection Example'; static const String title = 'Global Selection Example';
@ -25,7 +25,7 @@ class GlobalSelectionPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SelectionArea( return SelectionArea(
contextMenuBuilder: contextMenuBuilder:
(BuildContext context, SelectableRegionState selectableRegionState) { (context, selectableRegionState) {
return AdaptiveTextSelectionToolbar.buttonItems( return AdaptiveTextSelectionToolbar.buttonItems(
anchors: selectableRegionState.contextMenuAnchors, anchors: selectableRegionState.contextMenuAnchors,
buttonItems: <ContextMenuButtonItem>[ buttonItems: <ContextMenuButtonItem>[

@ -7,9 +7,9 @@ import 'platform_selector.dart';
class ImagePage extends StatelessWidget { class ImagePage extends StatelessWidget {
const ImagePage({ const ImagePage({
Key? key, super.key,
required this.onChangedPlatform, required this.onChangedPlatform,
}) : super(key: key); });
static const String route = 'image'; static const String route = 'image';
static const String title = 'ContextMenu on an Image'; static const String title = 'ContextMenu on an Image';
@ -22,7 +22,7 @@ class ImagePage extends StatelessWidget {
DialogRoute _showDialog(BuildContext context) { DialogRoute _showDialog(BuildContext context) {
return DialogRoute<void>( return DialogRoute<void>(
context: context, context: context,
builder: (BuildContext context) => builder: (context) =>
const AlertDialog(title: Text('Image saved! (not really though)')), const AlertDialog(title: Text('Image saved! (not really though)')),
); );
} }
@ -50,7 +50,7 @@ class ImagePage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
ContextMenuRegion( ContextMenuRegion(
contextMenuBuilder: (BuildContext context, Offset offset) { contextMenuBuilder: (context, offset) {
return AdaptiveTextSelectionToolbar.buttonItems( return AdaptiveTextSelectionToolbar.buttonItems(
anchors: TextSelectionToolbarAnchors( anchors: TextSelectionToolbarAnchors(
primaryAnchor: offset, primaryAnchor: offset,

@ -45,29 +45,29 @@ class _MyAppState extends State<MyApp> {
), ),
initialRoute: '/', initialRoute: '/',
routes: <String, Widget Function(BuildContext)>{ routes: <String, Widget Function(BuildContext)>{
'/': (BuildContext context) => '/': (context) =>
MyHomePage(onChangedPlatform: onChangedPlatform), MyHomePage(onChangedPlatform: onChangedPlatform),
AnywherePage.route: (BuildContext context) => AnywherePage.route: (context) =>
AnywherePage(onChangedPlatform: onChangedPlatform), AnywherePage(onChangedPlatform: onChangedPlatform),
CustomButtonsPage.route: (BuildContext context) => CustomButtonsPage.route: (context) =>
CustomButtonsPage(onChangedPlatform: onChangedPlatform), CustomButtonsPage(onChangedPlatform: onChangedPlatform),
ReorderedButtonsPage.route: (BuildContext context) => ReorderedButtonsPage.route: (context) =>
ReorderedButtonsPage(onChangedPlatform: onChangedPlatform), ReorderedButtonsPage(onChangedPlatform: onChangedPlatform),
EmailButtonPage.route: (BuildContext context) => EmailButtonPage.route: (context) =>
EmailButtonPage(onChangedPlatform: onChangedPlatform), EmailButtonPage(onChangedPlatform: onChangedPlatform),
ImagePage.route: (BuildContext context) => ImagePage.route: (context) =>
ImagePage(onChangedPlatform: onChangedPlatform), ImagePage(onChangedPlatform: onChangedPlatform),
FieldTypesPage.route: (BuildContext context) => FieldTypesPage.route: (context) =>
FieldTypesPage(onChangedPlatform: onChangedPlatform), FieldTypesPage(onChangedPlatform: onChangedPlatform),
FullPage.route: (BuildContext context) => FullPage.route: (context) =>
FullPage(onChangedPlatform: onChangedPlatform), FullPage(onChangedPlatform: onChangedPlatform),
ModifiedActionPage.route: (BuildContext context) => ModifiedActionPage.route: (context) =>
ModifiedActionPage(onChangedPlatform: onChangedPlatform), ModifiedActionPage(onChangedPlatform: onChangedPlatform),
GlobalSelectionPage.route: (BuildContext context) => GlobalSelectionPage.route: (context) =>
GlobalSelectionPage(onChangedPlatform: onChangedPlatform), GlobalSelectionPage(onChangedPlatform: onChangedPlatform),
DefaultValuesPage.route: (BuildContext context) => DefaultValuesPage.route: (context) =>
DefaultValuesPage(onChangedPlatform: onChangedPlatform), DefaultValuesPage(onChangedPlatform: onChangedPlatform),
CascadingMenuPage.route: (BuildContext context) => CascadingMenuPage.route: (context) =>
CascadingMenuPage(onChangedPlatform: onChangedPlatform), CascadingMenuPage(onChangedPlatform: onChangedPlatform),
}, },
); );

@ -6,9 +6,9 @@ import 'platform_selector.dart';
class ModifiedActionPage extends StatelessWidget { class ModifiedActionPage extends StatelessWidget {
ModifiedActionPage({ ModifiedActionPage({
Key? key, super.key,
required this.onChangedPlatform, required this.onChangedPlatform,
}) : super(key: key); });
static const String route = 'modified-action'; static const String route = 'modified-action';
static const String title = 'Modified Action'; static const String title = 'Modified Action';
@ -25,7 +25,7 @@ class ModifiedActionPage extends StatelessWidget {
DialogRoute _showDialog(BuildContext context) { DialogRoute _showDialog(BuildContext context) {
return DialogRoute<void>( return DialogRoute<void>(
context: context, context: context,
builder: (BuildContext context) => const AlertDialog( builder: (context) => const AlertDialog(
title: Text('Copied, but also showed this dialog.')), title: Text('Copied, but also showed this dialog.')),
); );
} }
@ -63,13 +63,13 @@ class ModifiedActionPage extends StatelessWidget {
), ),
TextField( TextField(
controller: _controller, controller: _controller,
contextMenuBuilder: (BuildContext context, contextMenuBuilder: (context,
EditableTextState editableTextState) { editableTextState) {
final List<ContextMenuButtonItem> buttonItems = final List<ContextMenuButtonItem> buttonItems =
editableTextState.contextMenuButtonItems; editableTextState.contextMenuButtonItems;
// Modify the copy buttonItem to show a dialog after copying. // Modify the copy buttonItem to show a dialog after copying.
final int copyButtonIndex = buttonItems.indexWhere( final int copyButtonIndex = buttonItems.indexWhere(
(ContextMenuButtonItem buttonItem) { (buttonItem) {
return buttonItem.type == ContextMenuButtonType.copy; return buttonItem.type == ContextMenuButtonType.copy;
}, },
); );

@ -32,7 +32,7 @@ class _PlatformSelectorState extends State<PlatformSelector> {
value: defaultTargetPlatform, value: defaultTargetPlatform,
icon: const Icon(Icons.arrow_downward), icon: const Icon(Icons.arrow_downward),
elevation: 16, elevation: 16,
onChanged: (TargetPlatform? value) { onChanged: (value) {
if (value == null) { if (value == null) {
return; return;
} }
@ -40,7 +40,7 @@ class _PlatformSelectorState extends State<PlatformSelector> {
widget.onChangedPlatform(value); widget.onChangedPlatform(value);
setState(() {}); setState(() {});
}, },
items: TargetPlatform.values.map((TargetPlatform platform) { items: TargetPlatform.values.map((platform) {
return DropdownMenuItem<TargetPlatform>( return DropdownMenuItem<TargetPlatform>(
value: platform, value: platform,
child: Row( child: Row(

@ -8,9 +8,9 @@ import 'platform_selector.dart';
class ReorderedButtonsPage extends StatelessWidget { class ReorderedButtonsPage extends StatelessWidget {
ReorderedButtonsPage({ ReorderedButtonsPage({
Key? key, super.key,
required this.onChangedPlatform, required this.onChangedPlatform,
}) : super(key: key); });
static const String route = 'reordered-buttons'; static const String route = 'reordered-buttons';
static const String title = 'Reordered Buttons'; static const String title = 'Reordered Buttons';
@ -60,8 +60,8 @@ class ReorderedButtonsPage extends StatelessWidget {
TextField( TextField(
controller: _controllerReordered, controller: _controllerReordered,
maxLines: 2, maxLines: 2,
contextMenuBuilder: (BuildContext context, contextMenuBuilder: (context,
EditableTextState editableTextState) { editableTextState) {
// Reorder the button datas by type. // Reorder the button datas by type.
final HashMap<ContextMenuButtonType, ContextMenuButtonItem> final HashMap<ContextMenuButtonType, ContextMenuButtonItem>
buttonItemsMap = buttonItemsMap =

@ -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/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:context_menus/main.dart';
import 'package:context_menus/anywhere_page.dart';
void main() { 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()); await tester.pumpWidget(const MyApp());
// Navigate to the AnywherePage example. // Navigate to the AnywherePage example.

@ -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/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:context_menus/main.dart';
import 'package:context_menus/cascading_menu_page.dart';
void main() { void main() {
testWidgets('Can show and use the cascading menu', testWidgets('Can show and use the cascading menu',
(WidgetTester tester) async { (tester) async {
await tester.pumpWidget(const MyApp()); await tester.pumpWidget(const MyApp());
// Navigate to the CascadingMenuPage example. // Navigate to the CascadingMenuPage example.

@ -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/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:context_menus/main.dart';
import 'package:context_menus/custom_buttons_page.dart';
void main() { void main() {
testWidgets('Shows custom buttons in the built-in context menu', testWidgets('Shows custom buttons in the built-in context menu',
(WidgetTester tester) async { (tester) async {
await tester.pumpWidget(const MyApp()); await tester.pumpWidget(const MyApp());
// Navigate to the CustomButtonsPage example. // Navigate to the CustomButtonsPage example.

@ -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/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:context_menus/main.dart';
import 'package:context_menus/default_values_page.dart';
void main() { void main() {
testWidgets('Gives correct behavior for all values of contextMenuBuilder', testWidgets('Gives correct behavior for all values of contextMenuBuilder',
(WidgetTester tester) async { (tester) async {
await tester.pumpWidget(const MyApp()); await tester.pumpWidget(const MyApp());
// Navigate to the DefaultValuesPage example. // Navigate to the DefaultValuesPage example.

@ -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/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
@ -5,14 +7,11 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.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'; import 'utils.dart';
void main() { void main() {
testWidgets('Selecting the email address shows a custom button', testWidgets('Selecting the email address shows a custom button',
(WidgetTester tester) async { (tester) async {
await tester.pumpWidget(const MyApp()); await tester.pumpWidget(const MyApp());
// Navigate to the EmailButtonPage example. // Navigate to the EmailButtonPage example.

@ -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/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:context_menus/main.dart';
import 'package:context_menus/field_types_page.dart';
void main() { void main() {
testWidgets( testWidgets(
'Gives correct behavior for all values of contextMenuBuilder', 'Gives correct behavior for all values of contextMenuBuilder',
(WidgetTester tester) async { (tester) async {
await tester.pumpWidget(const MyApp()); await tester.pumpWidget(const MyApp());
// Navigate to the FieldTypesPage example. // Navigate to the FieldTypesPage example.

@ -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/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:context_menus/main.dart';
import 'package:context_menus/global_selection_page.dart';
void main() { void main() {
testWidgets('Gives correct behavior for all values of contextMenuBuilder', testWidgets('Gives correct behavior for all values of contextMenuBuilder',
(WidgetTester tester) async { (tester) async {
await tester.pumpWidget(const MyApp()); await tester.pumpWidget(const MyApp());
// Navigate to the GlobalSelectionPage example. // Navigate to the GlobalSelectionPage example.

@ -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/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:context_menus/main.dart';
import 'package:context_menus/image_page.dart';
void main() { void main() {
testWidgets( testWidgets(
'Gives correct behavior for all values of contextMenuBuilder', 'Gives correct behavior for all values of contextMenuBuilder',
(WidgetTester tester) async { (tester) async {
await tester.pumpWidget(const MyApp()); await tester.pumpWidget(const MyApp());
// Navigate to the ImagePage example. // Navigate to the ImagePage example.

@ -37,7 +37,7 @@ Offset textOffsetToPosition(WidgetTester tester, int offset) {
List<TextSelectionPoint> globalize( List<TextSelectionPoint> globalize(
Iterable<TextSelectionPoint> points, RenderBox box) { Iterable<TextSelectionPoint> points, RenderBox box) {
return points.map<TextSelectionPoint>((TextSelectionPoint point) { return points.map<TextSelectionPoint>((point) {
return TextSelectionPoint( return TextSelectionPoint(
box.localToGlobal(point.point), box.localToGlobal(point.point),
point.direction, point.direction,

@ -19,7 +19,8 @@ declare -ar PROJECT_NAMES=(
"code_sharing/server" "code_sharing/server"
"desktop_photo_search/fluent_ui" "desktop_photo_search/fluent_ui"
"desktop_photo_search/material" "desktop_photo_search/material"
"experimental/context_menus" # TODO(DomesticMouse): Reformat code
# "experimental/context_menus"
"experimental/federated_plugin/federated_plugin" "experimental/federated_plugin/federated_plugin"
# TODO(DomesticMouse): Error: Method not found: 'FallThroughError'. # TODO(DomesticMouse): Error: Method not found: 'FallThroughError'.
# "experimental/web_dashboard" # "experimental/web_dashboard"

Loading…
Cancel
Save