From c9680b0e813c52f44dc6e6df64b742f7ce01f8a4 Mon Sep 17 00:00:00 2001 From: Brett Morgan Date: Tue, 17 Jan 2023 09:16:25 +1000 Subject: [PATCH 1/8] Add `discarded_futures` lint --- analysis_options.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/analysis_options.yaml b/analysis_options.yaml index 84774581270..5e179a01dc5 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -12,6 +12,7 @@ linter: cancel_subscriptions: true close_sinks: true directives_ordering: true + discarded_futures: true package_api_docs: true package_prefixed_library_names: true test_types_in_equals: true From a8a4434a63031f527ae743e10e28ca313380d8ed Mon Sep 17 00:00:00 2001 From: Brett Morgan Date: Tue, 17 Jan 2023 13:11:18 +1000 Subject: [PATCH 2/8] Fixups --- .../flutter_module_using_plugin/lib/main.dart | 8 ++- .../books/flutter_module_books/lib/main.dart | 8 +-- .../fullscreen/flutter_module/lib/main.dart | 8 ++- .../multiple_flutters_module/lib/main.dart | 6 +- .../flutter_module_using_plugin/lib/main.dart | 8 ++- .../flutter_module/lib/main.dart | 8 ++- animations/lib/main.dart | 5 +- .../lib/src/basics/02_page_route_builder.dart | 5 +- .../lib/src/basics/06_custom_tween.dart | 6 +- .../lib/src/basics/08_fade_transition.dart | 8 +-- animations/lib/src/misc/card_swipe.dart | 8 +-- animations/lib/src/misc/focus_image.dart | 4 +- animations/lib/src/misc/hero_animation.dart | 2 +- .../macos/Runner.xcodeproj/project.pbxproj | 62 +++++++++++++++- .../contents.xcworkspacedata | 3 + desktop_photo_search/fluent_ui/lib/main.dart | 31 ++++---- .../lib/src/widgets/unsplash_notice.dart | 19 ++--- .../fluent_ui/tool/grind.dart | 2 +- desktop_photo_search/material/lib/main.dart | 33 ++++----- .../lib/src/widgets/unsplash_notice.dart | 21 +++--- desktop_photo_search/material/tool/grind.dart | 2 +- flutter_maps_firestore/lib/main.dart | 2 +- form_app/lib/main.dart | 5 +- form_app/lib/src/sign_in_http.dart | 33 +++++---- form_app/lib/src/validation.dart | 4 +- game_template/analysis_options.yaml | 2 +- .../Flutter/GeneratedPluginRegistrant.swift | 4 +- infinite_list/lib/main.dart | 5 +- infinite_list/lib/src/catalog.dart | 4 +- ios_app_clip/lib/main.dart | 5 +- isolate_example/analysis_options.yaml | 4 ++ material_3_demo/lib/component_screen.dart | 6 +- navigation_and_routing/lib/main.dart | 5 +- navigation_and_routing/lib/src/app.dart | 4 +- .../lib/src/screens/author_details.dart | 5 +- .../lib/src/screens/authors.dart | 5 +- .../lib/src/screens/book_details.dart | 14 ++-- .../lib/src/screens/books.dart | 13 ++-- .../lib/src/screens/navigator.dart | 6 +- .../lib/src/screens/scaffold.dart | 8 +-- .../lib/src/screens/settings.dart | 10 +-- .../macos/Runner.xcodeproj/project.pbxproj | 62 +++++++++++++++- .../contents.xcworkspacedata | 3 + place_tracker/.metadata | 18 ++--- .../ios/Runner.xcodeproj/project.pbxproj | 68 ++++++++++++++++++ place_tracker/lib/place_map.dart | 21 +++--- place_tracker/pubspec.yaml | 6 +- place_tracker/web/index.html | 3 + .../ios/Runner.xcodeproj/project.pbxproj | 4 ++ .../lib/src/add_pet_details.dart | 5 +- .../lib/src/pet_list_message_channel.dart | 5 +- .../lib/src/platform_image_demo.dart | 2 + platform_channels/pubspec.yaml | 3 +- .../test/src/event_channel_demo_test.dart | 17 +++-- .../test/src/pet_list_screen_test.dart | 4 +- platform_design/lib/main.dart | 12 ++-- platform_design/lib/profile_tab.dart | 16 ++--- platform_design/lib/songs_tab.dart | 6 +- platform_design/lib/widgets.dart | 6 +- platform_design/web/favicon.png | Bin 917 -> 0 bytes platform_design/web/icons/Icon-192.png | Bin 5292 -> 0 bytes platform_design/web/icons/Icon-512.png | Bin 8252 -> 0 bytes .../web/icons/Icon-maskable-192.png | Bin 5594 -> 0 bytes .../web/icons/Icon-maskable-512.png | Bin 20998 -> 0 bytes platform_design/web/index.html | 58 --------------- platform_design/web/manifest.json | 35 --------- provider_counter/lib/main.dart | 5 +- provider_shopper/lib/main.dart | 5 +- simplistic_editor/analysis_options.yaml | 4 ++ veggieseasons/lib/data/preferences.dart | 4 +- veggieseasons/lib/main.dart | 10 +-- veggieseasons/lib/screens/settings.dart | 58 ++++++++------- .../Flutter/GeneratedPluginRegistrant.swift | 2 +- 73 files changed, 480 insertions(+), 363 deletions(-) delete mode 100644 platform_design/web/favicon.png delete mode 100644 platform_design/web/icons/Icon-192.png delete mode 100644 platform_design/web/icons/Icon-512.png delete mode 100644 platform_design/web/icons/Icon-maskable-192.png delete mode 100644 platform_design/web/icons/Icon-maskable-512.png delete mode 100644 platform_design/web/index.html delete mode 100644 platform_design/web/manifest.json diff --git a/add_to_app/android_view/flutter_module_using_plugin/lib/main.dart b/add_to_app/android_view/flutter_module_using_plugin/lib/main.dart index e3480ba6254..16ebe6ced56 100644 --- a/add_to_app/android_view/flutter_module_using_plugin/lib/main.dart +++ b/add_to_app/android_view/flutter_module_using_plugin/lib/main.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; + import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; @@ -44,7 +46,7 @@ void showCell() { class CounterModel extends ChangeNotifier { CounterModel() { _channel.setMethodCallHandler(_handleMessage); - _channel.invokeMethod('requestCounter'); + unawaited(_channel.invokeMethod('requestCounter')); } final _channel = const MethodChannel('dev.flutter.example/counter'); @@ -54,7 +56,7 @@ class CounterModel extends ChangeNotifier { int get count => _count; void increment() { - _channel.invokeMethod('incrementCounter'); + unawaited(_channel.invokeMethod('incrementCounter')); } Future _handleMessage(MethodCall call) async { @@ -175,7 +177,7 @@ class Contents extends StatelessWidget { if (showExit) ...[ const SizedBox(height: 16), ElevatedButton( - onPressed: () => SystemNavigator.pop(), + onPressed: () async => SystemNavigator.pop(), child: const Text('Exit this screen'), ), ], diff --git a/add_to_app/books/flutter_module_books/lib/main.dart b/add_to_app/books/flutter_module_books/lib/main.dart index edd9ef179d0..ef04abd51be 100644 --- a/add_to_app/books/flutter_module_books/lib/main.dart +++ b/add_to_app/books/flutter_module_books/lib/main.dart @@ -115,8 +115,8 @@ class _BookDetailState extends State { icon: const Icon(Icons.clear), // Pressing clear cancels the edit and leaves the activity without // modification. - onPressed: () { - hostApi.cancel(); + onPressed: () async { + await hostApi.cancel(); clear(); }, ), @@ -125,8 +125,8 @@ class _BookDetailState extends State { icon: const Icon(Icons.check), // Pressing save sends the updated book to the platform. onPressed: book != null - ? () { - hostApi.finishEditingBook(book!); + ? () async { + await hostApi.finishEditingBook(book!); clear(); } : null, diff --git a/add_to_app/fullscreen/flutter_module/lib/main.dart b/add_to_app/fullscreen/flutter_module/lib/main.dart index 3cd02f09b5a..369f8383f07 100644 --- a/add_to_app/fullscreen/flutter_module/lib/main.dart +++ b/add_to_app/fullscreen/flutter_module/lib/main.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; + import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; @@ -32,7 +34,7 @@ void main() { class CounterModel extends ChangeNotifier { CounterModel() { _channel.setMethodCallHandler(_handleMessage); - _channel.invokeMethod('requestCounter'); + unawaited(_channel.invokeMethod('requestCounter')); } final _channel = const MethodChannel('dev.flutter.example/counter'); @@ -42,7 +44,7 @@ class CounterModel extends ChangeNotifier { int get count => _count; void increment() { - _channel.invokeMethod('incrementCounter'); + unawaited(_channel.invokeMethod('incrementCounter')); } Future _handleMessage(MethodCall call) async { @@ -151,7 +153,7 @@ class Contents extends StatelessWidget { if (showExit) ...[ const SizedBox(height: 16), ElevatedButton( - onPressed: () => SystemNavigator.pop(animated: true), + onPressed: () async => SystemNavigator.pop(animated: true), child: const Text('Exit this screen'), ), ], diff --git a/add_to_app/multiple_flutters/multiple_flutters_module/lib/main.dart b/add_to_app/multiple_flutters/multiple_flutters_module/lib/main.dart index 771904b11a3..24ddd36f674 100644 --- a/add_to_app/multiple_flutters/multiple_flutters_module/lib/main.dart +++ b/add_to_app/multiple_flutters/multiple_flutters_module/lib/main.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; + import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:url_launcher/url_launcher.dart' as launcher; @@ -61,7 +63,7 @@ class _MyHomePageState extends State { void _incrementCounter() { // Mutations to the data model are forwarded to the host platform. - _channel.invokeMethod("incrementCount", _counter); + unawaited(_channel.invokeMethod("incrementCount", _counter)); } @override @@ -87,7 +89,7 @@ class _MyHomePageState extends State { ), TextButton( onPressed: () { - _channel.invokeMethod("next", _counter); + unawaited(_channel.invokeMethod("next", _counter)); }, child: const Text('Next'), ), diff --git a/add_to_app/plugin/flutter_module_using_plugin/lib/main.dart b/add_to_app/plugin/flutter_module_using_plugin/lib/main.dart index d65648ed6db..7af4fe9ab36 100644 --- a/add_to_app/plugin/flutter_module_using_plugin/lib/main.dart +++ b/add_to_app/plugin/flutter_module_using_plugin/lib/main.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; + import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; @@ -43,7 +45,7 @@ void showCell() { class CounterModel extends ChangeNotifier { CounterModel() { _channel.setMethodCallHandler(_handleMessage); - _channel.invokeMethod('requestCounter'); + unawaited(_channel.invokeMethod('requestCounter')); } final _channel = const MethodChannel('dev.flutter.example/counter'); @@ -53,7 +55,7 @@ class CounterModel extends ChangeNotifier { int get count => _count; void increment() { - _channel.invokeMethod('incrementCounter'); + unawaited(_channel.invokeMethod('incrementCounter')); } Future _handleMessage(MethodCall call) async { @@ -174,7 +176,7 @@ class Contents extends StatelessWidget { if (showExit) ...[ const SizedBox(height: 16), ElevatedButton( - onPressed: () => SystemNavigator.pop(), + onPressed: () async => SystemNavigator.pop(), child: const Text('Exit this screen'), ), ], diff --git a/add_to_app/prebuilt_module/flutter_module/lib/main.dart b/add_to_app/prebuilt_module/flutter_module/lib/main.dart index 9f32725a001..e4117ca1060 100644 --- a/add_to_app/prebuilt_module/flutter_module/lib/main.dart +++ b/add_to_app/prebuilt_module/flutter_module/lib/main.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; + import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; @@ -32,7 +34,7 @@ void main() { class CounterModel extends ChangeNotifier { CounterModel() { _channel.setMethodCallHandler(_handleMessage); - _channel.invokeMethod('requestCounter'); + unawaited(_channel.invokeMethod('requestCounter')); } final _channel = const MethodChannel('dev.flutter.example/counter'); @@ -42,7 +44,7 @@ class CounterModel extends ChangeNotifier { int get count => _count; void increment() { - _channel.invokeMethod('incrementCounter'); + unawaited(_channel.invokeMethod('incrementCounter')); } Future _handleMessage(MethodCall call) async { @@ -151,7 +153,7 @@ class Contents extends StatelessWidget { if (showExit) ...[ const SizedBox(height: 16), ElevatedButton( - onPressed: () => SystemNavigator.pop(animated: true), + onPressed: () async => SystemNavigator.pop(animated: true), child: const Text('Exit this screen'), ), ], diff --git a/animations/lib/main.dart b/animations/lib/main.dart index af5f44e36fa..880f42d6baa 100644 --- a/animations/lib/main.dart +++ b/animations/lib/main.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; import 'dart:io'; import 'package:flutter/foundation.dart'; @@ -45,13 +46,13 @@ void setupWindow() { setWindowTitle('Animation Samples'); setWindowMinSize(const Size(windowWidth, windowHeight)); setWindowMaxSize(const Size(windowWidth, windowHeight)); - getCurrentScreen().then((screen) { + unawaited(getCurrentScreen().then((screen) { setWindowFrame(Rect.fromCenter( center: screen!.frame.center, width: windowWidth, height: windowHeight, )); - }); + })); } } diff --git a/animations/lib/src/basics/02_page_route_builder.dart b/animations/lib/src/basics/02_page_route_builder.dart index 8033bc751ea..5a0d57eed8f 100644 --- a/animations/lib/src/basics/02_page_route_builder.dart +++ b/animations/lib/src/basics/02_page_route_builder.dart @@ -17,9 +17,8 @@ class PageRouteBuilderDemo extends StatelessWidget { body: Center( child: ElevatedButton( child: const Text('Go!'), - onPressed: () { - Navigator.of(context).push(_createRoute()); - }, + onPressed: () async => + Navigator.of(context).push(_createRoute()), ), ), ); diff --git a/animations/lib/src/basics/06_custom_tween.dart b/animations/lib/src/basics/06_custom_tween.dart index 7de726c6e0b..ff208a4c90c 100644 --- a/animations/lib/src/basics/06_custom_tween.dart +++ b/animations/lib/src/basics/06_custom_tween.dart @@ -52,13 +52,13 @@ class _CustomTweenDemoState extends State actions: [ MaterialButton( textColor: Colors.white, - onPressed: () { + onPressed: () async { if (controller.status == AnimationStatus.completed) { - controller.reverse().whenComplete(() { + await controller.reverse().whenComplete(() { setState(() {}); }); } else { - controller.forward().whenComplete(() { + await controller.forward().whenComplete(() { setState(() {}); }); } diff --git a/animations/lib/src/basics/08_fade_transition.dart b/animations/lib/src/basics/08_fade_transition.dart index a10f70a782b..e945d30ea26 100644 --- a/animations/lib/src/basics/08_fade_transition.dart +++ b/animations/lib/src/basics/08_fade_transition.dart @@ -64,10 +64,10 @@ class _FadeTransitionDemoState extends State ), ElevatedButton( child: const Text('animate'), - onPressed: () => setState(() { - _controller.animateTo(1.0).then( - (value) => _controller.animateBack(0.0)); - }), + onPressed: () async { + await _controller.animateTo(1.0); + await _controller.animateBack(0.0); + }, ), ], ), diff --git a/animations/lib/src/misc/card_swipe.dart b/animations/lib/src/misc/card_swipe.dart index 3fc74ec45f8..84c86fe1df1 100644 --- a/animations/lib/src/misc/card_swipe.dart +++ b/animations/lib/src/misc/card_swipe.dart @@ -167,7 +167,7 @@ class _SwipeableCardState extends State /// Runs the fling / spring animation using the final velocity of the drag /// gesture. - void _dragEnd(DragEndDetails details) { + Future _dragEnd(DragEndDetails details) async { final size = context.size; if (size == null) { @@ -175,7 +175,7 @@ class _SwipeableCardState extends State } var velocity = (details.velocity.pixelsPerSecond.dx / size.width).abs(); - _animate(velocity: velocity); + await _animate(velocity: velocity); } void _updateAnimation(double dragPosition) { @@ -185,12 +185,12 @@ class _SwipeableCardState extends State )); } - void _animate({double velocity = 0}) { + Future _animate({double velocity = 0}) async { var description = const SpringDescription(mass: 50, stiffness: 1, damping: 1); var simulation = SpringSimulation(description, _controller.value, 1, velocity); - _controller.animateWith(simulation).then((_) { + await _controller.animateWith(simulation).then((_) { widget.onSwiped(); }); } diff --git a/animations/lib/src/misc/focus_image.dart b/animations/lib/src/misc/focus_image.dart index 665713a8260..f7e7954be4e 100644 --- a/animations/lib/src/misc/focus_image.dart +++ b/animations/lib/src/misc/focus_image.dart @@ -80,9 +80,9 @@ class SmallCard extends StatelessWidget { return Card( child: Material( child: InkWell( - onTap: () { + onTap: () async { var nav = Navigator.of(context); - nav.push(_createRoute(context, imageAssetName)); + await nav.push(_createRoute(context, imageAssetName)); }, child: Image.asset( imageAssetName, diff --git a/animations/lib/src/misc/hero_animation.dart b/animations/lib/src/misc/hero_animation.dart index dbceeed2f6f..91f7ba7dd55 100644 --- a/animations/lib/src/misc/hero_animation.dart +++ b/animations/lib/src/misc/hero_animation.dart @@ -22,7 +22,7 @@ class HeroAnimationDemo extends StatelessWidget { color: Colors.grey.shade300, ), ), - onTap: () => Navigator.of(context).push( + onTap: () async => Navigator.of(context).push( MaterialPageRoute(builder: (context) => const HeroPage())), ), ); diff --git a/animations/macos/Runner.xcodeproj/project.pbxproj b/animations/macos/Runner.xcodeproj/project.pbxproj index f21bfdb8e5b..3a8c74fc03c 100644 --- a/animations/macos/Runner.xcodeproj/project.pbxproj +++ b/animations/macos/Runner.xcodeproj/project.pbxproj @@ -26,6 +26,7 @@ 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; + BECCF239D437C2BC5FC480DB /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F0DCFA8F2A21622CDA5E182A /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -54,7 +55,7 @@ /* Begin PBXFileReference section */ 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; - 33CC10ED2044A3C60003C045 /* animations.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "animations.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10ED2044A3C60003C045 /* animations.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = animations.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; @@ -66,8 +67,12 @@ 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 5455AC36776414D817D4D3B6 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 764B8D6023C0837DE812AD4E /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + D60D5D2C11902B1A3103F875 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + F0DCFA8F2A21622CDA5E182A /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -75,6 +80,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + BECCF239D437C2BC5FC480DB /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -99,6 +105,7 @@ 33CEB47122A05771004F2AC0 /* Flutter */, 33CC10EE2044A3C60003C045 /* Products */, D73912EC22F37F3D000D13A0 /* Frameworks */, + 682783AE1C3FB3E0EF16B26F /* Pods */, ); sourceTree = ""; }; @@ -145,9 +152,21 @@ path = Runner; sourceTree = ""; }; + 682783AE1C3FB3E0EF16B26F /* Pods */ = { + isa = PBXGroup; + children = ( + 764B8D6023C0837DE812AD4E /* Pods-Runner.debug.xcconfig */, + D60D5D2C11902B1A3103F875 /* Pods-Runner.release.xcconfig */, + 5455AC36776414D817D4D3B6 /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; D73912EC22F37F3D000D13A0 /* Frameworks */ = { isa = PBXGroup; children = ( + F0DCFA8F2A21622CDA5E182A /* Pods_Runner.framework */, ); name = Frameworks; sourceTree = ""; @@ -159,11 +178,13 @@ isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + 692819BE3F3B4B28A40EFCD9 /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, + 651DB5A212423BAF7397F1C7 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -270,6 +291,45 @@ shellPath = /bin/sh; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; + 651DB5A212423BAF7397F1C7 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 692819BE3F3B4B28A40EFCD9 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/animations/macos/Runner.xcworkspace/contents.xcworkspacedata b/animations/macos/Runner.xcworkspace/contents.xcworkspacedata index 1d526a16ed0..21a3cc14c74 100644 --- a/animations/macos/Runner.xcworkspace/contents.xcworkspacedata +++ b/animations/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/desktop_photo_search/fluent_ui/lib/main.dart b/desktop_photo_search/fluent_ui/lib/main.dart index 7dcd10dbb83..d7dc6f42a15 100644 --- a/desktop_photo_search/fluent_ui/lib/main.dart +++ b/desktop_photo_search/fluent_ui/lib/main.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; import 'dart:io'; import 'package:fluent_ui/fluent_ui.dart'; @@ -74,38 +75,32 @@ class UnsplashHomePage extends StatelessWidget { @override Widget build(BuildContext context) { final photoSearchModel = Provider.of(context); - menubar.setApplicationMenu([ + unawaited(menubar.setApplicationMenu([ menubar.NativeSubmenu(label: 'Search', children: [ menubar.NativeMenuItem( label: 'Search…', - onSelected: () { - showDialog( - context: context, - builder: (context) => - PhotoSearchDialog(callback: photoSearchModel.addSearch), - ); - }, + onSelected: () async => showDialog( + context: context, + builder: (context) => + PhotoSearchDialog(callback: photoSearchModel.addSearch), + ), ), if (!Platform.isMacOS) menubar.NativeMenuItem( label: 'Quit', - onSelected: () { - SystemNavigator.pop(); - }, + onSelected: () async => SystemNavigator.pop(), ), ]), menubar.NativeSubmenu(label: 'About', children: [ menubar.NativeMenuItem( label: 'About', - onSelected: () { - showDialog( - context: context, - builder: (context) => const PolicyDialog(), - ); - }, + onSelected: () async => showDialog( + context: context, + builder: (context) => const PolicyDialog(), + ), ), ]) - ]); + ])); return UnsplashNotice( child: Container( diff --git a/desktop_photo_search/fluent_ui/lib/src/widgets/unsplash_notice.dart b/desktop_photo_search/fluent_ui/lib/src/widgets/unsplash_notice.dart index 67bb7e6414f..5acac9feba7 100644 --- a/desktop_photo_search/fluent_ui/lib/src/widgets/unsplash_notice.dart +++ b/desktop_photo_search/fluent_ui/lib/src/widgets/unsplash_notice.dart @@ -27,17 +27,18 @@ class _UnsplashNoticeState extends State { @override void initState() { super.initState(); - WidgetsBinding.instance.addPostFrameCallback((timeStamp) { - showDialog( - context: context, - builder: (context) { - return _UnsplashDialog(accepted: () { - setState(() { - noticeAccepted = true; - }); + WidgetsBinding.instance.addPostFrameCallback( + (timeStamp) async => showDialog( + context: context, + builder: (context) { + return _UnsplashDialog(accepted: () { + setState(() { + noticeAccepted = true; }); }); - }); + }, + ), + ); } @override diff --git a/desktop_photo_search/fluent_ui/tool/grind.dart b/desktop_photo_search/fluent_ui/tool/grind.dart index 1f6bb89db1c..869cf0bf349 100644 --- a/desktop_photo_search/fluent_ui/tool/grind.dart +++ b/desktop_photo_search/fluent_ui/tool/grind.dart @@ -9,7 +9,7 @@ import 'dart:io'; import 'package:async/async.dart' show StreamGroup; import 'package:grinder/grinder.dart'; -void main(List args) => grind(args); +void main(List args) async => grind(args); @DefaultTask() @Depends(pubGet, generateJsonBindings, analyzeSource, test) diff --git a/desktop_photo_search/material/lib/main.dart b/desktop_photo_search/material/lib/main.dart index 0b4c3c00956..4d7243df102 100644 --- a/desktop_photo_search/material/lib/main.dart +++ b/desktop_photo_search/material/lib/main.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; import 'dart:io'; import 'package:flutter/foundation.dart'; @@ -77,38 +78,32 @@ class UnsplashHomePage extends StatelessWidget { @override Widget build(BuildContext context) { final photoSearchModel = Provider.of(context); - menubar.setApplicationMenu([ + unawaited(menubar.setApplicationMenu([ menubar.NativeSubmenu(label: 'Search', children: [ menubar.NativeMenuItem( label: 'Search…', - onSelected: () { - showDialog( - context: context, - builder: (context) => - PhotoSearchDialog(callback: photoSearchModel.addSearch), - ); - }, + onSelected: () async => showDialog( + context: context, + builder: (context) => + PhotoSearchDialog(callback: photoSearchModel.addSearch), + ), ), if (!Platform.isMacOS) menubar.NativeMenuItem( label: 'Quit', - onSelected: () { - SystemNavigator.pop(); - }, + onSelected: () async => SystemNavigator.pop(), ), ]), menubar.NativeSubmenu(label: 'About', children: [ menubar.NativeMenuItem( label: 'About', - onSelected: () { - showDialog( - context: context, - builder: (context) => const PolicyDialog(), - ); - }, + onSelected: () async => showDialog( + context: context, + builder: (context) => const PolicyDialog(), + ), ), ]) - ]); + ])); return UnsplashNotice( child: Scaffold( @@ -121,7 +116,7 @@ class UnsplashHomePage extends StatelessWidget { child: Text('Search for Photos using the Fab button'), ), floatingActionButton: FloatingActionButton( - onPressed: () => showDialog( + onPressed: () async => showDialog( context: context, builder: (context) => PhotoSearchDialog(callback: photoSearchModel.addSearch), diff --git a/desktop_photo_search/material/lib/src/widgets/unsplash_notice.dart b/desktop_photo_search/material/lib/src/widgets/unsplash_notice.dart index 9dda49289d8..e58b1292e27 100644 --- a/desktop_photo_search/material/lib/src/widgets/unsplash_notice.dart +++ b/desktop_photo_search/material/lib/src/widgets/unsplash_notice.dart @@ -27,18 +27,19 @@ class _UnsplashNoticeState extends State { @override void initState() { super.initState(); - WidgetsBinding.instance.addPostFrameCallback((timeStamp) { - showDialog( - barrierDismissible: false, - context: context, - builder: (context) { - return _UnsplashDialog(accepted: () { - setState(() { - noticeAccepted = true; - }); + WidgetsBinding.instance.addPostFrameCallback( + (timeStamp) async => showDialog( + barrierDismissible: false, + context: context, + builder: (context) { + return _UnsplashDialog(accepted: () { + setState(() { + noticeAccepted = true; }); }); - }); + }, + ), + ); } @override diff --git a/desktop_photo_search/material/tool/grind.dart b/desktop_photo_search/material/tool/grind.dart index 1f6bb89db1c..869cf0bf349 100644 --- a/desktop_photo_search/material/tool/grind.dart +++ b/desktop_photo_search/material/tool/grind.dart @@ -9,7 +9,7 @@ import 'dart:io'; import 'package:async/async.dart' show StreamGroup; import 'package:grinder/grinder.dart'; -void main(List args) => grind(args); +void main(List args) async => grind(args); @DefaultTask() @Depends(pubGet, generateJsonBindings, analyzeSource, test) diff --git a/flutter_maps_firestore/lib/main.dart b/flutter_maps_firestore/lib/main.dart index 821c4d2f0dc..18b0a18932b 100644 --- a/flutter_maps_firestore/lib/main.dart +++ b/flutter_maps_firestore/lib/main.dart @@ -185,7 +185,7 @@ class _StoreListTileState extends State { @override void initState() { super.initState(); - _retrievePlacesDetails(); + unawaited(_retrievePlacesDetails()); } @override diff --git a/form_app/lib/main.dart b/form_app/lib/main.dart index 423b894b5f3..98090d7053d 100644 --- a/form_app/lib/main.dart +++ b/form_app/lib/main.dart @@ -2,6 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:async'; import 'dart:io'; import 'package:flutter/foundation.dart'; @@ -29,13 +30,13 @@ void setupWindow() { setWindowTitle('Form Samples'); setWindowMinSize(const Size(windowWidth, windowHeight)); setWindowMaxSize(const Size(windowWidth, windowHeight)); - getCurrentScreen().then((screen) { + unawaited(getCurrentScreen().then((screen) { setWindowFrame(Rect.fromCenter( center: screen!.frame.center, width: windowWidth, height: windowHeight, )); - }); + })); } } diff --git a/form_app/lib/src/sign_in_http.dart b/form_app/lib/src/sign_in_http.dart index 4566e797811..d2415f78006 100644 --- a/form_app/lib/src/sign_in_http.dart +++ b/form_app/lib/src/sign_in_http.dart @@ -86,11 +86,12 @@ class _SignInHttpDemoState extends State { headers: {'content-type': 'application/json'}); if (result.statusCode == 200) { - _showDialog('Successfully signed in.'); + await _showDialog('Successfully signed in.'); } else if (result.statusCode == 401) { - _showDialog('Unable to sign in.'); + await _showDialog('Unable to sign in.'); } else { - _showDialog('Something went wrong. Please try again.'); + await _showDialog( + 'Something went wrong. Please try again.'); } }, ), @@ -110,18 +111,16 @@ class _SignInHttpDemoState extends State { ); } - void _showDialog(String message) { - showDialog( - context: context, - builder: (context) => AlertDialog( - title: Text(message), - actions: [ - TextButton( - child: const Text('OK'), - onPressed: () => Navigator.of(context).pop(), - ), - ], - ), - ); - } + Future _showDialog(String message) async => showDialog( + context: context, + builder: (context) => AlertDialog( + title: Text(message), + actions: [ + TextButton( + child: const Text('OK'), + onPressed: () => Navigator.of(context).pop(), + ), + ], + ), + ); } diff --git a/form_app/lib/src/validation.dart b/form_app/lib/src/validation.dart index 5b3a1d35eaa..3761bb943b5 100644 --- a/form_app/lib/src/validation.dart +++ b/form_app/lib/src/validation.dart @@ -29,7 +29,7 @@ class _FormValidationDemoState extends State { child: TextButton( style: TextButton.styleFrom(foregroundColor: Colors.white), child: const Text('Submit'), - onPressed: () { + onPressed: () async { // Validate the form by getting the FormState from the GlobalKey // and calling validate() on it. var valid = _formKey.currentState!.validate(); @@ -37,7 +37,7 @@ class _FormValidationDemoState extends State { return; } - showDialog( + await showDialog( context: context, builder: (context) => AlertDialog( title: const Text('Your story'), diff --git a/game_template/analysis_options.yaml b/game_template/analysis_options.yaml index 379ca229416..12b7a31d27d 100644 --- a/game_template/analysis_options.yaml +++ b/game_template/analysis_options.yaml @@ -1,4 +1,4 @@ -include: ../analysis_options.yaml +include: package:flutter_lints/flutter.yaml linter: rules: diff --git a/game_template/macos/Flutter/GeneratedPluginRegistrant.swift b/game_template/macos/Flutter/GeneratedPluginRegistrant.swift index 273d30bc913..029ad363fdc 100644 --- a/game_template/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/game_template/macos/Flutter/GeneratedPluginRegistrant.swift @@ -9,14 +9,16 @@ import audioplayers_darwin import firebase_core import firebase_crashlytics import games_services +import in_app_purchase_storekit import path_provider_macos -import shared_preferences_macos +import shared_preferences_foundation func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { AudioplayersDarwinPlugin.register(with: registry.registrar(forPlugin: "AudioplayersDarwinPlugin")) FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) FLTFirebaseCrashlyticsPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCrashlyticsPlugin")) GamesServicesPlugin.register(with: registry.registrar(forPlugin: "GamesServicesPlugin")) + InAppPurchasePlugin.register(with: registry.registrar(forPlugin: "InAppPurchasePlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) } diff --git a/infinite_list/lib/main.dart b/infinite_list/lib/main.dart index 57fe7422681..cd6e6eef8ea 100644 --- a/infinite_list/lib/main.dart +++ b/infinite_list/lib/main.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; import 'dart:io'; import 'package:flutter/foundation.dart'; @@ -26,13 +27,13 @@ void setupWindow() { setWindowTitle('Infinite List'); setWindowMinSize(const Size(windowWidth, windowHeight)); setWindowMaxSize(const Size(windowWidth, windowHeight)); - getCurrentScreen().then((screen) { + unawaited(getCurrentScreen().then((screen) { setWindowFrame(Rect.fromCenter( center: screen!.frame.center, width: windowWidth, height: windowHeight, )); - }); + })); } } diff --git a/infinite_list/lib/src/catalog.dart b/infinite_list/lib/src/catalog.dart index ce80c89dc86..994c4065919 100644 --- a/infinite_list/lib/src/catalog.dart +++ b/infinite_list/lib/src/catalog.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; + import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -67,7 +69,7 @@ class Catalog extends ChangeNotifier { } // We don't have the data yet. Start fetching it. - _fetchPage(startingIndex); + unawaited(_fetchPage(startingIndex)); // In the meantime, return a placeholder. return Item.loading(); diff --git a/ios_app_clip/lib/main.dart b/ios_app_clip/lib/main.dart index 07c3a283108..14efd3d5820 100644 --- a/ios_app_clip/lib/main.dart +++ b/ios_app_clip/lib/main.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; import 'package:device_info/device_info.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -24,12 +25,12 @@ class _DemoState extends State { @override void initState() { - DeviceInfoPlugin().iosInfo.then((info) { + unawaited(DeviceInfoPlugin().iosInfo.then((info) { setState(() { deviceInfo = '${info.name} on ${info.systemName} version ' '${info.systemVersion}'; }); - }); + })); super.initState(); } diff --git a/isolate_example/analysis_options.yaml b/isolate_example/analysis_options.yaml index 5e2133eb696..f874eee43c2 100644 --- a/isolate_example/analysis_options.yaml +++ b/isolate_example/analysis_options.yaml @@ -1 +1,5 @@ include: ../analysis_options.yaml + +linter: + rules: + discarded_futures: false \ No newline at end of file diff --git a/material_3_demo/lib/component_screen.dart b/material_3_demo/lib/component_screen.dart index 32ef5b5c5e4..44d90c7edc6 100644 --- a/material_3_demo/lib/component_screen.dart +++ b/material_3_demo/lib/component_screen.dart @@ -347,8 +347,8 @@ class Dialogs extends StatefulWidget { } class _DialogsState extends State { - void openDialog(BuildContext context) { - showDialog( + Future openDialog(BuildContext context) async { + await showDialog( context: context, builder: (context) => AlertDialog( title: const Text("Basic Dialog Title"), @@ -377,7 +377,7 @@ class _DialogsState extends State { "Open Dialog", style: TextStyle(fontWeight: FontWeight.bold), ), - onPressed: () => openDialog(context), + onPressed: () async => openDialog(context), ), ); } diff --git a/navigation_and_routing/lib/main.dart b/navigation_and_routing/lib/main.dart index 4925b1fec30..32c5be82b53 100644 --- a/navigation_and_routing/lib/main.dart +++ b/navigation_and_routing/lib/main.dart @@ -2,6 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:async'; import 'dart:io'; import 'package:flutter/foundation.dart'; @@ -36,12 +37,12 @@ void setupWindow() { setWindowTitle('Navigation and routing'); setWindowMinSize(const Size(windowWidth, windowHeight)); setWindowMaxSize(const Size(windowWidth, windowHeight)); - getCurrentScreen().then((screen) { + unawaited(getCurrentScreen().then((screen) { setWindowFrame(Rect.fromCenter( center: screen!.frame.center, width: windowWidth, height: windowHeight, )); - }); + })); } } diff --git a/navigation_and_routing/lib/src/app.dart b/navigation_and_routing/lib/src/app.dart index 04ec7645410..3a3593dd7ff 100644 --- a/navigation_and_routing/lib/src/app.dart +++ b/navigation_and_routing/lib/src/app.dart @@ -96,9 +96,9 @@ class _BookstoreState extends State { return from; } - void _handleAuthStateChanged() { + Future _handleAuthStateChanged() async { if (!_auth.signedIn) { - _routeState.go('/signin'); + await _routeState.go('/signin'); } } diff --git a/navigation_and_routing/lib/src/screens/author_details.dart b/navigation_and_routing/lib/src/screens/author_details.dart index d45f861b5ce..f5d70396828 100644 --- a/navigation_and_routing/lib/src/screens/author_details.dart +++ b/navigation_and_routing/lib/src/screens/author_details.dart @@ -27,9 +27,8 @@ class AuthorDetailsScreen extends StatelessWidget { Expanded( child: BookList( books: author.books, - onTap: (book) { - RouteStateScope.of(context).go('/book/${book.id}'); - }, + onTap: (book) async => + RouteStateScope.of(context).go('/book/${book.id}'), ), ), ], diff --git a/navigation_and_routing/lib/src/screens/authors.dart b/navigation_and_routing/lib/src/screens/authors.dart index 8965f91d9ed..06d04677b10 100644 --- a/navigation_and_routing/lib/src/screens/authors.dart +++ b/navigation_and_routing/lib/src/screens/authors.dart @@ -20,9 +20,8 @@ class AuthorsScreen extends StatelessWidget { ), body: AuthorList( authors: libraryInstance.allAuthors, - onTap: (author) { - RouteStateScope.of(context).go('/author/${author.id}'); - }, + onTap: (author) async => + RouteStateScope.of(context).go('/author/${author.id}'), ), ); } diff --git a/navigation_and_routing/lib/src/screens/book_details.dart b/navigation_and_routing/lib/src/screens/book_details.dart index 72a9346860f..0a7eb55477e 100644 --- a/navigation_and_routing/lib/src/screens/book_details.dart +++ b/navigation_and_routing/lib/src/screens/book_details.dart @@ -42,14 +42,12 @@ class BookDetailsScreen extends StatelessWidget { ), TextButton( child: const Text('View author (Push)'), - onPressed: () { - Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => - AuthorDetailsScreen(author: book!.author), - ), - ); - }, + onPressed: () async => Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => + AuthorDetailsScreen(author: book!.author), + ), + ), ), Link( uri: Uri.parse('/author/${book!.author.id}'), diff --git a/navigation_and_routing/lib/src/screens/books.dart b/navigation_and_routing/lib/src/screens/books.dart index 4fc6509f0ab..26f3fa17f32 100644 --- a/navigation_and_routing/lib/src/screens/books.dart +++ b/navigation_and_routing/lib/src/screens/books.dart @@ -91,21 +91,20 @@ class _BooksScreenState extends State RouteState get _routeState => RouteStateScope.of(context); - void _handleBookTapped(Book book) { - _routeState.go('/book/${book.id}'); - } + Future _handleBookTapped(Book book) async => + _routeState.go('/book/${book.id}'); - void _handleTabIndexChanged() { + Future _handleTabIndexChanged() async { switch (_tabController.index) { case 1: - _routeState.go('/books/new'); + await _routeState.go('/books/new'); break; case 2: - _routeState.go('/books/all'); + await _routeState.go('/books/all'); break; case 0: default: - _routeState.go('/books/popular'); + await _routeState.go('/books/popular'); break; } } diff --git a/navigation_and_routing/lib/src/screens/navigator.dart b/navigation_and_routing/lib/src/screens/navigator.dart index 0f62f503ebc..7dcc97ff8ac 100644 --- a/navigation_and_routing/lib/src/screens/navigator.dart +++ b/navigation_and_routing/lib/src/screens/navigator.dart @@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:async'; + import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; @@ -59,12 +61,12 @@ class _BookstoreNavigatorState extends State { // the /books or /authors tab in BookstoreScaffold. if (route.settings is Page && (route.settings as Page).key == _bookDetailsKey) { - routeState.go('/books/popular'); + unawaited(routeState.go('/books/popular')); } if (route.settings is Page && (route.settings as Page).key == _authorDetailsKey) { - routeState.go('/authors'); + unawaited(routeState.go('/authors')); } return route.didPop(result); diff --git a/navigation_and_routing/lib/src/screens/scaffold.dart b/navigation_and_routing/lib/src/screens/scaffold.dart index 49491919284..ba596014a26 100644 --- a/navigation_and_routing/lib/src/screens/scaffold.dart +++ b/navigation_and_routing/lib/src/screens/scaffold.dart @@ -22,10 +22,10 @@ class BookstoreScaffold extends StatelessWidget { body: AdaptiveNavigationScaffold( selectedIndex: selectedIndex, body: const BookstoreScaffoldBody(), - onDestinationSelected: (idx) { - if (idx == 0) routeState.go('/books/popular'); - if (idx == 1) routeState.go('/authors'); - if (idx == 2) routeState.go('/settings'); + onDestinationSelected: (idx) async { + if (idx == 0) await routeState.go('/books/popular'); + if (idx == 1) await routeState.go('/authors'); + if (idx == 2) await routeState.go('/settings'); }, destinations: const [ AdaptiveScaffoldDestination( diff --git a/navigation_and_routing/lib/src/screens/settings.dart b/navigation_and_routing/lib/src/screens/settings.dart index d25ec1ba21a..782760e7d87 100644 --- a/navigation_and_routing/lib/src/screens/settings.dart +++ b/navigation_and_routing/lib/src/screens/settings.dart @@ -51,9 +51,7 @@ class SettingsContent extends StatelessWidget { style: Theme.of(context).textTheme.headlineMedium, ), ElevatedButton( - onPressed: () { - BookstoreAuthScope.of(context).signOut(); - }, + onPressed: () async => BookstoreAuthScope.of(context).signOut(), child: const Text('Sign out'), ), Link( @@ -65,13 +63,11 @@ class SettingsContent extends StatelessWidget { ), TextButton( child: const Text('Go directly to /book/0 (RouteState)'), - onPressed: () { - RouteStateScope.of(context).go('/book/0'); - }, + onPressed: () async => RouteStateScope.of(context).go('/book/0'), ), ].map((w) => Padding(padding: const EdgeInsets.all(8), child: w)), TextButton( - onPressed: () => showDialog( + onPressed: () async => showDialog( context: context, builder: (context) => AlertDialog( title: const Text('Alert!'), diff --git a/navigation_and_routing/macos/Runner.xcodeproj/project.pbxproj b/navigation_and_routing/macos/Runner.xcodeproj/project.pbxproj index b2a4ce02ebc..58dc39434ea 100644 --- a/navigation_and_routing/macos/Runner.xcodeproj/project.pbxproj +++ b/navigation_and_routing/macos/Runner.xcodeproj/project.pbxproj @@ -26,6 +26,7 @@ 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; + E245D6A2CE27ABE903C253CE /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 811979194043656666206B1A /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -54,7 +55,7 @@ /* Begin PBXFileReference section */ 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; - 33CC10ED2044A3C60003C045 /* navigation_and_routing.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "navigation_and_routing.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10ED2044A3C60003C045 /* navigation_and_routing.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = navigation_and_routing.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; @@ -66,8 +67,12 @@ 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 733F93396DD6C31E32BA4E84 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 811979194043656666206B1A /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 87F630B6098B9462A21FEB6F /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + 9B3A4654CD16AA8D6074B14A /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -75,6 +80,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + E245D6A2CE27ABE903C253CE /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -99,6 +105,7 @@ 33CEB47122A05771004F2AC0 /* Flutter */, 33CC10EE2044A3C60003C045 /* Products */, D73912EC22F37F3D000D13A0 /* Frameworks */, + A6698C07FAD558E178114BF1 /* Pods */, ); sourceTree = ""; }; @@ -145,9 +152,21 @@ path = Runner; sourceTree = ""; }; + A6698C07FAD558E178114BF1 /* Pods */ = { + isa = PBXGroup; + children = ( + 9B3A4654CD16AA8D6074B14A /* Pods-Runner.debug.xcconfig */, + 733F93396DD6C31E32BA4E84 /* Pods-Runner.release.xcconfig */, + 87F630B6098B9462A21FEB6F /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; D73912EC22F37F3D000D13A0 /* Frameworks */ = { isa = PBXGroup; children = ( + 811979194043656666206B1A /* Pods_Runner.framework */, ); name = Frameworks; sourceTree = ""; @@ -159,11 +178,13 @@ isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + 6E431F7A1002C4CA68A8A13F /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, + 0741AA068917F994A5660E1C /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -233,6 +254,23 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 0741AA068917F994A5660E1C /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; 3399D490228B24CF009A79C7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -270,6 +308,28 @@ shellPath = /bin/sh; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; + 6E431F7A1002C4CA68A8A13F /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/navigation_and_routing/macos/Runner.xcworkspace/contents.xcworkspacedata b/navigation_and_routing/macos/Runner.xcworkspace/contents.xcworkspacedata index 1d526a16ed0..21a3cc14c74 100644 --- a/navigation_and_routing/macos/Runner.xcworkspace/contents.xcworkspacedata +++ b/navigation_and_routing/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/place_tracker/.metadata b/place_tracker/.metadata index af040ba02a1..bbe1ce24766 100644 --- a/place_tracker/.metadata +++ b/place_tracker/.metadata @@ -4,7 +4,7 @@ # This file should be version controlled. version: - revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + revision: 135454af32477f815a7525073027a3ff9eff1bfd channel: stable project_type: app @@ -13,17 +13,17 @@ project_type: app migration: platforms: - platform: root - create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 - base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + create_revision: 135454af32477f815a7525073027a3ff9eff1bfd + base_revision: 135454af32477f815a7525073027a3ff9eff1bfd - platform: android - create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 - base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + create_revision: 135454af32477f815a7525073027a3ff9eff1bfd + base_revision: 135454af32477f815a7525073027a3ff9eff1bfd - platform: ios - create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 - base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + create_revision: 135454af32477f815a7525073027a3ff9eff1bfd + base_revision: 135454af32477f815a7525073027a3ff9eff1bfd - platform: web - create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 - base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 + create_revision: 135454af32477f815a7525073027a3ff9eff1bfd + base_revision: 135454af32477f815a7525073027a3ff9eff1bfd # User provided section diff --git a/place_tracker/ios/Runner.xcodeproj/project.pbxproj b/place_tracker/ios/Runner.xcodeproj/project.pbxproj index d83354220df..5d2b1c8e937 100644 --- a/place_tracker/ios/Runner.xcodeproj/project.pbxproj +++ b/place_tracker/ios/Runner.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + E4D89E70C4043F10E7BA05D9 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A0ED54EDE91D7D7B993EFDCE /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -32,6 +33,7 @@ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 570600BABB78D30E8CB0CBF9 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; @@ -42,6 +44,9 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + A0ED54EDE91D7D7B993EFDCE /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D2ED8AC94FEF4836E93F969F /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + DF890EB8A3E74EEA5523F06C /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -49,12 +54,24 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + E4D89E70C4043F10E7BA05D9 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 713BC1252D4279ECDFA0C8DA /* Pods */ = { + isa = PBXGroup; + children = ( + 570600BABB78D30E8CB0CBF9 /* Pods-Runner.debug.xcconfig */, + D2ED8AC94FEF4836E93F969F /* Pods-Runner.release.xcconfig */, + DF890EB8A3E74EEA5523F06C /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -72,6 +89,8 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, + 713BC1252D4279ECDFA0C8DA /* Pods */, + D1390C33BF6B3833089809E8 /* Frameworks */, ); sourceTree = ""; }; @@ -98,6 +117,14 @@ path = Runner; sourceTree = ""; }; + D1390C33BF6B3833089809E8 /* Frameworks */ = { + isa = PBXGroup; + children = ( + A0ED54EDE91D7D7B993EFDCE /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -105,12 +132,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + 0FB6D23EE5655622C95E1788 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 9F18E4ADA0365821571D4D02 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -169,6 +198,28 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 0FB6D23EE5655622C95E1788 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -197,6 +248,23 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + 9F18E4ADA0365821571D4D02 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/place_tracker/lib/place_map.dart b/place_tracker/lib/place_map.dart index 2ec80b9dfd3..cc08b3489a6 100644 --- a/place_tracker/lib/place_map.dart +++ b/place_tracker/lib/place_map.dart @@ -92,7 +92,6 @@ class _PlaceMapState extends State { @override Widget build(BuildContext context) { - _watchMapConfigurationChanges(); var state = Provider.of(context); return Builder(builder: (context) { // We need this additional builder here so that we can pass its context to @@ -119,7 +118,7 @@ class _PlaceMapState extends State { ), _AddPlaceButtonBar( visible: _pendingMarker != null, - onSavePressed: () => _confirmAddPlace(context), + onSavePressed: () async => _confirmAddPlace(context), onCancelPressed: _cancelAddPlace, ), _MapFabs( @@ -148,7 +147,7 @@ class _PlaceMapState extends State { }); // Zoom to fit the initially selected category. - _zoomToFitSelectedCategory(); + await _zoomToFitSelectedCategory(); } @override @@ -156,19 +155,17 @@ class _PlaceMapState extends State { super.didUpdateWidget(oldWidget); // Zoom to fit the selected category. if (mounted) { - _zoomToFitSelectedCategory(); + unawaited(_zoomToFitSelectedCategory()); } } /// Applies zoom to fit the places of the selected category - void _zoomToFitSelectedCategory() { - _zoomToFitPlaces( - _getPlacesForCategory( - Provider.of(context, listen: false).selectedCategory, - _markedPlaces.values.toList(), - ), - ); - } + Future _zoomToFitSelectedCategory() async => _zoomToFitPlaces( + _getPlacesForCategory( + Provider.of(context, listen: false).selectedCategory, + _markedPlaces.values.toList(), + ), + ); void _cancelAddPlace() { if (_pendingMarker != null) { diff --git a/place_tracker/pubspec.yaml b/place_tracker/pubspec.yaml index 7ef8e273451..f2b3fb0ef5e 100644 --- a/place_tracker/pubspec.yaml +++ b/place_tracker/pubspec.yaml @@ -11,11 +11,11 @@ dependencies: sdk: flutter cupertino_icons: ^1.0.0 - google_maps_flutter: ^2.0.6 - google_maps_flutter_web: ">=0.3.0+1 <0.5.0" + google_maps_flutter: ^2.2.3 + google_maps_flutter_web: ^0.4.0+4 provider: ^6.0.2 uuid: ^3.0.4 - go_router: ">=5.2.4 <7.0.0" + go_router: ^6.0.1 collection: ^1.16.0 dev_dependencies: diff --git a/place_tracker/web/index.html b/place_tracker/web/index.html index b2dc04a9208..4419308f1df 100644 --- a/place_tracker/web/index.html +++ b/place_tracker/web/index.html @@ -32,6 +32,9 @@ place_tracker + + + - - - - - - - diff --git a/platform_design/web/manifest.json b/platform_design/web/manifest.json deleted file mode 100644 index 08f599d82e4..00000000000 --- a/platform_design/web/manifest.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "platform_design", - "short_name": "platform_design", - "start_url": ".", - "display": "standalone", - "background_color": "#0175C2", - "theme_color": "#0175C2", - "description": "A project showcasing a Flutter app following different platform IA conventions.", - "orientation": "portrait-primary", - "prefer_related_applications": false, - "icons": [ - { - "src": "icons/Icon-192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "icons/Icon-512.png", - "sizes": "512x512", - "type": "image/png" - }, - { - "src": "icons/Icon-maskable-192.png", - "sizes": "192x192", - "type": "image/png", - "purpose": "maskable" - }, - { - "src": "icons/Icon-maskable-512.png", - "sizes": "512x512", - "type": "image/png", - "purpose": "maskable" - } - ] -} diff --git a/provider_counter/lib/main.dart b/provider_counter/lib/main.dart index 77d3414be78..69ca52740ad 100644 --- a/provider_counter/lib/main.dart +++ b/provider_counter/lib/main.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; import 'dart:io'; import 'package:flutter/foundation.dart'; @@ -37,13 +38,13 @@ void setupWindow() { setWindowTitle('Provider Counter'); setWindowMinSize(const Size(windowWidth, windowHeight)); setWindowMaxSize(const Size(windowWidth, windowHeight)); - getCurrentScreen().then((screen) { + unawaited(getCurrentScreen().then((screen) { setWindowFrame(Rect.fromCenter( center: screen!.frame.center, width: windowWidth, height: windowHeight, )); - }); + })); } } diff --git a/provider_shopper/lib/main.dart b/provider_shopper/lib/main.dart index 8992e78ac98..121db47ad8c 100644 --- a/provider_shopper/lib/main.dart +++ b/provider_shopper/lib/main.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; import 'dart:io'; import 'package:flutter/foundation.dart'; @@ -30,13 +31,13 @@ void setupWindow() { setWindowTitle('Provider Demo'); setWindowMinSize(const Size(windowWidth, windowHeight)); setWindowMaxSize(const Size(windowWidth, windowHeight)); - getCurrentScreen().then((screen) { + unawaited(getCurrentScreen().then((screen) { setWindowFrame(Rect.fromCenter( center: screen!.frame.center, width: windowWidth, height: windowHeight, )); - }); + })); } } diff --git a/simplistic_editor/analysis_options.yaml b/simplistic_editor/analysis_options.yaml index 5e2133eb696..2abfa301916 100644 --- a/simplistic_editor/analysis_options.yaml +++ b/simplistic_editor/analysis_options.yaml @@ -1 +1,5 @@ include: ../analysis_options.yaml + +linter: + rules: + discarded_futures: false diff --git a/veggieseasons/lib/data/preferences.dart b/veggieseasons/lib/data/preferences.dart index 67a6dd3fd99..cd9c3c7a7a5 100644 --- a/veggieseasons/lib/data/preferences.dart +++ b/veggieseasons/lib/data/preferences.dart @@ -53,10 +53,10 @@ class Preferences extends ChangeNotifier { Future restoreDefaults() async { final prefs = await SharedPreferences.getInstance(); await prefs.clear(); - load(); + await load(); } - void load() { + Future load() async { _loading = _loadFromSharedPrefs(); } diff --git a/veggieseasons/lib/main.dart b/veggieseasons/lib/main.dart index a54f282d5a1..6f88a050a7a 100644 --- a/veggieseasons/lib/main.dart +++ b/veggieseasons/lib/main.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; import 'dart:io'; import 'package:flutter/cupertino.dart'; @@ -16,10 +17,10 @@ import 'package:window_size/window_size.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); - SystemChrome.setPreferredOrientations([ + unawaited(SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, DeviceOrientation.portraitDown, - ]); + ])); setupWindow(); runApp( @@ -38,13 +39,13 @@ void setupWindow() { setWindowTitle('Veggie Seasons'); setWindowMinSize(const Size(windowWidth, windowHeight)); setWindowMaxSize(const Size(windowWidth, windowHeight)); - getCurrentScreen().then((screen) { + unawaited(getCurrentScreen().then((screen) { setWindowFrame(Rect.fromCenter( center: screen!.frame.center, width: windowWidth, height: windowHeight, )); - }); + })); } } @@ -80,6 +81,7 @@ class _VeggieAppState extends State with RestorationMixin { value: _appState.value, ), ChangeNotifierProvider( + // ignore: discarded_futures create: (_) => Preferences()..load(), ), ], diff --git a/veggieseasons/lib/screens/settings.dart b/veggieseasons/lib/screens/settings.dart index 53d3ccb38d4..e9a01d7ed39 100644 --- a/veggieseasons/lib/screens/settings.dart +++ b/veggieseasons/lib/screens/settings.dart @@ -54,11 +54,11 @@ class VeggieCategorySettingsScreen extends StatelessWidget { if (snapshot.hasData) { toggle = CupertinoSwitch( value: snapshot.data!.contains(category), - onChanged: (value) { + onChanged: (value) async { if (value) { - model.addPreferredCategory(category); + await model.addPreferredCategory(category); } else { - model.removePreferredCategory(category); + await model.removePreferredCategory(category); } }, ); @@ -143,7 +143,7 @@ class CalorieSettingsScreen extends StatelessWidget { backgroundColor: Styles.transparentColor, ), onPress: snapshot.hasData - ? () => model.setDesiredCalories(cals) + ? () async => model.setDesiredCalories(cals) : null, ), ); @@ -227,33 +227,31 @@ class _SettingsScreenState extends State { icon: Styles.resetIcon, ), content: const SettingsNavigationIndicator(), - onPress: () { - showCupertinoDialog( - context: context, - builder: (context) => CupertinoAlertDialog( - title: const Text('Are you sure?'), - content: const Text( - 'Are you sure you want to reset the current settings?', - ), - actions: [ - CupertinoDialogAction( - isDestructiveAction: true, - child: const Text('Yes'), - onPressed: () async { - await prefs.restoreDefaults(); - if (!mounted) return; - Navigator.pop(context); - }, - ), - CupertinoDialogAction( - isDefaultAction: true, - child: const Text('No'), - onPressed: () => Navigator.pop(context), - ) - ], + onPress: () async => showCupertinoDialog( + context: context, + builder: (context) => CupertinoAlertDialog( + title: const Text('Are you sure?'), + content: const Text( + 'Are you sure you want to reset the current settings?', ), - ); - }, + actions: [ + CupertinoDialogAction( + isDestructiveAction: true, + child: const Text('Yes'), + onPressed: () async { + await prefs.restoreDefaults(); + if (!mounted) return; + Navigator.pop(context); + }, + ), + CupertinoDialogAction( + isDefaultAction: true, + child: const Text('No'), + onPressed: () => Navigator.pop(context), + ) + ], + ), + ), ); } diff --git a/veggieseasons/macos/Flutter/GeneratedPluginRegistrant.swift b/veggieseasons/macos/Flutter/GeneratedPluginRegistrant.swift index 6c0c3d4781b..f7175089273 100644 --- a/veggieseasons/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/veggieseasons/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,7 +5,7 @@ import FlutterMacOS import Foundation -import shared_preferences_macos +import shared_preferences_foundation import window_size func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { From 21822cdac4ae72ac137f5bc5bdc4052729650c21 Mon Sep 17 00:00:00 2001 From: Brett Morgan Date: Thu, 19 Jan 2023 01:23:39 +1000 Subject: [PATCH 3/8] `dart fix --apply` --- .../context_menus/analysis_options.yaml | 30 +------------------ .../context_menus/lib/anywhere_page.dart | 8 ++--- .../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 +- 24 files changed, 98 insertions(+), 134 deletions(-) diff --git a/experimental/context_menus/analysis_options.yaml b/experimental/context_menus/analysis_options.yaml index 61b6c4de17c..fac60e247cb 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 \ No newline at end of file diff --git a/experimental/context_menus/lib/anywhere_page.dart b/experimental/context_menus/lib/anywhere_page.dart index 62ca338d288..adaad0dcff3 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,8 +50,8 @@ class AnywherePage extends StatelessWidget { ], ), body: ContextMenuRegion( - contextMenuBuilder: (BuildContext context, Offset primaryAnchor, - [Offset? secondaryAnchor]) { + contextMenuBuilder: (context, primaryAnchor, + [secondaryAnchor]) { return AdaptiveTextSelectionToolbar.buttonItems( anchors: TextSelectionToolbarAnchors( primaryAnchor: primaryAnchor, diff --git a/experimental/context_menus/lib/cascading_menu_page.dart b/experimental/context_menus/lib/cascading_menu_page.dart index 5acc0bb39ee..500a08a1b1a 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 077b73b00db..e9f7e44526f 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 e1d1ea54755..7e1cc19ac29 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 ab87c87c094..67af7d90313 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 c761c6bb0be..60218fc4793 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 606ff53c0ff..7bc6e007d58 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 dffc842c2a1..51609eddc79 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 a302f8d2425..b09a7303376 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 a8dd9ff9a51..1cc9932d1ca 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 0991602b200..535884b01dc 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 a0d0f8b33b7..f5ea3b427ee 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 3bf4ce3c24e..ad486c5ca8b 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 cbb5ed1c147..2364dd22596 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 cb50f63d819..d8ab8962cdf 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 3ec39e127d3..a3eba5ddf88 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 38dd8857bd1..07266b1a6df 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 4fca5ce422b..77dc1646ef5 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 9b3c6f2a616..87dcc81afae 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 2ca1cd04453..c67c8617186 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 1982da6a452..4ddbe8c6ad3 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 cee4d34a6f8..c786518f040 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 e92b2880439..3f5f9caa397 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, From e20afbbacd0fc9ba2e52bb46099267580ac0035e Mon Sep 17 00:00:00 2001 From: Brett Morgan Date: Thu, 19 Jan 2023 01:28:05 +1000 Subject: [PATCH 4/8] `dart format` --- experimental/context_menus/lib/anywhere_page.dart | 3 +-- experimental/context_menus/lib/cascading_menu_page.dart | 3 +-- experimental/context_menus/lib/custom_buttons_page.dart | 7 +++---- experimental/context_menus/lib/default_values_page.dart | 3 +-- experimental/context_menus/lib/email_button_page.dart | 3 +-- experimental/context_menus/lib/field_types_page.dart | 9 +++------ experimental/context_menus/lib/full_page.dart | 6 ++---- .../context_menus/lib/global_selection_page.dart | 3 +-- experimental/context_menus/lib/main.dart | 3 +-- experimental/context_menus/lib/modified_action_page.dart | 3 +-- .../context_menus/lib/reordered_buttons_page.dart | 3 +-- .../context_menus/test/cascading_menu_page_test.dart | 3 +-- 12 files changed, 17 insertions(+), 32 deletions(-) diff --git a/experimental/context_menus/lib/anywhere_page.dart b/experimental/context_menus/lib/anywhere_page.dart index adaad0dcff3..f6da5e7f7ef 100644 --- a/experimental/context_menus/lib/anywhere_page.dart +++ b/experimental/context_menus/lib/anywhere_page.dart @@ -50,8 +50,7 @@ class AnywherePage extends StatelessWidget { ], ), body: ContextMenuRegion( - contextMenuBuilder: (context, primaryAnchor, - [secondaryAnchor]) { + contextMenuBuilder: (context, primaryAnchor, [secondaryAnchor]) { return AdaptiveTextSelectionToolbar.buttonItems( anchors: TextSelectionToolbarAnchors( primaryAnchor: primaryAnchor, diff --git a/experimental/context_menus/lib/cascading_menu_page.dart b/experimental/context_menus/lib/cascading_menu_page.dart index 500a08a1b1a..d02d1233f09 100644 --- a/experimental/context_menus/lib/cascading_menu_page.dart +++ b/experimental/context_menus/lib/cascading_menu_page.dart @@ -80,8 +80,7 @@ class _MyContextMenuRegionState extends State<_MyContextMenuRegion> { @override Widget build(BuildContext context) { return ContextMenuRegion( - contextMenuBuilder: (context, primaryAnchor, - [secondaryAnchor]) { + contextMenuBuilder: (context, primaryAnchor, [secondaryAnchor]) { return _MyCascadingContextMenu( anchor: primaryAnchor, showingMessage: _showMessage, diff --git a/experimental/context_menus/lib/custom_buttons_page.dart b/experimental/context_menus/lib/custom_buttons_page.dart index 7e1cc19ac29..957d78024a5 100644 --- a/experimental/context_menus/lib/custom_buttons_page.dart +++ b/experimental/context_menus/lib/custom_buttons_page.dart @@ -51,15 +51,14 @@ class CustomButtonsPage extends StatelessWidget { controller: _controller, maxLines: 4, minLines: 2, - contextMenuBuilder: - (context, editableTextState) { + contextMenuBuilder: (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((buttonItem) { + children: + editableTextState.contextMenuButtonItems.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 67af7d90313..27a8640ffc5 100644 --- a/experimental/context_menus/lib/default_values_page.dart +++ b/experimental/context_menus/lib/default_values_page.dart @@ -84,8 +84,7 @@ class DefaultValuesPage extends StatelessWidget { maxLines: 2, minLines: 2, controller: _controllerCustom, - contextMenuBuilder: (context, - 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 60218fc4793..8c927acb29a 100644 --- a/experimental/context_menus/lib/email_button_page.dart +++ b/experimental/context_menus/lib/email_button_page.dart @@ -63,8 +63,7 @@ class EmailButtonPage extends StatelessWidget { TextField( maxLines: 2, controller: _controller, - contextMenuBuilder: (context, - 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 7bc6e007d58..5184e0bb797 100644 --- a/experimental/context_menus/lib/field_types_page.dart +++ b/experimental/context_menus/lib/field_types_page.dart @@ -82,8 +82,7 @@ class FieldTypesPage extends StatelessWidget { CupertinoTextField( maxLines: 3, controller: _cupertinoControllerFixed, - contextMenuBuilder: (context, - editableTextState) { + contextMenuBuilder: (context, editableTextState) { return AdaptiveTextSelectionToolbar.editableText( editableTextState: editableTextState, ); @@ -93,8 +92,7 @@ class FieldTypesPage extends StatelessWidget { CupertinoTextField( maxLines: 3, controller: _cupertinoControllerForced, - contextMenuBuilder: (context, - editableTextState) { + contextMenuBuilder: (context, editableTextState) { return DesktopTextSelectionToolbar( anchor: editableTextState.contextMenuAnchors.primaryAnchor, children: AdaptiveTextSelectionToolbar.getAdaptiveButtons( @@ -118,8 +116,7 @@ class FieldTypesPage extends StatelessWidget { // EditableText has no built-in gesture detection for // selection. A wrapper would have to implement // TextSelectionGestureDetectorBuilderDelegate, etc. - contextMenuBuilder: (context, - 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 51609eddc79..6d4bb0115db 100644 --- a/experimental/context_menus/lib/full_page.dart +++ b/experimental/context_menus/lib/full_page.dart @@ -107,8 +107,7 @@ class FullPage extends StatelessWidget { Container(height: 20.0), TextField( controller: _controller, - contextMenuBuilder: (context, - editableTextState) { + contextMenuBuilder: (context, editableTextState) { final TextEditingValue value = editableTextState.textEditingValue; final List buttonItems = @@ -130,8 +129,7 @@ class FullPage extends StatelessWidget { // Build the default buttons, but make them look crazy. // Note that in a real project you may want to build // different buttons depending on the platform. - children: - buttonItems.map((buttonItem) { + children: 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 b09a7303376..3123f7056a6 100644 --- a/experimental/context_menus/lib/global_selection_page.dart +++ b/experimental/context_menus/lib/global_selection_page.dart @@ -24,8 +24,7 @@ class GlobalSelectionPage extends StatelessWidget { @override Widget build(BuildContext context) { return SelectionArea( - contextMenuBuilder: - (context, selectableRegionState) { + contextMenuBuilder: (context, selectableRegionState) { return AdaptiveTextSelectionToolbar.buttonItems( anchors: selectableRegionState.contextMenuAnchors, buttonItems: [ diff --git a/experimental/context_menus/lib/main.dart b/experimental/context_menus/lib/main.dart index 535884b01dc..b5c1a046e39 100644 --- a/experimental/context_menus/lib/main.dart +++ b/experimental/context_menus/lib/main.dart @@ -45,8 +45,7 @@ class _MyAppState extends State { ), initialRoute: '/', routes: { - '/': (context) => - MyHomePage(onChangedPlatform: onChangedPlatform), + '/': (context) => MyHomePage(onChangedPlatform: onChangedPlatform), AnywherePage.route: (context) => AnywherePage(onChangedPlatform: onChangedPlatform), CustomButtonsPage.route: (context) => diff --git a/experimental/context_menus/lib/modified_action_page.dart b/experimental/context_menus/lib/modified_action_page.dart index f5ea3b427ee..fd6e90cf4ba 100644 --- a/experimental/context_menus/lib/modified_action_page.dart +++ b/experimental/context_menus/lib/modified_action_page.dart @@ -63,8 +63,7 @@ class ModifiedActionPage extends StatelessWidget { ), TextField( controller: _controller, - contextMenuBuilder: (context, - editableTextState) { + contextMenuBuilder: (context, editableTextState) { final List buttonItems = editableTextState.contextMenuButtonItems; // Modify the copy buttonItem to show a dialog after copying. diff --git a/experimental/context_menus/lib/reordered_buttons_page.dart b/experimental/context_menus/lib/reordered_buttons_page.dart index 2364dd22596..cb528835da9 100644 --- a/experimental/context_menus/lib/reordered_buttons_page.dart +++ b/experimental/context_menus/lib/reordered_buttons_page.dart @@ -60,8 +60,7 @@ class ReorderedButtonsPage extends StatelessWidget { TextField( controller: _controllerReordered, maxLines: 2, - contextMenuBuilder: (context, - editableTextState) { + contextMenuBuilder: (context, editableTextState) { // Reorder the button datas by type. final HashMap buttonItemsMap = diff --git a/experimental/context_menus/test/cascading_menu_page_test.dart b/experimental/context_menus/test/cascading_menu_page_test.dart index a3eba5ddf88..931fe1858a0 100644 --- a/experimental/context_menus/test/cascading_menu_page_test.dart +++ b/experimental/context_menus/test/cascading_menu_page_test.dart @@ -6,8 +6,7 @@ import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('Can show and use the cascading menu', - (tester) async { + testWidgets('Can show and use the cascading menu', (tester) async { await tester.pumpWidget(const MyApp()); // Navigate to the CascadingMenuPage example. From d9bafc357280d7c7467c33d6edbafbbe5d804cf9 Mon Sep 17 00:00:00 2001 From: Brett Morgan Date: Thu, 19 Jan 2023 01:30:21 +1000 Subject: [PATCH 5/8] `discarded_futures` fixes --- experimental/context_menus/lib/anywhere_page.dart | 2 +- experimental/context_menus/lib/default_values_page.dart | 4 ++-- experimental/context_menus/lib/email_button_page.dart | 5 +++-- experimental/context_menus/lib/full_page.dart | 8 ++++---- experimental/context_menus/lib/image_page.dart | 4 ++-- experimental/context_menus/lib/main.dart | 4 ++-- experimental/context_menus/lib/modified_action_page.dart | 4 ++-- 7 files changed, 16 insertions(+), 15 deletions(-) diff --git a/experimental/context_menus/lib/anywhere_page.dart b/experimental/context_menus/lib/anywhere_page.dart index f6da5e7f7ef..13a1006e7ae 100644 --- a/experimental/context_menus/lib/anywhere_page.dart +++ b/experimental/context_menus/lib/anywhere_page.dart @@ -54,7 +54,7 @@ class AnywherePage extends StatelessWidget { return AdaptiveTextSelectionToolbar.buttonItems( anchors: TextSelectionToolbarAnchors( primaryAnchor: primaryAnchor, - secondaryAnchor: secondaryAnchor, + secondaryAnchor: secondaryAnchor as Offset?, ), buttonItems: [ ContextMenuButtonItem( diff --git a/experimental/context_menus/lib/default_values_page.dart b/experimental/context_menus/lib/default_values_page.dart index 27a8640ffc5..251fda71696 100644 --- a/experimental/context_menus/lib/default_values_page.dart +++ b/experimental/context_menus/lib/default_values_page.dart @@ -90,9 +90,9 @@ class DefaultValuesPage extends StatelessWidget { buttonItems: [ ContextMenuButtonItem( label: 'Custom button', - onPressed: () { + onPressed: () async { ContextMenuController.removeAny(); - Navigator.of(context).push(_showDialog( + await Navigator.of(context).push(_showDialog( context, 'You clicked the custom button.')); }, ), diff --git a/experimental/context_menus/lib/email_button_page.dart b/experimental/context_menus/lib/email_button_page.dart index 8c927acb29a..adeb910f871 100644 --- a/experimental/context_menus/lib/email_button_page.dart +++ b/experimental/context_menus/lib/email_button_page.dart @@ -73,9 +73,10 @@ class EmailButtonPage extends StatelessWidget { 0, ContextMenuButtonItem( label: 'Send email', - onPressed: () { + onPressed: () async { ContextMenuController.removeAny(); - Navigator.of(context).push(_showDialog(context)); + await Navigator.of(context) + .push(_showDialog(context)); }, )); } diff --git a/experimental/context_menus/lib/full_page.dart b/experimental/context_menus/lib/full_page.dart index 6d4bb0115db..1695f2d806d 100644 --- a/experimental/context_menus/lib/full_page.dart +++ b/experimental/context_menus/lib/full_page.dart @@ -88,9 +88,9 @@ class FullPage extends StatelessWidget { ), buttonItems: [ ContextMenuButtonItem( - onPressed: () { + onPressed: () async { ContextMenuController.removeAny(); - Navigator.of(context).push(_showDialog( + await Navigator.of(context).push(_showDialog( context, 'Image saved! (not really though)')); }, label: 'Save', @@ -117,9 +117,9 @@ class FullPage extends StatelessWidget { 0, ContextMenuButtonItem( label: 'Send email', - onPressed: () { + onPressed: () async { ContextMenuController.removeAny(); - Navigator.of(context).push(_showDialog( + await Navigator.of(context).push(_showDialog( context, 'You clicked send email')); }, )); diff --git a/experimental/context_menus/lib/image_page.dart b/experimental/context_menus/lib/image_page.dart index 1cc9932d1ca..c72e78391fa 100644 --- a/experimental/context_menus/lib/image_page.dart +++ b/experimental/context_menus/lib/image_page.dart @@ -57,9 +57,9 @@ class ImagePage extends StatelessWidget { ), buttonItems: [ ContextMenuButtonItem( - onPressed: () { + onPressed: () async { ContextMenuController.removeAny(); - Navigator.of(context).push(_showDialog(context)); + await Navigator.of(context).push(_showDialog(context)); }, label: 'Save', ), diff --git a/experimental/context_menus/lib/main.dart b/experimental/context_menus/lib/main.dart index b5c1a046e39..53af1595284 100644 --- a/experimental/context_menus/lib/main.dart +++ b/experimental/context_menus/lib/main.dart @@ -169,8 +169,8 @@ class _MyListItem extends StatelessWidget { @override Widget build(BuildContext context) { return GestureDetector( - onTap: () { - Navigator.of(context).pushNamed(route); + onTap: () async { + await Navigator.of(context).pushNamed(route); }, child: Card( margin: const EdgeInsets.all(12.0), diff --git a/experimental/context_menus/lib/modified_action_page.dart b/experimental/context_menus/lib/modified_action_page.dart index fd6e90cf4ba..1bc8ba53fa3 100644 --- a/experimental/context_menus/lib/modified_action_page.dart +++ b/experimental/context_menus/lib/modified_action_page.dart @@ -76,9 +76,9 @@ class ModifiedActionPage extends StatelessWidget { final ContextMenuButtonItem copyButtonItem = buttonItems[copyButtonIndex]; buttonItems[copyButtonIndex] = copyButtonItem.copyWith( - onPressed: () { + onPressed: () async { copyButtonItem.onPressed(); - Navigator.of(context).push(_showDialog(context)); + await Navigator.of(context).push(_showDialog(context)); }, ); } From 435560f88f25f4b6524d445a4a83ab5cc1f511d7 Mon Sep 17 00:00:00 2001 From: Brett Morgan Date: Thu, 19 Jan 2023 01:53:17 +1000 Subject: [PATCH 6/8] fixes --- .../lib/model/profiles_store.dart | 3 +- .../linting_tool/lib/model/rules_store.dart | 3 +- .../lib/pages/default_lints_page.dart | 6 +- .../linting_tool/lib/pages/home_page.dart | 2 +- .../linting_tool/lib/pages/rules_page.dart | 21 ++-- .../lib/pages/saved_lints_page.dart | 40 +++---- .../linting_tool/lib/theme/app_theme.dart | 5 +- .../lib/widgets/lint_expansion_tile.dart | 1 + .../linting_tool/test/widget_test.mocks.dart | 4 +- .../material_3_demo/lib/component_screen.dart | 104 +++++++++--------- .../lib/components/fragment_shaded.dart | 3 +- .../lib/components/rotator_puzzle.dart | 9 +- .../lib/page_content/pages_flow.dart | 6 +- .../web_dashboard/lib/src/pages/entries.dart | 14 +-- .../web_dashboard/lib/src/pages/home.dart | 10 +- .../web_dashboard/lib/src/pages/sign_in.dart | 2 +- .../lib/src/widgets/category_chart.dart | 14 +-- .../lib/src/widgets/category_forms.dart | 5 +- .../lib/src/widgets/dialogs.dart | 30 +++-- .../lib/src/widgets/edit_entry.dart | 5 +- experimental/web_dashboard/tool/grind.dart | 6 +- 21 files changed, 148 insertions(+), 145 deletions(-) diff --git a/experimental/linting_tool/lib/model/profiles_store.dart b/experimental/linting_tool/lib/model/profiles_store.dart index 67aa04adb52..4743712514f 100644 --- a/experimental/linting_tool/lib/model/profiles_store.dart +++ b/experimental/linting_tool/lib/model/profiles_store.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; import 'dart:convert'; import 'dart:developer'; import 'dart:io'; @@ -23,7 +24,7 @@ class ProfilesStore extends ChangeNotifier { final Repository repository; ProfilesStore(http.Client httpClient) : repository = Repository(httpClient) { - fetchSavedProfiles(); + unawaited(fetchSavedProfiles()); } bool _isLoading = true; diff --git a/experimental/linting_tool/lib/model/rules_store.dart b/experimental/linting_tool/lib/model/rules_store.dart index 66ef06f4934..a643e35bb59 100644 --- a/experimental/linting_tool/lib/model/rules_store.dart +++ b/experimental/linting_tool/lib/model/rules_store.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; import 'dart:developer'; import 'dart:io'; @@ -16,7 +17,7 @@ class RuleStore extends ChangeNotifier { final Repository repository; RuleStore(http.Client httpClient) : repository = Repository(httpClient) { - fetchRules(); + unawaited(fetchRules()); } bool _isLoading = true; diff --git a/experimental/linting_tool/lib/pages/default_lints_page.dart b/experimental/linting_tool/lib/pages/default_lints_page.dart index 3c356c9cb9e..5ff69b84363 100644 --- a/experimental/linting_tool/lib/pages/default_lints_page.dart +++ b/experimental/linting_tool/lib/pages/default_lints_page.dart @@ -51,8 +51,8 @@ class DefaultLintsPage extends StatelessWidget { profile.name, ), tileColor: AppColors.white50, - onTap: () { - Navigator.push( + onTap: () async { + await Navigator.push( context, MaterialPageRoute( builder: (context) => DefaultRulesPage(profile: profile), @@ -73,7 +73,7 @@ class DefaultLintsPage extends StatelessWidget { height: 16.0, ), IconButton( - onPressed: () => rulesStore.fetchRules(), + onPressed: () async => rulesStore.fetchRules(), icon: const Icon(Icons.refresh), ), ], diff --git a/experimental/linting_tool/lib/pages/home_page.dart b/experimental/linting_tool/lib/pages/home_page.dart index 2dc63a96f87..271843ef3ef 100644 --- a/experimental/linting_tool/lib/pages/home_page.dart +++ b/experimental/linting_tool/lib/pages/home_page.dart @@ -59,7 +59,7 @@ class HomePage extends StatelessWidget { height: 16.0, ), IconButton( - onPressed: () => rulesStore.fetchRules(), + onPressed: () async => rulesStore.fetchRules(), icon: const Icon(Icons.refresh), ), ], diff --git a/experimental/linting_tool/lib/pages/rules_page.dart b/experimental/linting_tool/lib/pages/rules_page.dart index 77ca1ab1da7..8b73bbb32ad 100644 --- a/experimental/linting_tool/lib/pages/rules_page.dart +++ b/experimental/linting_tool/lib/pages/rules_page.dart @@ -91,12 +91,10 @@ class RulesPage extends StatelessWidget { buttonConfigs: [ ContextMenuButtonConfig( 'Remove rule from profile', - onPressed: () { - context - .read() - .removeRuleFromProfile( - profile, profile.rules[index]); - }, + onPressed: () async => context + .read() + .removeRuleFromProfile( + profile, profile.rules[index]), ), ], ), @@ -130,13 +128,10 @@ class RulesPage extends StatelessWidget { .selectedRules.isNotEmpty) IconButton( icon: const Icon(Icons.delete), - onPressed: () { - editingController - .deleteSelected( - profile, - profilesStore, - ); - }, + onPressed: () async => + editingController + .deleteSelected(profile, + profilesStore), ), ], ) diff --git a/experimental/linting_tool/lib/pages/saved_lints_page.dart b/experimental/linting_tool/lib/pages/saved_lints_page.dart index 45940a43237..8acd3ef238a 100644 --- a/experimental/linting_tool/lib/pages/saved_lints_page.dart +++ b/experimental/linting_tool/lib/pages/saved_lints_page.dart @@ -57,35 +57,31 @@ class _SavedLintsPageState extends State { profile.name, ), tileColor: AppColors.white50, - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ChangeNotifierProvider( - create: (context) => EditingController(), - child: RulesPage(selectedProfileIndex: index), - ), + onTap: () async => Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChangeNotifierProvider( + create: (context) => EditingController(), + child: RulesPage(selectedProfileIndex: index), ), - ); - }, + ), + ), trailing: Row( mainAxisSize: MainAxisSize.min, children: [ IconButton( icon: const Icon(Icons.edit), - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ChangeNotifierProvider( - create: (context) => EditingController( - isEditing: true, - ), - child: RulesPage(selectedProfileIndex: index), + onPressed: () async => Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChangeNotifierProvider( + create: (context) => EditingController( + isEditing: true, ), + child: RulesPage(selectedProfileIndex: index), ), - ); - }, + ), + ), ), const SizedBox( width: 8.0, @@ -147,7 +143,7 @@ class _SavedLintsPageState extends State { height: 16.0, ), IconButton( - onPressed: () => profilesStore.fetchSavedProfiles(), + onPressed: () async => profilesStore.fetchSavedProfiles(), icon: const Icon(Icons.refresh), ), ], diff --git a/experimental/linting_tool/lib/theme/app_theme.dart b/experimental/linting_tool/lib/theme/app_theme.dart index 30ecb77b1b8..8fd8e704d24 100644 --- a/experimental/linting_tool/lib/theme/app_theme.dart +++ b/experimental/linting_tool/lib/theme/app_theme.dart @@ -11,7 +11,6 @@ abstract class AppTheme { static ThemeData buildReplyLightTheme(BuildContext context) { final base = ThemeData.light(); return base.copyWith( - bottomAppBarColor: AppColors.blue700, bottomSheetTheme: BottomSheetThemeData( backgroundColor: AppColors.blue700, modalBackgroundColor: Colors.white.withOpacity(0.7), @@ -45,13 +44,13 @@ abstract class AppTheme { ), textTheme: _buildReplyLightTextTheme(base.textTheme), scaffoldBackgroundColor: AppColors.blue50, + bottomAppBarTheme: const BottomAppBarTheme(color: AppColors.blue700), ); } static ThemeData buildReplyDarkTheme(BuildContext context) { final base = ThemeData.dark(); return base.copyWith( - bottomAppBarColor: AppColors.darkBottomAppBarBackground, bottomSheetTheme: BottomSheetThemeData( backgroundColor: AppColors.darkDrawerBackground, modalBackgroundColor: Colors.black.withOpacity(0.7), @@ -94,6 +93,8 @@ abstract class AppTheme { ), textTheme: _buildReplyDarkTextTheme(base.textTheme), scaffoldBackgroundColor: AppColors.black900, + bottomAppBarTheme: + const BottomAppBarTheme(color: AppColors.darkBottomAppBarBackground), ); } diff --git a/experimental/linting_tool/lib/widgets/lint_expansion_tile.dart b/experimental/linting_tool/lib/widgets/lint_expansion_tile.dart index 94836f3fbb1..001156d56e4 100644 --- a/experimental/linting_tool/lib/widgets/lint_expansion_tile.dart +++ b/experimental/linting_tool/lib/widgets/lint_expansion_tile.dart @@ -140,6 +140,7 @@ class _LintExpansionTileState extends State { return const _ProfileTypeDialog(); }, ); + if (!mounted) return; if (destinationProfileType == ProfileType.newProfile) { await showDialog( context: context, diff --git a/experimental/linting_tool/test/widget_test.mocks.dart b/experimental/linting_tool/test/widget_test.mocks.dart index 5f976d67826..4e4b435c948 100644 --- a/experimental/linting_tool/test/widget_test.mocks.dart +++ b/experimental/linting_tool/test/widget_test.mocks.dart @@ -24,8 +24,8 @@ import 'package:mockito/mockito.dart' as _i1; class _FakeResponse_0 extends _i1.Fake implements _i2.Response {} -class _FakeStreamedResponse_1 extends _i1.Fake implements _i3.StreamedResponse { -} +class _FakeStreamedResponse_1 extends _i1.Fake + implements _i3.StreamedResponse {} /// A class which mocks [Client]. /// diff --git a/experimental/material_3_demo/lib/component_screen.dart b/experimental/material_3_demo/lib/component_screen.dart index 8cb0b713ccc..77b95029d2c 100644 --- a/experimental/material_3_demo/lib/component_screen.dart +++ b/experimental/material_3_demo/lib/component_screen.dart @@ -593,26 +593,24 @@ class Dialogs extends StatefulWidget { } class _DialogsState extends State { - void openDialog(BuildContext context) { - showDialog( - context: context, - builder: (context) => AlertDialog( - title: const Text('Basic Dialog Title'), - content: const Text( - 'A dialog is a type of modal window that appears in front of app content to provide critical information, or prompt for a decision to be made.'), - actions: [ - TextButton( - child: const Text('Dismiss'), - onPressed: () => Navigator.of(context).pop(), - ), - TextButton( - child: const Text('Action'), - onPressed: () => Navigator.of(context).pop(), - ), - ], - ), - ); - } + Future openDialog(BuildContext context) async => showDialog( + context: context, + builder: (context) => AlertDialog( + title: const Text('Basic Dialog Title'), + content: const Text( + 'A dialog is a type of modal window that appears in front of app content to provide critical information, or prompt for a decision to be made.'), + actions: [ + TextButton( + child: const Text('Dismiss'), + onPressed: () => Navigator.of(context).pop(), + ), + TextButton( + child: const Text('Action'), + onPressed: () => Navigator.of(context).pop(), + ), + ], + ), + ); @override Widget build(BuildContext context) { @@ -626,7 +624,7 @@ class _DialogsState extends State { 'Open Dialog', style: TextStyle(fontWeight: FontWeight.bold), ), - onPressed: () => openDialog(context), + onPressed: () async => openDialog(context), ), ), ), @@ -1492,40 +1490,38 @@ class BottomSheetSection extends StatelessWidget { 'Show Modal bottom sheet', style: TextStyle(fontWeight: FontWeight.bold), ), - onPressed: () { - showModalBottomSheet( - context: context, - builder: (context) { - return SizedBox( - height: 250, - child: Column( - children: [ - Expanded( - flex: 3, - child: ListView( - scrollDirection: Axis.horizontal, - children: buttonList, - ), - ), - const Divider( - indent: 20, - endIndent: 20, - thickness: 2, + onPressed: () async => showModalBottomSheet( + context: context, + builder: (context) { + return SizedBox( + height: 250, + child: Column( + children: [ + Expanded( + flex: 3, + child: ListView( + scrollDirection: Axis.horizontal, + children: buttonList, ), - Expanded( - flex: 2, - child: Center( - child: FilledButton.tonal( - child: const Text('Close BottomSheet'), - onPressed: () => Navigator.pop(context), - ), - )) - ], - ), - ); - }, - ); - }, + ), + const Divider( + indent: 20, + endIndent: 20, + thickness: 2, + ), + Expanded( + flex: 2, + child: Center( + child: FilledButton.tonal( + child: const Text('Close BottomSheet'), + onPressed: () => Navigator.pop(context), + ), + )) + ], + ), + ); + }, + ), ), ); } diff --git a/experimental/varfont_shader_puzzle/lib/components/fragment_shaded.dart b/experimental/varfont_shader_puzzle/lib/components/fragment_shaded.dart index 7f19f60fc44..18d6eb043d3 100644 --- a/experimental/varfont_shader_puzzle/lib/components/fragment_shaded.dart +++ b/experimental/varfont_shader_puzzle/lib/components/fragment_shaded.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; import 'dart:ui' as ui; import 'package:flutter/material.dart'; @@ -59,7 +60,7 @@ class FragmentShadedState extends State ); _dampenAnimation = Tween(begin: 1.0, end: 0.0).animate(_dampenCurve); - initializeFragmentProgramsAndBuilder(); + unawaited(initializeFragmentProgramsAndBuilder()); } Future initializeFragmentProgramsAndBuilder() async { diff --git a/experimental/varfont_shader_puzzle/lib/components/rotator_puzzle.dart b/experimental/varfont_shader_puzzle/lib/components/rotator_puzzle.dart index 0a8fc0e4bed..d26e5bb3df7 100644 --- a/experimental/varfont_shader_puzzle/lib/components/rotator_puzzle.dart +++ b/experimental/varfont_shader_puzzle/lib/components/rotator_puzzle.dart @@ -129,14 +129,13 @@ class RotatorPuzzleState extends State } if (status == AnimationStatus.completed) { Future.delayed( - const Duration(milliseconds: FragmentShaded.dampenDuration + 250), - () { - widget.pageConfig.pageController.nextPage( + const Duration(milliseconds: FragmentShaded.dampenDuration + 250), + () async => widget.pageConfig.pageController.nextPage( duration: const Duration(milliseconds: PagesFlow.pageScrollDuration), curve: Curves.easeOut, - ); - }); + ), + ); } }); animationController.forward(); diff --git a/experimental/varfont_shader_puzzle/lib/page_content/pages_flow.dart b/experimental/varfont_shader_puzzle/lib/page_content/pages_flow.dart index 101fb21a89c..51694c98848 100644 --- a/experimental/varfont_shader_puzzle/lib/page_content/pages_flow.dart +++ b/experimental/varfont_shader_puzzle/lib/page_content/pages_flow.dart @@ -1,6 +1,8 @@ // Copyright 2023 The Flutter team. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. + +import 'dart:async'; import 'dart:math'; import 'package:flutter/material.dart'; @@ -152,11 +154,11 @@ class NarrativePageState extends State Future.delayed(const Duration(milliseconds: 50), () { setState(() { if (panelIndex == panels.length - 1) { - widget.pageConfig.pageController.nextPage( + unawaited(widget.pageConfig.pageController.nextPage( duration: const Duration(milliseconds: PagesFlow.pageScrollDuration), curve: Curves.easeOut, - ); + )); } else { panelIndex++; } diff --git a/experimental/web_dashboard/lib/src/pages/entries.dart b/experimental/web_dashboard/lib/src/pages/entries.dart index a22ae60809c..16554073a36 100644 --- a/experimental/web_dashboard/lib/src/pages/entries.dart +++ b/experimental/web_dashboard/lib/src/pages/entries.dart @@ -115,14 +115,12 @@ class EntryTile extends StatelessWidget { children: [ TextButton( child: const Text('Edit'), - onPressed: () { - showDialog( - context: context, - builder: (context) { - return EditEntryDialog(category: category, entry: entry); - }, - ); - }, + onPressed: () async => showDialog( + context: context, + builder: (context) { + return EditEntryDialog(category: category, entry: entry); + }, + ), ), TextButton( child: const Text('Delete'), diff --git a/experimental/web_dashboard/lib/src/pages/home.dart b/experimental/web_dashboard/lib/src/pages/home.dart index a64902df749..102b89925bc 100644 --- a/experimental/web_dashboard/lib/src/pages/home.dart +++ b/experimental/web_dashboard/lib/src/pages/home.dart @@ -35,7 +35,7 @@ class _HomePageState extends State { padding: const EdgeInsets.all(8.0), child: TextButton( style: TextButton.styleFrom(foregroundColor: Colors.white), - onPressed: () => _handleSignOut(), + onPressed: () async => _handleSignOut(), child: const Text('Sign Out'), ), ) @@ -71,18 +71,18 @@ class _HomePageState extends State { void _handleFabPressed() { if (_pageIndex == 0) { - showDialog( + unawaited(showDialog( context: context, builder: (context) => const NewCategoryDialog(), - ); + )); return; } if (_pageIndex == 1) { - showDialog( + unawaited(showDialog( context: context, builder: (context) => const NewEntryDialog(), - ); + )); return; } } diff --git a/experimental/web_dashboard/lib/src/pages/sign_in.dart b/experimental/web_dashboard/lib/src/pages/sign_in.dart index 51749c22e0a..b7aabbf45ae 100644 --- a/experimental/web_dashboard/lib/src/pages/sign_in.dart +++ b/experimental/web_dashboard/lib/src/pages/sign_in.dart @@ -90,7 +90,7 @@ class _SignInButtonState extends State { return ElevatedButton( child: const Text('Sign In with Google'), - onPressed: () => _signIn(), + onPressed: () async => _signIn(), ); }, ); diff --git a/experimental/web_dashboard/lib/src/widgets/category_chart.dart b/experimental/web_dashboard/lib/src/widgets/category_chart.dart index 2c39639bee5..520f1730601 100644 --- a/experimental/web_dashboard/lib/src/widgets/category_chart.dart +++ b/experimental/web_dashboard/lib/src/widgets/category_chart.dart @@ -35,14 +35,12 @@ class CategoryChart extends StatelessWidget { Text(category.name), IconButton( icon: const Icon(Icons.settings), - onPressed: () { - showDialog( - context: context, - builder: (context) { - return EditCategoryDialog(category: category); - }, - ); - }, + onPressed: () async => showDialog( + context: context, + builder: (context) { + return EditCategoryDialog(category: category); + }, + ), ), ], ), diff --git a/experimental/web_dashboard/lib/src/widgets/category_forms.dart b/experimental/web_dashboard/lib/src/widgets/category_forms.dart index c53e643ba74..33b95e1f342 100644 --- a/experimental/web_dashboard/lib/src/widgets/category_forms.dart +++ b/experimental/web_dashboard/lib/src/widgets/category_forms.dart @@ -22,10 +22,11 @@ class _NewCategoryFormState extends State { var api = Provider.of(context).api; return EditCategoryForm( category: _category, - onDone: (shouldInsert) { + onDone: (shouldInsert) async { if (shouldInsert) { - api!.categories.insert(_category); + await api!.categories.insert(_category); } + if (!mounted) return; Navigator.of(context).pop(); }, ); diff --git a/experimental/web_dashboard/lib/src/widgets/dialogs.dart b/experimental/web_dashboard/lib/src/widgets/dialogs.dart index 63faeca5132..e9eeee6cc79 100644 --- a/experimental/web_dashboard/lib/src/widgets/dialogs.dart +++ b/experimental/web_dashboard/lib/src/widgets/dialogs.dart @@ -24,7 +24,7 @@ class NewCategoryDialog extends StatelessWidget { } } -class EditCategoryDialog extends StatelessWidget { +class EditCategoryDialog extends StatefulWidget { final Category category; const EditCategoryDialog({ @@ -32,6 +32,11 @@ class EditCategoryDialog extends StatelessWidget { super.key, }); + @override + State createState() => _EditCategoryDialogState(); +} + +class _EditCategoryDialogState extends State { @override Widget build(BuildContext context) { var api = Provider.of(context).api; @@ -40,11 +45,13 @@ class EditCategoryDialog extends StatelessWidget { title: const Text('Edit Category'), children: [ EditCategoryForm( - category: category, - onDone: (shouldUpdate) { + category: widget.category, + onDone: (shouldUpdate) async { if (shouldUpdate) { - api!.categories.update(category, category.id!); + await api!.categories + .update(widget.category, widget.category.id!); } + if (!mounted) return; Navigator.of(context).pop(); }, ), @@ -72,7 +79,7 @@ class _NewEntryDialogState extends State { } } -class EditEntryDialog extends StatelessWidget { +class EditEntryDialog extends StatefulWidget { final Category? category; final Entry? entry; @@ -82,6 +89,11 @@ class EditEntryDialog extends StatelessWidget { super.key, }); + @override + State createState() => _EditEntryDialogState(); +} + +class _EditEntryDialogState extends State { @override Widget build(BuildContext context) { var api = Provider.of(context).api; @@ -90,11 +102,13 @@ class EditEntryDialog extends StatelessWidget { title: const Text('Edit Entry'), children: [ EditEntryForm( - entry: entry, - onDone: (shouldUpdate) { + entry: widget.entry, + onDone: (shouldUpdate) async { if (shouldUpdate) { - api!.entries.update(category!.id!, entry!.id!, entry!); + await api!.entries.update( + widget.category!.id!, widget.entry!.id!, widget.entry!); } + if (!mounted) return; Navigator.of(context).pop(); }, ) diff --git a/experimental/web_dashboard/lib/src/widgets/edit_entry.dart b/experimental/web_dashboard/lib/src/widgets/edit_entry.dart index 5c45c725196..11c17f7b246 100644 --- a/experimental/web_dashboard/lib/src/widgets/edit_entry.dart +++ b/experimental/web_dashboard/lib/src/widgets/edit_entry.dart @@ -42,10 +42,11 @@ class _NewEntryFormState extends State { ), EditEntryForm( entry: _entry, - onDone: (shouldInsert) { + onDone: (shouldInsert) async { if (shouldInsert) { - api.entries.insert(_selected.id!, _entry); + await api.entries.insert(_selected.id!, _entry); } + if (!mounted) return; Navigator.of(context).pop(); }, ), diff --git a/experimental/web_dashboard/tool/grind.dart b/experimental/web_dashboard/tool/grind.dart index ad0968277cd..4b18bb67d30 100644 --- a/experimental/web_dashboard/tool/grind.dart +++ b/experimental/web_dashboard/tool/grind.dart @@ -7,7 +7,7 @@ import 'dart:io'; import 'package:grinder/grinder.dart'; import 'package:path/path.dart' as path; -void main(List args) => grind(args); +void main(List args) async => grind(args); @Task() void runSkia() { @@ -39,9 +39,7 @@ void runFirebaseSkia() { } @Task() -void test() { - TestRunner().testAsync(); -} +Future test() async => TestRunner().testAsync(); @DefaultTask() @Depends(test, copyright) From cfd19fb74c20cc582fa3ac2c5ff96e630cd4a4e8 Mon Sep 17 00:00:00 2001 From: Brett Morgan Date: Thu, 19 Jan 2023 02:39:38 +1000 Subject: [PATCH 7/8] Update `analysis_options.yaml` --- experimental/context_menus/analysis_options.yaml | 2 +- experimental/web_dashboard/analysis_options.yaml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/experimental/context_menus/analysis_options.yaml b/experimental/context_menus/analysis_options.yaml index fac60e247cb..f04c6cf0f30 100644 --- a/experimental/context_menus/analysis_options.yaml +++ b/experimental/context_menus/analysis_options.yaml @@ -1 +1 @@ -include: ../../analysis_options.yaml \ No newline at end of file +include: ../../analysis_options.yaml diff --git a/experimental/web_dashboard/analysis_options.yaml b/experimental/web_dashboard/analysis_options.yaml index f04c6cf0f30..2062c08675b 100644 --- a/experimental/web_dashboard/analysis_options.yaml +++ b/experimental/web_dashboard/analysis_options.yaml @@ -1 +1,5 @@ include: ../../analysis_options.yaml + +linter: + rules: + discarded_futures: false From 299b9e043626521752bea624148fc567b7c0344c Mon Sep 17 00:00:00 2001 From: Brett Morgan Date: Thu, 19 Jan 2023 13:02:52 +1100 Subject: [PATCH 8/8] Add NL at EOF --- isolate_example/analysis_options.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/isolate_example/analysis_options.yaml b/isolate_example/analysis_options.yaml index f874eee43c2..2abfa301916 100644 --- a/isolate_example/analysis_options.yaml +++ b/isolate_example/analysis_options.yaml @@ -2,4 +2,4 @@ include: ../analysis_options.yaml linter: rules: - discarded_futures: false \ No newline at end of file + discarded_futures: false