From 42da8b016ca254c1a4fa01be2edbef2cadd71bd2 Mon Sep 17 00:00:00 2001 From: Dan Reynolds Date: Thu, 26 Jan 2023 07:02:51 -0500 Subject: [PATCH 01/29] resolve name conflict in Flutter 3.7 (#315) --- .../example/lib/modals/circular_modal.dart | 5 +- modal_bottom_sheet/example/pubspec.lock | 147 +++++++----- .../src/bottom_sheets/bar_bottom_sheet.dart | 5 +- .../bottom_sheets/material_bottom_sheet.dart | 8 +- .../src/material_with_modal_page_route.dart | 14 +- modal_bottom_sheet/pubspec.lock | 107 +++++---- sheet/example/pubspec.lock | 104 ++++---- sheet/pubspec.lock | 224 +++++++++++------- 8 files changed, 363 insertions(+), 251 deletions(-) diff --git a/modal_bottom_sheet/example/lib/modals/circular_modal.dart b/modal_bottom_sheet/example/lib/modals/circular_modal.dart index 6483d4e4..4a0821ac 100644 --- a/modal_bottom_sheet/example/lib/modals/circular_modal.dart +++ b/modal_bottom_sheet/example/lib/modals/circular_modal.dart @@ -2,7 +2,8 @@ import 'dart:math'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; +import 'package:modal_bottom_sheet/modal_bottom_sheet.dart' + as modal_bottom_sheet; class AvatarBottomSheet extends StatelessWidget { final Widget child; @@ -98,7 +99,7 @@ Future showAvatarModalBottomSheet({ assert(debugCheckHasMediaQuery(context)); assert(debugCheckHasMaterialLocalizations(context)); final result = await Navigator.of(context, rootNavigator: useRootNavigator) - .push(ModalBottomSheetRoute( + .push(modal_bottom_sheet.ModalBottomSheetRoute( builder: builder, containerBuilder: (_, animation, child) => AvatarBottomSheet( child: child, diff --git a/modal_bottom_sheet/example/pubspec.lock b/modal_bottom_sheet/example/pubspec.lock index 0de538b4..29c53f7d 100644 --- a/modal_bottom_sheet/example/pubspec.lock +++ b/modal_bottom_sheet/example/pubspec.lock @@ -5,58 +5,58 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + url: "https://pub.dev" source: hosted - version: "2.8.2" + version: "2.10.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + url: "https://pub.dev" source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.2.1" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.17.0" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be + url: "https://pub.dev" source: hosted version: "1.0.5" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -76,30 +76,34 @@ packages: dependency: transitive description: name: js - url: "https://pub.dartlang.org" + sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + url: "https://pub.dev" source: hosted - version: "0.6.4" + version: "0.6.5" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + url: "https://pub.dev" source: hosted - version: "0.12.11" + version: "0.12.13" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + url: "https://pub.dev" source: hosted - version: "0.1.4" + version: "0.2.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + url: "https://pub.dev" source: hosted - version: "1.7.0" + version: "1.8.0" modal_bottom_sheet: dependency: "direct main" description: @@ -111,16 +115,18 @@ packages: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + url: "https://pub.dev" source: hosted - version: "1.8.1" + version: "1.8.2" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - url: "https://pub.dartlang.org" + sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.3" sky_engine: dependency: transitive description: flutter @@ -130,107 +136,122 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.9.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + url: "https://pub.dev" source: hosted - version: "0.4.9" + version: "0.4.16" url_launcher: dependency: "direct main" description: name: url_launcher - url: "https://pub.dartlang.org" + sha256: "698fa0b4392effdc73e9e184403b627362eb5fbf904483ac9defbb1c2191d809" + url: "https://pub.dev" source: hosted - version: "6.1.5" + version: "6.1.8" url_launcher_android: dependency: transitive description: name: url_launcher_android - url: "https://pub.dartlang.org" + sha256: "3e2f6dfd2c7d9cd123296cab8ef66cfc2c1a13f5845f42c7a0f365690a8a7dd1" + url: "https://pub.dev" source: hosted - version: "6.0.17" + version: "6.0.23" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - url: "https://pub.dartlang.org" + sha256: bb328b24d3bccc20bdf1024a0990ac4f869d57663660de9c936fb8c043edefe3 + url: "https://pub.dev" source: hosted - version: "6.0.17" + version: "6.0.18" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - url: "https://pub.dartlang.org" + sha256: "318c42cba924e18180c029be69caf0a1a710191b9ec49bb42b5998fdcccee3cc" + url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - url: "https://pub.dartlang.org" + sha256: "41988b55570df53b3dd2a7fc90c76756a963de6a8c5f8e113330cb35992e2094" + url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface - url: "https://pub.dartlang.org" + sha256: "4eae912628763eb48fc214522e58e942fd16ce195407dbf45638239523c759a6" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" url_launcher_web: dependency: transitive description: name: url_launcher_web - url: "https://pub.dartlang.org" + sha256: "44d79408ce9f07052095ef1f9a693c258d6373dc3944249374e30eff7219ccb0" + url: "https://pub.dev" source: hosted - version: "2.0.13" + version: "2.0.14" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - url: "https://pub.dartlang.org" + sha256: "387e227c4b979034cc52afb11d66b04ed9b288ca1f45beeef39b2ea69e714fa5" + url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" sdks: - dart: ">=2.17.0 <3.0.0" + dart: ">=2.18.0 <4.0.0" flutter: ">=3.0.0" diff --git a/modal_bottom_sheet/lib/src/bottom_sheets/bar_bottom_sheet.dart b/modal_bottom_sheet/lib/src/bottom_sheets/bar_bottom_sheet.dart index da1d4530..6e43e0c8 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheets/bar_bottom_sheet.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheets/bar_bottom_sheet.dart @@ -3,8 +3,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import '../../modal_bottom_sheet.dart'; -import '../bottom_sheet_route.dart'; +import '../../modal_bottom_sheet.dart' as modal_bottom_sheet; const Radius kDefaultBarTopRadius = Radius.circular(15); @@ -99,7 +98,7 @@ Future showBarModalBottomSheet({ assert(debugCheckHasMediaQuery(context)); assert(debugCheckHasMaterialLocalizations(context)); final result = await Navigator.of(context, rootNavigator: useRootNavigator) - .push(ModalBottomSheetRoute( + .push(modal_bottom_sheet.ModalBottomSheetRoute( builder: builder, bounce: bounce, closeProgressThreshold: closeProgressThreshold, diff --git a/modal_bottom_sheet/lib/src/bottom_sheets/material_bottom_sheet.dart b/modal_bottom_sheet/lib/src/bottom_sheets/material_bottom_sheet.dart index 4bbdd1d3..f32f3b77 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheets/material_bottom_sheet.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheets/material_bottom_sheet.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; -import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; +import 'package:modal_bottom_sheet/modal_bottom_sheet.dart' + as modal_bottom_sheet; import 'dart:async'; /// Shows a modal material design bottom sheet. @@ -25,7 +26,7 @@ Future showMaterialModalBottomSheet({ assert(debugCheckHasMediaQuery(context)); assert(debugCheckHasMaterialLocalizations(context)); final result = await Navigator.of(context, rootNavigator: useRootNavigator) - .push(ModalBottomSheetRoute( + .push(modal_bottom_sheet.ModalBottomSheetRoute( builder: builder, closeProgressThreshold: closeProgressThreshold, containerBuilder: _materialContainerBuilder( @@ -51,7 +52,8 @@ Future showMaterialModalBottomSheet({ } //Default container builder is the Material Appearance -WidgetWithChildBuilder _materialContainerBuilder(BuildContext context, +modal_bottom_sheet.WidgetWithChildBuilder _materialContainerBuilder( + BuildContext context, {Color? backgroundColor, double? elevation, ThemeData? theme, diff --git a/modal_bottom_sheet/lib/src/material_with_modal_page_route.dart b/modal_bottom_sheet/lib/src/material_with_modal_page_route.dart index 6ae9da8f..bd0bf4b8 100644 --- a/modal_bottom_sheet/lib/src/material_with_modal_page_route.dart +++ b/modal_bottom_sheet/lib/src/material_with_modal_page_route.dart @@ -1,8 +1,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../modal_bottom_sheet.dart'; -import 'bottom_sheet_route.dart'; +import '../modal_bottom_sheet.dart' as modal_bottom_sheet; class MaterialWithModalsPageRoute extends MaterialPageRoute { /// Construct a MaterialPageRoute whose contents are defined by [builder]. @@ -20,7 +19,7 @@ class MaterialWithModalsPageRoute extends MaterialPageRoute { builder: builder, maintainState: maintainState); - ModalBottomSheetRoute? _nextModalRoute; + modal_bottom_sheet.ModalBottomSheetRoute? _nextModalRoute; @override bool canTransitionTo(TransitionRoute nextRoute) { @@ -29,23 +28,18 @@ class MaterialWithModalsPageRoute extends MaterialPageRoute { (nextRoute is CupertinoPageRoute && !nextRoute.fullscreenDialog) || (nextRoute is MaterialWithModalsPageRoute && !nextRoute.fullscreenDialog) || - (nextRoute is ModalBottomSheetRoute); + (nextRoute is modal_bottom_sheet.ModalBottomSheetRoute); } @override void didChangeNext(Route? nextRoute) { - if (nextRoute is ModalBottomSheetRoute) { + if (nextRoute is modal_bottom_sheet.ModalBottomSheetRoute) { _nextModalRoute = nextRoute; } super.didChangeNext(nextRoute); } - @override - void didPopNext(Route nextRoute) { - super.didPopNext(nextRoute); - } - @override bool didPop(T? result) { _nextModalRoute = null; diff --git a/modal_bottom_sheet/pubspec.lock b/modal_bottom_sheet/pubspec.lock index dea4689c..edf16cf8 100644 --- a/modal_bottom_sheet/pubspec.lock +++ b/modal_bottom_sheet/pubspec.lock @@ -5,51 +5,50 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + url: "https://pub.dev" source: hosted - version: "2.8.2" + version: "2.10.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + url: "https://pub.dev" source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.2.1" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.17.0" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -60,41 +59,54 @@ packages: description: flutter source: sdk version: "0.0.0" + js: + dependency: transitive + description: + name: js + sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + url: "https://pub.dev" + source: hosted + version: "0.6.5" lints: dependency: "direct dev" description: name: lints - url: "https://pub.dartlang.org" + sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593" + url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.0.1" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + url: "https://pub.dev" source: hosted - version: "0.12.11" + version: "0.12.13" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + url: "https://pub.dev" source: hosted - version: "0.1.4" + version: "0.2.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + url: "https://pub.dev" source: hosted - version: "1.7.0" + version: "1.8.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + url: "https://pub.dev" source: hosted - version: "1.8.1" + version: "1.8.2" sky_engine: dependency: transitive description: flutter @@ -104,51 +116,58 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.9.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + url: "https://pub.dev" source: hosted - version: "0.4.9" + version: "0.4.16" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" sdks: - dart: ">=2.17.0 <3.0.0" + dart: ">=2.18.0 <4.0.0" flutter: ">=3.0.0" diff --git a/sheet/example/pubspec.lock b/sheet/example/pubspec.lock index 6060f1ca..6c0527fe 100644 --- a/sheet/example/pubspec.lock +++ b/sheet/example/pubspec.lock @@ -5,56 +5,64 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + url: "https://pub.dev" source: hosted - version: "2.9.0" + version: "2.10.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + url: "https://pub.dev" source: hosted version: "1.2.1" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.17.0" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be + url: "https://pub.dev" source: hosted version: "1.0.5" equatable: dependency: "direct main" description: name: equatable - url: "https://pub.dartlang.org" + sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2 + url: "https://pub.dev" source: hosted version: "2.0.5" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted version: "1.3.1" flutter: @@ -76,65 +84,74 @@ packages: dependency: "direct main" description: name: go_router - url: "https://pub.dartlang.org" + sha256: aec1999abe8b2f131eda46d4c9629048fb1befed2b65e90b73f9193a300ce489 + url: "https://pub.dev" source: hosted - version: "4.3.0" + version: "4.5.1" js: dependency: transitive description: name: js - url: "https://pub.dartlang.org" + sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + url: "https://pub.dev" source: hosted - version: "0.6.4" + version: "0.6.5" logging: dependency: transitive description: name: logging - url: "https://pub.dartlang.org" + sha256: c0bbfe94d46aedf9b8b3e695cf3bd48c8e14b35e3b2c639e0aa7755d589ba946 + url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.1.0" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + url: "https://pub.dev" source: hosted - version: "0.12.12" + version: "0.12.13" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + url: "https://pub.dev" source: hosted - version: "0.1.5" + version: "0.2.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + url: "https://pub.dev" source: hosted version: "1.8.0" nested: dependency: transitive description: name: nested - url: "https://pub.dartlang.org" + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" source: hosted version: "1.0.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + url: "https://pub.dev" source: hosted version: "1.8.2" provider: dependency: "direct main" description: name: provider - url: "https://pub.dartlang.org" + sha256: cdbe7530b12ecd9eb455bdaa2fcb8d4dad22e80b8afb4798b41479d5ce26847f + url: "https://pub.dev" source: hosted - version: "6.0.3" + version: "6.0.5" sheet: dependency: "direct main" description: @@ -151,51 +168,58 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.9.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + url: "https://pub.dev" source: hosted - version: "0.4.12" + version: "0.4.16" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" sdks: - dart: ">=2.17.0 <3.0.0" + dart: ">=2.18.0 <4.0.0" flutter: ">=3.3.0" diff --git a/sheet/pubspec.lock b/sheet/pubspec.lock index 8ada3d94..26c63491 100644 --- a/sheet/pubspec.lock +++ b/sheet/pubspec.lock @@ -5,91 +5,104 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - url: "https://pub.dartlang.org" + sha256: "0c80aeab9bc807ab10022cd3b2f4cf2ecdf231949dc1ddd9442406a003f19201" + url: "https://pub.dev" source: hosted - version: "47.0.0" + version: "52.0.0" analyzer: dependency: transitive description: name: analyzer - url: "https://pub.dartlang.org" + sha256: cd8ee83568a77f3ae6b913a36093a1c9b1264e7cb7f834d9ddd2311dade9c1f4 + url: "https://pub.dev" source: hosted - version: "4.7.0" + version: "5.4.0" args: dependency: transitive description: name: args - url: "https://pub.dartlang.org" + sha256: "139d809800a412ebb26a3892da228b2d0ba36f0ef5d9a82166e5e52ec8d61611" + url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.3.2" async: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + url: "https://pub.dev" source: hosted - version: "2.9.0" + version: "2.10.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + url: "https://pub.dev" source: hosted version: "1.2.1" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.17.0" convert: dependency: transitive description: name: convert - url: "https://pub.dartlang.org" + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.1.1" coverage: dependency: transitive description: name: coverage - url: "https://pub.dartlang.org" + sha256: "961c4aebd27917269b1896382c7cb1b1ba81629ba669ba09c27a7e5710ec9040" + url: "https://pub.dev" source: hosted - version: "1.5.0" + version: "1.6.2" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" + sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 + url: "https://pub.dev" source: hosted version: "3.0.2" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted version: "1.3.1" file: dependency: transitive description: name: file - url: "https://pub.dartlang.org" + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + url: "https://pub.dev" source: hosted version: "6.1.4" flutter: @@ -106,156 +119,178 @@ packages: dependency: transitive description: name: frontend_server_client - url: "https://pub.dartlang.org" + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" + url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "3.2.0" glob: dependency: transitive description: name: glob - url: "https://pub.dartlang.org" + sha256: "4515b5b6ddb505ebdd242a5f2cc5d22d3d6a80013789debfbda7777f47ea308c" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" http_multi_server: dependency: transitive description: name: http_multi_server - url: "https://pub.dartlang.org" + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" source: hosted version: "3.2.1" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.dartlang.org" + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" source: hosted - version: "4.0.1" + version: "4.0.2" io: dependency: transitive description: name: io - url: "https://pub.dartlang.org" + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" source: hosted - version: "1.0.3" + version: "1.0.4" js: dependency: transitive description: name: js - url: "https://pub.dartlang.org" + sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + url: "https://pub.dev" source: hosted - version: "0.6.4" + version: "0.6.5" lints: dependency: "direct dev" description: name: lints - url: "https://pub.dartlang.org" + sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593" + url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.0.1" logging: dependency: transitive description: name: logging - url: "https://pub.dartlang.org" + sha256: c0bbfe94d46aedf9b8b3e695cf3bd48c8e14b35e3b2c639e0aa7755d589ba946 + url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.1.0" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + url: "https://pub.dev" source: hosted - version: "0.12.12" + version: "0.12.13" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + url: "https://pub.dev" source: hosted - version: "0.1.5" + version: "0.2.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + url: "https://pub.dev" source: hosted version: "1.8.0" mime: dependency: transitive description: name: mime - url: "https://pub.dartlang.org" + sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.0.4" mocktail: dependency: "direct dev" description: name: mocktail - url: "https://pub.dartlang.org" + sha256: "80a996cd9a69284b3dc521ce185ffe9150cde69767c2d3a0720147d93c0cef53" + url: "https://pub.dev" source: hosted version: "0.3.0" node_preamble: dependency: transitive description: name: node_preamble - url: "https://pub.dartlang.org" + sha256: "8ebdbaa3b96d5285d068f80772390d27c21e1fa10fb2df6627b1b9415043608d" + url: "https://pub.dev" source: hosted version: "2.0.1" package_config: dependency: transitive description: name: package_config - url: "https://pub.dartlang.org" + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" source: hosted version: "2.1.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + url: "https://pub.dev" source: hosted version: "1.8.2" pool: dependency: transitive description: name: pool - url: "https://pub.dartlang.org" + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" source: hosted version: "1.5.1" pub_semver: dependency: transitive description: name: pub_semver - url: "https://pub.dartlang.org" + sha256: "307de764d305289ff24ad257ad5c5793ce56d04947599ad68b3baa124105fc17" + url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.3" shelf: dependency: transitive description: name: shelf - url: "https://pub.dartlang.org" + sha256: c24a96135a2ccd62c64b69315a14adc5c3419df63b4d7c05832a346fdb73682c + url: "https://pub.dev" source: hosted - version: "1.3.2" + version: "1.4.0" shelf_packages_handler: dependency: transitive description: name: shelf_packages_handler - url: "https://pub.dartlang.org" + sha256: aef74dc9195746a384843102142ab65b6a4735bb3beea791e63527b88cc83306 + url: "https://pub.dev" source: hosted version: "3.0.1" shelf_static: dependency: transitive description: name: shelf_static - url: "https://pub.dartlang.org" + sha256: e792b76b96a36d4a41b819da593aff4bdd413576b3ba6150df5d8d9996d2e74c + url: "https://pub.dev" source: hosted version: "1.1.1" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - url: "https://pub.dartlang.org" + sha256: a988c0e8d8ffbdb8a28aa7ec8e449c260f3deb808781fe1284d22c5bba7156e8 + url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.0.3" sky_engine: dependency: transitive description: flutter @@ -265,121 +300,138 @@ packages: dependency: transitive description: name: source_map_stack_trace - url: "https://pub.dartlang.org" + sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" source_maps: dependency: transitive description: name: source_maps - url: "https://pub.dartlang.org" + sha256: "490098075234dcedb83c5d949b4c93dad5e6b7702748de000be2b57b8e6b2427" + url: "https://pub.dev" source: hosted - version: "0.10.10" + version: "0.10.11" source_span: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.9.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted version: "1.2.1" test: dependency: transitive description: name: test - url: "https://pub.dartlang.org" + sha256: a5fcd2d25eeadbb6589e80198a47d6a464ba3e2049da473943b8af9797900c2d + url: "https://pub.dev" source: hosted - version: "1.21.4" + version: "1.22.0" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + url: "https://pub.dev" source: hosted - version: "0.4.12" + version: "0.4.16" test_core: dependency: transitive description: name: test_core - url: "https://pub.dartlang.org" + sha256: "0ef9755ec6d746951ba0aabe62f874b707690b5ede0fecc818b138fcc9b14888" + url: "https://pub.dev" source: hosted - version: "0.4.16" + version: "0.4.20" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" + url: "https://pub.dev" source: hosted version: "1.3.1" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" vm_service: dependency: transitive description: name: vm_service - url: "https://pub.dartlang.org" + sha256: e7fb6c2282f7631712b69c19d1bff82f3767eea33a2321c14fa59ad67ea391c7 + url: "https://pub.dev" source: hosted version: "9.4.0" watcher: dependency: transitive description: name: watcher - url: "https://pub.dartlang.org" + sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" + url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.0.2" web_socket_channel: dependency: transitive description: name: web_socket_channel - url: "https://pub.dartlang.org" + sha256: ca49c0bc209c687b887f30527fb6a9d80040b072cc2990f34b9bec3e7663101b + url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.3.0" webkit_inspection_protocol: dependency: transitive description: name: webkit_inspection_protocol - url: "https://pub.dartlang.org" + sha256: "67d3a8b6c79e1987d19d848b0892e582dbb0c66c57cc1fef58a177dd2aa2823d" + url: "https://pub.dev" source: hosted version: "1.2.0" yaml: dependency: transitive description: name: yaml - url: "https://pub.dartlang.org" + sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370" + url: "https://pub.dev" source: hosted version: "3.1.1" sdks: - dart: ">=2.17.0 <3.0.0" + dart: ">=2.18.0 <4.0.0" flutter: ">=3.3.0" From 2e9afcec800ccd4d91cdad7a5c9c23cadccdc5c5 Mon Sep 17 00:00:00 2001 From: Jaime Blasco Date: Sat, 28 Jan 2023 17:03:25 +0100 Subject: [PATCH 02/29] fix: deprecate duplicated name (#323) --- .../example/lib/modals/circular_modal.dart | 2 +- modal_bottom_sheet/example/macos/Podfile | 2 +- modal_bottom_sheet/example/macos/Podfile.lock | 6 +++--- .../macos/Runner.xcodeproj/project.pbxproj | 9 +++++---- .../lib/src/bottom_sheet_route.dart | 18 ++++++++++++------ .../src/bottom_sheets/bar_bottom_sheet.dart | 2 +- .../bottom_sheets/cupertino_bottom_sheet.dart | 2 +- .../bottom_sheets/material_bottom_sheet.dart | 2 +- .../src/material_with_modal_page_route.dart | 6 +++--- 9 files changed, 28 insertions(+), 21 deletions(-) diff --git a/modal_bottom_sheet/example/lib/modals/circular_modal.dart b/modal_bottom_sheet/example/lib/modals/circular_modal.dart index 4a0821ac..4fcb43f3 100644 --- a/modal_bottom_sheet/example/lib/modals/circular_modal.dart +++ b/modal_bottom_sheet/example/lib/modals/circular_modal.dart @@ -99,7 +99,7 @@ Future showAvatarModalBottomSheet({ assert(debugCheckHasMediaQuery(context)); assert(debugCheckHasMaterialLocalizations(context)); final result = await Navigator.of(context, rootNavigator: useRootNavigator) - .push(modal_bottom_sheet.ModalBottomSheetRoute( + .push(modal_bottom_sheet.ModalSheetRoute( builder: builder, containerBuilder: (_, animation, child) => AvatarBottomSheet( child: child, diff --git a/modal_bottom_sheet/example/macos/Podfile b/modal_bottom_sheet/example/macos/Podfile index dade8dfa..049abe29 100644 --- a/modal_bottom_sheet/example/macos/Podfile +++ b/modal_bottom_sheet/example/macos/Podfile @@ -1,4 +1,4 @@ -platform :osx, '10.11' +platform :osx, '10.14' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/modal_bottom_sheet/example/macos/Podfile.lock b/modal_bottom_sheet/example/macos/Podfile.lock index 4f162e68..c9a64034 100644 --- a/modal_bottom_sheet/example/macos/Podfile.lock +++ b/modal_bottom_sheet/example/macos/Podfile.lock @@ -14,9 +14,9 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos SPEC CHECKSUMS: - FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424 - url_launcher_macos: 597e05b8e514239626bcf4a850fcf9ef5c856ec3 + FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 + url_launcher_macos: c04e4fa86382d4f94f6b38f14625708be3ae52e2 -PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c +PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 COCOAPODS: 1.11.3 diff --git a/modal_bottom_sheet/example/macos/Runner.xcodeproj/project.pbxproj b/modal_bottom_sheet/example/macos/Runner.xcodeproj/project.pbxproj index b9856e57..e88f5b0b 100644 --- a/modal_bottom_sheet/example/macos/Runner.xcodeproj/project.pbxproj +++ b/modal_bottom_sheet/example/macos/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 54; objects = { /* Begin PBXAggregateTarget section */ @@ -278,6 +278,7 @@ }; 3399D490228B24CF009A79C7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -404,7 +405,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; @@ -483,7 +484,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -530,7 +531,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; diff --git a/modal_bottom_sheet/lib/src/bottom_sheet_route.dart b/modal_bottom_sheet/lib/src/bottom_sheet_route.dart index 2e5339d8..3e4a5def 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheet_route.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheet_route.dart @@ -19,7 +19,7 @@ class _ModalBottomSheet extends StatefulWidget { }) : super(key: key); final double? closeProgressThreshold; - final ModalBottomSheetRoute route; + final ModalSheetRoute route; final bool expanded; final bool bounce; final bool enableDrag; @@ -122,8 +122,14 @@ class _ModalBottomSheetState extends State<_ModalBottomSheet> { } } -class ModalBottomSheetRoute extends PageRoute { - ModalBottomSheetRoute({ +@Deprecated( + 'ModalBottomSheetRoute has been introduced in Flutter 3.7, to avoid name ' + 'conflicts, this class has been renamed to ModalSheetRoute in this ' + 'packages. ModalBottomSheetRoute will be removed in the next major version.') +typedef ModalBottomSheetRoute = ModalSheetRoute; + +class ModalSheetRoute extends PageRoute { + ModalSheetRoute({ this.closeProgressThreshold, this.containerBuilder, required this.builder, @@ -211,11 +217,11 @@ class ModalBottomSheetRoute extends PageRoute { @override bool canTransitionTo(TransitionRoute nextRoute) => - nextRoute is ModalBottomSheetRoute; + nextRoute is ModalSheetRoute; @override bool canTransitionFrom(TransitionRoute previousRoute) => - previousRoute is ModalBottomSheetRoute || previousRoute is PageRoute; + previousRoute is ModalSheetRoute || previousRoute is PageRoute; Widget getPreviousRouteTransition( BuildContext context, @@ -257,7 +263,7 @@ Future showCustomModalBottomSheet({ : ''; final result = await Navigator.of(context, rootNavigator: useRootNavigator) - .push(ModalBottomSheetRoute( + .push(ModalSheetRoute( builder: builder, bounce: bounce, containerBuilder: containerWidget, diff --git a/modal_bottom_sheet/lib/src/bottom_sheets/bar_bottom_sheet.dart b/modal_bottom_sheet/lib/src/bottom_sheets/bar_bottom_sheet.dart index 6e43e0c8..fb5c9df9 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheets/bar_bottom_sheet.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheets/bar_bottom_sheet.dart @@ -98,7 +98,7 @@ Future showBarModalBottomSheet({ assert(debugCheckHasMediaQuery(context)); assert(debugCheckHasMaterialLocalizations(context)); final result = await Navigator.of(context, rootNavigator: useRootNavigator) - .push(modal_bottom_sheet.ModalBottomSheetRoute( + .push(modal_bottom_sheet.ModalSheetRoute( builder: builder, bounce: bounce, closeProgressThreshold: closeProgressThreshold, diff --git a/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart b/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart index 82f0ce74..bf6f7e6a 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart @@ -144,7 +144,7 @@ Future showCupertinoModalBottomSheet({ return result; } -class CupertinoModalBottomSheetRoute extends ModalBottomSheetRoute { +class CupertinoModalBottomSheetRoute extends ModalSheetRoute { final Radius topRadius; final Curve? previousRouteAnimationCurve; diff --git a/modal_bottom_sheet/lib/src/bottom_sheets/material_bottom_sheet.dart b/modal_bottom_sheet/lib/src/bottom_sheets/material_bottom_sheet.dart index f32f3b77..cb3149ca 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheets/material_bottom_sheet.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheets/material_bottom_sheet.dart @@ -26,7 +26,7 @@ Future showMaterialModalBottomSheet({ assert(debugCheckHasMediaQuery(context)); assert(debugCheckHasMaterialLocalizations(context)); final result = await Navigator.of(context, rootNavigator: useRootNavigator) - .push(modal_bottom_sheet.ModalBottomSheetRoute( + .push(modal_bottom_sheet.ModalSheetRoute( builder: builder, closeProgressThreshold: closeProgressThreshold, containerBuilder: _materialContainerBuilder( diff --git a/modal_bottom_sheet/lib/src/material_with_modal_page_route.dart b/modal_bottom_sheet/lib/src/material_with_modal_page_route.dart index bd0bf4b8..95066ba3 100644 --- a/modal_bottom_sheet/lib/src/material_with_modal_page_route.dart +++ b/modal_bottom_sheet/lib/src/material_with_modal_page_route.dart @@ -19,7 +19,7 @@ class MaterialWithModalsPageRoute extends MaterialPageRoute { builder: builder, maintainState: maintainState); - modal_bottom_sheet.ModalBottomSheetRoute? _nextModalRoute; + modal_bottom_sheet.ModalSheetRoute? _nextModalRoute; @override bool canTransitionTo(TransitionRoute nextRoute) { @@ -28,12 +28,12 @@ class MaterialWithModalsPageRoute extends MaterialPageRoute { (nextRoute is CupertinoPageRoute && !nextRoute.fullscreenDialog) || (nextRoute is MaterialWithModalsPageRoute && !nextRoute.fullscreenDialog) || - (nextRoute is modal_bottom_sheet.ModalBottomSheetRoute); + (nextRoute is modal_bottom_sheet.ModalSheetRoute); } @override void didChangeNext(Route? nextRoute) { - if (nextRoute is modal_bottom_sheet.ModalBottomSheetRoute) { + if (nextRoute is modal_bottom_sheet.ModalSheetRoute) { _nextModalRoute = nextRoute; } From 2073bdd144be1d09a6e8cf5f07b263a867553d8b Mon Sep 17 00:00:00 2001 From: Jaime Blasco Date: Sat, 28 Jan 2023 17:33:31 +0100 Subject: [PATCH 03/29] fix: flutter 3.7 (#324) * fix: deprecate duplicated name * fix: support flutter 3.7 * feat: add pre release version --- modal_bottom_sheet/CHANGELOG.md | 5 +++++ modal_bottom_sheet/example/lib/main.dart | 2 +- modal_bottom_sheet/example/pubspec.lock | 2 +- modal_bottom_sheet/example/pubspec.yaml | 2 +- modal_bottom_sheet/lib/src/bottom_sheet_route.dart | 8 +------- .../lib/src/bottom_sheets/cupertino_bottom_sheet.dart | 5 ----- modal_bottom_sheet/pubspec.lock | 2 +- modal_bottom_sheet/pubspec.yaml | 4 ++-- sheet/CHANGELOG.md | 4 ++-- sheet/example/lib/editor/editor_child.dart | 2 +- sheet/example/lib/editor/editor_page.dart | 2 +- .../lib/examples/route/examples/modal_complex_all.dart | 2 +- .../lib/examples/route/navigation/cupertino_page.dart | 4 ++-- .../example/lib/examples/route/navigation/go_router.dart | 4 ++-- sheet/example/lib/examples/route/navigation/page.dart | 4 ++-- sheet/example/lib/examples/sheet/complex_snap_sheet.dart | 2 +- sheet/example/lib/examples/sheet/scrollable_sheet.dart | 2 +- .../example/lib/examples/sheet/scrollable_snap_sheet.dart | 2 +- sheet/example/lib/examples/sheet/simple_sheet.dart | 4 ++-- sheet/example/lib/route_example_page.dart | 2 +- sheet/example/lib/sheet_example_page.dart | 2 +- sheet/example/pubspec.lock | 2 +- sheet/example/pubspec.yaml | 2 +- sheet/lib/src/scroll_controller.dart | 2 ++ sheet/lib/src/widgets/scroll_to_top_status_handler.dart | 3 ++- sheet/pubspec.lock | 2 +- sheet/pubspec.yaml | 4 ++-- 27 files changed, 39 insertions(+), 42 deletions(-) diff --git a/modal_bottom_sheet/CHANGELOG.md b/modal_bottom_sheet/CHANGELOG.md index 48653245..36f9bc01 100644 --- a/modal_bottom_sheet/CHANGELOG.md +++ b/modal_bottom_sheet/CHANGELOG.md @@ -1,4 +1,9 @@ +## 3.0.0-pre - Flutter 3.7 + ++ Migrates to Flutter 3.7 ++ ModalBottomSheetRoute has been renamed to ModalSheetRoute so it does not conflict with the new class from Flutter 3.7 + ## 2.1.1 + Bug fixes diff --git a/modal_bottom_sheet/example/lib/main.dart b/modal_bottom_sheet/example/lib/main.dart index c58e1e82..c0af86da 100644 --- a/modal_bottom_sheet/example/lib/main.dart +++ b/modal_bottom_sheet/example/lib/main.dart @@ -260,7 +260,7 @@ class _MyHomePageState extends State { padding: EdgeInsets.fromLTRB(16, 20, 16, 8), child: Text( title, - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, ), ); } diff --git a/modal_bottom_sheet/example/pubspec.lock b/modal_bottom_sheet/example/pubspec.lock index 29c53f7d..0c9d4ef9 100644 --- a/modal_bottom_sheet/example/pubspec.lock +++ b/modal_bottom_sheet/example/pubspec.lock @@ -254,4 +254,4 @@ packages: version: "2.1.4" sdks: dart: ">=2.18.0 <4.0.0" - flutter: ">=3.0.0" + flutter: ">=3.7.0" diff --git a/modal_bottom_sheet/example/pubspec.yaml b/modal_bottom_sheet/example/pubspec.yaml index 247bb490..a71607b5 100644 --- a/modal_bottom_sheet/example/pubspec.yaml +++ b/modal_bottom_sheet/example/pubspec.yaml @@ -14,8 +14,8 @@ publish_to: none version: 1.0.0+1 environment: - flutter: ">=3.0.0" sdk: '>=2.17.0 <3.0.0' + flutter: ">=3.7.0" dependencies: diff --git a/modal_bottom_sheet/lib/src/bottom_sheet_route.dart b/modal_bottom_sheet/lib/src/bottom_sheet_route.dart index 3e4a5def..b5801ad5 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheet_route.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheet_route.dart @@ -75,7 +75,7 @@ class _ModalBottomSheetState extends State<_ModalBottomSheet> { Widget build(BuildContext context) { assert(debugCheckHasMediaQuery(context)); assert(widget.route._animationController != null); - final scrollController = PrimaryScrollController.of(context) ?? + final scrollController = PrimaryScrollController.maybeOf(context) ?? (_scrollController ??= ScrollController()); return ModalScrollController( controller: scrollController, @@ -122,12 +122,6 @@ class _ModalBottomSheetState extends State<_ModalBottomSheet> { } } -@Deprecated( - 'ModalBottomSheetRoute has been introduced in Flutter 3.7, to avoid name ' - 'conflicts, this class has been renamed to ModalSheetRoute in this ' - 'packages. ModalBottomSheetRoute will be removed in the next major version.') -typedef ModalBottomSheetRoute = ModalSheetRoute; - class ModalSheetRoute extends PageRoute { ModalSheetRoute({ this.closeProgressThreshold, diff --git a/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart b/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart index bf6f7e6a..0b3c8a34 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart @@ -490,11 +490,6 @@ class _CupertinoScaffoldState extends State super.initState(); } - @override - void dispose() { - super.dispose(); - } - @override Widget build(BuildContext context) { return CupertinoScaffoldInheirted( diff --git a/modal_bottom_sheet/pubspec.lock b/modal_bottom_sheet/pubspec.lock index edf16cf8..bda99394 100644 --- a/modal_bottom_sheet/pubspec.lock +++ b/modal_bottom_sheet/pubspec.lock @@ -170,4 +170,4 @@ packages: version: "2.1.4" sdks: dart: ">=2.18.0 <4.0.0" - flutter: ">=3.0.0" + flutter: ">=3.7.0" diff --git a/modal_bottom_sheet/pubspec.yaml b/modal_bottom_sheet/pubspec.yaml index 001d7d23..57228c71 100644 --- a/modal_bottom_sheet/pubspec.yaml +++ b/modal_bottom_sheet/pubspec.yaml @@ -1,11 +1,11 @@ name: modal_bottom_sheet description: 'Create awesome and powerful modal bottom sheets. Material, Cupertino iOS 13 or create your own style' -version: 2.1.2 +version: 3.0.0-pre homepage: 'https://github.com/jamesblasco/modal_bottom_sheet' environment: sdk: ">=2.17.0 <3.0.0" - flutter: ">=3.0.0" + flutter: ">=3.7.0" dependencies: flutter: diff --git a/sheet/CHANGELOG.md b/sheet/CHANGELOG.md index ac071598..29319971 100644 --- a/sheet/CHANGELOG.md +++ b/sheet/CHANGELOG.md @@ -1,3 +1,3 @@ -## [0.0.1] - TODO: Add release date. +# [1.0.0-pre] - Adds support for Flutter 3.7 -* TODO: Describe initial release. +* This version requires Flutter 3.7 as the new framework version contains several breaking changes that affect the package diff --git a/sheet/example/lib/editor/editor_child.dart b/sheet/example/lib/editor/editor_child.dart index 0379f0b6..4cab16b6 100644 --- a/sheet/example/lib/editor/editor_child.dart +++ b/sheet/example/lib/editor/editor_child.dart @@ -87,7 +87,7 @@ class ListWidget extends StatelessWidget { return Container( child: Text( 'Location', - style: Theme.of(context).textTheme.headline6, + style: Theme.of(context).textTheme.titleLarge, ), padding: const EdgeInsets.all(20), alignment: Alignment.center, diff --git a/sheet/example/lib/editor/editor_page.dart b/sheet/example/lib/editor/editor_page.dart index 61337026..366aed4c 100644 --- a/sheet/example/lib/editor/editor_page.dart +++ b/sheet/example/lib/editor/editor_page.dart @@ -329,7 +329,7 @@ class SectionTitle extends StatelessWidget { padding: const EdgeInsets.all(16), child: Text( text, - style: Theme.of(context).textTheme.headline6, + style: Theme.of(context).textTheme.titleLarge, ), ); } diff --git a/sheet/example/lib/examples/route/examples/modal_complex_all.dart b/sheet/example/lib/examples/route/examples/modal_complex_all.dart index 59752019..8dff2576 100644 --- a/sheet/example/lib/examples/route/examples/modal_complex_all.dart +++ b/sheet/example/lib/examples/route/examples/modal_complex_all.dart @@ -7,7 +7,7 @@ class ComplexModal extends StatelessWidget { @override Widget build(BuildContext context) { final ScrollController primaryScrollController = - PrimaryScrollController.of(context)!; + PrimaryScrollController.maybeOf(context)!; return Material( child: WillPopScope( onWillPop: () async { diff --git a/sheet/example/lib/examples/route/navigation/cupertino_page.dart b/sheet/example/lib/examples/route/navigation/cupertino_page.dart index 3e731f57..480a0b12 100644 --- a/sheet/example/lib/examples/route/navigation/cupertino_page.dart +++ b/sheet/example/lib/examples/route/navigation/cupertino_page.dart @@ -145,8 +145,8 @@ class BookDetailsScreen extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Text(book.title, style: Theme.of(context).textTheme.headline6), - Text(book.author, style: Theme.of(context).textTheme.subtitle1), + Text(book.title, style: Theme.of(context).textTheme.titleLarge), + Text(book.author, style: Theme.of(context).textTheme.titleMedium), ], ), ), diff --git a/sheet/example/lib/examples/route/navigation/go_router.dart b/sheet/example/lib/examples/route/navigation/go_router.dart index 4d720274..a202b175 100644 --- a/sheet/example/lib/examples/route/navigation/go_router.dart +++ b/sheet/example/lib/examples/route/navigation/go_router.dart @@ -158,8 +158,8 @@ class BookDetailsScreen extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Text(book.title, style: Theme.of(context).textTheme.headline6), - Text(book.author, style: Theme.of(context).textTheme.subtitle1), + Text(book.title, style: Theme.of(context).textTheme.titleLarge), + Text(book.author, style: Theme.of(context).textTheme.titleMedium), ], ), ), diff --git a/sheet/example/lib/examples/route/navigation/page.dart b/sheet/example/lib/examples/route/navigation/page.dart index 6275ae6a..eb52500e 100644 --- a/sheet/example/lib/examples/route/navigation/page.dart +++ b/sheet/example/lib/examples/route/navigation/page.dart @@ -145,8 +145,8 @@ class BookDetailsScreen extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Text(book.title, style: Theme.of(context).textTheme.headline6), - Text(book.author, style: Theme.of(context).textTheme.subtitle1), + Text(book.title, style: Theme.of(context).textTheme.titleLarge), + Text(book.author, style: Theme.of(context).textTheme.titleMedium), ], ), ), diff --git a/sheet/example/lib/examples/sheet/complex_snap_sheet.dart b/sheet/example/lib/examples/sheet/complex_snap_sheet.dart index 8d5148a5..64bee2cf 100644 --- a/sheet/example/lib/examples/sheet/complex_snap_sheet.dart +++ b/sheet/example/lib/examples/sheet/complex_snap_sheet.dart @@ -291,7 +291,7 @@ class MapSheet extends StatelessWidget { child: Text( 'Latest near you', style: - Theme.of(context).textTheme.headline6, + Theme.of(context).textTheme.titleLarge, ), padding: EdgeInsets.all(20), alignment: Alignment.centerLeft, diff --git a/sheet/example/lib/examples/sheet/scrollable_sheet.dart b/sheet/example/lib/examples/sheet/scrollable_sheet.dart index 84760b6d..a8b4eb9f 100644 --- a/sheet/example/lib/examples/sheet/scrollable_sheet.dart +++ b/sheet/example/lib/examples/sheet/scrollable_sheet.dart @@ -31,7 +31,7 @@ class ScrollableSheet extends StatelessWidget { return Container( child: Text( 'Location', - style: Theme.of(context).textTheme.headline6, + style: Theme.of(context).textTheme.titleLarge, ), padding: const EdgeInsets.all(20), alignment: Alignment.center, diff --git a/sheet/example/lib/examples/sheet/scrollable_snap_sheet.dart b/sheet/example/lib/examples/sheet/scrollable_snap_sheet.dart index d347b396..de3d9641 100644 --- a/sheet/example/lib/examples/sheet/scrollable_snap_sheet.dart +++ b/sheet/example/lib/examples/sheet/scrollable_snap_sheet.dart @@ -36,7 +36,7 @@ class ScrollableSnapSheet extends StatelessWidget { return Container( child: Text( 'Location', - style: Theme.of(context).textTheme.headline6, + style: Theme.of(context).textTheme.titleLarge, ), padding: const EdgeInsets.all(20), alignment: Alignment.center, diff --git a/sheet/example/lib/examples/sheet/simple_sheet.dart b/sheet/example/lib/examples/sheet/simple_sheet.dart index a568483d..30004424 100644 --- a/sheet/example/lib/examples/sheet/simple_sheet.dart +++ b/sheet/example/lib/examples/sheet/simple_sheet.dart @@ -14,8 +14,8 @@ class SimpleSheet extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.stretch, children: [ const SizedBox(height: 20), - Text('Title', style: Theme.of(context).textTheme.headline3), - Text('Subtitle', style: Theme.of(context).textTheme.headline6), + Text('Title', style: Theme.of(context).textTheme.displaySmall), + Text('Subtitle', style: Theme.of(context).textTheme.titleLarge), ], ), ), diff --git a/sheet/example/lib/route_example_page.dart b/sheet/example/lib/route_example_page.dart index f9061c1c..8ca01831 100644 --- a/sheet/example/lib/route_example_page.dart +++ b/sheet/example/lib/route_example_page.dart @@ -324,7 +324,7 @@ class SectionTitle extends StatelessWidget { padding: const EdgeInsets.fromLTRB(16, 20, 16, 8), child: Text( title, - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, ), ); } diff --git a/sheet/example/lib/sheet_example_page.dart b/sheet/example/lib/sheet_example_page.dart index ee71780a..982c41c8 100644 --- a/sheet/example/lib/sheet_example_page.dart +++ b/sheet/example/lib/sheet_example_page.dart @@ -86,7 +86,7 @@ class SectionTitle extends StatelessWidget { padding: const EdgeInsets.fromLTRB(16, 20, 16, 8), child: Text( title, - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, ), ); } diff --git a/sheet/example/pubspec.lock b/sheet/example/pubspec.lock index 6c0527fe..78f8931f 100644 --- a/sheet/example/pubspec.lock +++ b/sheet/example/pubspec.lock @@ -222,4 +222,4 @@ packages: version: "2.1.4" sdks: dart: ">=2.18.0 <4.0.0" - flutter: ">=3.3.0" + flutter: ">=3.7.0" diff --git a/sheet/example/pubspec.yaml b/sheet/example/pubspec.yaml index cb875867..8baa7c65 100644 --- a/sheet/example/pubspec.yaml +++ b/sheet/example/pubspec.yaml @@ -5,7 +5,7 @@ version: 1.0.0+1 environment: sdk: ">=2.17.0 <3.0.0" - flutter: ">=3.0.0" + flutter: ">=3.7.0" dependencies: flutter: diff --git a/sheet/lib/src/scroll_controller.dart b/sheet/lib/src/scroll_controller.dart index 108a5d17..754738c9 100644 --- a/sheet/lib/src/scroll_controller.dart +++ b/sheet/lib/src/scroll_controller.dart @@ -139,6 +139,7 @@ class SheetPrimaryScrollPosition extends ScrollPositionWithSingleContext { velocity, ), context.vsync, + true, ), ); @@ -178,6 +179,7 @@ class SheetPrimaryScrollPosition extends ScrollPositionWithSingleContext { velocity, ), context.vsync, + true, ), ); return; diff --git a/sheet/lib/src/widgets/scroll_to_top_status_handler.dart b/sheet/lib/src/widgets/scroll_to_top_status_handler.dart index df68e989..2b338678 100644 --- a/sheet/lib/src/widgets/scroll_to_top_status_handler.dart +++ b/sheet/lib/src/widgets/scroll_to_top_status_handler.dart @@ -49,7 +49,8 @@ class ScrollToTopStatusBarState extends State { } void _handleStatusBarTap(BuildContext context) { - final ScrollController? controller = PrimaryScrollController.of(context); + final ScrollController? controller = + PrimaryScrollController.maybeOf(context); if (controller != null && controller.hasClients) { controller.animateTo( 0.0, diff --git a/sheet/pubspec.lock b/sheet/pubspec.lock index 26c63491..fd6e1e48 100644 --- a/sheet/pubspec.lock +++ b/sheet/pubspec.lock @@ -434,4 +434,4 @@ packages: version: "3.1.1" sdks: dart: ">=2.18.0 <4.0.0" - flutter: ">=3.3.0" + flutter: ">=3.7.0" diff --git a/sheet/pubspec.yaml b/sheet/pubspec.yaml index 230e3d9e..6aa1680c 100644 --- a/sheet/pubspec.yaml +++ b/sheet/pubspec.yaml @@ -1,11 +1,11 @@ name: sheet description: A fully customizable draggable bottom sheet. -version: 0.0.4+1 +version: 1.0.0-pre homepage: https://github.com/jamesblasco/modal_bottom_sheet environment: sdk: ">=2.17.0 <3.0.0" - flutter: ">=3.3.0" + flutter: ">=3.7.0" dependencies: flutter: From 09f4adcd7b86ac4783cb06a234bd761fdd938626 Mon Sep 17 00:00:00 2001 From: Takeshi Tsukamoto Date: Sun, 18 Jun 2023 18:23:37 +0900 Subject: [PATCH 04/29] Remove accessibleNavigation reference from BottomSheet (#339) --- modal_bottom_sheet/lib/src/bottom_sheet.dart | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/modal_bottom_sheet/lib/src/bottom_sheet.dart b/modal_bottom_sheet/lib/src/bottom_sheet.dart index da1600cc..ffb88ba9 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheet.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheet.dart @@ -366,16 +366,13 @@ class ModalBottomSheetState extends State ); } - final mediaQuery = MediaQuery.of(context); - child = AnimatedBuilder( animation: widget.animationController, builder: (context, Widget? child) { assert(child != null); final animationValue = animationCurve.transform( - mediaQuery.accessibleNavigation - ? 1.0 - : widget.animationController.value); + widget.animationController.value, + ); final draggableChild = !widget.enableDrag ? child From 2005ba18e33bf29281f97cfe6335dd796c079a14 Mon Sep 17 00:00:00 2001 From: Amarjeet Srivastava <59501867+harshitAmar@users.noreply.github.com> Date: Sun, 18 Jun 2023 14:54:56 +0530 Subject: [PATCH 05/29] fixes (#353) --- .../lib/src/bottom_sheets/bar_bottom_sheet.dart | 6 ++---- .../src/bottom_sheets/material_bottom_sheet.dart | 11 +++++------ .../lib/src/material_with_modal_page_route.dart | 16 +++++++++++----- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/modal_bottom_sheet/lib/src/bottom_sheets/bar_bottom_sheet.dart b/modal_bottom_sheet/lib/src/bottom_sheets/bar_bottom_sheet.dart index fb5c9df9..c866a951 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheets/bar_bottom_sheet.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheets/bar_bottom_sheet.dart @@ -1,10 +1,8 @@ import 'dart:async'; -import 'package:flutter/material.dart'; +import 'package:flutter/material.dart' hide ModalBottomSheetRoute; import 'package:flutter/services.dart'; -import '../../modal_bottom_sheet.dart' as modal_bottom_sheet; - const Radius kDefaultBarTopRadius = Radius.circular(15); class BarBottomSheet extends StatelessWidget { @@ -98,7 +96,7 @@ Future showBarModalBottomSheet({ assert(debugCheckHasMediaQuery(context)); assert(debugCheckHasMaterialLocalizations(context)); final result = await Navigator.of(context, rootNavigator: useRootNavigator) - .push(modal_bottom_sheet.ModalSheetRoute( + .push(ModalBottomSheetRoute( builder: builder, bounce: bounce, closeProgressThreshold: closeProgressThreshold, diff --git a/modal_bottom_sheet/lib/src/bottom_sheets/material_bottom_sheet.dart b/modal_bottom_sheet/lib/src/bottom_sheets/material_bottom_sheet.dart index cb3149ca..f1b9ae65 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheets/material_bottom_sheet.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheets/material_bottom_sheet.dart @@ -1,8 +1,8 @@ -import 'package:flutter/material.dart'; -import 'package:modal_bottom_sheet/modal_bottom_sheet.dart' - as modal_bottom_sheet; import 'dart:async'; +import 'package:flutter/material.dart' hide ModalBottomSheetRoute; +import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; + /// Shows a modal material design bottom sheet. Future showMaterialModalBottomSheet({ required BuildContext context, @@ -26,7 +26,7 @@ Future showMaterialModalBottomSheet({ assert(debugCheckHasMediaQuery(context)); assert(debugCheckHasMaterialLocalizations(context)); final result = await Navigator.of(context, rootNavigator: useRootNavigator) - .push(modal_bottom_sheet.ModalSheetRoute( + .push(ModalBottomSheetRoute( builder: builder, closeProgressThreshold: closeProgressThreshold, containerBuilder: _materialContainerBuilder( @@ -52,8 +52,7 @@ Future showMaterialModalBottomSheet({ } //Default container builder is the Material Appearance -modal_bottom_sheet.WidgetWithChildBuilder _materialContainerBuilder( - BuildContext context, +WidgetWithChildBuilder _materialContainerBuilder(BuildContext context, {Color? backgroundColor, double? elevation, ThemeData? theme, diff --git a/modal_bottom_sheet/lib/src/material_with_modal_page_route.dart b/modal_bottom_sheet/lib/src/material_with_modal_page_route.dart index 95066ba3..76d997be 100644 --- a/modal_bottom_sheet/lib/src/material_with_modal_page_route.dart +++ b/modal_bottom_sheet/lib/src/material_with_modal_page_route.dart @@ -1,7 +1,8 @@ import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; +import 'package:flutter/material.dart' hide ModalBottomSheetRoute; -import '../modal_bottom_sheet.dart' as modal_bottom_sheet; +import '../modal_bottom_sheet.dart'; +import 'bottom_sheet_route.dart'; class MaterialWithModalsPageRoute extends MaterialPageRoute { /// Construct a MaterialPageRoute whose contents are defined by [builder]. @@ -19,7 +20,7 @@ class MaterialWithModalsPageRoute extends MaterialPageRoute { builder: builder, maintainState: maintainState); - modal_bottom_sheet.ModalSheetRoute? _nextModalRoute; + ModalBottomSheetRoute? _nextModalRoute; @override bool canTransitionTo(TransitionRoute nextRoute) { @@ -28,18 +29,23 @@ class MaterialWithModalsPageRoute extends MaterialPageRoute { (nextRoute is CupertinoPageRoute && !nextRoute.fullscreenDialog) || (nextRoute is MaterialWithModalsPageRoute && !nextRoute.fullscreenDialog) || - (nextRoute is modal_bottom_sheet.ModalSheetRoute); + (nextRoute is ModalBottomSheetRoute); } @override void didChangeNext(Route? nextRoute) { - if (nextRoute is modal_bottom_sheet.ModalSheetRoute) { + if (nextRoute is ModalBottomSheetRoute) { _nextModalRoute = nextRoute; } super.didChangeNext(nextRoute); } + @override + void didPopNext(Route nextRoute) { + super.didPopNext(nextRoute); + } + @override bool didPop(T? result) { _nextModalRoute = null; From 62c54282459bd020ce0fb3c8d20c77bd7fa7d64e Mon Sep 17 00:00:00 2001 From: Matthieu Pernelle Date: Sun, 18 Jun 2023 11:27:49 +0200 Subject: [PATCH 06/29] :bug: (Annotated region) (#352) * :bug: (Annotated region) Move annatated region in _CupertinoBottomSheetContainer and made overlayStyle depend on transitionBackgroundColor luminance * :bug: (OverlayStyle) remove computed overlayStyle in showCupertinoModalBottomSheet function --- .../bottom_sheets/cupertino_bottom_sheet.dart | 113 +++++++++++------- 1 file changed, 68 insertions(+), 45 deletions(-) diff --git a/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart b/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart index 0b3c8a34..6972e71d 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart @@ -18,6 +18,7 @@ import 'package:flutter/material.dart' Colors, MaterialLocalizations, Theme, + ThemeData, debugCheckHasMaterialLocalizations; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; @@ -30,6 +31,13 @@ const Radius _kDefaultTopRadius = Radius.circular(12); const BoxShadow _kDefaultBoxShadow = BoxShadow(blurRadius: 10, color: Colors.black12, spreadRadius: 5); +SystemUiOverlayStyle overlayStyleFromColor(Color color) { + final brightness = ThemeData.estimateBrightnessForColor(color); + return brightness == Brightness.dark + ? SystemUiOverlayStyle.light + : SystemUiOverlayStyle.dark; +} + /// Cupertino Bottom Sheet Container /// /// Clip the child widget to rectangle with top rounded corners and adds @@ -40,17 +48,20 @@ class _CupertinoBottomSheetContainer extends StatelessWidget { final Color? backgroundColor; final Radius topRadius; final BoxShadow? shadow; + final SystemUiOverlayStyle? overlayStyle; const _CupertinoBottomSheetContainer({ Key? key, required this.child, this.backgroundColor, required this.topRadius, + this.overlayStyle, this.shadow, }) : super(key: key); @override Widget build(BuildContext context) { + final scopedOverlayStyle = overlayStyle; final topSafeAreaPadding = MediaQuery.of(context).padding.top; final topPadding = _kPreviousPageVisibleOffset + topSafeAreaPadding; @@ -58,7 +69,7 @@ class _CupertinoBottomSheetContainer extends StatelessWidget { BoxShadow(blurRadius: 10, color: Colors.black12, spreadRadius: 5); final backgroundColor = this.backgroundColor ?? CupertinoTheme.of(context).scaffoldBackgroundColor; - return Padding( + Widget bottomSheetContainer = Padding( padding: EdgeInsets.only(top: topPadding), child: ClipRRect( borderRadius: BorderRadius.vertical(top: topRadius), @@ -77,6 +88,13 @@ class _CupertinoBottomSheetContainer extends StatelessWidget { ), ), ); + if (scopedOverlayStyle != null) { + bottomSheetContainer = AnnotatedRegion( + value: scopedOverlayStyle, + child: bottomSheetContainer, + ); + } + return bottomSheetContainer; } } @@ -111,7 +129,6 @@ Future showCupertinoModalBottomSheet({ final barrierLabel = hasMaterialLocalizations ? MaterialLocalizations.of(context).modalBarrierDismissLabel : ''; - final result = await Navigator.of(context, rootNavigator: useRootNavigator).push( CupertinoModalBottomSheetRoute( @@ -121,6 +138,7 @@ Future showCupertinoModalBottomSheet({ backgroundColor: backgroundColor, topRadius: topRadius, shadow: shadow, + overlayStyle: overlayStyle, ), secondAnimationController: secondAnimation, expanded: expand, @@ -154,6 +172,9 @@ class CupertinoModalBottomSheetRoute extends ModalSheetRoute { // Background color behind all routes // Black by default final Color? transitionBackgroundColor; + @Deprecated( + 'Will be ignored. OverlayStyle is computed from luminance of transitionBackgroundColor', + ) final SystemUiOverlayStyle? overlayStyle; CupertinoModalBottomSheetRoute({ @@ -230,7 +251,6 @@ class CupertinoModalBottomSheetRoute extends ModalSheetRoute { animationCurve: previousRouteAnimationCurve, topRadius: topRadius, backgroundColor: transitionBackgroundColor ?? Colors.black, - overlayStyle: overlayStyle, ); } } @@ -240,7 +260,6 @@ class _CupertinoModalTransition extends StatelessWidget { final Radius topRadius; final Curve? animationCurve; final Color backgroundColor; - final SystemUiOverlayStyle? overlayStyle; final Widget body; @@ -251,7 +270,6 @@ class _CupertinoModalTransition extends StatelessWidget { required this.topRadius, this.backgroundColor = Colors.black, this.animationCurve, - this.overlayStyle, }) : super(key: key); @override @@ -268,50 +286,47 @@ class _CupertinoModalTransition extends StatelessWidget { curve: animationCurve ?? Curves.easeOut, ); - return AnnotatedRegion( - value: overlayStyle ?? SystemUiOverlayStyle.light, - child: AnimatedBuilder( - animation: curvedAnimation, - child: body, - builder: (context, child) { - final progress = curvedAnimation.value; - final yOffset = progress * paddingTop; - final scale = 1 - progress / 10; - final radius = progress == 0 - ? 0.0 - : (1 - progress) * startRoundCorner + progress * topRadius.x; - return Stack( - children: [ - Container(color: backgroundColor), - Transform.translate( - offset: Offset(0, yOffset), - child: Transform.scale( - scale: scale, - alignment: Alignment.topCenter, - child: ClipRRect( - borderRadius: BorderRadius.circular(radius), - child: CupertinoUserInterfaceLevel( - data: CupertinoUserInterfaceLevelData.elevated, - child: Builder( - builder: (context) => CupertinoTheme( - data: createPreviousRouteTheme( - context, - curvedAnimation, - ), - child: CupertinoUserInterfaceLevel( - data: CupertinoUserInterfaceLevelData.base, - child: child!, - ), + return AnimatedBuilder( + animation: curvedAnimation, + child: body, + builder: (context, child) { + final progress = curvedAnimation.value; + final yOffset = progress * paddingTop; + final scale = 1 - progress / 10; + final radius = progress == 0 + ? 0.0 + : (1 - progress) * startRoundCorner + progress * topRadius.x; + return Stack( + children: [ + Container(color: backgroundColor), + Transform.translate( + offset: Offset(0, yOffset), + child: Transform.scale( + scale: scale, + alignment: Alignment.topCenter, + child: ClipRRect( + borderRadius: BorderRadius.circular(radius), + child: CupertinoUserInterfaceLevel( + data: CupertinoUserInterfaceLevelData.elevated, + child: Builder( + builder: (context) => CupertinoTheme( + data: createPreviousRouteTheme( + context, + curvedAnimation, + ), + child: CupertinoUserInterfaceLevel( + data: CupertinoUserInterfaceLevelData.base, + child: child!, ), ), ), ), ), ), - ], - ); - }, - ), + ), + ], + ); + }, ); } @@ -390,11 +405,13 @@ class CupertinoScaffoldInheirted extends InheritedWidget { final AnimationController? animation; final Radius? topRadius; + final Color transitionBackgroundColor; const CupertinoScaffoldInheirted({ this.animation, required super.child, this.topRadius, + required this.transitionBackgroundColor, }) : super(); @override @@ -440,6 +457,9 @@ class CupertinoScaffold extends StatefulWidget { Duration? duration, RouteSettings? settings, BoxShadow? shadow, + @Deprecated( + 'Will be ignored. OverlayStyle is computed from luminance of transitionBackgroundColor', + ) SystemUiOverlayStyle? overlayStyle, }) async { assert(debugCheckHasMediaQuery(context)); @@ -451,6 +471,9 @@ class CupertinoScaffold extends StatefulWidget { barrierLabel = MaterialLocalizations.of(context).modalBarrierDismissLabel; } final topRadius = CupertinoScaffold.of(context)!.topRadius; + final transitionBackgroundColor = + CupertinoScaffold.of(context)!.transitionBackgroundColor; + final overlayStyle = overlayStyleFromColor(transitionBackgroundColor); final result = await Navigator.of(context, rootNavigator: useRootNavigator) .push(CupertinoModalBottomSheetRoute( closeProgressThreshold: closeProgressThreshold, @@ -461,6 +484,7 @@ class CupertinoScaffold extends StatefulWidget { backgroundColor: backgroundColor, topRadius: topRadius ?? _kDefaultTopRadius, shadow: shadow, + overlayStyle: overlayStyle, ), expanded: expand, barrierLabel: barrierLabel, @@ -473,7 +497,6 @@ class CupertinoScaffold extends StatefulWidget { previousRouteAnimationCurve: previousRouteAnimationCurve, duration: duration, settings: settings, - overlayStyle: overlayStyle, )); return result; } @@ -495,12 +518,12 @@ class _CupertinoScaffoldState extends State return CupertinoScaffoldInheirted( animation: animationController, topRadius: widget.topRadius, + transitionBackgroundColor: widget.transitionBackgroundColor, child: _CupertinoModalTransition( secondaryAnimation: animationController, body: widget.body, topRadius: widget.topRadius, backgroundColor: widget.transitionBackgroundColor, - overlayStyle: widget.overlayStyle, ), ); } From 39174843294cf19ec8a3a624c32034227cdfd788 Mon Sep 17 00:00:00 2001 From: Mirko Mucaria Date: Sun, 18 Jun 2023 11:28:19 +0200 Subject: [PATCH 07/29] fixes issue 343 (#344) --- sheet/lib/src/route/base_route_extended.dart | 4 +- .../src/route/base_route_extended_test.dart | 60 +++++++++++++++++++ 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/sheet/lib/src/route/base_route_extended.dart b/sheet/lib/src/route/base_route_extended.dart index 7779d1b0..8bf6951d 100644 --- a/sheet/lib/src/route/base_route_extended.dart +++ b/sheet/lib/src/route/base_route_extended.dart @@ -73,7 +73,7 @@ class _PageBasedMaterialPageRoute extends MaterialExtendedPageRoute { @override Widget buildContent(BuildContext context) { - return builder(context); + return _page.child; } @override @@ -150,7 +150,7 @@ class _PageBasedCupertinoPageRoute extends CupertinoExtendedPageRoute { @override Widget buildContent(BuildContext context) { - return builder(context); + return _page.child; } @override diff --git a/sheet/test/src/route/base_route_extended_test.dart b/sheet/test/src/route/base_route_extended_test.dart index 9119b0f0..f9016b5c 100644 --- a/sheet/test/src/route/base_route_extended_test.dart +++ b/sheet/test/src/route/base_route_extended_test.dart @@ -55,6 +55,36 @@ void main() { expect(find.text('child'), findsOneWidget); }); + testWidgets('navigating to different routes keeping the same page', + (WidgetTester tester) async { + await tester.pumpWidget(MaterialApp( + builder: (context, child) { + return Navigator( + pages: [ + MaterialExtendedPage(child: Text('first child')), + ], + onPopPage: (route, result) => false, + ); + }, + )); + await tester.pumpAndSettle(); + expect(find.text('first child'), findsOneWidget); + + await tester.pumpWidget(MaterialApp( + builder: (context, child) { + return Navigator( + pages: [ + MaterialExtendedPage(child: Text('second child')), + ], + onPopPage: (route, result) => false, + ); + }, + )); + + await tester.pumpAndSettle(); + expect(find.text('second child'), findsOneWidget); + }); + testWidgets('route is a MaterialExtendedPageRoute', (WidgetTester tester) async { await tester.pumpWidget(MaterialApp( @@ -156,6 +186,36 @@ void main() { expect(find.text('child'), findsOneWidget); }); + testWidgets('navigating to different routes keeping the same page', + (WidgetTester tester) async { + await tester.pumpWidget(MaterialApp( + builder: (context, child) { + return Navigator( + pages: [ + CupertinoExtendedPage(child: Text('first child')), + ], + onPopPage: (route, result) => false, + ); + }, + )); + await tester.pumpAndSettle(); + expect(find.text('first child'), findsOneWidget); + + await tester.pumpWidget(MaterialApp( + builder: (context, child) { + return Navigator( + pages: [ + CupertinoExtendedPage(child: Text('second child')), + ], + onPopPage: (route, result) => false, + ); + }, + )); + + await tester.pumpAndSettle(); + expect(find.text('second child'), findsOneWidget); + }); + testWidgets('route is a CupertinoExtendedPageRoute', (WidgetTester tester) async { await tester.pumpWidget(MaterialApp( From 6a5816d91f7aad2217030a3e598d833867671525 Mon Sep 17 00:00:00 2001 From: saltedpotatos Date: Sun, 3 Sep 2023 12:27:36 -0700 Subject: [PATCH 08/29] Rudimentary fix for devicePixelRatio (#365) Tries to mirror changes made in flutter/flutter PR 126535 for devicePixelRatio Does not mirror changes made to scroll_position.dart @override double get devicePixelRatio => context.devicePixelRatio; --- sheet/lib/src/scrollable.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sheet/lib/src/scrollable.dart b/sheet/lib/src/scrollable.dart index dbfd4f14..2f3f4cd9 100644 --- a/sheet/lib/src/scrollable.dart +++ b/sheet/lib/src/scrollable.dart @@ -392,6 +392,8 @@ class SheetState extends State @override void didChangeDependencies() { + _devicePixelRatio = MediaQuery.maybeDevicePixelRatioOf(context) ?? + View.of(context).devicePixelRatio; _updatePosition(); super.didChangeDependencies(); } @@ -559,6 +561,10 @@ class SheetState extends State @override TickerProvider get vsync => this; + @override + double get devicePixelRatio => _devicePixelRatio; + late double _devicePixelRatio; + @override @protected void setIgnorePointer(bool value) { From d89711deb8f5e5c976ec23585551125700e4a80a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mon?= Date: Mon, 25 Sep 2023 10:19:46 +0100 Subject: [PATCH 09/29] chore: fix analysis issues for flutter 3.1.3 (#376) Co-authored-by: Remon Helmond --- .../examples/sheet/complex_snap_sheet.dart | 2 +- sheet/example/pubspec.lock | 56 +++++++++---------- sheet/lib/src/physics.dart | 8 +-- sheet/pubspec.lock | 54 ++++++++++-------- sheet/test/screen_size_test.dart | 5 +- sheet/test/src/physics_test.dart | 14 +++++ 6 files changed, 81 insertions(+), 58 deletions(-) diff --git a/sheet/example/lib/examples/sheet/complex_snap_sheet.dart b/sheet/example/lib/examples/sheet/complex_snap_sheet.dart index 64bee2cf..fa7095fe 100644 --- a/sheet/example/lib/examples/sheet/complex_snap_sheet.dart +++ b/sheet/example/lib/examples/sheet/complex_snap_sheet.dart @@ -70,7 +70,7 @@ class _AdvancedSnapSheetPageState extends State } } -class MapAppBar extends StatefulWidget with PreferredSizeWidget { +class MapAppBar extends StatefulWidget implements PreferredSizeWidget { const MapAppBar({Key? key, required this.controller}) : super(key: key); final SheetController controller; @override diff --git a/sheet/example/pubspec.lock b/sheet/example/pubspec.lock index 78f8931f..9e8ace10 100644 --- a/sheet/example/pubspec.lock +++ b/sheet/example/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: async - sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" url: "https://pub.dev" source: hosted - version: "2.10.0" + version: "2.11.0" boolean_selector: dependency: transitive description: @@ -21,10 +21,10 @@ packages: dependency: transitive description: name: characters - sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" clock: dependency: transitive description: @@ -37,10 +37,10 @@ packages: dependency: transitive description: name: collection - sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 url: "https://pub.dev" source: hosted - version: "1.17.0" + version: "1.17.2" cupertino_icons: dependency: "direct main" description: @@ -88,14 +88,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.5.1" - js: - dependency: transitive - description: - name: js - sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" - url: "https://pub.dev" - source: hosted - version: "0.6.5" logging: dependency: transitive description: @@ -108,26 +100,26 @@ packages: dependency: transitive description: name: matcher - sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" url: "https://pub.dev" source: hosted - version: "0.12.13" + version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "0.5.0" meta: dependency: transitive description: name: meta - sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.1" nested: dependency: transitive description: @@ -140,10 +132,10 @@ packages: dependency: transitive description: name: path - sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.8.3" provider: dependency: "direct main" description: @@ -158,7 +150,7 @@ packages: path: ".." relative: true source: path - version: "0.0.4+1" + version: "1.0.0-pre" sky_engine: dependency: transitive description: flutter @@ -168,10 +160,10 @@ packages: dependency: transitive description: name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" stack_trace: dependency: transitive description: @@ -208,10 +200,10 @@ packages: dependency: transitive description: name: test_api - sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" url: "https://pub.dev" source: hosted - version: "0.4.16" + version: "0.6.0" vector_math: dependency: transitive description: @@ -220,6 +212,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + web: + dependency: transitive + description: + name: web + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + url: "https://pub.dev" + source: hosted + version: "0.1.4-beta" sdks: - dart: ">=2.18.0 <4.0.0" + dart: ">=3.1.0-185.0.dev <4.0.0" flutter: ">=3.7.0" diff --git a/sheet/lib/src/physics.dart b/sheet/lib/src/physics.dart index 12b59472..d8f0395e 100644 --- a/sheet/lib/src/physics.dart +++ b/sheet/lib/src/physics.dart @@ -169,7 +169,7 @@ class BouncingSheetPhysics extends ScrollPhysics with SheetPhysics { @override Simulation? createBallisticSimulation( ScrollMetrics position, double velocity) { - final Tolerance tolerance = this.tolerance; + final Tolerance tolerance = toleranceFor(position); if (position.outOfRange) { return BouncingScrollSimulation( spring: const SpringDescription( @@ -266,7 +266,7 @@ class NoMomentumSheetPhysics extends ScrollPhysics with SheetPhysics { @override Simulation? createBallisticSimulation( ScrollMetrics position, double velocity) { - final Tolerance tolerance = this.tolerance; + final Tolerance tolerance = toleranceFor(position); if (position.outOfRange) { double? end; if (position.pixels > position.maxScrollExtent) { @@ -336,7 +336,7 @@ class ClampingSheetPhysics extends ScrollPhysics with SheetPhysics { @override Simulation? createBallisticSimulation( ScrollMetrics position, double velocity) { - final Tolerance tolerance = this.tolerance; + final Tolerance tolerance = toleranceFor(position); if (position.outOfRange) { double? end; if (position.pixels > position.maxScrollExtent) { @@ -443,7 +443,7 @@ class SnapSheetPhysics extends ScrollPhysics with SheetPhysics { // if ((velocity <= 0.0 && position.pixels <= position.minScrollExtent) || // (velocity >= 0.0 && position.pixels >= position.maxScrollExtent)) // return super.createBallisticSimulation(position, velocity); - final Tolerance tolerance = this.tolerance; + final Tolerance tolerance = toleranceFor(position); final double target = _getTargetPixels(position, tolerance, velocity); if (target != position.pixels) { return ScrollSpringSimulation( diff --git a/sheet/pubspec.lock b/sheet/pubspec.lock index fd6e1e48..add55cd5 100644 --- a/sheet/pubspec.lock +++ b/sheet/pubspec.lock @@ -29,10 +29,10 @@ packages: dependency: transitive description: name: async - sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" url: "https://pub.dev" source: hosted - version: "2.10.0" + version: "2.11.0" boolean_selector: dependency: transitive description: @@ -45,10 +45,10 @@ packages: dependency: transitive description: name: characters - sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" clock: dependency: transitive description: @@ -61,10 +61,10 @@ packages: dependency: transitive description: name: collection - sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 url: "https://pub.dev" source: hosted - version: "1.17.0" + version: "1.17.2" convert: dependency: transitive description: @@ -183,26 +183,26 @@ packages: dependency: transitive description: name: matcher - sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" url: "https://pub.dev" source: hosted - version: "0.12.13" + version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "0.5.0" meta: dependency: transitive description: name: meta - sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.1" mime: dependency: transitive description: @@ -239,10 +239,10 @@ packages: dependency: transitive description: name: path - sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.8.3" pool: dependency: transitive description: @@ -316,10 +316,10 @@ packages: dependency: transitive description: name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" stack_trace: dependency: transitive description: @@ -356,26 +356,26 @@ packages: dependency: transitive description: name: test - sha256: a5fcd2d25eeadbb6589e80198a47d6a464ba3e2049da473943b8af9797900c2d + sha256: "13b41f318e2a5751c3169137103b60c584297353d4b1761b66029bae6411fe46" url: "https://pub.dev" source: hosted - version: "1.22.0" + version: "1.24.3" test_api: dependency: transitive description: name: test_api - sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" url: "https://pub.dev" source: hosted - version: "0.4.16" + version: "0.6.0" test_core: dependency: transitive description: name: test_core - sha256: "0ef9755ec6d746951ba0aabe62f874b707690b5ede0fecc818b138fcc9b14888" + sha256: "99806e9e6d95c7b059b7a0fc08f07fc53fabe54a829497f0d9676299f1e8637e" url: "https://pub.dev" source: hosted - version: "0.4.20" + version: "0.5.3" typed_data: dependency: transitive description: @@ -408,6 +408,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.2" + web: + dependency: transitive + description: + name: web + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + url: "https://pub.dev" + source: hosted + version: "0.1.4-beta" web_socket_channel: dependency: transitive description: @@ -433,5 +441,5 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=2.18.0 <4.0.0" + dart: ">=3.1.0-185.0.dev <4.0.0" flutter: ">=3.7.0" diff --git a/sheet/test/screen_size_test.dart b/sheet/test/screen_size_test.dart index 62907df7..764e050c 100644 --- a/sheet/test/screen_size_test.dart +++ b/sheet/test/screen_size_test.dart @@ -9,8 +9,9 @@ const Rect kScreenRect = Rect.fromLTRB(0, 0, kScreenWidth, kScreenHeight); void main() { testWidgets('defaultTestSize', (WidgetTester tester) async { - final Size testSize = tester.binding.window.physicalSize / - tester.binding.window.devicePixelRatio; + final Size testSize = + tester.view.physicalSize / tester.view.devicePixelRatio; + expect(testSize, equals(kScreenSize)); }); } diff --git a/sheet/test/src/physics_test.dart b/sheet/test/src/physics_test.dart index b458ebdc..36f6a08e 100644 --- a/sheet/test/src/physics_test.dart +++ b/sheet/test/src/physics_test.dart @@ -77,6 +77,7 @@ void main() { test('overscroll is progressively harder', () { final ScrollMetrics lessOverscrolledPosition = FixedScrollMetrics( + devicePixelRatio: 1, minScrollExtent: 0.0, maxScrollExtent: 1000.0, pixels: -20.0, @@ -86,6 +87,7 @@ void main() { final ScrollMetrics moreOverscrolledPosition = FixedScrollMetrics( minScrollExtent: 0.0, + devicePixelRatio: 1, maxScrollExtent: 1000.0, pixels: -40.0, viewportDimension: 100.0, @@ -114,6 +116,7 @@ void main() { test('easing an overscroll still has resistance', () { final ScrollMetrics overscrolledPosition = FixedScrollMetrics( minScrollExtent: 0.0, + devicePixelRatio: 1, maxScrollExtent: 1000.0, pixels: -20.0, viewportDimension: 100.0, @@ -131,6 +134,7 @@ void main() { final ScrollMetrics scrollPosition = FixedScrollMetrics( minScrollExtent: 0.0, maxScrollExtent: 1000.0, + devicePixelRatio: 1, pixels: 300.0, viewportDimension: 100.0, axisDirection: AxisDirection.down, @@ -150,6 +154,7 @@ void main() { final ScrollMetrics overscrolledPosition = FixedScrollMetrics( minScrollExtent: 0.0, maxScrollExtent: 1000.0, + devicePixelRatio: 1, pixels: -20.0, viewportDimension: 100.0, axisDirection: AxisDirection.down, @@ -168,12 +173,14 @@ void main() { minScrollExtent: 0.0, maxScrollExtent: 10.0, pixels: -20.0, + devicePixelRatio: 1, viewportDimension: 100.0, axisDirection: AxisDirection.down, ); final ScrollMetrics bigListOverscrolledPosition = FixedScrollMetrics( minScrollExtent: 0.0, + devicePixelRatio: 1, maxScrollExtent: 1000.0, pixels: -20.0, viewportDimension: 100.0, @@ -199,6 +206,7 @@ void main() { final ScrollMetrics scrollMetrics = FixedScrollMetrics( minScrollExtent: 0.0, maxScrollExtent: 200.0, + devicePixelRatio: 1, pixels: 10.0, viewportDimension: 100.0, axisDirection: AxisDirection.down, @@ -217,6 +225,7 @@ void main() { final ScrollMetrics scrollMetrics = FixedScrollMetrics( minScrollExtent: 0.0, maxScrollExtent: 200.0, + devicePixelRatio: 1, pixels: 120.0, viewportDimension: 100.0, axisDirection: AxisDirection.down, @@ -237,6 +246,7 @@ void main() { final ScrollMetrics scrollMetrics = FixedScrollMetrics( minScrollExtent: 0.0, maxScrollExtent: 200.0, + devicePixelRatio: 1, pixels: -10.0, viewportDimension: 100.0, axisDirection: AxisDirection.down, @@ -258,6 +268,7 @@ void main() { final ScrollMetrics scrollMetrics = FixedScrollMetrics( minScrollExtent: 0.0, maxScrollExtent: 200.0, + devicePixelRatio: 1, pixels: 120.0, viewportDimension: 100.0, axisDirection: AxisDirection.down, @@ -275,6 +286,7 @@ void main() { final ScrollMetrics scrollMetrics = FixedScrollMetrics( minScrollExtent: 0.0, maxScrollExtent: 200.0, + devicePixelRatio: 1, pixels: -10.0, viewportDimension: 100.0, axisDirection: AxisDirection.down, @@ -303,6 +315,7 @@ void main() { final ScrollMetrics scrollMetrics = FixedScrollMetrics( minScrollExtent: 0.0, maxScrollExtent: 200.0, + devicePixelRatio: 1, pixels: 120.0, viewportDimension: 100.0, axisDirection: AxisDirection.down, @@ -320,6 +333,7 @@ void main() { final ScrollMetrics scrollMetrics = FixedScrollMetrics( minScrollExtent: 0.0, maxScrollExtent: 200.0, + devicePixelRatio: 1, pixels: -10.0, viewportDimension: 100.0, axisDirection: AxisDirection.down, From 9f1817e44c9577bc9bf30bd9eec60361ffd4f1c4 Mon Sep 17 00:00:00 2001 From: Kyle Venn Date: Wed, 8 Nov 2023 12:35:21 -0500 Subject: [PATCH 10/29] Initial route fix (#379) Fixes: https://github.com/jamesblasco/modal_bottom_sheet/issues/228 --- modal_bottom_sheet/lib/src/bottom_sheet_route.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modal_bottom_sheet/lib/src/bottom_sheet_route.dart b/modal_bottom_sheet/lib/src/bottom_sheet_route.dart index b5801ad5..e0dc21b3 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheet_route.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheet_route.dart @@ -180,7 +180,7 @@ class ModalSheetRoute extends PageRoute { AnimationController createAnimationController() { assert(_animationController == null); _animationController = ModalBottomSheet.createAnimationController( - navigator!.overlay!, + navigator!, duration: transitionDuration, ); return _animationController!; From 62e11d6cf2475996e296ba723475a0ddf7232e95 Mon Sep 17 00:00:00 2001 From: Jaime Blasco Date: Wed, 8 Nov 2023 18:37:55 +0100 Subject: [PATCH 11/29] feat: sheet improvements (#355) * feat: sheet improvements * fix: remove unused simulation * fix: rebase * fix: update dependencies --- .../ios/Flutter/AppFrameworkInfo.plist | 2 +- modal_bottom_sheet/example/ios/Podfile | 2 +- modal_bottom_sheet/example/ios/Podfile.lock | 8 +- .../ios/Runner.xcodeproj/project.pbxproj | 17 ++- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- .../example/ios/Runner/Info.plist | 2 + modal_bottom_sheet/example/pubspec.lock | 98 +++++++------- .../src/bottom_sheets/bar_bottom_sheet.dart | 5 +- .../bottom_sheets/material_bottom_sheet.dart | 2 +- .../src/material_with_modal_page_route.dart | 11 +- modal_bottom_sheet/pubspec.lock | 59 ++++---- modal_bottom_sheet/pubspec.yaml | 3 +- sheet/README.md | 12 +- .../ios/Runner.xcodeproj/project.pbxproj | 11 +- sheet/example/ios/Runner/Info.plist | 2 + .../examples/modal_with_nested_scroll.dart | 126 +++++++++++++++--- .../examples/route/navigation/go_router.dart | 6 +- sheet/example/lib/route_example_page.dart | 18 +-- .../macos/Runner.xcodeproj/project.pbxproj | 11 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- sheet/example/pubspec.lock | 14 +- sheet/example/pubspec.yaml | 9 +- sheet/lib/src/physics.dart | 9 +- sheet/lib/src/route/base_route_extended.dart | 61 +++------ .../lib/src/route/cupertino/sheet_route.dart | 34 +++-- sheet/lib/src/route/sheet_route.dart | 81 +++++------ sheet/lib/src/scroll_controller.dart | 62 +++------ sheet/lib/src/scrollable.dart | 10 +- sheet/lib/src/sheet.dart | 73 +++++----- .../src/widgets/default_sheet_controller.dart | 2 +- sheet/lib/src/widgets/material_sheet.dart | 42 ++++++ sheet/pubspec.lock | 93 +++++++------ sheet/pubspec.yaml | 3 +- sheet/test/screen_size_test.dart | 1 - sheet/test/src/physics_test.dart | 8 +- 35 files changed, 478 insertions(+), 423 deletions(-) create mode 100644 sheet/lib/src/widgets/material_sheet.dart diff --git a/modal_bottom_sheet/example/ios/Flutter/AppFrameworkInfo.plist b/modal_bottom_sheet/example/ios/Flutter/AppFrameworkInfo.plist index 8d4492f9..9625e105 100644 --- a/modal_bottom_sheet/example/ios/Flutter/AppFrameworkInfo.plist +++ b/modal_bottom_sheet/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 9.0 + 11.0 diff --git a/modal_bottom_sheet/example/ios/Podfile b/modal_bottom_sheet/example/ios/Podfile index 1e8c3c90..88359b22 100644 --- a/modal_bottom_sheet/example/ios/Podfile +++ b/modal_bottom_sheet/example/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '9.0' +# platform :ios, '11.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/modal_bottom_sheet/example/ios/Podfile.lock b/modal_bottom_sheet/example/ios/Podfile.lock index 6bb8168c..a1127c65 100644 --- a/modal_bottom_sheet/example/ios/Podfile.lock +++ b/modal_bottom_sheet/example/ios/Podfile.lock @@ -14,9 +14,9 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/url_launcher_ios/ios" SPEC CHECKSUMS: - Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a - url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de + Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 + url_launcher_ios: ae1517e5e344f5544fb090b079e11f399dfbe4d2 -PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c +PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 -COCOAPODS: 1.11.3 +COCOAPODS: 1.13.0 diff --git a/modal_bottom_sheet/example/ios/Runner.xcodeproj/project.pbxproj b/modal_bottom_sheet/example/ios/Runner.xcodeproj/project.pbxproj index 40cde136..1418909a 100644 --- a/modal_bottom_sheet/example/ios/Runner.xcodeproj/project.pbxproj +++ b/modal_bottom_sheet/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -113,7 +113,6 @@ 9E13656F8C2A211F9F4C04EF /* Pods-Runner.release.xcconfig */, C33049C8773181A0B4BCD4EE /* Pods-Runner.profile.xcconfig */, ); - name = Pods; path = Pods; sourceTree = ""; }; @@ -156,7 +155,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1430; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -200,10 +199,12 @@ /* Begin PBXShellScriptBuildPhase section */ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", ); name = "Thin Binary"; outputPaths = ( @@ -214,6 +215,7 @@ }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -340,7 +342,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -356,6 +358,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = 87RQQPQ85J; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -417,7 +420,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -466,7 +469,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -483,6 +486,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = 87RQQPQ85J; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -505,6 +509,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = 87RQQPQ85J; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( diff --git a/modal_bottom_sheet/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/modal_bottom_sheet/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 3db53b6e..b52b2e69 100644 --- a/modal_bottom_sheet/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/modal_bottom_sheet/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ CADisableMinimumFrameDurationOnPhone + UIApplicationSupportsIndirectInputEvents + diff --git a/modal_bottom_sheet/example/pubspec.lock b/modal_bottom_sheet/example/pubspec.lock index 0c9d4ef9..78b15c15 100644 --- a/modal_bottom_sheet/example/pubspec.lock +++ b/modal_bottom_sheet/example/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: async - sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" url: "https://pub.dev" source: hosted - version: "2.10.0" + version: "2.11.0" boolean_selector: dependency: transitive description: @@ -21,10 +21,10 @@ packages: dependency: transitive description: name: characters - sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" clock: dependency: transitive description: @@ -37,18 +37,18 @@ packages: dependency: transitive description: name: collection - sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 url: "https://pub.dev" source: hosted - version: "1.17.0" + version: "1.17.2" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be + sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "1.0.6" fake_async: dependency: transitive description: @@ -72,61 +72,53 @@ packages: description: flutter source: sdk version: "0.0.0" - js: - dependency: transitive - description: - name: js - sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" - url: "https://pub.dev" - source: hosted - version: "0.6.5" matcher: dependency: transitive description: name: matcher - sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" url: "https://pub.dev" source: hosted - version: "0.12.13" + version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "0.5.0" meta: dependency: transitive description: name: meta - sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.1" modal_bottom_sheet: dependency: "direct main" description: path: ".." relative: true source: path - version: "2.1.2" + version: "3.0.1" path: dependency: transitive description: name: path - sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.8.3" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a + sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.6" sky_engine: dependency: transitive description: flutter @@ -136,10 +128,10 @@ packages: dependency: transitive description: name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" stack_trace: dependency: transitive description: @@ -176,74 +168,74 @@ packages: dependency: transitive description: name: test_api - sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" url: "https://pub.dev" source: hosted - version: "0.4.16" + version: "0.6.0" url_launcher: dependency: "direct main" description: name: url_launcher - sha256: "698fa0b4392effdc73e9e184403b627362eb5fbf904483ac9defbb1c2191d809" + sha256: b1c9e98774adf8820c96fbc7ae3601231d324a7d5ebd8babe27b6dfac91357ba url: "https://pub.dev" source: hosted - version: "6.1.8" + version: "6.2.1" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: "3e2f6dfd2c7d9cd123296cab8ef66cfc2c1a13f5845f42c7a0f365690a8a7dd1" + sha256: "31222ffb0063171b526d3e569079cf1f8b294075ba323443fdc690842bfd4def" url: "https://pub.dev" source: hosted - version: "6.0.23" + version: "6.2.0" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: bb328b24d3bccc20bdf1024a0990ac4f869d57663660de9c936fb8c043edefe3 + sha256: "4ac97281cf60e2e8c5cc703b2b28528f9b50c8f7cebc71df6bdf0845f647268a" url: "https://pub.dev" source: hosted - version: "6.0.18" + version: "6.2.0" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - sha256: "318c42cba924e18180c029be69caf0a1a710191b9ec49bb42b5998fdcccee3cc" + sha256: "9f2d390e096fdbe1e6e6256f97851e51afc2d9c423d3432f1d6a02a8a9a8b9fd" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.1.0" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - sha256: "41988b55570df53b3dd2a7fc90c76756a963de6a8c5f8e113330cb35992e2094" + sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234 url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.1.0" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface - sha256: "4eae912628763eb48fc214522e58e942fd16ce195407dbf45638239523c759a6" + sha256: "980e8d9af422f477be6948bdfb68df8433be71f5743a188968b0c1b887807e50" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.2.0" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: "44d79408ce9f07052095ef1f9a693c258d6373dc3944249374e30eff7219ccb0" + sha256: "7fd2f55fe86cea2897b963e864dc01a7eb0719ecc65fcef4c1cc3d686d718bb2" url: "https://pub.dev" source: hosted - version: "2.0.14" + version: "2.2.0" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - sha256: "387e227c4b979034cc52afb11d66b04ed9b288ca1f45beeef39b2ea69e714fa5" + sha256: "7754a1ad30ee896b265f8d14078b0513a4dba28d358eabb9d5f339886f4a1adc" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.1.0" vector_math: dependency: transitive description: @@ -252,6 +244,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + web: + dependency: transitive + description: + name: web + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + url: "https://pub.dev" + source: hosted + version: "0.1.4-beta" sdks: - dart: ">=2.18.0 <4.0.0" - flutter: ">=3.7.0" + dart: ">=3.1.0 <4.0.0" + flutter: ">=3.13.0" diff --git a/modal_bottom_sheet/lib/src/bottom_sheets/bar_bottom_sheet.dart b/modal_bottom_sheet/lib/src/bottom_sheets/bar_bottom_sheet.dart index c866a951..8f8557e7 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheets/bar_bottom_sheet.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheets/bar_bottom_sheet.dart @@ -1,7 +1,8 @@ import 'dart:async'; -import 'package:flutter/material.dart' hide ModalBottomSheetRoute; +import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; const Radius kDefaultBarTopRadius = Radius.circular(15); @@ -96,7 +97,7 @@ Future showBarModalBottomSheet({ assert(debugCheckHasMediaQuery(context)); assert(debugCheckHasMaterialLocalizations(context)); final result = await Navigator.of(context, rootNavigator: useRootNavigator) - .push(ModalBottomSheetRoute( + .push(ModalSheetRoute( builder: builder, bounce: bounce, closeProgressThreshold: closeProgressThreshold, diff --git a/modal_bottom_sheet/lib/src/bottom_sheets/material_bottom_sheet.dart b/modal_bottom_sheet/lib/src/bottom_sheets/material_bottom_sheet.dart index f1b9ae65..ba681efd 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheets/material_bottom_sheet.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheets/material_bottom_sheet.dart @@ -26,7 +26,7 @@ Future showMaterialModalBottomSheet({ assert(debugCheckHasMediaQuery(context)); assert(debugCheckHasMaterialLocalizations(context)); final result = await Navigator.of(context, rootNavigator: useRootNavigator) - .push(ModalBottomSheetRoute( + .push(ModalSheetRoute( builder: builder, closeProgressThreshold: closeProgressThreshold, containerBuilder: _materialContainerBuilder( diff --git a/modal_bottom_sheet/lib/src/material_with_modal_page_route.dart b/modal_bottom_sheet/lib/src/material_with_modal_page_route.dart index 76d997be..f77cb13c 100644 --- a/modal_bottom_sheet/lib/src/material_with_modal_page_route.dart +++ b/modal_bottom_sheet/lib/src/material_with_modal_page_route.dart @@ -20,7 +20,7 @@ class MaterialWithModalsPageRoute extends MaterialPageRoute { builder: builder, maintainState: maintainState); - ModalBottomSheetRoute? _nextModalRoute; + ModalSheetRoute? _nextModalRoute; @override bool canTransitionTo(TransitionRoute nextRoute) { @@ -29,23 +29,18 @@ class MaterialWithModalsPageRoute extends MaterialPageRoute { (nextRoute is CupertinoPageRoute && !nextRoute.fullscreenDialog) || (nextRoute is MaterialWithModalsPageRoute && !nextRoute.fullscreenDialog) || - (nextRoute is ModalBottomSheetRoute); + (nextRoute is ModalSheetRoute); } @override void didChangeNext(Route? nextRoute) { - if (nextRoute is ModalBottomSheetRoute) { + if (nextRoute is ModalSheetRoute) { _nextModalRoute = nextRoute; } super.didChangeNext(nextRoute); } - @override - void didPopNext(Route nextRoute) { - super.didPopNext(nextRoute); - } - @override bool didPop(T? result) { _nextModalRoute = null; diff --git a/modal_bottom_sheet/pubspec.lock b/modal_bottom_sheet/pubspec.lock index bda99394..db9aade7 100644 --- a/modal_bottom_sheet/pubspec.lock +++ b/modal_bottom_sheet/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: async - sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" url: "https://pub.dev" source: hosted - version: "2.10.0" + version: "2.11.0" boolean_selector: dependency: transitive description: @@ -21,10 +21,10 @@ packages: dependency: transitive description: name: characters - sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" clock: dependency: transitive description: @@ -37,10 +37,10 @@ packages: dependency: transitive description: name: collection - sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 url: "https://pub.dev" source: hosted - version: "1.17.0" + version: "1.17.2" fake_async: dependency: transitive description: @@ -59,54 +59,46 @@ packages: description: flutter source: sdk version: "0.0.0" - js: - dependency: transitive - description: - name: js - sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" - url: "https://pub.dev" - source: hosted - version: "0.6.5" lints: dependency: "direct dev" description: name: lints - sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593" + sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.1.1" matcher: dependency: transitive description: name: matcher - sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" url: "https://pub.dev" source: hosted - version: "0.12.13" + version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "0.5.0" meta: dependency: transitive description: name: meta - sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.1" path: dependency: transitive description: name: path - sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.8.3" sky_engine: dependency: transitive description: flutter @@ -116,10 +108,10 @@ packages: dependency: transitive description: name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" stack_trace: dependency: transitive description: @@ -156,10 +148,10 @@ packages: dependency: transitive description: name: test_api - sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" url: "https://pub.dev" source: hosted - version: "0.4.16" + version: "0.6.0" vector_math: dependency: transitive description: @@ -168,6 +160,13 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + web: + dependency: transitive + description: + name: web + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + url: "https://pub.dev" + source: hosted + version: "0.1.4-beta" sdks: - dart: ">=2.18.0 <4.0.0" - flutter: ">=3.7.0" + dart: ">=3.1.0-185.0.dev <4.0.0" diff --git a/modal_bottom_sheet/pubspec.yaml b/modal_bottom_sheet/pubspec.yaml index 57228c71..f57053d6 100644 --- a/modal_bottom_sheet/pubspec.yaml +++ b/modal_bottom_sheet/pubspec.yaml @@ -1,11 +1,10 @@ name: modal_bottom_sheet description: 'Create awesome and powerful modal bottom sheets. Material, Cupertino iOS 13 or create your own style' -version: 3.0.0-pre +version: 3.0.1 homepage: 'https://github.com/jamesblasco/modal_bottom_sheet' environment: sdk: ">=2.17.0 <3.0.0" - flutter: ">=3.7.0" dependencies: flutter: diff --git a/sheet/README.md b/sheet/README.md index 13934a15..221c3765 100644 --- a/sheet/README.md +++ b/sheet/README.md @@ -47,7 +47,7 @@ Stack( ``` -The widget has several parameters that allow fully costumization of the sheet +The widget has several parameters that allow fully customization of the sheet #### Add an initial position @@ -60,7 +60,7 @@ Sheet( ) ``` -#### Clamp the sheet between a min and maximun values +#### Clamp the sheet between a min and maximum values You can set a `minExtent` and `maxExtent` to limit the position of the Sheet between those values @@ -89,9 +89,9 @@ Sheet( #### Fit modes -By default the sheet height will be the minimun between the max available height and the one recommended by the child. +By default the sheet height will be the minimum between the max available height and the one recommended by the child. -It is possible to force the sheet child to be the maxium size available by setting `SheetFit.expand` +It is possible to force the sheet child to be the maximum size available by setting `SheetFit.expand` ```dart Sheet( @@ -104,7 +104,7 @@ Sheet( #### Resizable By default the sheet has a fixed sized and it is vertically translated according to the user drag. -It is posible to make the sheet change the height of the child by setting `resize: true` +It is possible to make the sheet change the height of the child by setting `resize: true` This will force the child to fit the available visual space. ```dart @@ -131,7 +131,7 @@ Sheet( #### Control the position of the sheet -It is possible to pass a `SheetController` to control programatically the position of the sheet. +It is possible to pass a `SheetController` to control programmatically the position of the sheet. ```dart SheetController controller = SheetController(); diff --git a/sheet/example/ios/Runner.xcodeproj/project.pbxproj b/sheet/example/ios/Runner.xcodeproj/project.pbxproj index fc4ebb6e..f45ef400 100644 --- a/sheet/example/ios/Runner.xcodeproj/project.pbxproj +++ b/sheet/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -171,10 +171,12 @@ /* Begin PBXShellScriptBuildPhase section */ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", ); name = "Thin Binary"; outputPaths = ( @@ -185,6 +187,7 @@ }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -288,7 +291,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 8734Y6QF3F; + DEVELOPMENT_TEAM = 87RQQPQ85J; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -425,7 +428,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 8734Y6QF3F; + DEVELOPMENT_TEAM = 87RQQPQ85J; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -456,7 +459,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 8734Y6QF3F; + DEVELOPMENT_TEAM = 87RQQPQ85J; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", diff --git a/sheet/example/ios/Runner/Info.plist b/sheet/example/ios/Runner/Info.plist index 1579fb30..4f68a2ce 100644 --- a/sheet/example/ios/Runner/Info.plist +++ b/sheet/example/ios/Runner/Info.plist @@ -43,5 +43,7 @@ CADisableMinimumFrameDurationOnPhone + UIApplicationSupportsIndirectInputEvents + diff --git a/sheet/example/lib/examples/route/examples/modal_with_nested_scroll.dart b/sheet/example/lib/examples/route/examples/modal_with_nested_scroll.dart index e0b4b384..9bc00dbc 100644 --- a/sheet/example/lib/examples/route/examples/modal_with_nested_scroll.dart +++ b/sheet/example/lib/examples/route/examples/modal_with_nested_scroll.dart @@ -5,28 +5,112 @@ class NestedScrollModal extends StatelessWidget { @override Widget build(BuildContext context) { - return NestedScrollView( - physics: const ClampingScrollPhysics(), - controller: PrimaryScrollController.of(context), - headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { - return [ - SliverList( - delegate: SliverChildListDelegate( - [ - Container(height: 300, color: Colors.blue), - ], - ), + final List tabs = ['Tab 1', 'Tab 2']; + return DefaultTabController( + length: tabs.length, // This is the number of tabs. + child: Scaffold( + body: NestedScrollView( + headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { + // These are the slivers that show up in the "outer" scroll view. + return [ + SliverOverlapAbsorber( + // This widget takes the overlapping behavior of the SliverAppBar, + // and redirects it to the SliverOverlapInjector below. If it is + // missing, then it is possible for the nested "inner" scroll view + // below to end up under the SliverAppBar even when the inner + // scroll view thinks it has not been scrolled. + // This is not necessary if the "headerSliverBuilder" only builds + // widgets that do not overlap the next sliver. + handle: + NestedScrollView.sliverOverlapAbsorberHandleFor(context), + sliver: SliverAppBar( + title: + const Text('Books'), // This is the title in the app bar. + pinned: true, + expandedHeight: 150.0, + // The "forceElevated" property causes the SliverAppBar to show + // a shadow. The "innerBoxIsScrolled" parameter is true when the + // inner scroll view is scrolled beyond its "zero" point, i.e. + // when it appears to be scrolled below the SliverAppBar. + // Without this, there are cases where the shadow would appear + // or not appear inappropriately, because the SliverAppBar is + // not actually aware of the precise position of the inner + // scroll views. + forceElevated: innerBoxIsScrolled, + bottom: TabBar( + // These are the widgets to put in each tab in the tab bar. + tabs: tabs.map((String name) => Tab(text: name)).toList(), + ), + ), + ), + ]; + }, + body: TabBarView( + // These are the contents of the tab views, below the tabs. + children: tabs.map((String name) { + return SafeArea( + top: false, + bottom: false, + child: Builder( + // This Builder is needed to provide a BuildContext that is + // "inside" the NestedScrollView, so that + // sliverOverlapAbsorberHandleFor() can find the + // NestedScrollView. + builder: (BuildContext context) { + return CustomScrollView( + controller: PrimaryScrollController.of(context), + // The "controller" and "primary" members should be left + // unset, so that the NestedScrollView can control this + // inner scroll view. + // If the "controller" property is set, then this scroll + // view will not be associated with the NestedScrollView. + // The PageStorageKey should be unique to this ScrollView; + // it allows the list to remember its scroll position when + // the tab view is not on the screen. + key: PageStorageKey(name), + slivers: [ + SliverOverlapInjector( + // This is the flip side of the SliverOverlapAbsorber + // above. + handle: + NestedScrollView.sliverOverlapAbsorberHandleFor( + context), + ), + SliverPadding( + padding: const EdgeInsets.all(8.0), + // In this example, the inner scroll view has + // fixed-height list items, hence the use of + // SliverFixedExtentList. However, one could use any + // sliver widget here, e.g. SliverList or SliverGrid. + sliver: SliverFixedExtentList( + // The items in this example are fixed to 48 pixels + // high. This matches the Material Design spec for + // ListTile widgets. + itemExtent: 48.0, + delegate: SliverChildBuilderDelegate( + (BuildContext context, int index) { + // This builder is called for each child. + // In this example, we just number each list item. + return ListTile( + title: Text('Item $index'), + ); + }, + // The childCount of the SliverChildBuilderDelegate + // specifies how many children this inner list + // has. In this example, each tab has a list of + // exactly 30 items, but this is arbitrary. + childCount: 30, + ), + ), + ), + ], + ); + }, + ), + ); + }).toList(), ), - ]; - }, - body: ListView.builder( - itemBuilder: (BuildContext context, int index) { - return Container( - height: 100, - color: index.isOdd ? Colors.green : Colors.orange, - ); - }, - itemCount: 12, + ), ), ); } diff --git a/sheet/example/lib/examples/route/navigation/go_router.dart b/sheet/example/lib/examples/route/navigation/go_router.dart index a202b175..d7196e73 100644 --- a/sheet/example/lib/examples/route/navigation/go_router.dart +++ b/sheet/example/lib/examples/route/navigation/go_router.dart @@ -66,7 +66,7 @@ class _GoRouterBooksAppState extends State { name: 'book', path: 'book/:bid', pageBuilder: (BuildContext context, GoRouterState state) { - final String id = state.params['bid']!; + final String id = state.pathParameters['bid']!; final Book? book = books.firstWhereOrNull((Book b) => b.id == id); return CupertinoSheetPage( @@ -76,8 +76,8 @@ class _GoRouterBooksAppState extends State { ), ); }, - redirect: (GoRouterState state) { - final String id = state.params['bid']!; + redirect: (context, state) { + final String id = state.pathParameters['bid']!; final Book? book = books.firstWhereOrNull((Book b) => b.id == id); if (book == null) { diff --git a/sheet/example/lib/route_example_page.dart b/sheet/example/lib/route_example_page.dart index 8ca01831..15368244 100644 --- a/sheet/example/lib/route_example_page.dart +++ b/sheet/example/lib/route_example_page.dart @@ -17,6 +17,7 @@ import 'package:flutter/material.dart'; import 'package:sheet/route.dart'; import 'package:sheet/sheet.dart'; +import 'examples/route/examples/modal_with_nested_scroll.dart'; import 'examples/route/navigation/go_router.dart'; class RouteExamplePage extends StatelessWidget { @@ -251,15 +252,14 @@ class RouteExamplePage extends StatelessWidget { ), ), - // TODO(jaime): It does not work for nested scroll yet - // ListTile( - // title: Text('Modal with Nested Scroll'), - // onTap: () => Navigator.of(context).push( - // CupertinoSheetRoute( - // builder: (context) => NestedScrollModal(), - // ), - // ), - // ), + ListTile( + title: Text('Modal with Nested Scroll'), + onTap: () => Navigator.of(context).push( + CupertinoSheetRoute( + builder: (context) => NestedScrollModal(), + ), + ), + ), ListTile( title: const Text('Modal with PageView'), onTap: () => Navigator.of(context).push( diff --git a/sheet/example/macos/Runner.xcodeproj/project.pbxproj b/sheet/example/macos/Runner.xcodeproj/project.pbxproj index 4f661d4a..7e96b2fe 100644 --- a/sheet/example/macos/Runner.xcodeproj/project.pbxproj +++ b/sheet/example/macos/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 54; objects = { /* Begin PBXAggregateTarget section */ @@ -182,7 +182,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = "The Flutter Authors"; TargetAttributes = { 33CC10EC2044A3C60003C045 = { @@ -235,6 +235,7 @@ /* Begin PBXShellScriptBuildPhase section */ 3399D490228B24CF009A79C7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -344,7 +345,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; @@ -427,7 +428,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -474,7 +475,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; diff --git a/sheet/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/sheet/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index df12c333..ad089fa5 100644 --- a/sheet/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/sheet/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ =3.1.0-185.0.dev <4.0.0" - flutter: ">=3.7.0" + flutter: ">=3.3.0" diff --git a/sheet/example/pubspec.yaml b/sheet/example/pubspec.yaml index 8baa7c65..47b2e984 100644 --- a/sheet/example/pubspec.yaml +++ b/sheet/example/pubspec.yaml @@ -4,18 +4,17 @@ publish_to: 'none' version: 1.0.0+1 environment: - sdk: ">=2.17.0 <3.0.0" - flutter: ">=3.7.0" + sdk: ">=3.0.0 <4.0.0" dependencies: flutter: sdk: flutter - equatable: ^2.0.3 + equatable: ^2.0.5 cupertino_icons: ^1.0.0 - provider: ^6.0.2 + provider: ^6.0.5 sheet: path: ../ - go_router: ^4.3.0 + go_router: ^8.0.5 dev_dependencies: flutter_test: diff --git a/sheet/lib/src/physics.dart b/sheet/lib/src/physics.dart index d8f0395e..370c66ed 100644 --- a/sheet/lib/src/physics.dart +++ b/sheet/lib/src/physics.dart @@ -169,7 +169,7 @@ class BouncingSheetPhysics extends ScrollPhysics with SheetPhysics { @override Simulation? createBallisticSimulation( ScrollMetrics position, double velocity) { - final Tolerance tolerance = toleranceFor(position); + if (position.outOfRange) { return BouncingScrollSimulation( spring: const SpringDescription( @@ -181,7 +181,7 @@ class BouncingSheetPhysics extends ScrollPhysics with SheetPhysics { velocity: velocity, leadingExtent: position.minScrollExtent, trailingExtent: position.maxScrollExtent, - tolerance: tolerance, + tolerance: toleranceFor(position), ); } return super.createBallisticSimulation(position, velocity); @@ -266,7 +266,6 @@ class NoMomentumSheetPhysics extends ScrollPhysics with SheetPhysics { @override Simulation? createBallisticSimulation( ScrollMetrics position, double velocity) { - final Tolerance tolerance = toleranceFor(position); if (position.outOfRange) { double? end; if (position.pixels > position.maxScrollExtent) { @@ -280,7 +279,7 @@ class NoMomentumSheetPhysics extends ScrollPhysics with SheetPhysics { position.pixels, end!, math.min(0.0, velocity), - tolerance: tolerance, + tolerance: toleranceFor(position), ); } return null; @@ -514,7 +513,7 @@ class SnapSheetPhysics extends ScrollPhysics with SheetPhysics { } /// Describes how [SheetScrollable] widgets should behave. -class SheetBehaviour extends ScrollBehavior { +class SheetBehavior extends ScrollBehavior { static const SheetPhysics _clampingPhysics = NoMomentumSheetPhysics(parent: RangeMaintainingScrollPhysics()); diff --git a/sheet/lib/src/route/base_route_extended.dart b/sheet/lib/src/route/base_route_extended.dart index 8bf6951d..b5c8a058 100644 --- a/sheet/lib/src/route/base_route_extended.dart +++ b/sheet/lib/src/route/base_route_extended.dart @@ -14,16 +14,11 @@ mixin PreviousSheetRouteMixin on PageRoute { class MaterialExtendedPageRoute extends MaterialPageRoute with PreviousSheetRouteMixin, DelegatedTransitionsRoute { MaterialExtendedPageRoute({ - required WidgetBuilder builder, - RouteSettings? settings, - bool maintainState = true, - bool fullscreenDialog = false, - }) : super( - builder: builder, - maintainState: maintainState, - settings: settings, - fullscreenDialog: fullscreenDialog, - ); + required super.builder, + super.settings, + super.maintainState = true, + super.fullscreenDialog = false, + }); } class MaterialExtendedPage extends Page { @@ -32,15 +27,11 @@ class MaterialExtendedPage extends Page { required this.child, this.maintainState = true, this.fullscreenDialog = false, - LocalKey? key, - String? name, - Object? arguments, - String? restorationId, - }) : super( - key: key, - name: name, - arguments: arguments, - restorationId: restorationId); + super.key, + super.name, + super.arguments, + super.restorationId, + }); /// The content to be shown in the [Route] created by this page. final Widget child; @@ -89,18 +80,12 @@ class _PageBasedMaterialPageRoute extends MaterialExtendedPageRoute { class CupertinoExtendedPageRoute extends CupertinoPageRoute with PreviousSheetRouteMixin, DelegatedTransitionsRoute { CupertinoExtendedPageRoute({ - required WidgetBuilder builder, - String? title, - RouteSettings? settings, - bool maintainState = true, - bool fullscreenDialog = false, - }) : super( - builder: builder, - title: title, - maintainState: maintainState, - settings: settings, - fullscreenDialog: fullscreenDialog, - ); + required super.builder, + super.title, + super.settings, + super.maintainState = true, + super.fullscreenDialog = false, + }); } class CupertinoExtendedPage extends Page { @@ -110,15 +95,11 @@ class CupertinoExtendedPage extends Page { this.maintainState = true, this.title, this.fullscreenDialog = false, - LocalKey? key, - String? name, - Object? arguments, - String? restorationId, - }) : super( - key: key, - name: name, - arguments: arguments, - restorationId: restorationId); + super.key, + super.name, + super.arguments, + super.restorationId, + }); /// The content to be shown in the [Route] created by this page. final Widget child; diff --git a/sheet/lib/src/route/cupertino/sheet_route.dart b/sheet/lib/src/route/cupertino/sheet_route.dart index 4cf0fcf2..112eeb01 100644 --- a/sheet/lib/src/route/cupertino/sheet_route.dart +++ b/sheet/lib/src/route/cupertino/sheet_route.dart @@ -26,7 +26,7 @@ const Radius _kCupertinoSheetTopRadius = Radius.circular(10.0); const Radius _kRoundedDeviceRadius = Radius.circular(38.5); /// Minimal distance from the top of the screen to the top of the previous route -/// It will be used ff the top safearea is less than this value. +/// It will be used ff the top safe area is less than this value. /// In iPhones the top SafeArea is more or equal to this distance. const double _kSheetMinimalOffset = 10; @@ -38,18 +38,17 @@ const double _kRoundedDeviceStatusBarHeight = 20; const Curve _kCupertinoSheetCurve = Curves.easeOutExpo; const Curve _kCupertinoTransitionCurve = Curves.linear; -/// Wraps the child into a cupertino modal sheet appareance. This is used to +/// Wraps the child into a cupertino modal sheet appearance. This is used to /// create a [SheetRoute]. /// /// Clip the child widget to rectangle with top rounded corners and adds /// top padding and top safe area. class _CupertinoSheetDecorationBuilder extends StatelessWidget { const _CupertinoSheetDecorationBuilder({ - Key? key, required this.child, required this.topRadius, this.backgroundColor, - }) : super(key: key); + }); /// The child contained by the modal sheet final Widget child; @@ -86,22 +85,22 @@ class _CupertinoSheetDecorationBuilder extends StatelessWidget { } /// A modal route that overlays a widget over the current route and animates -/// it from the bottom with a cupertino modal sheet appareance +/// it from the bottom with a cupertino modal sheet appearance /// /// Clip the child widget to rectangle with top rounded corners and adds /// top padding and top safe area. /// /// * [CupertinoSheetPage], which is the [Page] version of this class class CupertinoSheetRoute extends SheetRoute { - CupertinoSheetRoute( - {required WidgetBuilder builder, - List? stops, - double initialStop = 1, - RouteSettings? settings, - Color? backgroundColor, - bool maintainState = true, - super.fit}) - : super( + CupertinoSheetRoute({ + required WidgetBuilder builder, + super.stops, + double initialStop = 1, + super.settings, + Color? backgroundColor, + super.maintainState = true, + super.fit, + }) : super( builder: (BuildContext context) { return _CupertinoSheetDecorationBuilder( child: Builder(builder: builder), @@ -109,11 +108,8 @@ class CupertinoSheetRoute extends SheetRoute { topRadius: _kCupertinoSheetTopRadius, ); }, - settings: settings, animationCurve: _kCupertinoSheetCurve, - stops: stops, initialExtent: initialStop, - maintainState: maintainState, ); @override @@ -239,7 +235,7 @@ class CupertinoSheetBottomRouteTransition extends StatelessWidget { // Currently iOS does not provide any way to detect the radius of the // screen device. Right not we detect if the safe area has the size - // for the device that contain a notch as they are the ones rigth + // for the device that contain a notch as they are the ones right // now that has corners with radius Radius _getRadiusForDevice(MediaQueryData mediaQuery) { final double topPadding = mediaQuery.padding.top; @@ -305,7 +301,7 @@ class CupertinoSheetBottomRouteTransition extends StatelessWidget { } /// A modal page that overlays a widget over the current route and animates -/// it from the bottom with a cupertino modal sheet appareance +/// it from the bottom with a cupertino modal sheet appearance /// /// Clip the child widget to rectangle with top rounded corners and adds /// top padding and top safe area. diff --git a/sheet/lib/src/route/sheet_route.dart b/sheet/lib/src/route/sheet_route.dart index 3cb29acf..d28ad125 100644 --- a/sheet/lib/src/route/sheet_route.dart +++ b/sheet/lib/src/route/sheet_route.dart @@ -3,6 +3,7 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; import 'package:sheet/route.dart'; import 'package:sheet/sheet.dart'; @@ -27,7 +28,7 @@ const Color _kBarrierColor = Color(0x59000000); /// See also: /// /// * [SheetPage], which is a [Page] of this class. -/// * [CupertinoSheetRoute], which is has an iOS appareance +/// * [CupertinoSheetRoute], which is has an iOS appearance class SheetRoute extends PageRoute with DelegatedTransitionsRoute { SheetRoute({ required this.builder, @@ -45,9 +46,9 @@ class SheetRoute extends PageRoute with DelegatedTransitionsRoute { this.maintainState = true, this.willPopThreshold = _kWillPopThreshold, this.decorationBuilder, - RouteSettings? settings, + super.settings, }) : transitionDuration = duration ?? _kSheetTransitionDuration, - super(settings: settings, fullscreenDialog: true); + super(fullscreenDialog: true); /// Builds the primary contents of the route. final WidgetBuilder builder; @@ -85,7 +86,7 @@ class SheetRoute extends PageRoute with DelegatedTransitionsRoute { /// Drag threshold to block any interaction if [Route.willPop] returns false /// See also: - /// * [WillPopScope], that allow to block an attemp to close a [ModalRoute] + /// * [WillPopScope], that allow to block an attempt to close a [ModalRoute] final double willPopThreshold; /// {@macro flutter.widgets.TransitionRoute.transitionDuration} @@ -95,7 +96,7 @@ class SheetRoute extends PageRoute with DelegatedTransitionsRoute { /// The semantic label used for a sheet modal route. final String? sheetLabel; - /// Wraps the child in a custom sheet decoration appareance + /// Wraps the child in a custom sheet decoration appearance /// /// The default value is null. final SheetDecorationBuilder? decorationBuilder; @@ -225,9 +226,9 @@ class SheetPage extends Page { const SheetPage( {required this.child, this.maintainState = true, - LocalKey? key, - String? name, - Object? arguments, + super.key, + super.name, + super.arguments, this.initialExtent = 1, this.stops, this.draggable = true, @@ -241,12 +242,7 @@ class SheetPage extends Page { this.barrierDismissible = true, this.willPopThreshold = _kWillPopThreshold, this.decorationBuilder}) - : transitionDuration = duration ?? _kSheetTransitionDuration, - super( - key: key, - name: name, - arguments: arguments, - ); + : transitionDuration = duration ?? _kSheetTransitionDuration; /// Relative extent up to where the sheet is animated when pushed for /// the first time. @@ -287,7 +283,7 @@ class SheetPage extends Page { /// Drag threshold to block any interaction if [Route.willPop] returns false /// See also: - /// * [WillPopScope], that allow to block an attemp to close a [ModalRoute] + /// * [WillPopScope], that allow to block an attempt to close a [ModalRoute] final double willPopThreshold; /// {@macro flutter.widgets.TransitionRoute.transitionDuration} @@ -302,7 +298,7 @@ class SheetPage extends Page { final String? barrierLabel; - /// Wraps the child in a custom sheet decoration appareance + /// Wraps the child in a custom sheet decoration appearance /// /// The default value is null. final SheetDecorationBuilder? decorationBuilder; @@ -332,30 +328,17 @@ class SheetPage extends Page { class _PageBasedSheetRoute extends SheetRoute { _PageBasedSheetRoute({ required SheetPage page, - Color? barrierColor, - SheetPhysics? physics, - SheetFit fit = SheetFit.expand, - Curve? animationCurve, - bool barrierDismissible = true, - bool draggable = true, - Duration? duration, - List? stops, - double initialExtent = 1, - SheetDecorationBuilder? decorationBuilder, - }) : super( - settings: page, - builder: (BuildContext context) => page.child, - physics: physics, - fit: fit, - stops: stops, - initialExtent: initialExtent, - barrierDismissible: barrierDismissible, - barrierColor: barrierColor, - draggable: draggable, - animationCurve: animationCurve, - duration: duration, - decorationBuilder: decorationBuilder, - ); + super.physics, + required super.fit, + super.animationCurve, + required super.barrierDismissible, + super.barrierColor, + required super.draggable, + super.duration, + super.stops, + required super.initialExtent, + super.decorationBuilder, + }) : super(settings: page, builder: (BuildContext context) => page.child); SheetPage get _page => settings as SheetPage; @@ -392,7 +375,6 @@ class __SheetRouteContainerState extends State<_SheetRouteContainer> curve: route.animationCurve ?? Curves.easeOut, ); }); - super.initState(); } @@ -406,8 +388,11 @@ class __SheetRouteContainerState extends State<_SheetRouteContainer> void onSheetExtentUpdate() { if (_routeController.value != _sheetController.animation.value) { if (route.isCurrent && + !_firstAnimation && !_sheetController.position.preventingDrag && - route.shouldPreventPopForExtent(_sheetController.animation.value)) { + route.shouldPreventPopForExtent(_sheetController.animation.value) && + _sheetController.position.userScrollDirection == + ScrollDirection.forward) { preventPop(); return; } @@ -420,9 +405,10 @@ class __SheetRouteContainerState extends State<_SheetRouteContainer> toHigh: 1, ); _routeController.value = animationValue; - if (_sheetController.animation.value == 0) { - widget.sheetRoute.navigator?.pop(); + _routeController.value = 0.001; + _routeController.animateBack(0); + route.navigator?.pop(); } } } @@ -436,6 +422,8 @@ class __SheetRouteContainerState extends State<_SheetRouteContainer> if (!_routeController.isAnimating) { return; } + // widget.sheetRoute.navigator!.userGestureInProgressNotifier.value = false; + if (!_firstAnimation && _routeController.value != _sheetController.animation.value) { if (_routeController.status == AnimationStatus.forward) { @@ -462,11 +450,12 @@ class __SheetRouteContainerState extends State<_SheetRouteContainer> @protected void preventPop() { _sheetController.position.preventDrag(); - _sheetController.relativeAnimateTo( - 1, + _sheetController.position.animateTo( + _sheetController.position.maxScrollExtent, duration: const Duration(milliseconds: 400), curve: Curves.easeInOut, ); + route.willPop().then( (RoutePopDisposition disposition) { if (disposition == RoutePopDisposition.pop) { diff --git a/sheet/lib/src/scroll_controller.dart b/sheet/lib/src/scroll_controller.dart index 754738c9..6224c265 100644 --- a/sheet/lib/src/scroll_controller.dart +++ b/sheet/lib/src/scroll_controller.dart @@ -88,7 +88,7 @@ class SheetPrimaryScrollPosition extends ScrollPositionWithSingleContext { final SheetContext sheetContext; SheetPosition get sheetPosition => sheetContext.position; - bool sheetShouldSheetAcceptUserOffser(double delta) { + bool sheetShouldSheetAcceptUserOffset(double delta) { // Can drag down if list already on the top final bool canDragForward = delta >= 0 && pixels <= minScrollExtent; @@ -106,63 +106,37 @@ class SheetPrimaryScrollPosition extends ScrollPositionWithSingleContext { if (sheetPosition.preventingDrag) { return; } - if (sheetShouldSheetAcceptUserOffser(delta)) { - final double pixels = sheetPosition.pixels - + if (sheetShouldSheetAcceptUserOffset(delta)) { + if (sheetPosition.activity is! _SheetScrollActivity) { + sheetPosition.beginActivity(_SheetScrollActivity(sheetPosition)); + } + final double sheetDelta = sheetPosition.physics.applyPhysicsToUserOffset(sheetPosition, delta); - - sheetPosition.forcePixels( - pixels.clamp( - sheetPosition.minScrollExtent, sheetPosition.maxScrollExtent), - ); - sheetPosition.beginActivity(_SheetScrollActivity(sheetPosition)); + sheetPosition.applyUserOffset(sheetDelta); return; } else { super.applyUserOffset(delta); - sheetPosition.goIdle(); + if (sheetPosition.activity is! HoldScrollActivity) { + sheetPosition.hold(() {}); + } } } @override void goBallistic(double velocity) { if (sheetPosition.preventingDrag) { - beginActivity( - BallisticScrollActivity( - this, - ScrollSpringSimulation( - SpringDescription.withDampingRatio( - mass: 0.5, - stiffness: 100.0, - ratio: 1.1, - ), - pixels, - 0, - velocity, - ), - context.vsync, - true, - ), - ); - + goIdle(); return; } - final bool sheetDragging = sheetPosition.activity!.isScrolling; - if (sheetDragging && - sheetPosition.hasContentDimensions && - !sheetPosition.preventingDrag && - sheetPosition.activity!.isScrolling) { + if (sheetPosition.hasContentDimensions) { sheetPosition.goBallistic(velocity); - } else { - sheetPosition.goIdle(); } - if (!sheetDragging) { - super.goBallistic(velocity); - return; - } else if (velocity > 0.0 && + if (velocity > 0.0 && sheetPosition.pixels >= sheetPosition.maxScrollExtent || (velocity < 0.0 && pixels > 0)) { - // super.goBallistic(velocity); + super.goBallistic(velocity); return; } else if (outOfRange) { beginActivity( @@ -183,11 +157,9 @@ class SheetPrimaryScrollPosition extends ScrollPositionWithSingleContext { ), ); return; + } else { + goIdle(); + return; } - - goIdle(); } - - //@override - //double get pixels => super.pixels + viewportDimension; } diff --git a/sheet/lib/src/scrollable.dart b/sheet/lib/src/scrollable.dart index 2f3f4cd9..d9af5746 100644 --- a/sheet/lib/src/scrollable.dart +++ b/sheet/lib/src/scrollable.dart @@ -196,11 +196,11 @@ class SheetScrollable extends StatefulWidget { /// {@macro flutter.widgets.shadow.scrollBehavior} /// - /// [SheetBehaviour]s also provide [SheetPhysics]. If an explicit + /// [SheetBehavior]s also provide [SheetPhysics]. If an explicit /// [ScrollPhysics] is provided in [physics], it will take precedence, /// followed by [scrollBehavior], and then the inherited ancestor - /// [SheetBehaviour]. - final SheetBehaviour? scrollBehavior; + /// [SheetBehavior]. + final SheetBehavior? scrollBehavior; final double? initialExtent; @@ -328,7 +328,7 @@ class SheetState extends State @override AxisDirection get axisDirection => widget.axisDirection; - late SheetBehaviour _configuration; + late SheetBehavior _configuration; ScrollPhysics? _physics; SheetController? _fallbackScrollController; @@ -339,7 +339,7 @@ class SheetState extends State // Only call this from places that will definitely trigger a rebuild. void _updatePosition() { - _configuration = widget.scrollBehavior ?? SheetBehaviour(); + _configuration = widget.scrollBehavior ?? SheetBehavior(); _physics = _configuration.getScrollPhysics(context); if (widget.physics != null) { _physics = widget.physics!.applyTo(_physics); diff --git a/sheet/lib/src/sheet.dart b/sheet/lib/src/sheet.dart index ccd8870b..eec6032b 100644 --- a/sheet/lib/src/sheet.dart +++ b/sheet/lib/src/sheet.dart @@ -21,14 +21,14 @@ enum SheetFit { /// The constraints passed to the child from the sheet are loosened. /// /// For example, if the sheet has expand constraints with 600 high, this would allow the child of the sheet to have any - /// height from zero to maximun available. + /// height from zero to maximum available. loose, /// The constraints passed to the stack from its parent are tightened to the /// biggest size allowed. /// /// For example, if the sheet has loose constraints with a height in the - /// range 0 to 600, then the child of the shhet would all be sized + /// range 0 to 600, then the child of the sheet would all be sized /// as 600 high. expand, } @@ -54,7 +54,7 @@ typedef SheetDecorationBuilder = Widget Function( /// /// By default the bottom sheet inherits the values provided by the /// material theme and prioritize the ones passed in the constructor. -/// Use [Sheet.raw] if you wish to remove the Material appareance and +/// Use [Sheet.raw] if you wish to remove the Material appearance and /// build your own /// /// See also: @@ -115,7 +115,7 @@ class Sheet extends StatelessWidget { /// Empty space to surround the [child]. final EdgeInsets padding; - /// The inital height to use when displaying the widget. + /// The initial height to use when displaying the widget. /// /// This value will be clamped between [minExtent] and [maxExtent] /// @@ -129,12 +129,12 @@ class Sheet extends StatelessWidget { /// The maximum height to use when displaying the widget. /// - /// This value will be clamped to be as maximun the parent container's height + /// This value will be clamped to be as maximum the parent container's height /// /// The default value is `double.infinity`. final double? maxExtent; - /// The height area of the minimun interaction zone to allow to + /// The height area of the minimum interaction zone to allow to /// drag up the sheet when it is closed /// /// The default value is `0`. @@ -148,10 +148,10 @@ class Sheet extends StatelessWidget { /// The default value is `false`. final bool resizable; - /// If resizable true, the minimun height that the sheet can be. + /// If resizable true, the minimum height that the sheet can be. /// The content of the sheet will be resized to fit the /// available visible space until this value, after that will be - /// translated keeping this minimun height. + /// translated keeping this minimum height. /// /// The default value is `0`. final double? minResizableExtent; @@ -212,7 +212,7 @@ class Sheet extends StatelessWidget { /// will be [Clip.none]. final Clip? clipBehavior; - /// Wraps the child in a custom sheet decoration appareance + /// Wraps the child in a custom sheet decoration appearance /// If null, the sheet has material appareance /// /// The default value is null. @@ -222,8 +222,7 @@ class Sheet extends StatelessWidget { return child; } - @override - Widget build(BuildContext context) { + Widget decorationBuild(BuildContext context, Widget child) { final SheetDecorationBuilder decorationBuilder = this.decorationBuilder ?? (BuildContext context, Widget child) { final BottomSheetThemeData bottomSheetTheme = @@ -244,6 +243,11 @@ class Sheet extends StatelessWidget { child: child, ); }; + return decorationBuilder(context, child); + } + + @override + Widget build(BuildContext context) { final SheetController? effectiveController = controller ?? DefaultSheetController.of(context); final double? initialExtent = @@ -254,7 +258,7 @@ class Sheet extends StatelessWidget { physics: physics, controller: effectiveController, axisDirection: AxisDirection.down, - scrollBehavior: SheetBehaviour(), + scrollBehavior: SheetBehavior(), viewportBuilder: (BuildContext context, ViewportOffset offset) { return _DefaultSheetScrollController( child: ScrollToTopStatusBarHandler( @@ -274,10 +278,7 @@ class Sheet extends StatelessWidget { child: Builder( key: const Key('_sheet_child'), builder: (BuildContext context) { - return decorationBuilder( - context, - child, - ); + return decorationBuild(context, child); }, ), ), @@ -317,12 +318,7 @@ class _DefaultSheetScrollController extends StatelessWidget { /// * [SheetPosition], which manages the positioning logic for /// this controller. class SheetController extends ScrollController { - SheetController({ - String? debugLabel, - }) : super( - debugLabel: debugLabel, - initialScrollOffset: 0, - ); + SheetController({super.debugLabel}) : super(initialScrollOffset: 0); final ProxyAnimation _animation = ProxyAnimation(); Animation get animation => _animation; @@ -411,20 +407,13 @@ class SheetController extends ScrollController { /// * [_SheetScrollController], which uses this as its [ScrollPosition]. class SheetPosition extends ScrollPositionWithSingleContext { SheetPosition({ - required ScrollPhysics physics, - required SheetContext context, - double initialPixels = 0.0, - bool keepScrollOffset = true, - ScrollPosition? oldPosition, - String? debugLabel, - }) : super( - physics: physics, - context: context, - initialPixels: initialPixels, - keepScrollOffset: keepScrollOffset, - oldPosition: oldPosition, - debugLabel: debugLabel, - ); + required super.physics, + required SheetContext super.context, + super.initialPixels = 0.0, + super.keepScrollOffset = true, + super.oldPosition, + super.debugLabel, + }); late final SheetPrimaryScrollController _scrollController = SheetPrimaryScrollController(sheetContext: context as SheetContext); @@ -540,15 +529,15 @@ class SheetPosition extends ScrollPositionWithSingleContext { class SheetViewport extends SingleChildRenderObjectWidget { const SheetViewport({ - Key? key, + super.key, this.axisDirection = AxisDirection.down, required this.offset, this.minExtent, this.maxExtent, - Widget? child, + super.child, required this.fit, required this.clipBehavior, - }) : super(key: key, child: child); + }); final AxisDirection axisDirection; final ViewportOffset offset; @@ -801,13 +790,13 @@ class RenderSheetViewport extends RenderBox minHeight = overflowHeight; } - final BoxConstraints childContstraints = BoxConstraints( + final BoxConstraints childConstraints = BoxConstraints( minHeight: minHeight, maxHeight: maxHeight, minWidth: constraints.minWidth, maxWidth: constraints.maxWidth, ); - child!.layout(childContstraints, parentUsesSize: true); + child!.layout(childConstraints, parentUsesSize: true); size = constraints.biggest; } @@ -955,7 +944,7 @@ class RenderSheetViewport extends RenderBox Curve curve = Curves.ease, }) { return; - // TODO(jaime): check showOnScreen method beheves when keyboard appears on + // TODO(jaime): check showOnScreen method behaves when keyboard appears on // the screen // if (!offset.allowImplicitScrolling) { // return super.showOnScreen( diff --git a/sheet/lib/src/widgets/default_sheet_controller.dart b/sheet/lib/src/widgets/default_sheet_controller.dart index 99e59232..21ff8987 100644 --- a/sheet/lib/src/widgets/default_sheet_controller.dart +++ b/sheet/lib/src/widgets/default_sheet_controller.dart @@ -3,7 +3,7 @@ import 'package:sheet/sheet.dart'; typedef SheetControllerCallback = void Function(SheetController controller); -/// A widget that injets a [SheetController] that can be used by +/// A widget that injects a [SheetController] that can be used by /// any [Sheet] children /// /// It is useful for creating initial animations diff --git a/sheet/lib/src/widgets/material_sheet.dart b/sheet/lib/src/widgets/material_sheet.dart new file mode 100644 index 00000000..f3d65331 --- /dev/null +++ b/sheet/lib/src/widgets/material_sheet.dart @@ -0,0 +1,42 @@ +import 'package:flutter/material.dart'; +import 'package:sheet/sheet.dart'; + +class MaterialSheet extends Sheet { + const MaterialSheet({ + super.key, + required super.child, + super.controller, + super.physics, + super.initialExtent, + super.minExtent, + super.maxExtent, + super.minInteractionExtent = 20.0, + super.backgroundColor, + super.clipBehavior, + super.shape, + super.elevation, + super.fit = SheetFit.loose, + super.resizable = false, + super.padding = EdgeInsets.zero, + super.minResizableExtent, + }); + + @override + Widget decorationBuild(BuildContext context, Widget child) { + final BottomSheetThemeData bottomSheetTheme = + Theme.of(context).bottomSheetTheme; + final Color? color = backgroundColor ?? bottomSheetTheme.backgroundColor; + final double elevation = this.elevation ?? bottomSheetTheme.elevation ?? 0; + final ShapeBorder? shape = this.shape ?? bottomSheetTheme.shape; + final Clip clipBehavior = + this.clipBehavior ?? bottomSheetTheme.clipBehavior ?? Clip.none; + + return Material( + color: color, + elevation: elevation, + shape: shape, + clipBehavior: clipBehavior, + child: child, + ); + } +} diff --git a/sheet/pubspec.lock b/sheet/pubspec.lock index add55cd5..ed9b859c 100644 --- a/sheet/pubspec.lock +++ b/sheet/pubspec.lock @@ -5,26 +5,26 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "0c80aeab9bc807ab10022cd3b2f4cf2ecdf231949dc1ddd9442406a003f19201" + sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a url: "https://pub.dev" source: hosted - version: "52.0.0" + version: "61.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: cd8ee83568a77f3ae6b913a36093a1c9b1264e7cb7f834d9ddd2311dade9c1f4 + sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 url: "https://pub.dev" source: hosted - version: "5.4.0" + version: "5.13.0" args: dependency: transitive description: name: args - sha256: "139d809800a412ebb26a3892da228b2d0ba36f0ef5d9a82166e5e52ec8d61611" + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.2" async: dependency: transitive description: @@ -77,18 +77,18 @@ packages: dependency: transitive description: name: coverage - sha256: "961c4aebd27917269b1896382c7cb1b1ba81629ba669ba09c27a7e5710ec9040" + sha256: "595a29b55ce82d53398e1bcc2cba525d7bd7c59faeb2d2540e9d42c390cfeeeb" url: "https://pub.dev" source: hosted - version: "1.6.2" + version: "1.6.4" crypto: dependency: transitive description: name: crypto - sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.3" fake_async: dependency: transitive description: @@ -101,10 +101,10 @@ packages: dependency: transitive description: name: file - sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" url: "https://pub.dev" source: hosted - version: "6.1.4" + version: "7.0.0" flutter: dependency: "direct main" description: flutter @@ -127,10 +127,10 @@ packages: dependency: transitive description: name: glob - sha256: "4515b5b6ddb505ebdd242a5f2cc5d22d3d6a80013789debfbda7777f47ea308c" + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" http_multi_server: dependency: transitive description: @@ -159,26 +159,26 @@ packages: dependency: transitive description: name: js - sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 url: "https://pub.dev" source: hosted - version: "0.6.5" + version: "0.6.7" lints: dependency: "direct dev" description: name: lints - sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593" + sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.1.1" logging: dependency: transitive description: name: logging - sha256: c0bbfe94d46aedf9b8b3e695cf3bd48c8e14b35e3b2c639e0aa7755d589ba946 + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0" matcher: dependency: transitive description: @@ -223,10 +223,10 @@ packages: dependency: transitive description: name: node_preamble - sha256: "8ebdbaa3b96d5285d068f80772390d27c21e1fa10fb2df6627b1b9415043608d" + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.0.2" package_config: dependency: transitive description: @@ -255,42 +255,42 @@ packages: dependency: transitive description: name: pub_semver - sha256: "307de764d305289ff24ad257ad5c5793ce56d04947599ad68b3baa124105fc17" + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.4" shelf: dependency: transitive description: name: shelf - sha256: c24a96135a2ccd62c64b69315a14adc5c3419df63b4d7c05832a346fdb73682c + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.4.1" shelf_packages_handler: dependency: transitive description: name: shelf_packages_handler - sha256: aef74dc9195746a384843102142ab65b6a4735bb3beea791e63527b88cc83306 + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" shelf_static: dependency: transitive description: name: shelf_static - sha256: e792b76b96a36d4a41b819da593aff4bdd413576b3ba6150df5d8d9996d2e74c + sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.2" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - sha256: a988c0e8d8ffbdb8a28aa7ec8e449c260f3deb808781fe1284d22c5bba7156e8 + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" url: "https://pub.dev" source: hosted - version: "1.0.3" + version: "1.0.4" sky_engine: dependency: transitive description: flutter @@ -308,10 +308,10 @@ packages: dependency: transitive description: name: source_maps - sha256: "490098075234dcedb83c5d949b4c93dad5e6b7702748de000be2b57b8e6b2427" + sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" url: "https://pub.dev" source: hosted - version: "0.10.11" + version: "0.10.12" source_span: dependency: transitive description: @@ -380,10 +380,10 @@ packages: dependency: transitive description: name: typed_data - sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.3.2" vector_math: dependency: transitive description: @@ -396,18 +396,18 @@ packages: dependency: transitive description: name: vm_service - sha256: e7fb6c2282f7631712b69c19d1bff82f3767eea33a2321c14fa59ad67ea391c7 + sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583 url: "https://pub.dev" source: hosted - version: "9.4.0" + version: "11.10.0" watcher: dependency: transitive description: name: watcher - sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.1.0" web: dependency: transitive description: @@ -420,26 +420,25 @@ packages: dependency: transitive description: name: web_socket_channel - sha256: ca49c0bc209c687b887f30527fb6a9d80040b072cc2990f34b9bec3e7663101b + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.4.0" webkit_inspection_protocol: dependency: transitive description: name: webkit_inspection_protocol - sha256: "67d3a8b6c79e1987d19d848b0892e582dbb0c66c57cc1fef58a177dd2aa2823d" + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" yaml: dependency: transitive description: name: yaml - sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370" + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.2" sdks: dart: ">=3.1.0-185.0.dev <4.0.0" - flutter: ">=3.7.0" diff --git a/sheet/pubspec.yaml b/sheet/pubspec.yaml index 6aa1680c..95bb047a 100644 --- a/sheet/pubspec.yaml +++ b/sheet/pubspec.yaml @@ -5,7 +5,6 @@ homepage: https://github.com/jamesblasco/modal_bottom_sheet environment: sdk: ">=2.17.0 <3.0.0" - flutter: ">=3.7.0" dependencies: flutter: @@ -15,6 +14,6 @@ dev_dependencies: flutter_test: sdk: flutter mocktail: ^0.3.0 - lints: ^2.0.0 + lints: ^2.1.1 flutter: \ No newline at end of file diff --git a/sheet/test/screen_size_test.dart b/sheet/test/screen_size_test.dart index 764e050c..c1bd5682 100644 --- a/sheet/test/screen_size_test.dart +++ b/sheet/test/screen_size_test.dart @@ -11,7 +11,6 @@ void main() { testWidgets('defaultTestSize', (WidgetTester tester) async { final Size testSize = tester.view.physicalSize / tester.view.devicePixelRatio; - expect(testSize, equals(kScreenSize)); }); } diff --git a/sheet/test/src/physics_test.dart b/sheet/test/src/physics_test.dart index 36f6a08e..f30d4ac9 100644 --- a/sheet/test/src/physics_test.dart +++ b/sheet/test/src/physics_test.dart @@ -77,21 +77,21 @@ void main() { test('overscroll is progressively harder', () { final ScrollMetrics lessOverscrolledPosition = FixedScrollMetrics( - devicePixelRatio: 1, minScrollExtent: 0.0, maxScrollExtent: 1000.0, pixels: -20.0, viewportDimension: 100.0, axisDirection: AxisDirection.down, + devicePixelRatio: 1, ); final ScrollMetrics moreOverscrolledPosition = FixedScrollMetrics( minScrollExtent: 0.0, - devicePixelRatio: 1, maxScrollExtent: 1000.0, pixels: -40.0, viewportDimension: 100.0, axisDirection: AxisDirection.down, + devicePixelRatio: 1, ); final double lessOverscrollApplied = physicsUnderTest @@ -116,11 +116,11 @@ void main() { test('easing an overscroll still has resistance', () { final ScrollMetrics overscrolledPosition = FixedScrollMetrics( minScrollExtent: 0.0, - devicePixelRatio: 1, maxScrollExtent: 1000.0, pixels: -20.0, viewportDimension: 100.0, axisDirection: AxisDirection.down, + devicePixelRatio: 1, ); final double easingApplied = physicsUnderTest.applyPhysicsToUserOffset( @@ -154,10 +154,10 @@ void main() { final ScrollMetrics overscrolledPosition = FixedScrollMetrics( minScrollExtent: 0.0, maxScrollExtent: 1000.0, - devicePixelRatio: 1, pixels: -20.0, viewportDimension: 100.0, axisDirection: AxisDirection.down, + devicePixelRatio: 1, ); final double easingApplied = physicsUnderTest.applyPhysicsToUserOffset( From 639ccadc446486a9b39630a4e1f7e6de491dee1b Mon Sep 17 00:00:00 2001 From: Jaime Blasco Date: Wed, 8 Nov 2023 18:59:40 +0100 Subject: [PATCH 12/29] fix: update lints (#380) --- modal_bottom_sheet/lib/src/bottom_sheet.dart | 5 +- .../lib/src/bottom_sheet_route.dart | 9 +- .../src/bottom_sheets/bar_bottom_sheet.dart | 4 +- .../bottom_sheets/cupertino_bottom_sheet.dart | 55 ++-- .../src/material_with_modal_page_route.dart | 14 +- .../src/utils/modal_scroll_controller.dart | 3 +- .../src/utils/scroll_to_top_status_bar.dart | 4 +- modal_bottom_sheet/pubspec.lock | 4 +- modal_bottom_sheet/pubspec.yaml | 2 +- .../test/bottom_sheet_test.dart | 3 +- sheet/lib/src/physics.dart | 23 +- .../lib/src/route/cupertino/sheet_route.dart | 24 +- sheet/lib/src/route/sheet_route.dart | 3 +- sheet/lib/src/scroll_controller.dart | 32 +-- sheet/lib/src/scrollable.dart | 17 +- sheet/lib/src/sheet.dart | 3 +- .../src/widgets/default_sheet_controller.dart | 6 +- sheet/lib/src/widgets/resizable_sheet.dart | 6 +- .../widgets/scroll_to_top_status_handler.dart | 4 +- sheet/lib/src/widgets/sheet_media_query.dart | 2 +- sheet/pubspec.lock | 272 +----------------- sheet/pubspec.yaml | 4 +- sheet/test/scrollable_of_test.dart | 3 +- .../src/widgets/min_interaction_test.dart | 2 +- 24 files changed, 95 insertions(+), 409 deletions(-) diff --git a/modal_bottom_sheet/lib/src/bottom_sheet.dart b/modal_bottom_sheet/lib/src/bottom_sheet.dart index ffb88ba9..742e6ece 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheet.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheet.dart @@ -33,7 +33,7 @@ typedef WidgetWithChildBuilder = Widget Function( class ModalBottomSheet extends StatefulWidget { /// Creates a bottom sheet. const ModalBottomSheet({ - Key? key, + super.key, required this.animationController, this.animationCurve, this.enableDrag = true, @@ -48,8 +48,7 @@ class ModalBottomSheet extends StatefulWidget { double? closeProgressThreshold, this.willPopThreshold = _willPopThreshold, }) : closeProgressThreshold = - closeProgressThreshold ?? _closeProgressThreshold, - super(key: key); + closeProgressThreshold ?? _closeProgressThreshold; /// The closeProgressThreshold parameter /// specifies when the bottom sheet will be dismissed when user drags it. diff --git a/modal_bottom_sheet/lib/src/bottom_sheet_route.dart b/modal_bottom_sheet/lib/src/bottom_sheet_route.dart index e0dc21b3..4247447b 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheet_route.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheet_route.dart @@ -8,7 +8,7 @@ const Duration _bottomSheetDuration = Duration(milliseconds: 400); class _ModalBottomSheet extends StatefulWidget { const _ModalBottomSheet({ - Key? key, + super.key, this.closeProgressThreshold, required this.route, this.secondAnimationController, @@ -16,7 +16,7 @@ class _ModalBottomSheet extends StatefulWidget { this.expanded = false, this.enableDrag = true, this.animationCurve, - }) : super(key: key); + }); final double? closeProgressThreshold; final ModalSheetRoute route; @@ -137,9 +137,8 @@ class ModalSheetRoute extends PageRoute { this.bounce = false, this.animationCurve, Duration? duration, - RouteSettings? settings, - }) : duration = duration ?? _bottomSheetDuration, - super(settings: settings); + super.settings, + }) : duration = duration ?? _bottomSheetDuration; final double? closeProgressThreshold; final WidgetWithChildBuilder? containerBuilder; diff --git a/modal_bottom_sheet/lib/src/bottom_sheets/bar_bottom_sheet.dart b/modal_bottom_sheet/lib/src/bottom_sheets/bar_bottom_sheet.dart index 8f8557e7..c528ce1e 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheets/bar_bottom_sheet.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheets/bar_bottom_sheet.dart @@ -16,7 +16,7 @@ class BarBottomSheet extends StatelessWidget { final SystemUiOverlayStyle? overlayStyle; const BarBottomSheet({ - Key? key, + super.key, required this.child, this.control, this.clipBehavior, @@ -24,7 +24,7 @@ class BarBottomSheet extends StatelessWidget { this.backgroundColor, this.elevation, this.overlayStyle, - }) : super(key: key); + }); @override Widget build(BuildContext context) { diff --git a/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart b/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart index 6972e71d..7bafe49f 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart @@ -51,13 +51,12 @@ class _CupertinoBottomSheetContainer extends StatelessWidget { final SystemUiOverlayStyle? overlayStyle; const _CupertinoBottomSheetContainer({ - Key? key, required this.child, this.backgroundColor, required this.topRadius, this.overlayStyle, this.shadow, - }) : super(key: key); + }); @override Widget build(BuildContext context) { @@ -178,44 +177,29 @@ class CupertinoModalBottomSheetRoute extends ModalSheetRoute { final SystemUiOverlayStyle? overlayStyle; CupertinoModalBottomSheetRoute({ - required WidgetBuilder builder, - WidgetWithChildBuilder? containerBuilder, - double? closeProgressThreshold, - String? barrierLabel, + required super.builder, + super.containerBuilder, + super.closeProgressThreshold, + super.barrierLabel, double? elevation, ShapeBorder? shape, Clip? clipBehavior, - AnimationController? secondAnimationController, - Curve? animationCurve, - Color? modalBarrierColor, - bool bounce = true, - bool isDismissible = true, - bool enableDrag = true, - required bool expanded, - Duration? duration, - RouteSettings? settings, - ScrollController? scrollController, + super.secondAnimationController, + super.animationCurve, + super.modalBarrierColor, + super.bounce = true, + super.isDismissible, + super.enableDrag, + required super.expanded, + super.duration, + super.settings, + super.scrollController, this.boxShadow = _kDefaultBoxShadow, this.transitionBackgroundColor, this.topRadius = _kDefaultTopRadius, this.previousRouteAnimationCurve, this.overlayStyle, - }) : super( - closeProgressThreshold: closeProgressThreshold, - scrollController: scrollController, - containerBuilder: containerBuilder, - builder: builder, - bounce: bounce, - barrierLabel: barrierLabel, - secondAnimationController: secondAnimationController, - modalBarrierColor: modalBarrierColor, - isDismissible: isDismissible, - enableDrag: enableDrag, - expanded: expanded, - settings: settings, - animationCurve: animationCurve, - duration: duration, - ); + }); @override Widget buildTransitions( @@ -264,13 +248,12 @@ class _CupertinoModalTransition extends StatelessWidget { final Widget body; const _CupertinoModalTransition({ - Key? key, required this.secondaryAnimation, required this.body, required this.topRadius, this.backgroundColor = Colors.black, this.animationCurve, - }) : super(key: key); + }); @override Widget build(BuildContext context) { @@ -431,12 +414,12 @@ class CupertinoScaffold extends StatefulWidget { final SystemUiOverlayStyle? overlayStyle; const CupertinoScaffold({ - Key? key, + super.key, required this.body, this.topRadius = _kDefaultTopRadius, this.transitionBackgroundColor = Colors.black, this.overlayStyle, - }) : super(key: key); + }); @override State createState() => _CupertinoScaffoldState(); diff --git a/modal_bottom_sheet/lib/src/material_with_modal_page_route.dart b/modal_bottom_sheet/lib/src/material_with_modal_page_route.dart index f77cb13c..91262da7 100644 --- a/modal_bottom_sheet/lib/src/material_with_modal_page_route.dart +++ b/modal_bottom_sheet/lib/src/material_with_modal_page_route.dart @@ -10,15 +10,11 @@ class MaterialWithModalsPageRoute extends MaterialPageRoute { /// The values of [builder], [maintainState], and [fullScreenDialog] must not /// be null. MaterialWithModalsPageRoute({ - required WidgetBuilder builder, - RouteSettings? settings, - bool maintainState = true, - bool fullscreenDialog = false, - }) : super( - settings: settings, - fullscreenDialog: fullscreenDialog, - builder: builder, - maintainState: maintainState); + required super.builder, + super.settings, + super.maintainState, + super.fullscreenDialog, + }); ModalSheetRoute? _nextModalRoute; diff --git a/modal_bottom_sheet/lib/src/utils/modal_scroll_controller.dart b/modal_bottom_sheet/lib/src/utils/modal_scroll_controller.dart index 3a3b13fa..7afe0898 100644 --- a/modal_bottom_sheet/lib/src/utils/modal_scroll_controller.dart +++ b/modal_bottom_sheet/lib/src/utils/modal_scroll_controller.dart @@ -13,11 +13,10 @@ import 'package:flutter/widgets.dart'; class ModalScrollController extends InheritedWidget { /// Creates a widget that associates a [ScrollController] with a subtree. ModalScrollController({ - Key? key, + super.key, required this.controller, required Widget child, }) : super( - key: key, child: PrimaryScrollController( controller: controller, child: child, diff --git a/modal_bottom_sheet/lib/src/utils/scroll_to_top_status_bar.dart b/modal_bottom_sheet/lib/src/utils/scroll_to_top_status_bar.dart index f7feaf8d..89515ac6 100644 --- a/modal_bottom_sheet/lib/src/utils/scroll_to_top_status_bar.dart +++ b/modal_bottom_sheet/lib/src/utils/scroll_to_top_status_bar.dart @@ -9,10 +9,10 @@ class ScrollToTopStatusBarHandler extends StatefulWidget { final ScrollController scrollController; const ScrollToTopStatusBarHandler({ - Key? key, + super.key, required this.child, required this.scrollController, - }) : super(key: key); + }); @override ScrollToTopStatusBarState createState() => ScrollToTopStatusBarState(); diff --git a/modal_bottom_sheet/pubspec.lock b/modal_bottom_sheet/pubspec.lock index db9aade7..6bbd9a87 100644 --- a/modal_bottom_sheet/pubspec.lock +++ b/modal_bottom_sheet/pubspec.lock @@ -63,10 +63,10 @@ packages: dependency: "direct dev" description: name: lints - sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "3.0.0" matcher: dependency: transitive description: diff --git a/modal_bottom_sheet/pubspec.yaml b/modal_bottom_sheet/pubspec.yaml index f57053d6..1cf4a03d 100644 --- a/modal_bottom_sheet/pubspec.yaml +++ b/modal_bottom_sheet/pubspec.yaml @@ -13,4 +13,4 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - lints: ^2.0.0 + lints: ^3.0.0 diff --git a/modal_bottom_sheet/test/bottom_sheet_test.dart b/modal_bottom_sheet/test/bottom_sheet_test.dart index 7b593482..231c0bfa 100644 --- a/modal_bottom_sheet/test/bottom_sheet_test.dart +++ b/modal_bottom_sheet/test/bottom_sheet_test.dart @@ -90,10 +90,9 @@ Finder _textButtonWithText(String text) { class _TestWidget extends StatefulWidget { const _TestWidget({ - Key? key, this.onInitState, this.onDispose, - }) : super(key: key); + }); final VoidCallback? onInitState; final VoidCallback? onDispose; diff --git a/sheet/lib/src/physics.dart b/sheet/lib/src/physics.dart index 370c66ed..69010076 100644 --- a/sheet/lib/src/physics.dart +++ b/sheet/lib/src/physics.dart @@ -17,8 +17,7 @@ mixin SheetPhysics on ScrollPhysics { /// Sheet physics that does not allow the user to drag a sheet. class NeverDraggableSheetPhysics extends NeverScrollableScrollPhysics with SheetPhysics { - const NeverDraggableSheetPhysics({ScrollPhysics? parent}) - : super(parent: parent); + const NeverDraggableSheetPhysics({super.parent}); @override NeverDraggableSheetPhysics applyTo(ScrollPhysics? ancestor) { @@ -30,8 +29,7 @@ class NeverDraggableSheetPhysics extends NeverScrollableScrollPhysics class AlwaysDraggableSheetPhysics extends AlwaysScrollableScrollPhysics with SheetPhysics { /// Creates scroll physics that always lets the user scroll. - const AlwaysDraggableSheetPhysics({ScrollPhysics? parent}) - : super(parent: parent); + const AlwaysDraggableSheetPhysics({super.parent}); @override AlwaysDraggableSheetPhysics applyTo(ScrollPhysics? ancestor) { @@ -43,9 +41,9 @@ class AlwaysDraggableSheetPhysics extends AlwaysScrollableScrollPhysics class BouncingSheetPhysics extends ScrollPhysics with SheetPhysics { /// Creates sheet physics that bounce back from the edge. const BouncingSheetPhysics({ - ScrollPhysics? parent, + super.parent, this.overflowViewport = false, - }) : super(parent: parent); + }); final bool overflowViewport; @@ -169,7 +167,6 @@ class BouncingSheetPhysics extends ScrollPhysics with SheetPhysics { @override Simulation? createBallisticSimulation( ScrollMetrics position, double velocity) { - if (position.outOfRange) { return BouncingScrollSimulation( spring: const SpringDescription( @@ -223,8 +220,8 @@ class BouncingSheetPhysics extends ScrollPhysics with SheetPhysics { class NoMomentumSheetPhysics extends ScrollPhysics with SheetPhysics { /// Creates sheet physics that has no momentum after the user stops dragging. const NoMomentumSheetPhysics({ - ScrollPhysics? parent, - }) : super(parent: parent); + super.parent, + }); @override NoMomentumSheetPhysics applyTo(ScrollPhysics? ancestor) { @@ -289,8 +286,8 @@ class NoMomentumSheetPhysics extends ScrollPhysics with SheetPhysics { class ClampingSheetPhysics extends ScrollPhysics with SheetPhysics { /// Creates sheet physics that has no momentum after the user stops dragging. const ClampingSheetPhysics({ - ScrollPhysics? parent, - }) : super(parent: parent); + super.parent, + }); @override ClampingSheetPhysics applyTo(ScrollPhysics? ancestor) { @@ -384,10 +381,10 @@ class ClampingSheetPhysics extends ScrollPhysics with SheetPhysics { class SnapSheetPhysics extends ScrollPhysics with SheetPhysics { /// Creates snapping physics for a [Sheet]. const SnapSheetPhysics({ - ScrollPhysics? parent, + super.parent, this.stops = const [], this.relative = true, - }) : super(parent: parent); + }); /// Positions where the sheet could be snapped once the user stops /// dragging diff --git a/sheet/lib/src/route/cupertino/sheet_route.dart b/sheet/lib/src/route/cupertino/sheet_route.dart index 112eeb01..635eacd8 100644 --- a/sheet/lib/src/route/cupertino/sheet_route.dart +++ b/sheet/lib/src/route/cupertino/sheet_route.dart @@ -222,11 +222,11 @@ class CupertinoSheetRoute extends SheetRoute { @visibleForTesting class CupertinoSheetBottomRouteTransition extends StatelessWidget { const CupertinoSheetBottomRouteTransition({ - Key? key, + super.key, required this.sheetAnimation, required this.secondaryAnimation, required this.body, - }) : super(key: key); + }); final Widget body; @@ -319,10 +319,10 @@ class CupertinoSheetPage extends Page { const CupertinoSheetPage({ required this.child, this.maintainState = true, - LocalKey? key, - String? name, - Object? arguments, - }) : super(key: key, name: name, arguments: arguments); + super.key, + super.name, + super.arguments, + }); /// The content to be shown in the [Route] created by this page. final Widget child; @@ -343,17 +343,13 @@ class CupertinoSheetPage extends Page { class _PageBasedCupertinoSheetRoute extends CupertinoSheetRoute { _PageBasedCupertinoSheetRoute({ required CupertinoSheetPage page, - List? stops, - double initialStop = 1, - Color? backgroundColor, - bool maintainState = true, + super.stops, + super.initialStop, + super.backgroundColor, + super.maintainState, }) : super( settings: page, builder: (BuildContext context) => page.child, - initialStop: initialStop, - backgroundColor: backgroundColor, - stops: stops, - maintainState: maintainState, ); CupertinoSheetPage get _page => settings as CupertinoSheetPage; diff --git a/sheet/lib/src/route/sheet_route.dart b/sheet/lib/src/route/sheet_route.dart index d28ad125..639d2f8d 100644 --- a/sheet/lib/src/route/sheet_route.dart +++ b/sheet/lib/src/route/sheet_route.dart @@ -350,8 +350,7 @@ class _PageBasedSheetRoute extends SheetRoute { } class _SheetRouteContainer extends StatefulWidget { - const _SheetRouteContainer({Key? key, required this.sheetRoute}) - : super(key: key); + const _SheetRouteContainer({required this.sheetRoute}); final SheetRoute sheetRoute; @override diff --git a/sheet/lib/src/scroll_controller.dart b/sheet/lib/src/scroll_controller.dart index 6224c265..e400dc88 100644 --- a/sheet/lib/src/scroll_controller.dart +++ b/sheet/lib/src/scroll_controller.dart @@ -17,13 +17,10 @@ import 'package:sheet/sheet.dart'; /// descendants. class SheetPrimaryScrollController extends ScrollController { SheetPrimaryScrollController({ - double initialScrollOffset = 0.0, - String? debugLabel, + super.initialScrollOffset, + super.debugLabel, required this.sheetContext, - }) : super( - debugLabel: debugLabel, - initialScrollOffset: initialScrollOffset, - ); + }); final SheetContext sheetContext; @@ -43,7 +40,7 @@ class SheetPrimaryScrollController extends ScrollController { } class _SheetScrollActivity extends ScrollActivity { - _SheetScrollActivity(SheetPosition delegate) : super(delegate); + _SheetScrollActivity(SheetPosition super.delegate); @override bool get isScrolling => true; @@ -69,21 +66,14 @@ class _SheetScrollActivity extends ScrollActivity { /// * [_SheetScrollController], which uses this as its [ScrollPosition]. class SheetPrimaryScrollPosition extends ScrollPositionWithSingleContext { SheetPrimaryScrollPosition({ - required ScrollPhysics physics, - required ScrollContext context, - double initialPixels = 0.0, - bool keepScrollOffset = true, + required super.physics, + required super.context, + double super.initialPixels, + super.keepScrollOffset, required this.sheetContext, - ScrollPosition? oldPosition, - String? debugLabel, - }) : super( - physics: physics, - context: context, - initialPixels: initialPixels, - keepScrollOffset: keepScrollOffset, - oldPosition: oldPosition, - debugLabel: debugLabel, - ); + super.oldPosition, + super.debugLabel, + }); final SheetContext sheetContext; SheetPosition get sheetPosition => sheetContext.position; diff --git a/sheet/lib/src/scrollable.dart b/sheet/lib/src/scrollable.dart index d9af5746..253f8fb3 100644 --- a/sheet/lib/src/scrollable.dart +++ b/sheet/lib/src/scrollable.dart @@ -43,7 +43,7 @@ class SheetScrollable extends StatefulWidget { /// /// The [axisDirection] and [viewportBuilder] arguments must not be null. const SheetScrollable({ - Key? key, + super.key, this.axisDirection = AxisDirection.down, this.controller, this.physics, @@ -55,8 +55,7 @@ class SheetScrollable extends StatefulWidget { this.scrollBehavior, this.initialExtent, this.minInteractionExtent = 0, - }) : assert(semanticChildCount == null || semanticChildCount >= 0), - super(key: key); + }) : assert(semanticChildCount == null || semanticChildCount >= 0); /// The direction in which this widget scrolls. /// @@ -285,11 +284,10 @@ class SheetScrollable extends StatefulWidget { // ScrollableState.build() always rebuilds its _ScrollableScope. class _ScrollableScope extends InheritedWidget { const _ScrollableScope({ - Key? key, required this.scrollable, required this.position, - required Widget child, - }) : super(key: key, child: child); + required super.child, + }); final SheetState scrollable; final ScrollPosition position; @@ -772,13 +770,12 @@ class SheetState extends State /// scrollable children. class _ScrollSemantics extends SingleChildRenderObjectWidget { const _ScrollSemantics({ - Key? key, + super.key, required this.position, required this.allowImplicitScrolling, required this.semanticChildCount, - Widget? child, - }) : assert(semanticChildCount == null || semanticChildCount >= 0), - super(key: key, child: child); + super.child, + }) : assert(semanticChildCount == null || semanticChildCount >= 0); final ScrollPosition position; final bool allowImplicitScrolling; diff --git a/sheet/lib/src/sheet.dart b/sheet/lib/src/sheet.dart index eec6032b..602df321 100644 --- a/sheet/lib/src/sheet.dart +++ b/sheet/lib/src/sheet.dart @@ -292,8 +292,7 @@ class Sheet extends StatelessWidget { } class _DefaultSheetScrollController extends StatelessWidget { - const _DefaultSheetScrollController({Key? key, required this.child}) - : super(key: key); + const _DefaultSheetScrollController({required this.child}); final Widget child; diff --git a/sheet/lib/src/widgets/default_sheet_controller.dart b/sheet/lib/src/widgets/default_sheet_controller.dart index 21ff8987..9adda1c6 100644 --- a/sheet/lib/src/widgets/default_sheet_controller.dart +++ b/sheet/lib/src/widgets/default_sheet_controller.dart @@ -14,8 +14,7 @@ typedef SheetControllerCallback = void Function(SheetController controller); /// /// class DefaultSheetController extends StatefulWidget { - const DefaultSheetController({Key? key, required this.child, this.onCreated}) - : super(key: key); + const DefaultSheetController({super.key, required this.child, this.onCreated}); final Widget child; @@ -56,8 +55,7 @@ class _DefaultSheetControllerState extends State { class _InheritedSheetController extends InheritedWidget { const _InheritedSheetController( - {Key? key, required super.child, required this.controller}) - : super(key: key); + {required super.child, required this.controller}); final SheetController controller; diff --git a/sheet/lib/src/widgets/resizable_sheet.dart b/sheet/lib/src/widgets/resizable_sheet.dart index 2e938766..6f5dd822 100644 --- a/sheet/lib/src/widgets/resizable_sheet.dart +++ b/sheet/lib/src/widgets/resizable_sheet.dart @@ -14,12 +14,12 @@ import 'package:sheet/sheet.dart'; /// * [Sheet], that uses this widget to allow resizable sheet child class ResizableSheetChild extends SingleChildRenderObjectWidget { const ResizableSheetChild({ - Key? key, + super.key, this.minExtent = 0, required this.offset, - required Widget child, + required Widget super.child, required this.resizable, - }) : super(key: key, child: child); + }); final double minExtent; final bool resizable; diff --git a/sheet/lib/src/widgets/scroll_to_top_status_handler.dart b/sheet/lib/src/widgets/scroll_to_top_status_handler.dart index 2b338678..320e96e5 100644 --- a/sheet/lib/src/widgets/scroll_to_top_status_handler.dart +++ b/sheet/lib/src/widgets/scroll_to_top_status_handler.dart @@ -6,9 +6,9 @@ import 'package:flutter/widgets.dart'; /// Extracted from [Scaffold] and used in [Sheet] class ScrollToTopStatusBarHandler extends StatefulWidget { const ScrollToTopStatusBarHandler({ - Key? key, + super.key, required this.child, - }) : super(key: key); + }); final Widget child; diff --git a/sheet/lib/src/widgets/sheet_media_query.dart b/sheet/lib/src/widgets/sheet_media_query.dart index 96d9dcd5..c7b66a47 100644 --- a/sheet/lib/src/widgets/sheet_media_query.dart +++ b/sheet/lib/src/widgets/sheet_media_query.dart @@ -11,7 +11,7 @@ import 'dart:math' as math; /// If the sheet is fully expanded to the top of the screen the top padding /// will be the same as the parent top safe area. class SheetMediaQuery extends StatelessWidget { - const SheetMediaQuery({Key? key, required this.child}) : super(key: key); + const SheetMediaQuery({super.key, required this.child}); final Widget child; diff --git a/sheet/pubspec.lock b/sheet/pubspec.lock index ed9b859c..1245b8f2 100644 --- a/sheet/pubspec.lock +++ b/sheet/pubspec.lock @@ -1,30 +1,6 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - _fe_analyzer_shared: - dependency: transitive - description: - name: _fe_analyzer_shared - sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a - url: "https://pub.dev" - source: hosted - version: "61.0.0" - analyzer: - dependency: transitive - description: - name: analyzer - sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 - url: "https://pub.dev" - source: hosted - version: "5.13.0" - args: - dependency: transitive - description: - name: args - sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 - url: "https://pub.dev" - source: hosted - version: "2.4.2" async: dependency: transitive description: @@ -65,30 +41,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.17.2" - convert: - dependency: transitive - description: - name: convert - sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" - url: "https://pub.dev" - source: hosted - version: "3.1.1" - coverage: - dependency: transitive - description: - name: coverage - sha256: "595a29b55ce82d53398e1bcc2cba525d7bd7c59faeb2d2540e9d42c390cfeeeb" - url: "https://pub.dev" - source: hosted - version: "1.6.4" - crypto: - dependency: transitive - description: - name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab - url: "https://pub.dev" - source: hosted - version: "3.0.3" fake_async: dependency: transitive description: @@ -97,14 +49,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" - file: - dependency: transitive - description: - name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" - url: "https://pub.dev" - source: hosted - version: "7.0.0" flutter: dependency: "direct main" description: flutter @@ -115,70 +59,14 @@ packages: description: flutter source: sdk version: "0.0.0" - frontend_server_client: - dependency: transitive - description: - name: frontend_server_client - sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" - url: "https://pub.dev" - source: hosted - version: "3.2.0" - glob: - dependency: transitive - description: - name: glob - sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" - url: "https://pub.dev" - source: hosted - version: "2.1.2" - http_multi_server: - dependency: transitive - description: - name: http_multi_server - sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" - url: "https://pub.dev" - source: hosted - version: "3.2.1" - http_parser: - dependency: transitive - description: - name: http_parser - sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" - url: "https://pub.dev" - source: hosted - version: "4.0.2" - io: - dependency: transitive - description: - name: io - sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" - url: "https://pub.dev" - source: hosted - version: "1.0.4" - js: - dependency: transitive - description: - name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 - url: "https://pub.dev" - source: hosted - version: "0.6.7" lints: dependency: "direct dev" description: name: lints - sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 url: "https://pub.dev" source: hosted - version: "2.1.1" - logging: - dependency: transitive - description: - name: logging - sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" - url: "https://pub.dev" - source: hosted - version: "1.2.0" + version: "3.0.0" matcher: dependency: transitive description: @@ -203,38 +91,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.9.1" - mime: - dependency: transitive - description: - name: mime - sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e - url: "https://pub.dev" - source: hosted - version: "1.0.4" mocktail: dependency: "direct dev" description: name: mocktail - sha256: "80a996cd9a69284b3dc521ce185ffe9150cde69767c2d3a0720147d93c0cef53" - url: "https://pub.dev" - source: hosted - version: "0.3.0" - node_preamble: - dependency: transitive - description: - name: node_preamble - sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + sha256: bac151b31e4ed78bd59ab89aa4c0928f297b1180186d5daf03734519e5f596c1 url: "https://pub.dev" source: hosted - version: "2.0.2" - package_config: - dependency: transitive - description: - name: package_config - sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" - url: "https://pub.dev" - source: hosted - version: "2.1.0" + version: "1.0.1" path: dependency: transitive description: @@ -243,75 +107,11 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.3" - pool: - dependency: transitive - description: - name: pool - sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" - url: "https://pub.dev" - source: hosted - version: "1.5.1" - pub_semver: - dependency: transitive - description: - name: pub_semver - sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - shelf: - dependency: transitive - description: - name: shelf - sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 - url: "https://pub.dev" - source: hosted - version: "1.4.1" - shelf_packages_handler: - dependency: transitive - description: - name: shelf_packages_handler - sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" - url: "https://pub.dev" - source: hosted - version: "3.0.2" - shelf_static: - dependency: transitive - description: - name: shelf_static - sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e - url: "https://pub.dev" - source: hosted - version: "1.1.2" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" - url: "https://pub.dev" - source: hosted - version: "1.0.4" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.99" - source_map_stack_trace: - dependency: transitive - description: - name: source_map_stack_trace - sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - source_maps: - dependency: transitive - description: - name: source_maps - sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" - url: "https://pub.dev" - source: hosted - version: "0.10.12" source_span: dependency: transitive description: @@ -352,14 +152,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.1" - test: - dependency: transitive - description: - name: test - sha256: "13b41f318e2a5751c3169137103b60c584297353d4b1761b66029bae6411fe46" - url: "https://pub.dev" - source: hosted - version: "1.24.3" test_api: dependency: transitive description: @@ -368,22 +160,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.0" - test_core: - dependency: transitive - description: - name: test_core - sha256: "99806e9e6d95c7b059b7a0fc08f07fc53fabe54a829497f0d9676299f1e8637e" - url: "https://pub.dev" - source: hosted - version: "0.5.3" - typed_data: - dependency: transitive - description: - name: typed_data - sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c - url: "https://pub.dev" - source: hosted - version: "1.3.2" vector_math: dependency: transitive description: @@ -392,22 +168,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583 - url: "https://pub.dev" - source: hosted - version: "11.10.0" - watcher: - dependency: transitive - description: - name: watcher - sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" - url: "https://pub.dev" - source: hosted - version: "1.1.0" web: dependency: transitive description: @@ -416,29 +176,5 @@ packages: url: "https://pub.dev" source: hosted version: "0.1.4-beta" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b - url: "https://pub.dev" - source: hosted - version: "2.4.0" - webkit_inspection_protocol: - dependency: transitive - description: - name: webkit_inspection_protocol - sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" - url: "https://pub.dev" - source: hosted - version: "1.2.1" - yaml: - dependency: transitive - description: - name: yaml - sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" - url: "https://pub.dev" - source: hosted - version: "3.1.2" sdks: dart: ">=3.1.0-185.0.dev <4.0.0" diff --git a/sheet/pubspec.yaml b/sheet/pubspec.yaml index 95bb047a..b4c0e98e 100644 --- a/sheet/pubspec.yaml +++ b/sheet/pubspec.yaml @@ -13,7 +13,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - mocktail: ^0.3.0 - lints: ^2.1.1 + mocktail: ^1.0.1 + lints: ^3.0.0 flutter: \ No newline at end of file diff --git a/sheet/test/scrollable_of_test.dart b/sheet/test/scrollable_of_test.dart index abdc34eb..8cb45d26 100644 --- a/sheet/test/scrollable_of_test.dart +++ b/sheet/test/scrollable_of_test.dart @@ -8,8 +8,7 @@ import 'package:sheet/sheet.dart'; class ScrollPositionListener extends StatefulWidget { const ScrollPositionListener( - {Key? key, required this.child, required this.log}) - : super(key: key); + {super.key, required this.child, required this.log}); final Widget child; final ValueChanged log; diff --git a/sheet/test/src/widgets/min_interaction_test.dart b/sheet/test/src/widgets/min_interaction_test.dart index 8ae6949c..1a9244bc 100644 --- a/sheet/test/src/widgets/min_interaction_test.dart +++ b/sheet/test/src/widgets/min_interaction_test.dart @@ -32,7 +32,7 @@ void main() { late VoidCallback mockOnTap; setUp(() { - mockOnTap = MockVoidCallback(); + mockOnTap = MockVoidCallback().call; when(mockOnTap).thenAnswer((_) {}); }); From d5c9ceb4e2263f63f449ed9b1c212a34c6dcaa5d Mon Sep 17 00:00:00 2001 From: Haikal Izzuddin Date: Mon, 20 Nov 2023 18:43:38 +0800 Subject: [PATCH 13/29] [sheet] fixed for Flutter 3.16 (#381) --- sheet/lib/src/sheet.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sheet/lib/src/sheet.dart b/sheet/lib/src/sheet.dart index 602df321..d0c389d1 100644 --- a/sheet/lib/src/sheet.dart +++ b/sheet/lib/src/sheet.dart @@ -891,7 +891,7 @@ class RenderSheetViewport extends RenderBox @override RevealedOffset getOffsetToReveal(RenderObject target, double alignment, - {Rect? rect}) { + {Rect? rect, Axis? axis}) { rect ??= target.paintBounds; if (target is! RenderBox) { return RevealedOffset(offset: offset.pixels, rect: rect); From 2703e684f28e678f35dd800cbc5763e0f5fc874f Mon Sep 17 00:00:00 2001 From: Richard Shiue <71320345+richardshiue@users.noreply.github.com> Date: Tue, 12 Mar 2024 17:33:43 +0800 Subject: [PATCH 14/29] fix: adapt scrollable.dart to upstream SemanticsNode changes (#387) This PR https://github.com/flutter/flutter/pull/137304 makes SemanticsNode.isMergedIntoParent readonly, which makes the customized scrollable.dart incompatible. --- sheet/lib/src/scrollable.dart | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sheet/lib/src/scrollable.dart b/sheet/lib/src/scrollable.dart index 253f8fb3..c90f2daf 100644 --- a/sheet/lib/src/scrollable.dart +++ b/sheet/lib/src/scrollable.dart @@ -866,10 +866,7 @@ class _RenderScrollSemantics extends RenderProxyBox { return; } - _innerNode ??= SemanticsNode(showOnScreen: showOnScreen); - _innerNode! - ..isMergedIntoParent = node.isPartOfNodeMerging - ..rect = node.rect; + (_innerNode ??= SemanticsNode(showOnScreen: showOnScreen)).rect = node.rect; int? firstVisibleIndex; final List excluded = [_innerNode!]; From 14ff58b8c85d5bfa681aab98e22b5c870638ded2 Mon Sep 17 00:00:00 2001 From: Hari07 <22373191+Hari-07@users.noreply.github.com> Date: Tue, 12 Mar 2024 15:04:08 +0530 Subject: [PATCH 15/29] Expose `onAttach` and `onDetach` in scroll controller (#386) * Expose onattach and ondetach in scroll controller * Expose on attach and detach in sheet controller --- sheet/lib/src/scroll_controller.dart | 2 ++ sheet/lib/src/sheet.dart | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sheet/lib/src/scroll_controller.dart b/sheet/lib/src/scroll_controller.dart index e400dc88..c2606c87 100644 --- a/sheet/lib/src/scroll_controller.dart +++ b/sheet/lib/src/scroll_controller.dart @@ -19,6 +19,8 @@ class SheetPrimaryScrollController extends ScrollController { SheetPrimaryScrollController({ super.initialScrollOffset, super.debugLabel, + super.onAttach, + super.onDetach, required this.sheetContext, }); diff --git a/sheet/lib/src/sheet.dart b/sheet/lib/src/sheet.dart index d0c389d1..219ceb5c 100644 --- a/sheet/lib/src/sheet.dart +++ b/sheet/lib/src/sheet.dart @@ -317,7 +317,11 @@ class _DefaultSheetScrollController extends StatelessWidget { /// * [SheetPosition], which manages the positioning logic for /// this controller. class SheetController extends ScrollController { - SheetController({super.debugLabel}) : super(initialScrollOffset: 0); + SheetController({ + super.debugLabel, + super.onAttach, + super.onDetach, + }) : super(initialScrollOffset: 0); final ProxyAnimation _animation = ProxyAnimation(); Animation get animation => _animation; From e06e8e9e4b98dbe9cefdb294ba393091a39f4c95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Bentes?= Date: Tue, 12 Mar 2024 06:34:26 -0300 Subject: [PATCH 16/29] chore: Update example to latest flutter (#383) * chore: Upgrade compileSdkVersion, targeSdkVersion and kotlinVersion * chore: Upgrade gradle version * chore: Fix incompatibility with Java 16 --- modal_bottom_sheet/example/android/app/build.gradle | 6 +++--- modal_bottom_sheet/example/android/build.gradle | 4 ++-- modal_bottom_sheet/example/android/gradle.properties | 10 +++++++--- .../android/gradle/wrapper/gradle-wrapper.properties | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/modal_bottom_sheet/example/android/app/build.gradle b/modal_bottom_sheet/example/android/app/build.gradle index 86d5ab45..03e5e854 100644 --- a/modal_bottom_sheet/example/android/app/build.gradle +++ b/modal_bottom_sheet/example/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 31 + compileSdkVersion 33 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -35,8 +35,8 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.example" - minSdkVersion 16 - targetSdkVersion 31 + minSdkVersion flutter.minSdkVersion + targetSdkVersion 33 versionCode flutterVersionCode.toInteger() versionName flutterVersionName } diff --git a/modal_bottom_sheet/example/android/build.gradle b/modal_bottom_sheet/example/android/build.gradle index 714549c2..2509e3ee 100644 --- a/modal_bottom_sheet/example/android/build.gradle +++ b/modal_bottom_sheet/example/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.6.10' + ext.kotlin_version = '1.7.10' repositories { google() jcenter() @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/modal_bottom_sheet/example/android/gradle.properties b/modal_bottom_sheet/example/android/gradle.properties index 94adc3a3..9f9844a8 100644 --- a/modal_bottom_sheet/example/android/gradle.properties +++ b/modal_bottom_sheet/example/android/gradle.properties @@ -1,3 +1,7 @@ -org.gradle.jvmargs=-Xmx1536M -android.useAndroidX=true -android.enableJetifier=true +org.gradle.jvmargs=-Xmx1536M \ +--add-exports=java.base/sun.nio.ch=ALL-UNNAMED \ +--add-opens=java.base/java.lang=ALL-UNNAMED \ +--add-opens=java.base/java.lang.reflect=ALL-UNNAMED \ +--add-opens=java.base/java.io=ALL-UNNAMED \ +--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED +android.useAndroidX=true \ No newline at end of file diff --git a/modal_bottom_sheet/example/android/gradle/wrapper/gradle-wrapper.properties b/modal_bottom_sheet/example/android/gradle/wrapper/gradle-wrapper.properties index bc6a58af..cfe88f69 100644 --- a/modal_bottom_sheet/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/modal_bottom_sheet/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip From 2e4826dcf2c60b4f541b10334d33fafe20925bc4 Mon Sep 17 00:00:00 2001 From: Jaime Blasco Date: Tue, 12 Mar 2024 10:42:08 +0100 Subject: [PATCH 17/29] feat: bring up to date (#391) * fix: lints * feat: fix inner not resizing * fix: expanded --- .../example/analysis_options.yaml | 5 +- modal_bottom_sheet/example/ios/Podfile.lock | 4 +- .../example/lib/examples/cupertino_share.dart | 6 +- modal_bottom_sheet/example/lib/main.dart | 4 +- .../example/lib/modals/circular_modal.dart | 5 +- .../example/lib/modals/floating_modal.dart | 3 +- .../example/lib/modals/modal_complex_all.dart | 2 +- .../example/lib/modals/modal_fit.dart | 2 +- .../lib/modals/modal_inside_modal.dart | 2 +- .../example/lib/modals/modal_simple.dart | 2 +- .../example/lib/modals/modal_will_scope.dart | 2 +- .../lib/modals/modal_with_navigator.dart | 16 +- .../lib/modals/modal_with_nested_scroll.dart | 2 +- .../lib/modals/modal_with_page_view.dart | 2 +- .../example/lib/modals/modal_with_scroll.dart | 2 +- modal_bottom_sheet/example/lib/web_frame.dart | 2 +- modal_bottom_sheet/example/pubspec.lock | 34 ++- modal_bottom_sheet/example/pubspec.yaml | 59 +---- modal_bottom_sheet/lib/src/bottom_sheet.dart | 24 +- .../bottom_sheets/cupertino_bottom_sheet.dart | 2 +- .../src/utils/scroll_to_top_status_bar.dart | 68 +++-- sheet/example/analysis_options.yaml | 1 + .../ios/Runner.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- sheet/example/lib/base_scaffold.dart | 11 +- sheet/example/lib/editor/editor_page.dart | 13 +- .../route/examples/modal_inside_modal.dart | 2 +- .../examples/route/examples/modal_simple.dart | 3 +- .../examples/route/modals/avatar_sheet.dart | 3 +- .../lib/examples/route/modals/bar_sheet.dart | 24 +- .../examples/route/modals/dialog_sheet.dart | 3 +- .../examples/route/modals/floating_sheet.dart | 3 +- .../examples/route/modals/material_sheet.dart | 19 +- .../route/navigation/go_router_advanced.dart | 236 ++++++++++++++++++ .../lib/examples/sheet/bouncing_sheet.dart | 2 +- .../lib/examples/sheet/clamped_sheet.dart | 2 +- .../examples/sheet/complex_snap_sheet.dart | 8 +- .../examples/sheet/fit_resizable_sheet.dart | 2 +- .../lib/examples/sheet/fit_sheet_snap.dart | 2 +- .../lib/examples/sheet/floating_sheet.dart | 2 +- .../lib/examples/sheet/fold_screen_sheet.dart | 2 +- .../sheet/sheet_without_momentum.dart | 2 +- .../lib/examples/sheet/snap_sheet.dart | 2 +- .../lib/examples/sheet/text_field.dart | 2 +- sheet/example/lib/main.dart | 22 +- sheet/example/lib/route_example_page.dart | 16 +- sheet/example/lib/sheet_example_page.dart | 5 +- sheet/example/pubspec.lock | 16 +- sheet/example/pubspec.yaml | 6 +- sheet/lib/src/physics.dart | 10 + .../lib/src/route/cupertino/sheet_route.dart | 8 +- sheet/lib/src/route/sheet_route.dart | 3 + sheet/lib/src/sheet.dart | 12 +- .../src/widgets/default_sheet_controller.dart | 16 +- sheet/lib/src/widgets/min_interaction.dart | 8 +- .../widgets/scroll_to_top_status_handler.dart | 62 ----- .../widgets/status_bar_gesture_detector.dart | 73 ++++++ sheet/pubspec.lock | 2 +- sheet/pubspec.yaml | 5 +- sheet/test/scrollable_of_test.dart | 7 +- .../scroll_to_top_status_handler_test.dart | 38 --- .../status_bar_gesture_detector_test.dart | 47 ++++ 62 files changed, 595 insertions(+), 357 deletions(-) create mode 100644 sheet/example/analysis_options.yaml create mode 100644 sheet/example/lib/examples/route/navigation/go_router_advanced.dart delete mode 100644 sheet/lib/src/widgets/scroll_to_top_status_handler.dart create mode 100644 sheet/lib/src/widgets/status_bar_gesture_detector.dart delete mode 100644 sheet/test/src/widgets/scroll_to_top_status_handler_test.dart create mode 100644 sheet/test/src/widgets/status_bar_gesture_detector_test.dart diff --git a/modal_bottom_sheet/example/analysis_options.yaml b/modal_bottom_sheet/example/analysis_options.yaml index f468c238..572dd239 100644 --- a/modal_bottom_sheet/example/analysis_options.yaml +++ b/modal_bottom_sheet/example/analysis_options.yaml @@ -1,4 +1 @@ - - -enable-experiment: - - extension-methods \ No newline at end of file +include: package:lints/recommended.yaml diff --git a/modal_bottom_sheet/example/ios/Podfile.lock b/modal_bottom_sheet/example/ios/Podfile.lock index a1127c65..69a9e703 100644 --- a/modal_bottom_sheet/example/ios/Podfile.lock +++ b/modal_bottom_sheet/example/ios/Podfile.lock @@ -15,8 +15,8 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 - url_launcher_ios: ae1517e5e344f5544fb090b079e11f399dfbe4d2 + url_launcher_ios: 68d46cc9766d0c41dbdc884310529557e3cd7a86 PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 -COCOAPODS: 1.13.0 +COCOAPODS: 1.14.3 diff --git a/modal_bottom_sheet/example/lib/examples/cupertino_share.dart b/modal_bottom_sheet/example/lib/examples/cupertino_share.dart index 893b10f4..d7202c1a 100644 --- a/modal_bottom_sheet/example/lib/examples/cupertino_share.dart +++ b/modal_bottom_sheet/example/lib/examples/cupertino_share.dart @@ -93,7 +93,7 @@ class CupertinoSharePage extends StatelessWidget { } class PhotoShareBottomSheet extends StatelessWidget { - const PhotoShareBottomSheet({Key? key}) : super(key: key); + const PhotoShareBottomSheet({super.key}); @override Widget build(BuildContext context) { @@ -539,9 +539,9 @@ final actions2 = [ ]; extension ListUtils on List { - List addItemInBetween(A item) => this.length == 0 + List addItemInBetween(A item) => isEmpty ? this - : (this.fold([], (r, element) => [...r, element, item])..removeLast()); + : (fold([], (r, element) => [...r, element, item])..removeLast()); } class SimpleSliverDelegate extends SliverPersistentHeaderDelegate { diff --git a/modal_bottom_sheet/example/lib/main.dart b/modal_bottom_sheet/example/lib/main.dart index c0af86da..e28a1a74 100644 --- a/modal_bottom_sheet/example/lib/main.dart +++ b/modal_bottom_sheet/example/lib/main.dart @@ -92,12 +92,12 @@ class MyApp extends StatelessWidget { } class MyHomePage extends StatefulWidget { - MyHomePage({Key? key, required this.title}) : super(key: key); + MyHomePage({super.key, required this.title}); final String title; @override - _MyHomePageState createState() => _MyHomePageState(); + State createState() => _MyHomePageState(); } class _MyHomePageState extends State { diff --git a/modal_bottom_sheet/example/lib/modals/circular_modal.dart b/modal_bottom_sheet/example/lib/modals/circular_modal.dart index 4fcb43f3..a2fb46e9 100644 --- a/modal_bottom_sheet/example/lib/modals/circular_modal.dart +++ b/modal_bottom_sheet/example/lib/modals/circular_modal.dart @@ -11,11 +11,10 @@ class AvatarBottomSheet extends StatelessWidget { final SystemUiOverlayStyle? overlayStyle; const AvatarBottomSheet( - {Key? key, + {super.key, required this.child, required this.animation, - this.overlayStyle}) - : super(key: key); + this.overlayStyle}); @override Widget build(BuildContext context) { diff --git a/modal_bottom_sheet/example/lib/modals/floating_modal.dart b/modal_bottom_sheet/example/lib/modals/floating_modal.dart index a4033731..4c894cf8 100644 --- a/modal_bottom_sheet/example/lib/modals/floating_modal.dart +++ b/modal_bottom_sheet/example/lib/modals/floating_modal.dart @@ -5,8 +5,7 @@ class FloatingModal extends StatelessWidget { final Widget child; final Color? backgroundColor; - const FloatingModal({Key? key, required this.child, this.backgroundColor}) - : super(key: key); + const FloatingModal({super.key, required this.child, this.backgroundColor}); @override Widget build(BuildContext context) { diff --git a/modal_bottom_sheet/example/lib/modals/modal_complex_all.dart b/modal_bottom_sheet/example/lib/modals/modal_complex_all.dart index 9038f3c9..68508fde 100644 --- a/modal_bottom_sheet/example/lib/modals/modal_complex_all.dart +++ b/modal_bottom_sheet/example/lib/modals/modal_complex_all.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; class ComplexModal extends StatelessWidget { - const ComplexModal({Key? key}) : super(key: key); + const ComplexModal({super.key}); @override Widget build(BuildContext context) { diff --git a/modal_bottom_sheet/example/lib/modals/modal_fit.dart b/modal_bottom_sheet/example/lib/modals/modal_fit.dart index af4d979c..f716b7d5 100644 --- a/modal_bottom_sheet/example/lib/modals/modal_fit.dart +++ b/modal_bottom_sheet/example/lib/modals/modal_fit.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; class ModalFit extends StatelessWidget { - const ModalFit({Key? key}) : super(key: key); + const ModalFit({super.key}); @override Widget build(BuildContext context) { diff --git a/modal_bottom_sheet/example/lib/modals/modal_inside_modal.dart b/modal_bottom_sheet/example/lib/modals/modal_inside_modal.dart index 9f412078..eadf1be8 100644 --- a/modal_bottom_sheet/example/lib/modals/modal_inside_modal.dart +++ b/modal_bottom_sheet/example/lib/modals/modal_inside_modal.dart @@ -5,7 +5,7 @@ import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; class ModalInsideModal extends StatelessWidget { final bool reverse; - const ModalInsideModal({Key? key, this.reverse = false}) : super(key: key); + const ModalInsideModal({super.key, this.reverse = false}); @override Widget build(BuildContext context) { diff --git a/modal_bottom_sheet/example/lib/modals/modal_simple.dart b/modal_bottom_sheet/example/lib/modals/modal_simple.dart index 7d3d4485..14076346 100644 --- a/modal_bottom_sheet/example/lib/modals/modal_simple.dart +++ b/modal_bottom_sheet/example/lib/modals/modal_simple.dart @@ -2,7 +2,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class SimpleModal extends StatelessWidget { - const SimpleModal({Key? key}) : super(key: key); + const SimpleModal({super.key}); @override Widget build(BuildContext context) { diff --git a/modal_bottom_sheet/example/lib/modals/modal_will_scope.dart b/modal_bottom_sheet/example/lib/modals/modal_will_scope.dart index 7744ab9c..506f84c3 100644 --- a/modal_bottom_sheet/example/lib/modals/modal_will_scope.dart +++ b/modal_bottom_sheet/example/lib/modals/modal_will_scope.dart @@ -2,7 +2,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class ModalWillScope extends StatelessWidget { - const ModalWillScope({Key? key}) : super(key: key); + const ModalWillScope({super.key}); @override Widget build(BuildContext context) { diff --git a/modal_bottom_sheet/example/lib/modals/modal_with_navigator.dart b/modal_bottom_sheet/example/lib/modals/modal_with_navigator.dart index da3d344d..6236274d 100644 --- a/modal_bottom_sheet/example/lib/modals/modal_with_navigator.dart +++ b/modal_bottom_sheet/example/lib/modals/modal_with_navigator.dart @@ -3,30 +3,30 @@ import 'package:flutter/material.dart'; import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; class ModalWithNavigator extends StatelessWidget { - const ModalWithNavigator({Key? key}) : super(key: key); + const ModalWithNavigator({super.key}); @override - Widget build(BuildContext rootContext) { + Widget build(BuildContext context) { return Material( child: Navigator( onGenerateRoute: (_) => MaterialPageRoute( - builder: (context2) => Builder( - builder: (context) => CupertinoPageScaffold( + builder: (childContext) => Builder( + builder: (childContext2) => CupertinoPageScaffold( navigationBar: CupertinoNavigationBar( leading: Container(), middle: Text('Modal Page')), child: SafeArea( bottom: false, child: ListView( shrinkWrap: true, - controller: ModalScrollController.of(context), + controller: ModalScrollController.of(childContext2), children: ListTile.divideTiles( - context: context, + context: childContext2, tiles: List.generate( 100, (index) => ListTile( title: Text('Item'), onTap: () { - Navigator.of(context).push( + Navigator.of(childContext2).push( MaterialPageRoute( builder: (context) => CupertinoPageScaffold( navigationBar: CupertinoNavigationBar( @@ -37,7 +37,7 @@ class ModalWithNavigator extends StatelessWidget { children: [ MaterialButton( onPressed: () => - Navigator.of(rootContext).pop(), + Navigator.of(context).pop(), child: Text('touch here'), ) ], diff --git a/modal_bottom_sheet/example/lib/modals/modal_with_nested_scroll.dart b/modal_bottom_sheet/example/lib/modals/modal_with_nested_scroll.dart index 14f56e64..b0aa6d67 100644 --- a/modal_bottom_sheet/example/lib/modals/modal_with_nested_scroll.dart +++ b/modal_bottom_sheet/example/lib/modals/modal_with_nested_scroll.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; class NestedScrollModal extends StatelessWidget { - const NestedScrollModal({Key? key}) : super(key: key); + const NestedScrollModal({super.key}); @override Widget build(BuildContext context) { diff --git a/modal_bottom_sheet/example/lib/modals/modal_with_page_view.dart b/modal_bottom_sheet/example/lib/modals/modal_with_page_view.dart index 972a8bad..d9617f21 100644 --- a/modal_bottom_sheet/example/lib/modals/modal_with_page_view.dart +++ b/modal_bottom_sheet/example/lib/modals/modal_with_page_view.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; class ModalWithPageView extends StatelessWidget { - const ModalWithPageView({Key? key}) : super(key: key); + const ModalWithPageView({super.key}); @override Widget build(BuildContext context) { diff --git a/modal_bottom_sheet/example/lib/modals/modal_with_scroll.dart b/modal_bottom_sheet/example/lib/modals/modal_with_scroll.dart index d5430c95..f5209781 100644 --- a/modal_bottom_sheet/example/lib/modals/modal_with_scroll.dart +++ b/modal_bottom_sheet/example/lib/modals/modal_with_scroll.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; class ModalWithScroll extends StatelessWidget { - const ModalWithScroll({Key? key}) : super(key: key); + const ModalWithScroll({super.key}); @override Widget build(BuildContext context) { diff --git a/modal_bottom_sheet/example/lib/web_frame.dart b/modal_bottom_sheet/example/lib/web_frame.dart index 604da1aa..7f5ef3a2 100644 --- a/modal_bottom_sheet/example/lib/web_frame.dart +++ b/modal_bottom_sheet/example/lib/web_frame.dart @@ -6,7 +6,7 @@ import 'package:url_launcher/url_launcher_string.dart'; class WebFrame extends StatelessWidget { final Widget child; - const WebFrame({Key? key, required this.child}) : super(key: key); + const WebFrame({super.key, required this.child}); @override Widget build(BuildContext context) { diff --git a/modal_bottom_sheet/example/pubspec.lock b/modal_bottom_sheet/example/pubspec.lock index 78b15c15..3eaf01df 100644 --- a/modal_bottom_sheet/example/pubspec.lock +++ b/modal_bottom_sheet/example/pubspec.lock @@ -37,10 +37,10 @@ packages: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" cupertino_icons: dependency: "direct main" description: @@ -72,6 +72,14 @@ packages: description: flutter source: sdk version: "0.0.0" + lints: + dependency: "direct dev" + description: + name: lints + sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 + url: "https://pub.dev" + source: hosted + version: "3.0.0" matcher: dependency: transitive description: @@ -92,10 +100,10 @@ packages: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" modal_bottom_sheet: dependency: "direct main" description: @@ -136,18 +144,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" string_scanner: dependency: transitive description: @@ -168,10 +176,10 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.6.1" url_launcher: dependency: "direct main" description: @@ -248,10 +256,10 @@ packages: dependency: transitive description: name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "0.3.0" sdks: - dart: ">=3.1.0 <4.0.0" + dart: ">=3.2.0-194.0.dev <4.0.0" flutter: ">=3.13.0" diff --git a/modal_bottom_sheet/example/pubspec.yaml b/modal_bottom_sheet/example/pubspec.yaml index a71607b5..23c4c84b 100644 --- a/modal_bottom_sheet/example/pubspec.yaml +++ b/modal_bottom_sheet/example/pubspec.yaml @@ -1,75 +1,26 @@ name: example description: A new Flutter project. publish_to: none -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html version: 1.0.0+1 environment: - sdk: '>=2.17.0 <3.0.0' - flutter: ">=3.7.0" - + sdk: ">=3.0.0 <4.0.0" dependencies: - cupertino_icons: ^1.0.5 + cupertino_icons: ^1.0.6 flutter: sdk: flutter modal_bottom_sheet: path: '../' - url_launcher: ^6.1.5 + url_launcher: ^6.2.1 dev_dependencies: flutter_test: sdk: flutter + lints: ^3.0.0 -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec -# The following section is specific to Flutter. flutter: - - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. uses-material-design: true - assets: - - assets/ - # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware. - - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages - - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages + - assets/ \ No newline at end of file diff --git a/modal_bottom_sheet/lib/src/bottom_sheet.dart b/modal_bottom_sheet/lib/src/bottom_sheet.dart index 742e6ece..1f55ae93 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheet.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheet.dart @@ -47,7 +47,7 @@ class ModalBottomSheet extends StatefulWidget { this.minFlingVelocity = _minFlingVelocity, double? closeProgressThreshold, this.willPopThreshold = _willPopThreshold, - }) : closeProgressThreshold = + }) : closeProgressThreshold = closeProgressThreshold ?? _closeProgressThreshold; /// The closeProgressThreshold parameter @@ -231,7 +231,6 @@ class ModalBottomSheetState extends State if (_dismissUnderway || !isDragging) return; isDragging = false; - // ignore: unawaited_futures _bounceDragController.reverse(); Future tryClose() async { @@ -251,7 +250,6 @@ class ModalBottomSheetState extends State tryClose(); } else if (hasReachedCloseThreshold) { if (widget.animationController.value > 0.0) { - // ignore: unawaited_futures widget.animationController.fling(velocity: -1.0); } tryClose(); @@ -273,13 +271,11 @@ class ModalBottomSheetState extends State if (!_scrollController.hasClients) return; ScrollPosition scrollPosition; - // ignore: invalid_use_of_protected_member + if (_scrollController.positions.length > 1) { - // ignore: invalid_use_of_protected_member - scrollPosition = _scrollController.positions - .firstWhere((p) => p.isScrollingNotifier.value, - // ignore: invalid_use_of_protected_member - orElse: () => _scrollController.positions.first); + scrollPosition = _scrollController.positions.firstWhere( + (p) => p.isScrollingNotifier.value, + orElse: () => _scrollController.positions.first); } else { scrollPosition = _scrollController.position; } @@ -412,9 +408,15 @@ class ModalBottomSheetState extends State child: RepaintBoundary(child: child), ); - return ScrollToTopStatusBarHandler( + return StatusBarGestureDetector( child: child, - scrollController: _scrollController, + onTap: (context) { + _scrollController.animateTo( + 0.0, + duration: const Duration(milliseconds: 1000), + curve: Curves.easeOutCirc, + ); + }, ); } } diff --git a/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart b/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart index 7bafe49f..db1da315 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart @@ -395,7 +395,7 @@ class CupertinoScaffoldInheirted extends InheritedWidget { required super.child, this.topRadius, required this.transitionBackgroundColor, - }) : super(); + }); @override bool updateShouldNotify(InheritedWidget oldWidget) { diff --git a/modal_bottom_sheet/lib/src/utils/scroll_to_top_status_bar.dart b/modal_bottom_sheet/lib/src/utils/scroll_to_top_status_bar.dart index 89515ac6..c0557192 100644 --- a/modal_bottom_sheet/lib/src/utils/scroll_to_top_status_bar.dart +++ b/modal_bottom_sheet/lib/src/utils/scroll_to_top_status_bar.dart @@ -1,61 +1,57 @@ -import 'package:flutter/widgets.dart'; +import 'package:flutter/material.dart'; -/// Widget that that will scroll to the top the ScrollController +typedef StatusBarGestureDetectorCallback = void Function(BuildContext context); + +/// Widget that that will make the [scrollController] to scroll the top /// when tapped on the status bar /// -/// Extracted from Scaffold and used in modal bottom sheet -class ScrollToTopStatusBarHandler extends StatefulWidget { - final Widget child; - final ScrollController scrollController; - - const ScrollToTopStatusBarHandler({ +/// Extracted from [Scaffold] and used in [Sheet] +class StatusBarGestureDetector extends StatefulWidget { + const StatusBarGestureDetector({ super.key, required this.child, - required this.scrollController, + required this.onTap, }); + final Widget child; + + final StatusBarGestureDetectorCallback onTap; + @override - ScrollToTopStatusBarState createState() => ScrollToTopStatusBarState(); + State createState() => + _StatusBarGestureDetectorState(); } -class ScrollToTopStatusBarState extends State { +class _StatusBarGestureDetectorState extends State { + final OverlayPortalController controller = OverlayPortalController(); + @override void initState() { + controller.show(); super.initState(); } @override Widget build(BuildContext context) { - return Stack( - fit: StackFit.expand, - children: [ - widget.child, - Positioned( - top: 0, - left: 0, - right: 0, - height: MediaQuery.of(context).padding.top, - child: Builder( - builder: (context) => GestureDetector( + final view = View.of(context); + return OverlayPortal.targetsRootOverlay( + controller: controller, + overlayChildBuilder: (context) { + return Align( + alignment: Alignment.topCenter, + child: SizedBox( + height: view.padding.top / view.devicePixelRatio, + width: double.infinity, + child: GestureDetector( behavior: HitTestBehavior.opaque, - onTap: () => _handleStatusBarTap(context), + onTap: () => widget.onTap(context), // iOS accessibility automatically adds scroll-to-top to the clock in the status bar excludeFromSemantics: true, ), ), - ), - ], + ); + }, + child: widget.child, ); } - - void _handleStatusBarTap(BuildContext context) { - final controller = widget.scrollController; - if (controller.hasClients) { - controller.animateTo( - 0.0, - duration: const Duration(milliseconds: 300), - curve: Curves.linear, // TODO(ianh): Use a more appropriate curve. - ); - } - } } diff --git a/sheet/example/analysis_options.yaml b/sheet/example/analysis_options.yaml new file mode 100644 index 00000000..ea2c9e94 --- /dev/null +++ b/sheet/example/analysis_options.yaml @@ -0,0 +1 @@ +include: package:lints/recommended.yaml \ No newline at end of file diff --git a/sheet/example/ios/Runner.xcodeproj/project.pbxproj b/sheet/example/ios/Runner.xcodeproj/project.pbxproj index f45ef400..8036f6e3 100644 --- a/sheet/example/ios/Runner.xcodeproj/project.pbxproj +++ b/sheet/example/ios/Runner.xcodeproj/project.pbxproj @@ -127,7 +127,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1430; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { diff --git a/sheet/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/sheet/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 3db53b6e..b52b2e69 100644 --- a/sheet/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/sheet/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ ? onChanged; final int maxNumber; @override @@ -318,8 +317,8 @@ class NumericalRangeFormatter extends TextInputFormatter { class SectionTitle extends StatelessWidget { const SectionTitle( this.text, { - Key? key, - }) : super(key: key); + super.key, + }); final String text; diff --git a/sheet/example/lib/examples/route/examples/modal_inside_modal.dart b/sheet/example/lib/examples/route/examples/modal_inside_modal.dart index 14a65f42..de001bcd 100644 --- a/sheet/example/lib/examples/route/examples/modal_inside_modal.dart +++ b/sheet/example/lib/examples/route/examples/modal_inside_modal.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'package:sheet/route.dart'; class ModalInsideModal extends StatelessWidget { - const ModalInsideModal({Key? key, this.reverse = false}) : super(key: key); + const ModalInsideModal({super.key, this.reverse = false}); final bool reverse; @override diff --git a/sheet/example/lib/examples/route/examples/modal_simple.dart b/sheet/example/lib/examples/route/examples/modal_simple.dart index c8632b52..2b31fa3d 100644 --- a/sheet/example/lib/examples/route/examples/modal_simple.dart +++ b/sheet/example/lib/examples/route/examples/modal_simple.dart @@ -2,8 +2,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class SimpleModal extends StatelessWidget { - const SimpleModal({Key? key, required this.scrollController}) - : super(key: key); + const SimpleModal({super.key, required this.scrollController}); final ScrollController scrollController; @override diff --git a/sheet/example/lib/examples/route/modals/avatar_sheet.dart b/sheet/example/lib/examples/route/modals/avatar_sheet.dart index 8d9046e3..2b001590 100644 --- a/sheet/example/lib/examples/route/modals/avatar_sheet.dart +++ b/sheet/example/lib/examples/route/modals/avatar_sheet.dart @@ -24,8 +24,7 @@ class AvatarSheetRoute extends SheetRoute { } class _AvatarSheet extends StatelessWidget { - const _AvatarSheet({Key? key, required this.child, required this.animation}) - : super(key: key); + const _AvatarSheet({required this.child, required this.animation}); final Widget child; final Animation animation; diff --git a/sheet/example/lib/examples/route/modals/bar_sheet.dart b/sheet/example/lib/examples/route/modals/bar_sheet.dart index 0f1deca8..28466cb6 100644 --- a/sheet/example/lib/examples/route/modals/bar_sheet.dart +++ b/sheet/example/lib/examples/route/modals/bar_sheet.dart @@ -1,19 +1,17 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:sheet/route.dart'; -import 'package:sheet/sheet.dart'; -const Radius _default_bar_top_radius = Radius.circular(15); +const Radius _defaultBarTopRadius = Radius.circular(15); class BarBottomSheet extends StatelessWidget { const BarBottomSheet( - {Key? key, + {super.key, required this.child, this.control, this.clipBehavior, this.shape, - this.elevation}) - : super(key: key); + this.elevation}); final Widget child; final Widget? control; final Clip? clipBehavior; @@ -49,8 +47,8 @@ class BarBottomSheet extends StatelessWidget { const RoundedRectangleBorder( side: BorderSide(), borderRadius: BorderRadius.only( - topLeft: _default_bar_top_radius, - topRight: _default_bar_top_radius), + topLeft: _defaultBarTopRadius, + topRight: _defaultBarTopRadius), ), clipBehavior: clipBehavior ?? Clip.hardEdge, elevation: elevation ?? 2, @@ -72,13 +70,13 @@ class BarSheetRoute extends SheetRoute { double? elevation, ShapeBorder? shape, Clip? clipBehavior, - Color barrierColor = Colors.black87, - SheetFit fit = SheetFit.expand, - Curve? animationCurve, + Color super.barrierColor = Colors.black87, + super.fit, + super.animationCurve, bool isDismissible = true, bool enableDrag = true, Widget? topControl, - Duration? duration, + super.duration, }) : super( builder: (BuildContext context) { return BarBottomSheet( @@ -89,11 +87,7 @@ class BarSheetRoute extends SheetRoute { elevation: elevation, ); }, - fit: fit, barrierDismissible: isDismissible, - barrierColor: barrierColor, draggable: enableDrag, - animationCurve: animationCurve, - duration: duration, ); } diff --git a/sheet/example/lib/examples/route/modals/dialog_sheet.dart b/sheet/example/lib/examples/route/modals/dialog_sheet.dart index 8472390f..e5bcd035 100644 --- a/sheet/example/lib/examples/route/modals/dialog_sheet.dart +++ b/sheet/example/lib/examples/route/modals/dialog_sheet.dart @@ -3,8 +3,7 @@ import 'package:sheet/route.dart'; import 'package:sheet/sheet.dart'; class DialogSheet extends StatelessWidget { - const DialogSheet({Key? key, required this.child, this.backgroundColor}) - : super(key: key); + const DialogSheet({super.key, required this.child, this.backgroundColor}); final Widget child; final Color? backgroundColor; diff --git a/sheet/example/lib/examples/route/modals/floating_sheet.dart b/sheet/example/lib/examples/route/modals/floating_sheet.dart index 2f471502..24643071 100644 --- a/sheet/example/lib/examples/route/modals/floating_sheet.dart +++ b/sheet/example/lib/examples/route/modals/floating_sheet.dart @@ -3,8 +3,7 @@ import 'package:sheet/route.dart'; import 'package:sheet/sheet.dart'; class FloatingModal extends StatelessWidget { - const FloatingModal({Key? key, required this.child, this.backgroundColor}) - : super(key: key); + const FloatingModal({super.key, required this.child, this.backgroundColor}); final Widget child; final Color? backgroundColor; diff --git a/sheet/example/lib/examples/route/modals/material_sheet.dart b/sheet/example/lib/examples/route/modals/material_sheet.dart index f6ca37ac..1e1fb90a 100644 --- a/sheet/example/lib/examples/route/modals/material_sheet.dart +++ b/sheet/example/lib/examples/route/modals/material_sheet.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:sheet/route.dart'; -import 'package:sheet/sheet.dart'; class MaterialSheetRoute extends SheetRoute { MaterialSheetRoute({ @@ -9,14 +8,14 @@ class MaterialSheetRoute extends SheetRoute { double? elevation, ShapeBorder? shape, Clip? clipBehavior, - Color barrierColor = Colors.black87, - SheetFit fit = SheetFit.expand, - Curve? animationCurve, - bool barrierDismissible = true, + Color super.barrierColor = Colors.black87, + super.fit, + super.animationCurve, + super.barrierDismissible, bool enableDrag = true, - List? stops, + super.stops, double initialStop = 1, - Duration? duration, + super.duration, }) : super( builder: (BuildContext context) => Material( child: Builder( @@ -27,13 +26,7 @@ class MaterialSheetRoute extends SheetRoute { shape: shape, elevation: elevation ?? 1, ), - stops: stops, initialExtent: initialStop, - fit: fit, - barrierDismissible: barrierDismissible, - barrierColor: barrierColor, draggable: enableDrag, - animationCurve: animationCurve, - duration: duration, ); } diff --git a/sheet/example/lib/examples/route/navigation/go_router_advanced.dart b/sheet/example/lib/examples/route/navigation/go_router_advanced.dart new file mode 100644 index 00000000..2eee42f0 --- /dev/null +++ b/sheet/example/lib/examples/route/navigation/go_router_advanced.dart @@ -0,0 +1,236 @@ +import 'package:collection/collection.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:sheet/route.dart'; + +class Book { + const Book(this.id, this.title, this.author); + final String id; + final String title; + final String author; +} + +class AdvancedGoRouterBooksApp extends StatefulWidget { + @override + State createState() => _GoRouterBooksAppState(); +} + +class _GoRouterBooksAppState extends State { + List books = [ + const Book('1', 'Stranger in a Strange Land', 'Robert A. Heinlein'), + const Book('2', 'Foundation', 'Isaac Asimov'), + const Book('3', 'Fahrenheit 451', 'Ray Bradbury'), + ]; + + @override + void initState() { + super.initState(); + } + + Brightness brightness = Brightness.light; + + @override + Widget build(BuildContext context) { + return MaterialApp.router( + routeInformationProvider: _router.routeInformationProvider, + routeInformationParser: _router.routeInformationParser, + routerDelegate: _router.routerDelegate, + debugShowCheckedModeBanner: false, + theme: + brightness == Brightness.light ? ThemeData.light() : ThemeData.dark(), + title: 'Books App', + builder: (BuildContext context, Widget? child) { + return CupertinoTheme( + data: CupertinoThemeData(brightness: brightness), + child: child!, + ); + }, + ); + } + + final rootNavigatorKey = GlobalKey(); + final nestedNavigationKey = GlobalKey(); + late final GoRouter _router = GoRouter( + debugLogDiagnostics: true, + navigatorKey: rootNavigatorKey, + routes: [ + GoRoute( + path: '/', + pageBuilder: (BuildContext context, GoRouterState state) { + return MaterialExtendedPage( + key: state.pageKey, + child: BooksListScreen( + books: books, + onBrigthnessChanged: (Brightness brightness) { + setState(() { + this.brightness = brightness; + }); + }, + ), + ); + }, + routes: [ + ShellRoute( + navigatorKey: nestedNavigationKey, + parentNavigatorKey: rootNavigatorKey, + pageBuilder: (context, state, child) { + return CupertinoSheetPage(child: child); + }, + routes: [ + GoRoute( + name: 'book', + path: 'book/:bid', + parentNavigatorKey: nestedNavigationKey, + pageBuilder: (BuildContext context, GoRouterState state) { + final String id = state.pathParameters['bid']!; + final Book? book = + books.firstWhereOrNull((Book b) => b.id == id); + return MaterialPage( + key: state.pageKey, + child: BookDetailsScreen( + book: book!, + ), + ); + }, + redirect: (context, state) { + final String id = state.pathParameters['bid']!; + final Book? book = + books.firstWhereOrNull((Book b) => b.id == id); + if (book == null) { + return '/404'; + } + // no need to redirect at all + return null; + }, + routes: [ + GoRoute( + name: 'Reviews', + path: 'reviews', + parentNavigatorKey: nestedNavigationKey, + pageBuilder: (context, state) { + return MaterialPage( + key: state.pageKey, + child: Scaffold( + appBar: AppBar( + title: const Text('Reviews'), + ), + ), + ); + }, + ), + ]), + ]), + GoRoute( + name: 'new', + path: 'new', + parentNavigatorKey: rootNavigatorKey, + pageBuilder: (BuildContext context, GoRouterState state) { + return CupertinoSheetPage( + key: state.pageKey, + child: Scaffold( + backgroundColor: Colors.grey[200], + appBar: AppBar( + title: const Text('New'), + ), + ), + ); + }, + ), + ]), + ], + ); +} + +class BooksListScreen extends StatelessWidget { + const BooksListScreen({ + required this.books, + required this.onBrigthnessChanged, + }); + final List books; + + final void Function(Brightness) onBrigthnessChanged; + + @override + Widget build(BuildContext context) { + final Brightness brightness = Theme.of(context).brightness; + return Scaffold( + appBar: CupertinoNavigationBar( + leading: BackButton(onPressed: () { + Navigator.of(context, rootNavigator: true).pop(); + }), + middle: const Text('Book'), + trailing: IconButton( + icon: Icon(brightness == Brightness.light + ? Icons.nightlight_round + : Icons.wb_sunny), + onPressed: () { + onBrigthnessChanged( + brightness == Brightness.light + ? Brightness.dark + : Brightness.light, + ); + }, + ), + ), + body: SafeArea( + child: ListView( + children: [ + for (Book book in books) + ListTile( + title: Text(book.title), + subtitle: Text(book.author), + onTap: () { + context.go('/book/${book.id}'); + }, + trailing: TextButton( + onPressed: () { + context.go('/book/${book.id}'); + context.go('/book/${book.id}/reviews'); + }, + child: const Text('Reviews'), + )) + ], + ), + ), + ); + } +} + +class BookDetailsScreen extends StatelessWidget { + const BookDetailsScreen({ + required this.book, + }); + final Book book; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: const CupertinoNavigationBar( + middle: Text('Book'), + ), + body: Padding( + padding: const EdgeInsets.all(8.0) + const EdgeInsets.only(top: 52.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Text(book.title, style: Theme.of(context).textTheme.titleLarge), + Text(book.author, style: Theme.of(context).textTheme.titleMedium), + TextButton( + onPressed: () { + context.go('/book/${book.id}/reviews'); + }, + child: Text('Reviews'), + ) + ], + ), + ), + floatingActionButton: FloatingActionButton( + child: const Icon(Icons.add), + onPressed: () { + context.push('/new'); + }, + ), + ); + } +} diff --git a/sheet/example/lib/examples/sheet/bouncing_sheet.dart b/sheet/example/lib/examples/sheet/bouncing_sheet.dart index f17b39e1..39306e88 100644 --- a/sheet/example/lib/examples/sheet/bouncing_sheet.dart +++ b/sheet/example/lib/examples/sheet/bouncing_sheet.dart @@ -20,7 +20,7 @@ class BounceTopSheet extends StatelessWidget { class BouncingSheetPage extends StatefulWidget { @override - _BouncingSheetPageState createState() => _BouncingSheetPageState(); + State createState() => _BouncingSheetPageState(); } class _BouncingSheetPageState extends State { diff --git a/sheet/example/lib/examples/sheet/clamped_sheet.dart b/sheet/example/lib/examples/sheet/clamped_sheet.dart index 30d755f8..ca24f5e8 100644 --- a/sheet/example/lib/examples/sheet/clamped_sheet.dart +++ b/sheet/example/lib/examples/sheet/clamped_sheet.dart @@ -6,7 +6,7 @@ import 'package:sheet/sheet.dart'; class ClampedSheet extends StatefulWidget { @override - _ClampedSheetState createState() => _ClampedSheetState(); + State createState() => _ClampedSheetState(); } class _ClampedSheetState extends State { diff --git a/sheet/example/lib/examples/sheet/complex_snap_sheet.dart b/sheet/example/lib/examples/sheet/complex_snap_sheet.dart index fa7095fe..d6035a59 100644 --- a/sheet/example/lib/examples/sheet/complex_snap_sheet.dart +++ b/sheet/example/lib/examples/sheet/complex_snap_sheet.dart @@ -8,7 +8,7 @@ import 'package:sheet/sheet.dart'; class AdvancedSnapSheetPage extends StatefulWidget { @override - _AdvancedSnapSheetPageState createState() => _AdvancedSnapSheetPageState(); + State createState() => _AdvancedSnapSheetPageState(); } class _AdvancedSnapSheetPageState extends State @@ -71,7 +71,7 @@ class _AdvancedSnapSheetPageState extends State } class MapAppBar extends StatefulWidget implements PreferredSizeWidget { - const MapAppBar({Key? key, required this.controller}) : super(key: key); + const MapAppBar({super.key, required this.controller}); final SheetController controller; @override Size get preferredSize => Size.fromHeight(kToolbarHeight); @@ -174,7 +174,7 @@ class _MapAppBarState extends State { } class FloatingButtons extends StatelessWidget { - const FloatingButtons({Key? key, required this.controller}) : super(key: key); + const FloatingButtons({super.key, required this.controller}); final SheetController controller; @override Widget build(BuildContext context) { @@ -225,7 +225,7 @@ class FloatingButtons extends StatelessWidget { } class MapSheet extends StatelessWidget { - const MapSheet({Key? key, required this.controller}) : super(key: key); + const MapSheet({super.key, required this.controller}); final SheetController controller; @override Widget build(BuildContext context) { diff --git a/sheet/example/lib/examples/sheet/fit_resizable_sheet.dart b/sheet/example/lib/examples/sheet/fit_resizable_sheet.dart index 70454eb8..f8433781 100644 --- a/sheet/example/lib/examples/sheet/fit_resizable_sheet.dart +++ b/sheet/example/lib/examples/sheet/fit_resizable_sheet.dart @@ -5,7 +5,7 @@ import 'package:sheet/sheet.dart'; class FitResizableSheet extends StatefulWidget { @override - _FitSheetState createState() => _FitSheetState(); + State createState() => _FitSheetState(); } class _FitSheetState extends State { diff --git a/sheet/example/lib/examples/sheet/fit_sheet_snap.dart b/sheet/example/lib/examples/sheet/fit_sheet_snap.dart index 11c037a0..52030599 100644 --- a/sheet/example/lib/examples/sheet/fit_sheet_snap.dart +++ b/sheet/example/lib/examples/sheet/fit_sheet_snap.dart @@ -6,7 +6,7 @@ import 'package:sheet/sheet.dart'; class FitSnapSheet extends StatefulWidget { @override - _FitSheetState createState() => _FitSheetState(); + State createState() => _FitSheetState(); } class _FitSheetState extends State { diff --git a/sheet/example/lib/examples/sheet/floating_sheet.dart b/sheet/example/lib/examples/sheet/floating_sheet.dart index 6bd02381..bd2fd28c 100644 --- a/sheet/example/lib/examples/sheet/floating_sheet.dart +++ b/sheet/example/lib/examples/sheet/floating_sheet.dart @@ -3,7 +3,7 @@ import 'package:sheet/sheet.dart'; class FloatingSheet extends StatefulWidget { @override - _FitSheetState createState() => _FitSheetState(); + State createState() => _FitSheetState(); } class _FitSheetState extends State { diff --git a/sheet/example/lib/examples/sheet/fold_screen_sheet.dart b/sheet/example/lib/examples/sheet/fold_screen_sheet.dart index dafb1127..f238ba84 100644 --- a/sheet/example/lib/examples/sheet/fold_screen_sheet.dart +++ b/sheet/example/lib/examples/sheet/fold_screen_sheet.dart @@ -3,7 +3,7 @@ import 'package:sheet/sheet.dart'; class FoldableScreenFloatingSheet extends StatefulWidget { @override - _FitSheetState createState() => _FitSheetState(); + State createState() => _FitSheetState(); } class _FitSheetState extends State { diff --git a/sheet/example/lib/examples/sheet/sheet_without_momentum.dart b/sheet/example/lib/examples/sheet/sheet_without_momentum.dart index 51b44ff7..31814400 100644 --- a/sheet/example/lib/examples/sheet/sheet_without_momentum.dart +++ b/sheet/example/lib/examples/sheet/sheet_without_momentum.dart @@ -6,7 +6,7 @@ import 'package:sheet/sheet.dart'; class NoMomentumSheet extends StatefulWidget { @override - _NoMomentumSheetState createState() => _NoMomentumSheetState(); + State createState() => _NoMomentumSheetState(); } class _NoMomentumSheetState extends State { diff --git a/sheet/example/lib/examples/sheet/snap_sheet.dart b/sheet/example/lib/examples/sheet/snap_sheet.dart index af6875d8..2ff8e77f 100644 --- a/sheet/example/lib/examples/sheet/snap_sheet.dart +++ b/sheet/example/lib/examples/sheet/snap_sheet.dart @@ -6,7 +6,7 @@ import 'package:sheet/sheet.dart'; class SnapSheet extends StatefulWidget { @override - _SnapSheetState createState() => _SnapSheetState(); + State createState() => _SnapSheetState(); } class _SnapSheetState extends State { diff --git a/sheet/example/lib/examples/sheet/text_field.dart b/sheet/example/lib/examples/sheet/text_field.dart index 8571d8d3..32b35c7b 100644 --- a/sheet/example/lib/examples/sheet/text_field.dart +++ b/sheet/example/lib/examples/sheet/text_field.dart @@ -4,7 +4,7 @@ import 'package:sheet/sheet.dart'; class TextFieldSheet extends StatefulWidget { @override - _TextFieldSheetState createState() => _TextFieldSheetState(); + State createState() => _TextFieldSheetState(); } class _TextFieldSheetState extends State diff --git a/sheet/example/lib/main.dart b/sheet/example/lib/main.dart index daf49e91..ea7f8a15 100644 --- a/sheet/example/lib/main.dart +++ b/sheet/example/lib/main.dart @@ -1,27 +1,27 @@ import 'package:example/route_example_page.dart'; import 'package:example/sheet_example_page.dart'; import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; import 'package:sheet/route.dart'; void main() => runApp(MyApp()); +final goRouter = GoRouter(routes: [ + GoRoute( + path: '/', + pageBuilder: (context, state) => + MaterialExtendedPage(child: const BottomNavigationScaffold()), + ), +]); + class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { - return MaterialApp( + return MaterialApp.router( theme: ThemeData(platform: TargetPlatform.iOS), debugShowCheckedModeBanner: false, title: 'BottomSheet Modals', - onGenerateRoute: (RouteSettings settings) { - if (settings.name == '/') { - return MaterialExtendedPageRoute( - builder: (BuildContext context) { - return const BottomNavigationScaffold(); - }, - ); - } - return null; - }, + routerConfig: goRouter, ); } } diff --git a/sheet/example/lib/route_example_page.dart b/sheet/example/lib/route_example_page.dart index 15368244..bb4c3d2a 100644 --- a/sheet/example/lib/route_example_page.dart +++ b/sheet/example/lib/route_example_page.dart @@ -19,6 +19,7 @@ import 'package:sheet/sheet.dart'; import 'examples/route/examples/modal_with_nested_scroll.dart'; import 'examples/route/navigation/go_router.dart'; +import 'examples/route/navigation/go_router_advanced.dart'; class RouteExamplePage extends StatelessWidget { const RouteExamplePage({super.key}); @@ -84,6 +85,16 @@ class RouteExamplePage extends StatelessWidget { ), ), ), + ListTile( + title: const Text('Go router - ShellRoutes'), + onTap: () => Navigator.of(context).push( + MaterialPageRoute( + fullscreenDialog: true, + builder: (BuildContext context) => + AdvancedGoRouterBooksApp(), + ), + ), + ), const SectionTitle('STYLES'), ListTile( title: const Text('Material fit'), @@ -313,11 +324,10 @@ class RouteExamplePage extends StatelessWidget { class SectionTitle extends StatelessWidget { final String title; - // ignore: sort_constructors_first const SectionTitle( this.title, { - Key? key, - }) : super(key: key); + super.key, + }); @override Widget build(BuildContext context) { return Padding( diff --git a/sheet/example/lib/sheet_example_page.dart b/sheet/example/lib/sheet_example_page.dart index 982c41c8..6f3ba022 100644 --- a/sheet/example/lib/sheet_example_page.dart +++ b/sheet/example/lib/sheet_example_page.dart @@ -75,11 +75,10 @@ class SheetExamplesPage extends StatelessWidget { class SectionTitle extends StatelessWidget { final String title; - // ignore: sort_constructors_first const SectionTitle( this.title, { - Key? key, - }) : super(key: key); + super.key, + }); @override Widget build(BuildContext context) { return Padding( diff --git a/sheet/example/pubspec.lock b/sheet/example/pubspec.lock index fdcf011a..ed1dbdb5 100644 --- a/sheet/example/pubspec.lock +++ b/sheet/example/pubspec.lock @@ -34,7 +34,7 @@ packages: source: hosted version: "1.1.1" collection: - dependency: transitive + dependency: "direct main" description: name: collection sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 @@ -84,10 +84,18 @@ packages: dependency: "direct main" description: name: go_router - sha256: "2cb236ba3f923043fdbe14a6a3a796b8c250e85658e28caee3e86c0c275847e5" + sha256: "5098760d7478aabfe682a462bf121d61bc5dbe5df5aac8dad733564a0aee33bc" + url: "https://pub.dev" + source: hosted + version: "12.1.0" + lints: + dependency: "direct dev" + description: + name: lints + sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 url: "https://pub.dev" source: hosted - version: "8.2.0" + version: "3.0.0" logging: dependency: transitive description: @@ -222,4 +230,4 @@ packages: version: "0.1.4-beta" sdks: dart: ">=3.1.0-185.0.dev <4.0.0" - flutter: ">=3.3.0" + flutter: ">=3.7.0" diff --git a/sheet/example/pubspec.yaml b/sheet/example/pubspec.yaml index 47b2e984..6381da78 100644 --- a/sheet/example/pubspec.yaml +++ b/sheet/example/pubspec.yaml @@ -10,15 +10,17 @@ dependencies: flutter: sdk: flutter equatable: ^2.0.5 - cupertino_icons: ^1.0.0 + collection: + cupertino_icons: ^1.0.6 provider: ^6.0.5 sheet: path: ../ - go_router: ^8.0.5 + go_router: ^12.1.0 dev_dependencies: flutter_test: sdk: flutter + lints: ^3.0.0 flutter: uses-material-design: true diff --git a/sheet/lib/src/physics.dart b/sheet/lib/src/physics.dart index 69010076..6cb3cc32 100644 --- a/sheet/lib/src/physics.dart +++ b/sheet/lib/src/physics.dart @@ -414,6 +414,16 @@ class SnapSheetPhysics extends ScrollPhysics with SheetPhysics { (old.relative != relative || !listEquals(old.stops, stops)); } + @override + double adjustPositionForNewDimensions( + {required ScrollMetrics oldPosition, + required ScrollMetrics newPosition, + required bool isScrolling, + required double velocity}) { + final Tolerance tolerance = toleranceFor(newPosition); + return _getTargetPixels(newPosition, tolerance, velocity); + } + double _getTargetPixels( ScrollMetrics position, Tolerance tolerance, double velocity) { int page = _getPage(position) ?? 0; diff --git a/sheet/lib/src/route/cupertino/sheet_route.dart b/sheet/lib/src/route/cupertino/sheet_route.dart index 635eacd8..db31e562 100644 --- a/sheet/lib/src/route/cupertino/sheet_route.dart +++ b/sheet/lib/src/route/cupertino/sheet_route.dart @@ -8,6 +8,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:meta/meta.dart'; import 'package:sheet/route.dart'; import 'package:sheet/sheet.dart'; @@ -219,7 +220,7 @@ class CupertinoSheetRoute extends SheetRoute { } /// Animation for previous route when a [CupertinoSheetRoute] enters/exits -@visibleForTesting +@internal class CupertinoSheetBottomRouteTransition extends StatelessWidget { const CupertinoSheetBottomRouteTransition({ super.key, @@ -349,7 +350,10 @@ class _PageBasedCupertinoSheetRoute extends CupertinoSheetRoute { super.maintainState, }) : super( settings: page, - builder: (BuildContext context) => page.child, + builder: (BuildContext context) { + return (ModalRoute.of(context)!.settings as CupertinoSheetPage) + .child; + }, ); CupertinoSheetPage get _page => settings as CupertinoSheetPage; diff --git a/sheet/lib/src/route/sheet_route.dart b/sheet/lib/src/route/sheet_route.dart index 639d2f8d..2cf63cd8 100644 --- a/sheet/lib/src/route/sheet_route.dart +++ b/sheet/lib/src/route/sheet_route.dart @@ -342,6 +342,9 @@ class _PageBasedSheetRoute extends SheetRoute { SheetPage get _page => settings as SheetPage; + @override + WidgetBuilder get builder => (context) => _page.child; + @override bool get maintainState => _page.maintainState; diff --git a/sheet/lib/src/sheet.dart b/sheet/lib/src/sheet.dart index 219ceb5c..39d99ec3 100644 --- a/sheet/lib/src/sheet.dart +++ b/sheet/lib/src/sheet.dart @@ -4,7 +4,7 @@ import 'dart:math' as math; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:sheet/src/widgets/resizable_sheet.dart'; -import 'package:sheet/src/widgets/scroll_to_top_status_handler.dart'; +import 'package:sheet/src/widgets/status_bar_gesture_detector.dart'; import '../sheet.dart'; @@ -261,7 +261,7 @@ class Sheet extends StatelessWidget { scrollBehavior: SheetBehavior(), viewportBuilder: (BuildContext context, ViewportOffset offset) { return _DefaultSheetScrollController( - child: ScrollToTopStatusBarHandler( + child: StatusBarGestureDetector.scrollToTop( child: SheetViewport( clipBehavior: Clip.antiAlias, axisDirection: AxisDirection.down, @@ -894,8 +894,12 @@ class RenderSheetViewport extends RenderBox } @override - RevealedOffset getOffsetToReveal(RenderObject target, double alignment, - {Rect? rect, Axis? axis}) { + RevealedOffset getOffsetToReveal( + RenderObject target, + double alignment, { + Axis? axis, + Rect? rect, + }) { rect ??= target.paintBounds; if (target is! RenderBox) { return RevealedOffset(offset: offset.pixels, rect: rect); diff --git a/sheet/lib/src/widgets/default_sheet_controller.dart b/sheet/lib/src/widgets/default_sheet_controller.dart index 9adda1c6..8eec5824 100644 --- a/sheet/lib/src/widgets/default_sheet_controller.dart +++ b/sheet/lib/src/widgets/default_sheet_controller.dart @@ -14,7 +14,11 @@ typedef SheetControllerCallback = void Function(SheetController controller); /// /// class DefaultSheetController extends StatefulWidget { - const DefaultSheetController({super.key, required this.child, this.onCreated}); + const DefaultSheetController({ + super.key, + required this.child, + this.onCreated, + }); final Widget child; @@ -43,7 +47,9 @@ class _DefaultSheetControllerState extends State { @override Widget build(BuildContext context) { return _InheritedSheetController( - child: widget.child, controller: controller); + child: widget.child, + controller: controller, + ); } @override @@ -54,8 +60,10 @@ class _DefaultSheetControllerState extends State { } class _InheritedSheetController extends InheritedWidget { - const _InheritedSheetController( - {required super.child, required this.controller}); + const _InheritedSheetController({ + required super.child, + required this.controller, + }); final SheetController controller; diff --git a/sheet/lib/src/widgets/min_interaction.dart b/sheet/lib/src/widgets/min_interaction.dart index 94617350..20979917 100644 --- a/sheet/lib/src/widgets/min_interaction.dart +++ b/sheet/lib/src/widgets/min_interaction.dart @@ -1,5 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/rendering.dart'; +import 'package:meta/meta.dart'; /// A widget that add a min interaction zone where hitTestSelf is true /// This is rarely used by its own @@ -8,12 +9,13 @@ import 'package:flutter/rendering.dart'; /// /// * [Sheet], that uses this widget that enables to drag closed/hidden /// sheets +@internal class MinInteractionZone extends SingleChildRenderObjectWidget { const MinInteractionZone({ required this.direction, required this.extent, - required Widget child, - }) : super(child: child); + super.child, + }); final AxisDirection direction; @@ -41,7 +43,6 @@ class MinInteractionPaddingRenderBox extends RenderProxyBox { AxisDirection _direction; AxisDirection get direction => _direction; set direction(AxisDirection value) { - // ignore: always_put_control_body_on_new_line if (value == _direction) return; _direction = value; } @@ -49,7 +50,6 @@ class MinInteractionPaddingRenderBox extends RenderProxyBox { double _extent; double get extent => _extent; set extent(double value) { - // ignore: always_put_control_body_on_new_line if (value == _extent) return; _extent = value; } diff --git a/sheet/lib/src/widgets/scroll_to_top_status_handler.dart b/sheet/lib/src/widgets/scroll_to_top_status_handler.dart deleted file mode 100644 index 320e96e5..00000000 --- a/sheet/lib/src/widgets/scroll_to_top_status_handler.dart +++ /dev/null @@ -1,62 +0,0 @@ -import 'package:flutter/widgets.dart'; - -/// Widget that that will make the [scrollController] to scroll the top -/// when tapped on the status bar -/// -/// Extracted from [Scaffold] and used in [Sheet] -class ScrollToTopStatusBarHandler extends StatefulWidget { - const ScrollToTopStatusBarHandler({ - super.key, - required this.child, - }); - - final Widget child; - - @override - ScrollToTopStatusBarState createState() => ScrollToTopStatusBarState(); -} - -class ScrollToTopStatusBarState extends State { - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Stack( - fit: StackFit.expand, - children: [ - widget.child, - Positioned( - top: 0, - left: 0, - right: 0, - height: MediaQuery.maybeOf(context)?.padding.top ?? 0, - child: Builder( - builder: (BuildContext context) { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () => _handleStatusBarTap(context), - // iOS accessibility automatically adds scroll-to-top to the clock in the status bar - excludeFromSemantics: true, - ); - }, - ), - ), - ], - ); - } - - void _handleStatusBarTap(BuildContext context) { - final ScrollController? controller = - PrimaryScrollController.maybeOf(context); - if (controller != null && controller.hasClients) { - controller.animateTo( - 0.0, - duration: const Duration(milliseconds: 300), - curve: Curves.linear, // TODO(ianh): Use a more appropriate curve. - ); - } - } -} diff --git a/sheet/lib/src/widgets/status_bar_gesture_detector.dart b/sheet/lib/src/widgets/status_bar_gesture_detector.dart new file mode 100644 index 00000000..d1e86a43 --- /dev/null +++ b/sheet/lib/src/widgets/status_bar_gesture_detector.dart @@ -0,0 +1,73 @@ +import 'package:flutter/material.dart'; + +typedef StatusBarGestureDetectorCallback = void Function(BuildContext context); + +/// Widget that that will make the [scrollController] to scroll the top +/// when tapped on the status bar +/// +/// Extracted from [Scaffold] and used in [Sheet] +class StatusBarGestureDetector extends StatefulWidget { + const StatusBarGestureDetector({ + super.key, + required this.child, + required this.onTap, + }); + + const StatusBarGestureDetector.scrollToTop({ + super.key, + required this.child, + }) : onTap = _scrollToTopBarTap; + + static void _scrollToTopBarTap(BuildContext context) { + final controller = PrimaryScrollController.maybeOf(context); + if (controller != null && controller.hasClients) { + controller.animateTo( + 0.0, + duration: const Duration(milliseconds: 1000), + curve: Curves.easeOutCirc, + ); + } + } + + final Widget child; + + final StatusBarGestureDetectorCallback onTap; + + @override + State createState() => + _StatusBarGestureDetectorState(); +} + +class _StatusBarGestureDetectorState extends State { + final OverlayPortalController controller = OverlayPortalController(); + + @override + void initState() { + controller.show(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + final view = View.of(context); + return OverlayPortal.targetsRootOverlay( + controller: controller, + overlayChildBuilder: (context) { + return Align( + alignment: Alignment.topCenter, + child: SizedBox( + height: view.padding.top / view.devicePixelRatio, + width: double.infinity, + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () => widget.onTap(context), + // iOS accessibility automatically adds scroll-to-top to the clock in the status bar + excludeFromSemantics: true, + ), + ), + ); + }, + child: widget.child, + ); + } +} diff --git a/sheet/pubspec.lock b/sheet/pubspec.lock index 1245b8f2..b80c9c49 100644 --- a/sheet/pubspec.lock +++ b/sheet/pubspec.lock @@ -84,7 +84,7 @@ packages: source: hosted version: "0.5.0" meta: - dependency: transitive + dependency: "direct main" description: name: meta sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" diff --git a/sheet/pubspec.yaml b/sheet/pubspec.yaml index b4c0e98e..1e34b1dc 100644 --- a/sheet/pubspec.yaml +++ b/sheet/pubspec.yaml @@ -4,12 +4,13 @@ version: 1.0.0-pre homepage: https://github.com/jamesblasco/modal_bottom_sheet environment: - sdk: ">=2.17.0 <3.0.0" + sdk: ">=3.0.0 <4.0.0" dependencies: flutter: sdk: flutter - + meta: ^1.9.1 + dev_dependencies: flutter_test: sdk: flutter diff --git a/sheet/test/scrollable_of_test.dart b/sheet/test/scrollable_of_test.dart index 8cb45d26..0eda812b 100644 --- a/sheet/test/scrollable_of_test.dart +++ b/sheet/test/scrollable_of_test.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter/widgets.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:sheet/sheet.dart'; @@ -54,9 +54,8 @@ void main() { // ScrollController's ScrollPosition to be rebuilt. Widget buildFrame(SheetPhysics? physics) { - return Directionality( - textDirection: TextDirection.ltr, - child: Sheet( + return MaterialApp( + home: Sheet( controller: controller, physics: physics, child: ScrollPositionListener( diff --git a/sheet/test/src/widgets/scroll_to_top_status_handler_test.dart b/sheet/test/src/widgets/scroll_to_top_status_handler_test.dart deleted file mode 100644 index 62cedd9c..00000000 --- a/sheet/test/src/widgets/scroll_to_top_status_handler_test.dart +++ /dev/null @@ -1,38 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:sheet/src/widgets/scroll_to_top_status_handler.dart'; - -void main() { - testWidgets('Tap status bar scrolls primary scroll controller', - (WidgetTester tester) async { - final ScrollController controller = ScrollController(); - await tester.pumpWidget(MaterialApp( - builder: (BuildContext context, Widget? child) { - return MediaQuery( - data: MediaQuery.of(context).copyWith( - padding: const EdgeInsets.all(20), - ), - child: child!, - ); - }, - home: PrimaryScrollController( - controller: controller, - child: ScrollToTopStatusBarHandler( - child: Material( - child: ListView.builder( - controller: controller, - itemBuilder: (BuildContext context, int index) { - return ListTile(title: Text('Text $index')); - }, - ), - ), - ), - ), - )); - controller.jumpTo(200); - await tester.pump(); - await tester.tapAt(Offset.zero); - await tester.pumpAndSettle(); - expect(controller.position.pixels, isZero); - }); -} diff --git a/sheet/test/src/widgets/status_bar_gesture_detector_test.dart b/sheet/test/src/widgets/status_bar_gesture_detector_test.dart new file mode 100644 index 00000000..f7c5cdf6 --- /dev/null +++ b/sheet/test/src/widgets/status_bar_gesture_detector_test.dart @@ -0,0 +1,47 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:sheet/src/widgets/status_bar_gesture_detector.dart'; + +void main() { + group('StatusBarGestureDetector', () { + testWidgets('Tap status bar calls onTap callback', + (WidgetTester tester) async { + tester.view.padding = FakeViewPadding(top: 20); + bool called = false; + await tester.pumpWidget(MaterialApp( + home: StatusBarGestureDetector( + onTap: (_) => called = true, + child: Container(), + ), + )); + await tester.tapAt(Offset.zero); + await tester.pumpAndSettle(); + expect(called, isTrue); + }); + testWidgets('Tap status bar scrolls primary scroll controller', + (WidgetTester tester) async { + final ScrollController controller = ScrollController(); + tester.view.padding = FakeViewPadding(top: 20); + await tester.pumpWidget(MaterialApp( + home: PrimaryScrollController( + controller: controller, + child: StatusBarGestureDetector.scrollToTop( + child: Material( + child: ListView.builder( + controller: controller, + itemBuilder: (BuildContext context, int index) { + return ListTile(title: Text('Text $index')); + }, + ), + ), + ), + ), + )); + controller.jumpTo(200); + await tester.pump(); + await tester.tapAt(Offset.zero); + await tester.pumpAndSettle(); + expect(controller.position.pixels, isZero); + }); + }); +} From 17bc7998d8672824cee0deab5dd997f85b87b89b Mon Sep 17 00:00:00 2001 From: Jaime Blasco Date: Tue, 12 Mar 2024 10:46:53 +0100 Subject: [PATCH 18/29] fix: prepare for will pop deprecation --- modal_bottom_sheet/lib/src/bottom_sheet.dart | 11 +++++++---- modal_bottom_sheet/lib/src/bottom_sheet_route.dart | 1 + sheet/lib/src/route/sheet_route.dart | 2 ++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/modal_bottom_sheet/lib/src/bottom_sheet.dart b/modal_bottom_sheet/lib/src/bottom_sheet.dart index 1f55ae93..4cbc1c3c 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheet.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheet.dart @@ -46,8 +46,11 @@ class ModalBottomSheet extends StatefulWidget { required this.child, this.minFlingVelocity = _minFlingVelocity, double? closeProgressThreshold, - this.willPopThreshold = _willPopThreshold, - }) : closeProgressThreshold = + @Deprecated('Use preventPopThreshold instead') double? willPopThreshold, + double? preventPopThreshold, + }) : preventPopThreshold = + preventPopThreshold ?? willPopThreshold ?? _willPopThreshold, + closeProgressThreshold = closeProgressThreshold ?? _closeProgressThreshold; /// The closeProgressThreshold parameter @@ -107,9 +110,9 @@ class ModalBottomSheet extends StatefulWidget { /// Determines how fast the sheet should be flinged before closing. final double minFlingVelocity; - /// The willPopThreshold parameter + /// The preventPopThreshold parameter /// Determines how far the sheet should be flinged before closing. - final double willPopThreshold; + final double preventPopThreshold; @override ModalBottomSheetState createState() => ModalBottomSheetState(); diff --git a/modal_bottom_sheet/lib/src/bottom_sheet_route.dart b/modal_bottom_sheet/lib/src/bottom_sheet_route.dart index 4247447b..c797ea54 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheet_route.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheet_route.dart @@ -185,6 +185,7 @@ class ModalSheetRoute extends PageRoute { return _animationController!; } + // ignore: deprecated_member_use bool get _hasScopedWillPopCallback => hasScopedWillPopCallback; @override diff --git a/sheet/lib/src/route/sheet_route.dart b/sheet/lib/src/route/sheet_route.dart index 2cf63cd8..5e4b8b86 100644 --- a/sheet/lib/src/route/sheet_route.dart +++ b/sheet/lib/src/route/sheet_route.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. +// ignore_for_file: deprecated_member_use + import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; From e44458d2359565324e117bb3d41da04f5e60362e Mon Sep 17 00:00:00 2001 From: Jaime Blasco Date: Tue, 12 Mar 2024 10:55:20 +0100 Subject: [PATCH 19/29] feat: prepare 3.0 release (#392) * feat: release * feat: add changelog --- modal_bottom_sheet/CHANGELOG.md | 6 +++ modal_bottom_sheet/pubspec.lock | 66 +++++++++++++++++++++---------- modal_bottom_sheet/pubspec.yaml | 4 +- sheet/CHANGELOG.md | 5 +++ sheet/example/pubspec.yaml | 2 +- sheet/pubspec.lock | 70 ++++++++++++++++++++++----------- sheet/pubspec.yaml | 6 +-- 7 files changed, 109 insertions(+), 50 deletions(-) diff --git a/modal_bottom_sheet/CHANGELOG.md b/modal_bottom_sheet/CHANGELOG.md index 36f9bc01..e33c43bf 100644 --- a/modal_bottom_sheet/CHANGELOG.md +++ b/modal_bottom_sheet/CHANGELOG.md @@ -1,3 +1,9 @@ +## 3.0.0 - Flutter 3.19 + ++ Migrates to Flutter 3.19 ++ ModalBottomSheetRoute has been renamed to ModalSheetRoute +- WillPopScope support will be replaced for PopScope functionality + ## 3.0.0-pre - Flutter 3.7 diff --git a/modal_bottom_sheet/pubspec.lock b/modal_bottom_sheet/pubspec.lock index 6bbd9a87..54f76b45 100644 --- a/modal_bottom_sheet/pubspec.lock +++ b/modal_bottom_sheet/pubspec.lock @@ -37,10 +37,10 @@ packages: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" fake_async: dependency: transitive description: @@ -59,6 +59,30 @@ packages: description: flutter source: sdk version: "0.0.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + url: "https://pub.dev" + source: hosted + version: "10.0.0" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + url: "https://pub.dev" + source: hosted + version: "2.0.1" lints: dependency: "direct dev" description: @@ -71,34 +95,34 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.11.0" path: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" sky_engine: dependency: transitive description: flutter @@ -116,18 +140,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" string_scanner: dependency: transitive description: @@ -148,10 +172,10 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.6.1" vector_math: dependency: transitive description: @@ -160,13 +184,13 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - web: + vm_service: dependency: transitive description: - name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + name: vm_service + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "13.0.0" sdks: - dart: ">=3.1.0-185.0.dev <4.0.0" + dart: ">=3.3.0 <4.0.0" diff --git a/modal_bottom_sheet/pubspec.yaml b/modal_bottom_sheet/pubspec.yaml index 1cf4a03d..f9088820 100644 --- a/modal_bottom_sheet/pubspec.yaml +++ b/modal_bottom_sheet/pubspec.yaml @@ -1,10 +1,10 @@ name: modal_bottom_sheet description: 'Create awesome and powerful modal bottom sheets. Material, Cupertino iOS 13 or create your own style' -version: 3.0.1 +version: 3.0.0 homepage: 'https://github.com/jamesblasco/modal_bottom_sheet' environment: - sdk: ">=2.17.0 <3.0.0" + sdk: ">=3.3.0 <4.0.0" dependencies: flutter: diff --git a/sheet/CHANGELOG.md b/sheet/CHANGELOG.md index 29319971..c4d9b569 100644 --- a/sheet/CHANGELOG.md +++ b/sheet/CHANGELOG.md @@ -1,3 +1,8 @@ +# [1.0.0] - Release sheets package + +* This version requires Flutter 3.19 as the new framework version contains several breaking changes that affect the package + + # [1.0.0-pre] - Adds support for Flutter 3.7 * This version requires Flutter 3.7 as the new framework version contains several breaking changes that affect the package diff --git a/sheet/example/pubspec.yaml b/sheet/example/pubspec.yaml index 6381da78..24bf6c37 100644 --- a/sheet/example/pubspec.yaml +++ b/sheet/example/pubspec.yaml @@ -4,7 +4,7 @@ publish_to: 'none' version: 1.0.0+1 environment: - sdk: ">=3.0.0 <4.0.0" + sdk: ">=3.19.0 <4.0.0" dependencies: flutter: diff --git a/sheet/pubspec.lock b/sheet/pubspec.lock index b80c9c49..0913707e 100644 --- a/sheet/pubspec.lock +++ b/sheet/pubspec.lock @@ -37,10 +37,10 @@ packages: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" fake_async: dependency: transitive description: @@ -59,6 +59,30 @@ packages: description: flutter source: sdk version: "0.0.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + url: "https://pub.dev" + source: hosted + version: "10.0.0" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + url: "https://pub.dev" + source: hosted + version: "2.0.1" lints: dependency: "direct dev" description: @@ -71,42 +95,42 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.8.0" meta: dependency: "direct main" description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.11.0" mocktail: dependency: "direct dev" description: name: mocktail - sha256: bac151b31e4ed78bd59ab89aa4c0928f297b1180186d5daf03734519e5f596c1 + sha256: c4b5007d91ca4f67256e720cb1b6d704e79a510183a12fa551021f652577dce6 url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.0.3" path: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" sky_engine: dependency: transitive description: flutter @@ -124,18 +148,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" string_scanner: dependency: transitive description: @@ -156,10 +180,10 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.6.1" vector_math: dependency: transitive description: @@ -168,13 +192,13 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - web: + vm_service: dependency: transitive description: - name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + name: vm_service + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "13.0.0" sdks: - dart: ">=3.1.0-185.0.dev <4.0.0" + dart: ">=3.3.0 <4.0.0" diff --git a/sheet/pubspec.yaml b/sheet/pubspec.yaml index 1e34b1dc..93c402ea 100644 --- a/sheet/pubspec.yaml +++ b/sheet/pubspec.yaml @@ -1,10 +1,10 @@ name: sheet description: A fully customizable draggable bottom sheet. -version: 1.0.0-pre +version: 1.0.0 homepage: https://github.com/jamesblasco/modal_bottom_sheet environment: - sdk: ">=3.0.0 <4.0.0" + sdk: ">=3.3.0 <4.0.0" dependencies: flutter: @@ -14,7 +14,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - mocktail: ^1.0.1 + mocktail: ^1.0.3 lints: ^3.0.0 flutter: \ No newline at end of file From 55a97bc7d8fa1178046b99049a8c0dcf4e6d17c1 Mon Sep 17 00:00:00 2001 From: creativecreatorormaybenot Date: Mon, 18 Nov 2024 18:29:17 +0100 Subject: [PATCH 20/29] Fix the system UI overlay style in the `CupertinoModalBottomSheetRoute` (#434) * Fix the system UI overlay style in the `CupertinoModalBottomSheetRoute` * Fix background color * Reduce rebuilds --------- Co-authored-by: Jonas Wanke --- .../bottom_sheets/cupertino_bottom_sheet.dart | 76 ++++++++++--------- modal_bottom_sheet/pubspec.lock | 25 +++--- 2 files changed, 54 insertions(+), 47 deletions(-) diff --git a/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart b/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart index db1da315..ad8e764c 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheets/cupertino_bottom_sheet.dart @@ -269,47 +269,53 @@ class _CupertinoModalTransition extends StatelessWidget { curve: animationCurve ?? Curves.easeOut, ); - return AnimatedBuilder( - animation: curvedAnimation, - child: body, - builder: (context, child) { - final progress = curvedAnimation.value; - final yOffset = progress * paddingTop; - final scale = 1 - progress / 10; - final radius = progress == 0 - ? 0.0 - : (1 - progress) * startRoundCorner + progress * topRadius.x; - return Stack( - children: [ - Container(color: backgroundColor), - Transform.translate( - offset: Offset(0, yOffset), - child: Transform.scale( - scale: scale, - alignment: Alignment.topCenter, - child: ClipRRect( - borderRadius: BorderRadius.circular(radius), - child: CupertinoUserInterfaceLevel( - data: CupertinoUserInterfaceLevelData.elevated, - child: Builder( - builder: (context) => CupertinoTheme( - data: createPreviousRouteTheme( - context, - curvedAnimation, - ), - child: CupertinoUserInterfaceLevel( - data: CupertinoUserInterfaceLevelData.base, + return AnnotatedRegion( + // Make sure to match the system UI overlay style to the background color + // we insert below. Since all other content is pushed down, the background + // color will always be the one visible behind the status bar. + value: overlayStyleFromColor(backgroundColor), + child: Stack( + children: [ + Positioned.fill(child: ColoredBox(color: backgroundColor)), + AnimatedBuilder( + animation: curvedAnimation, + child: CupertinoUserInterfaceLevel( + data: CupertinoUserInterfaceLevelData.base, + child: body, + ), + builder: (context, child) { + final progress = curvedAnimation.value; + final yOffset = progress * paddingTop; + final scale = 1 - progress / 10; + final radius = progress == 0 + ? 0.0 + : (1 - progress) * startRoundCorner + progress * topRadius.x; + return Transform.translate( + offset: Offset(0, yOffset), + child: Transform.scale( + scale: scale, + alignment: Alignment.topCenter, + child: ClipRRect( + borderRadius: BorderRadius.circular(radius), + child: CupertinoUserInterfaceLevel( + data: CupertinoUserInterfaceLevelData.elevated, + child: Builder( + builder: (context) => CupertinoTheme( + data: createPreviousRouteTheme( + context, + curvedAnimation, + ), child: child!, ), ), ), ), ), - ), - ), - ], - ); - }, + ); + }, + ), + ], + ), ); } diff --git a/modal_bottom_sheet/pubspec.lock b/modal_bottom_sheet/pubspec.lock index 54f76b45..644a7200 100644 --- a/modal_bottom_sheet/pubspec.lock +++ b/modal_bottom_sheet/pubspec.lock @@ -63,26 +63,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" url: "https://pub.dev" source: hosted - version: "10.0.0" + version: "10.0.4" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.3" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.1" lints: dependency: "direct dev" description: @@ -111,10 +111,10 @@ packages: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.12.0" path: dependency: transitive description: @@ -172,10 +172,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.7.0" vector_math: dependency: transitive description: @@ -188,9 +188,10 @@ packages: dependency: transitive description: name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "14.2.1" sdks: dart: ">=3.3.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" From 2b014f4bad796d0eaff960d9e0b5597829c92842 Mon Sep 17 00:00:00 2001 From: maRci002 Date: Mon, 18 Nov 2024 18:31:55 +0100 Subject: [PATCH 21/29] Fix update Sheet content while initializing (#432) --- sheet/lib/src/route/sheet_route.dart | 11 +++++++++-- sheet/lib/src/scroll_controller.dart | 7 ++++++- sheet/lib/src/scrollable.dart | 7 ++++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/sheet/lib/src/route/sheet_route.dart b/sheet/lib/src/route/sheet_route.dart index 5e4b8b86..d06e27bf 100644 --- a/sheet/lib/src/route/sheet_route.dart +++ b/sheet/lib/src/route/sheet_route.dart @@ -373,11 +373,18 @@ class __SheetRouteContainerState extends State<_SheetRouteContainer> _routeController.addListener(onRouteAnimationUpdate); _sheetController.addListener(onSheetExtentUpdate); WidgetsBinding.instance.addPostFrameCallback((Duration timeStamp) { - _sheetController.relativeAnimateTo( + _sheetController + .relativeAnimateTo( route.initialExtent, duration: route.transitionDuration, curve: route.animationCurve ?? Curves.easeOut, - ); + ) + .then((_) { + if (_sheetController.hasClients) { + (_sheetController.position.context as SheetContext) + .initialAnimationFinished = true; + } + }); }); super.initState(); } diff --git a/sheet/lib/src/scroll_controller.dart b/sheet/lib/src/scroll_controller.dart index c2606c87..de72cd4b 100644 --- a/sheet/lib/src/scroll_controller.dart +++ b/sheet/lib/src/scroll_controller.dart @@ -122,7 +122,12 @@ class SheetPrimaryScrollPosition extends ScrollPositionWithSingleContext { } if (sheetPosition.hasContentDimensions) { - sheetPosition.goBallistic(velocity); + if (sheetContext.initialAnimationFinished) { + sheetPosition.goBallistic(velocity); + } else { + goIdle(); + return; + } } if (velocity > 0.0 && diff --git a/sheet/lib/src/scrollable.dart b/sheet/lib/src/scrollable.dart index c90f2daf..cfff31b6 100644 --- a/sheet/lib/src/scrollable.dart +++ b/sheet/lib/src/scrollable.dart @@ -25,6 +25,8 @@ import 'package:sheet/src/widgets/min_interaction.dart'; abstract class SheetContext extends ScrollContext { double? get initialExtent; SheetPosition get position; + bool get initialAnimationFinished; + set initialAnimationFinished(bool initialAnimationFinished); } /// A widget that transform to user drag. @@ -326,6 +328,9 @@ class SheetState extends State @override AxisDirection get axisDirection => widget.axisDirection; + @override + bool initialAnimationFinished = false; + late SheetBehavior _configuration; ScrollPhysics? _physics; SheetController? _fallbackScrollController; @@ -775,7 +780,7 @@ class _ScrollSemantics extends SingleChildRenderObjectWidget { required this.allowImplicitScrolling, required this.semanticChildCount, super.child, - }) : assert(semanticChildCount == null || semanticChildCount >= 0); + }) : assert(semanticChildCount == null || semanticChildCount >= 0); final ScrollPosition position; final bool allowImplicitScrolling; From 2a94be35de1f40ad956f9d7314261ef4c0158739 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 18:35:09 +0100 Subject: [PATCH 22/29] chore(deps): bump mocktail from 1.0.3 to 1.0.4 in /sheet (#408) Bumps [mocktail](https://github.com/felangel/mocktail) from 1.0.3 to 1.0.4. - [Release notes](https://github.com/felangel/mocktail/releases) - [Commits](https://github.com/felangel/mocktail/compare/mocktail-v1.0.3...mocktail-v1.0.4) --- updated-dependencies: - dependency-name: mocktail dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- sheet/pubspec.lock | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/sheet/pubspec.lock b/sheet/pubspec.lock index 0913707e..0110da3f 100644 --- a/sheet/pubspec.lock +++ b/sheet/pubspec.lock @@ -63,26 +63,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" url: "https://pub.dev" source: hosted - version: "10.0.0" + version: "10.0.4" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.3" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.1" lints: dependency: "direct dev" description: @@ -111,18 +111,18 @@ packages: dependency: "direct main" description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.12.0" mocktail: dependency: "direct dev" description: name: mocktail - sha256: c4b5007d91ca4f67256e720cb1b6d704e79a510183a12fa551021f652577dce6 + sha256: "890df3f9688106f25755f26b1c60589a92b3ab91a22b8b224947ad041bf172d8" url: "https://pub.dev" source: hosted - version: "1.0.3" + version: "1.0.4" path: dependency: transitive description: @@ -180,10 +180,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.7.0" vector_math: dependency: transitive description: @@ -196,9 +196,9 @@ packages: dependency: transitive description: name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "14.2.1" sdks: dart: ">=3.3.0 <4.0.0" From 6190855a13a48819db5906bb836549c152a9df28 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 18:35:18 +0100 Subject: [PATCH 23/29] chore(deps): bump meta from 1.11.0 to 1.12.0 in /sheet (#406) Bumps [meta](https://github.com/dart-lang/sdk/tree/main/pkg) from 1.11.0 to 1.12.0. - [Changelog](https://github.com/dart-lang/sdk/blob/main/CHANGELOG.md) - [Commits](https://github.com/dart-lang/sdk/commits/1.12.0/pkg) --- updated-dependencies: - dependency-name: meta dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> From 323e3a9b68c83e6d3933147d6f3f1334d52765c6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 18:35:28 +0100 Subject: [PATCH 24/29] chore(deps): bump lints from 3.0.0 to 4.0.0 in /sheet (#402) Bumps [lints](https://github.com/dart-lang/lints) from 3.0.0 to 4.0.0. - [Release notes](https://github.com/dart-lang/lints/releases) - [Changelog](https://github.com/dart-lang/lints/blob/main/CHANGELOG.md) - [Commits](https://github.com/dart-lang/lints/compare/v3.0.0...v4.0.0) --- updated-dependencies: - dependency-name: lints dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- sheet/pubspec.lock | 4 ++-- sheet/pubspec.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sheet/pubspec.lock b/sheet/pubspec.lock index 0110da3f..3e4746c8 100644 --- a/sheet/pubspec.lock +++ b/sheet/pubspec.lock @@ -87,10 +87,10 @@ packages: dependency: "direct dev" description: name: lints - sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 + sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "4.0.0" matcher: dependency: transitive description: diff --git a/sheet/pubspec.yaml b/sheet/pubspec.yaml index 93c402ea..ab40b67c 100644 --- a/sheet/pubspec.yaml +++ b/sheet/pubspec.yaml @@ -15,6 +15,6 @@ dev_dependencies: flutter_test: sdk: flutter mocktail: ^1.0.3 - lints: ^3.0.0 + lints: ">=3.0.0 <5.0.0" flutter: \ No newline at end of file From 19471c184a2f03a2f79303823e39bdf98ca10166 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 18:35:42 +0100 Subject: [PATCH 25/29] chore(deps): bump lints from 3.0.0 to 4.0.0 in /modal_bottom_sheet (#403) Bumps [lints](https://github.com/dart-lang/lints) from 3.0.0 to 4.0.0. - [Release notes](https://github.com/dart-lang/lints/releases) - [Changelog](https://github.com/dart-lang/lints/blob/main/CHANGELOG.md) - [Commits](https://github.com/dart-lang/lints/compare/v3.0.0...v4.0.0) --- updated-dependencies: - dependency-name: lints dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- modal_bottom_sheet/pubspec.lock | 4 ++-- modal_bottom_sheet/pubspec.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modal_bottom_sheet/pubspec.lock b/modal_bottom_sheet/pubspec.lock index 644a7200..48e7fd49 100644 --- a/modal_bottom_sheet/pubspec.lock +++ b/modal_bottom_sheet/pubspec.lock @@ -87,10 +87,10 @@ packages: dependency: "direct dev" description: name: lints - sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 + sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "4.0.0" matcher: dependency: transitive description: diff --git a/modal_bottom_sheet/pubspec.yaml b/modal_bottom_sheet/pubspec.yaml index f9088820..9d716a3a 100644 --- a/modal_bottom_sheet/pubspec.yaml +++ b/modal_bottom_sheet/pubspec.yaml @@ -13,4 +13,4 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - lints: ^3.0.0 + lints: ">=3.0.0 <5.0.0" From ac1ddc856a54e323d9459f3d4940d25db98a6c0b Mon Sep 17 00:00:00 2001 From: Jon Date: Mon, 18 Nov 2024 17:39:21 +0000 Subject: [PATCH 26/29] Prevent scrolling beyond the maximum position (#427) --- sheet/lib/src/physics.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sheet/lib/src/physics.dart b/sheet/lib/src/physics.dart index 6cb3cc32..8c2d3c16 100644 --- a/sheet/lib/src/physics.dart +++ b/sheet/lib/src/physics.dart @@ -139,6 +139,10 @@ class BouncingSheetPhysics extends ScrollPhysics with SheetPhysics { } return true; }()); + // Prevent scrolling beyond the maximum position + if (value > position.maxScrollExtent) { + return value - position.maxScrollExtent; + } if (!overflowViewport) { // overscroll if (position.viewportDimension <= position.pixels && From 208300a93c3adeab88217e380fe4666b787b1db9 Mon Sep 17 00:00:00 2001 From: Assaf Packin Date: Mon, 18 Nov 2024 12:39:48 -0500 Subject: [PATCH 27/29] Allow resizing sheet larger than minResizableExtent when resizable is true (#411) * include resizeable in sheet performLayout * Update resize logic --------- Co-authored-by: Hari07 <22373191+Hari-07@users.noreply.github.com> --- sheet/lib/src/scrollable.dart | 12 ++++++++++- sheet/lib/src/sheet.dart | 23 +++++++++++++++++++++- sheet/lib/src/widgets/resizable_sheet.dart | 22 +++++---------------- 3 files changed, 38 insertions(+), 19 deletions(-) diff --git a/sheet/lib/src/scrollable.dart b/sheet/lib/src/scrollable.dart index cfff31b6..a9910c7e 100644 --- a/sheet/lib/src/scrollable.dart +++ b/sheet/lib/src/scrollable.dart @@ -409,7 +409,7 @@ class SheetState extends State return newPhysics.shouldReload(oldPhysics); } - bool _shouldUpdatePosition(SheetScrollable oldWidget) { + bool _shouldUpdatePositionBasedOnPhysics(SheetScrollable oldWidget) { ScrollPhysics? newPhysics = widget.physics ?? widget.scrollBehavior?.getScrollPhysics(context); ScrollPhysics? oldPhysics = oldWidget.physics ?? @@ -424,6 +424,16 @@ class SheetState extends State return widget.controller?.runtimeType != oldWidget.controller?.runtimeType; } + bool _shouldUpdatePositionBasedOnInitialExtent(SheetScrollable oldWidget) { + return widget.initialExtent != oldWidget.initialExtent; + // return false; + } + + bool _shouldUpdatePosition(SheetScrollable oldWidget) { + return _shouldUpdatePositionBasedOnPhysics(oldWidget) || + _shouldUpdatePositionBasedOnInitialExtent(oldWidget); + } + @override void didUpdateWidget(SheetScrollable oldWidget) { super.didUpdateWidget(oldWidget); diff --git a/sheet/lib/src/sheet.dart b/sheet/lib/src/sheet.dart index 39d99ec3..34ac8241 100644 --- a/sheet/lib/src/sheet.dart +++ b/sheet/lib/src/sheet.dart @@ -1,6 +1,7 @@ // ignore_for_file: always_put_control_body_on_new_line import 'dart:math' as math; + import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:sheet/src/widgets/resizable_sheet.dart'; @@ -269,6 +270,7 @@ class Sheet extends StatelessWidget { minExtent: minExtent, maxExtent: maxExtent, fit: fit, + resizeable: resizable, child: Padding( padding: padding, child: ResizableSheetChild( @@ -535,6 +537,7 @@ class SheetViewport extends SingleChildRenderObjectWidget { super.key, this.axisDirection = AxisDirection.down, required this.offset, + this.resizeable = false, this.minExtent, this.maxExtent, super.child, @@ -548,6 +551,7 @@ class SheetViewport extends SingleChildRenderObjectWidget { final double? minExtent; final double? maxExtent; final SheetFit fit; + final bool resizeable; @override RenderSheetViewport createRenderObject(BuildContext context) { @@ -557,6 +561,7 @@ class SheetViewport extends SingleChildRenderObjectWidget { clipBehavior: clipBehavior, minExtent: minExtent, maxExtent: maxExtent, + resizeable: resizeable, fit: fit, ); } @@ -587,12 +592,14 @@ class RenderSheetViewport extends RenderBox SheetFit fit = SheetFit.expand, double? minExtent, double? maxExtent, + bool? resizeable, }) : _axisDirection = axisDirection, _offset = offset, _fit = fit, _minExtent = minExtent, _maxExtent = maxExtent, _cacheExtent = cacheExtent, + _resizeable = resizeable ?? false, _clipBehavior = clipBehavior { this.child = child; } @@ -702,6 +709,14 @@ class RenderSheetViewport extends RenderBox } } + bool get resizeable => _resizeable; + bool _resizeable; + set resizeable(bool value) { + if (value == _resizeable) return; + _resizeable = value; + markNeedsLayout(); + } + double get _viewportExtent { assert(hasSize); switch (axis) { @@ -779,7 +794,13 @@ class RenderSheetViewport extends RenderBox void performLayout() { final BoxConstraints constraints = this.constraints; if (child == null) { - size = constraints.smallest; + if (resizeable) { + // Allows expanding the sheet to the maximum available space + size = constraints.biggest; + } else { + // Locks the sheet to the child size + size = constraints.smallest; + } } else { final bool expand = fit == SheetFit.expand; final double maxExtent = this.maxExtent ?? constraints.maxHeight; diff --git a/sheet/lib/src/widgets/resizable_sheet.dart b/sheet/lib/src/widgets/resizable_sheet.dart index 6f5dd822..18c54531 100644 --- a/sheet/lib/src/widgets/resizable_sheet.dart +++ b/sheet/lib/src/widgets/resizable_sheet.dart @@ -118,27 +118,15 @@ class RenderResizableSheetChildBox extends RenderShiftedBox { return; } - // The height of the child will be the maximun between the offset pixels + // The height of the child will be the maximum between the offset pixels // and the minExtent - final double extent = max(_offset.pixels, minExtent); - + final double extend = max(_offset.pixels, minExtent); child!.layout( - BoxConstraints( - maxHeight: extent, - minHeight: extent, - minWidth: constraints.minWidth, - maxWidth: constraints.maxWidth, - ), + constraints.copyWith(maxHeight: extend, minHeight: extend), parentUsesSize: true, ); - if (!constraints.hasTightHeight) { - size = Size( - child!.size.width, constraints.constrainHeight(child!.size.height)); - childParentData.offset = Offset.zero; - } else { - size = constraints.biggest; - childParentData.offset = Offset.zero; - } + size = constraints.biggest; + childParentData.offset = Offset.zero; } } From c6718a0e8523858c2d79382a7366ba04ea7c61f3 Mon Sep 17 00:00:00 2001 From: Joran Dob Date: Mon, 18 Nov 2024 18:44:54 +0100 Subject: [PATCH 28/29] Feat/add draggable property cupertino sheet route (#357) * feat: add draggable property to CupertinoSheetRoute it seems like a nice addition to me to let users customise this behaviour, also it might mitigate some scrolling issues users have. * chore: reformatted changed content --------- Co-authored-by: Jaime Blasco --- sheet/lib/src/route/cupertino/sheet_route.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sheet/lib/src/route/cupertino/sheet_route.dart b/sheet/lib/src/route/cupertino/sheet_route.dart index db31e562..c2112b66 100644 --- a/sheet/lib/src/route/cupertino/sheet_route.dart +++ b/sheet/lib/src/route/cupertino/sheet_route.dart @@ -101,6 +101,7 @@ class CupertinoSheetRoute extends SheetRoute { Color? backgroundColor, super.maintainState = true, super.fit, + super.draggable = true, }) : super( builder: (BuildContext context) { return _CupertinoSheetDecorationBuilder( @@ -113,9 +114,6 @@ class CupertinoSheetRoute extends SheetRoute { initialExtent: initialStop, ); - @override - bool get draggable => true; - final SheetController _sheetController = SheetController(); @override From a87f82b4872042ca0ff2f5d5ab75c432532b94b5 Mon Sep 17 00:00:00 2001 From: Jaime Blasco Date: Mon, 18 Nov 2024 19:30:04 +0100 Subject: [PATCH 29/29] feat: pop scope (#437) --- modal_bottom_sheet/README.md | 2 +- .../ios/Flutter/AppFrameworkInfo.plist | 2 +- modal_bottom_sheet/example/ios/Podfile | 2 +- modal_bottom_sheet/example/ios/Podfile.lock | 6 +- .../ios/Runner.xcodeproj/project.pbxproj | 8 +-- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- modal_bottom_sheet/example/lib/main.dart | 5 +- .../example/lib/modals/modal_complex_all.dart | 52 +++++++------- .../example/lib/modals/modal_will_scope.dart | 51 +++++++------- modal_bottom_sheet/example/pubspec.lock | 52 ++++++++++---- .../lib/src/bottom_sheet_route.dart | 17 ++++- .../ios/Flutter/AppFrameworkInfo.plist | 2 +- .../ios/Runner.xcodeproj/project.pbxproj | 8 +-- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- .../route/examples/modal_complex_all.dart | 51 +++++++------- .../route/examples/modal_fit_will_scope.dart | 14 ++-- .../route/examples/modal_will_scope.dart | 52 +++++++------- .../lib/examples/sheet/fold_screen_sheet.dart | 2 +- .../sheet/sheet_without_momentum.dart | 2 +- .../lib/examples/sheet/snap_sheet.dart | 2 +- .../lib/examples/sheet/text_field.dart | 2 +- sheet/example/lib/route_example_page.dart | 8 +-- sheet/example/pubspec.lock | 68 +++++++++++++------ sheet/example/pubspec.yaml | 2 +- sheet/lib/src/route/sheet_route.dart | 35 ++++++---- 25 files changed, 260 insertions(+), 189 deletions(-) diff --git a/modal_bottom_sheet/README.md b/modal_bottom_sheet/README.md index 5b606e1b..a6ddec9e 100644 --- a/modal_bottom_sheet/README.md +++ b/modal_bottom_sheet/README.md @@ -20,7 +20,7 @@ Why not `showModalBottomSheet`? Inspired by `showModalBottomSheet`, it completes with some must-need features: - Support for inside scrollview + dragging down to close (`showModalBottomSheet` won't work correctly with scrollviews. -- Support for `WillPopScope` to prevent closing the dialog. +- Support for `PopScope` and `WillPopScope` to prevent closing the dialog. - Support for scroll to top when tapping status bar (iOS only) - Support for top SafeArea (not supported by showModalBottomSheet) - Cupertino modal bottom sheet diff --git a/modal_bottom_sheet/example/ios/Flutter/AppFrameworkInfo.plist b/modal_bottom_sheet/example/ios/Flutter/AppFrameworkInfo.plist index 9625e105..7c569640 100644 --- a/modal_bottom_sheet/example/ios/Flutter/AppFrameworkInfo.plist +++ b/modal_bottom_sheet/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 11.0 + 12.0 diff --git a/modal_bottom_sheet/example/ios/Podfile b/modal_bottom_sheet/example/ios/Podfile index 88359b22..279576f3 100644 --- a/modal_bottom_sheet/example/ios/Podfile +++ b/modal_bottom_sheet/example/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '11.0' +# platform :ios, '12.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/modal_bottom_sheet/example/ios/Podfile.lock b/modal_bottom_sheet/example/ios/Podfile.lock index 69a9e703..541635a1 100644 --- a/modal_bottom_sheet/example/ios/Podfile.lock +++ b/modal_bottom_sheet/example/ios/Podfile.lock @@ -14,9 +14,9 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/url_launcher_ios/ios" SPEC CHECKSUMS: - Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 + Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 url_launcher_ios: 68d46cc9766d0c41dbdc884310529557e3cd7a86 -PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 +PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011 -COCOAPODS: 1.14.3 +COCOAPODS: 1.15.2 diff --git a/modal_bottom_sheet/example/ios/Runner.xcodeproj/project.pbxproj b/modal_bottom_sheet/example/ios/Runner.xcodeproj/project.pbxproj index 1418909a..add1a572 100644 --- a/modal_bottom_sheet/example/ios/Runner.xcodeproj/project.pbxproj +++ b/modal_bottom_sheet/example/ios/Runner.xcodeproj/project.pbxproj @@ -155,7 +155,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -342,7 +342,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -420,7 +420,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -469,7 +469,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/modal_bottom_sheet/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/modal_bottom_sheet/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index b52b2e69..e67b2808 100644 --- a/modal_bottom_sheet/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/modal_bottom_sheet/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ { builder: (context) => ModalWithNavigator(), )), ListTile( - title: - Text('Cupertino Navigator + Scroll + WillPopScope'), + title: Text('Cupertino Navigator + Scroll + PopScope'), onTap: () => showCupertinoModalBottomSheet( expand: true, context: context, @@ -218,7 +217,7 @@ class _MyHomePageState extends State { ), ), ListTile( - title: Text('Modal with WillPopScope'), + title: Text('Modal with PopScope'), onTap: () => showCupertinoModalBottomSheet( expand: true, context: context, diff --git a/modal_bottom_sheet/example/lib/modals/modal_complex_all.dart b/modal_bottom_sheet/example/lib/modals/modal_complex_all.dart index 68508fde..2eaec2ab 100644 --- a/modal_bottom_sheet/example/lib/modals/modal_complex_all.dart +++ b/modal_bottom_sheet/example/lib/modals/modal_complex_all.dart @@ -8,31 +8,33 @@ class ComplexModal extends StatelessWidget { @override Widget build(BuildContext context) { return Material( - child: WillPopScope( - onWillPop: () async { - bool shouldClose = true; - await showCupertinoDialog( - context: context, - builder: (context) => CupertinoAlertDialog( - title: Text('Should Close?'), - actions: [ - CupertinoButton( - child: Text('Yes'), - onPressed: () { - shouldClose = true; - Navigator.of(context).pop(); - }, - ), - CupertinoButton( - child: Text('No'), - onPressed: () { - shouldClose = false; - Navigator.of(context).pop(); - }, - ), - ], - )); - return shouldClose; + child: PopScope( + canPop: false, + onPopInvoked: (didPop) { + if (!didPop) { + final sheetNavigator = Navigator.of(context); + + showCupertinoDialog( + context: context, + builder: (context) => CupertinoAlertDialog( + title: Text('Should Close?'), + actions: [ + CupertinoButton( + child: Text('Yes'), + onPressed: () { + Navigator.of(context).pop(); + sheetNavigator.pop(); + }, + ), + CupertinoButton( + child: Text('No'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + )); + } }, child: Navigator( onGenerateRoute: (_) => MaterialPageRoute( diff --git a/modal_bottom_sheet/example/lib/modals/modal_will_scope.dart b/modal_bottom_sheet/example/lib/modals/modal_will_scope.dart index 506f84c3..992023b0 100644 --- a/modal_bottom_sheet/example/lib/modals/modal_will_scope.dart +++ b/modal_bottom_sheet/example/lib/modals/modal_will_scope.dart @@ -7,31 +7,32 @@ class ModalWillScope extends StatelessWidget { @override Widget build(BuildContext context) { return Material( - child: WillPopScope( - onWillPop: () async { - bool shouldClose = true; - await showCupertinoDialog( - context: context, - builder: (context) => CupertinoAlertDialog( - title: Text('Should Close?'), - actions: [ - CupertinoButton( - child: Text('Yes'), - onPressed: () { - shouldClose = true; - Navigator.of(context).pop(); - }, - ), - CupertinoButton( - child: Text('No'), - onPressed: () { - shouldClose = false; - Navigator.of(context).pop(); - }, - ), - ], - )); - return shouldClose; + child: PopScope( + canPop: false, + onPopInvoked: (didPop) { + if (didPop) return; + final sheetNavigator = Navigator.of(context); + showCupertinoDialog( + context: context, + builder: (context) => CupertinoAlertDialog( + title: Text('Should Close?'), + actions: [ + CupertinoButton( + child: Text('Yes'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + CupertinoButton( + child: Text('No'), + onPressed: () { + Navigator.of(context).pop(); + sheetNavigator.pop(); + }, + ), + ], + ), + ); }, child: CupertinoPageScaffold( navigationBar: CupertinoNavigationBar( diff --git a/modal_bottom_sheet/example/pubspec.lock b/modal_bottom_sheet/example/pubspec.lock index 3eaf01df..60af5126 100644 --- a/modal_bottom_sheet/example/pubspec.lock +++ b/modal_bottom_sheet/example/pubspec.lock @@ -72,6 +72,30 @@ packages: description: flutter source: sdk version: "0.0.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + url: "https://pub.dev" + source: hosted + version: "10.0.0" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + url: "https://pub.dev" + source: hosted + version: "2.0.1" lints: dependency: "direct dev" description: @@ -84,41 +108,41 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" modal_bottom_sheet: dependency: "direct main" description: path: ".." relative: true source: path - version: "3.0.1" + version: "3.0.0" path: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" plugin_platform_interface: dependency: transitive description: @@ -252,14 +276,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - web: + vm_service: dependency: transitive description: - name: web - sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + name: vm_service + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 url: "https://pub.dev" source: hosted - version: "0.3.0" + version: "13.0.0" sdks: - dart: ">=3.2.0-194.0.dev <4.0.0" + dart: ">=3.3.0 <4.0.0" flutter: ">=3.13.0" diff --git a/modal_bottom_sheet/lib/src/bottom_sheet_route.dart b/modal_bottom_sheet/lib/src/bottom_sheet_route.dart index c797ea54..967851ca 100644 --- a/modal_bottom_sheet/lib/src/bottom_sheet_route.dart +++ b/modal_bottom_sheet/lib/src/bottom_sheet_route.dart @@ -96,10 +96,21 @@ class _ModalBottomSheetState extends State<_ModalBottomSheet> { expanded: widget.route.expanded, containerBuilder: widget.route.containerBuilder, animationController: widget.route._animationController!, - shouldClose: widget.route._hasScopedWillPopCallback + shouldClose: widget.route.popDisposition == + RoutePopDisposition.doNotPop || + widget.route._hasScopedWillPopCallback ? () async { + // ignore: deprecated_member_use final willPop = await widget.route.willPop(); - return willPop != RoutePopDisposition.doNotPop; + final popDisposition = widget.route.popDisposition; + final shouldClose = + !(willPop == RoutePopDisposition.doNotPop || + popDisposition == RoutePopDisposition.doNotPop); + popDisposition == RoutePopDisposition.doNotPop; + if (!shouldClose) { + widget.route.onPopInvoked(false); + } + return shouldClose; } : null, onClosing: () { @@ -138,7 +149,7 @@ class ModalSheetRoute extends PageRoute { this.animationCurve, Duration? duration, super.settings, - }) : duration = duration ?? _bottomSheetDuration; + }) : duration = duration ?? _bottomSheetDuration; final double? closeProgressThreshold; final WidgetWithChildBuilder? containerBuilder; diff --git a/sheet/example/ios/Flutter/AppFrameworkInfo.plist b/sheet/example/ios/Flutter/AppFrameworkInfo.plist index 4f8d4d24..8c6e5614 100644 --- a/sheet/example/ios/Flutter/AppFrameworkInfo.plist +++ b/sheet/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 11.0 + 12.0 diff --git a/sheet/example/ios/Runner.xcodeproj/project.pbxproj b/sheet/example/ios/Runner.xcodeproj/project.pbxproj index 8036f6e3..ad590e39 100644 --- a/sheet/example/ios/Runner.xcodeproj/project.pbxproj +++ b/sheet/example/ios/Runner.xcodeproj/project.pbxproj @@ -127,7 +127,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -275,7 +275,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -361,7 +361,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -410,7 +410,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/sheet/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/sheet/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index b52b2e69..e67b2808 100644 --- a/sheet/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/sheet/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ ( - context: context, - builder: (BuildContext context) => CupertinoAlertDialog( - title: const Text('Should Close?'), - actions: [ - CupertinoButton( - child: const Text('Yes'), - onPressed: () { - shouldClose = true; - Navigator.of(context).pop(); - }, - ), - CupertinoButton( - child: const Text('No'), - onPressed: () { - shouldClose = false; - Navigator.of(context).pop(); - }, - ), - ], - )); - return shouldClose; + child: PopScope( + canPop: false, + onPopInvoked: (didPop) { + final sheetNavigator = Navigator.of(context); + if (!didPop) { + showCupertinoDialog( + context: context, + builder: (BuildContext context) => CupertinoAlertDialog( + title: const Text('Should Close?'), + actions: [ + CupertinoButton( + child: const Text('Yes'), + onPressed: () { + Navigator.of(context).pop(); + sheetNavigator.pop(); + }, + ), + CupertinoButton( + child: const Text('No'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + )); + } }, child: Navigator( onGenerateRoute: (_) => MaterialPageRoute( diff --git a/sheet/example/lib/examples/route/examples/modal_fit_will_scope.dart b/sheet/example/lib/examples/route/examples/modal_fit_will_scope.dart index 6a226794..2d57104b 100644 --- a/sheet/example/lib/examples/route/examples/modal_fit_will_scope.dart +++ b/sheet/example/lib/examples/route/examples/modal_fit_will_scope.dart @@ -7,10 +7,12 @@ class ModalFitWillScope extends StatelessWidget { @override Widget build(BuildContext context) { return Material( - child: WillPopScope( - onWillPop: () async { - bool shouldClose = true; - await showCupertinoDialog( + child: PopScope( + canPop: false, + onPopInvoked: (didPop) { + if (didPop) return; + final sheetNavigator = Navigator.of(context); + showCupertinoDialog( context: context, builder: (BuildContext context) => CupertinoAlertDialog( title: const Text('Should Close?'), @@ -18,20 +20,18 @@ class ModalFitWillScope extends StatelessWidget { CupertinoButton( child: const Text('Yes'), onPressed: () { - shouldClose = true; Navigator.of(context).pop(); + sheetNavigator.pop(); }, ), CupertinoButton( child: const Text('No'), onPressed: () { - shouldClose = false; Navigator.of(context).pop(); }, ), ], )); - return shouldClose; }, child: Column( mainAxisSize: MainAxisSize.min, diff --git a/sheet/example/lib/examples/route/examples/modal_will_scope.dart b/sheet/example/lib/examples/route/examples/modal_will_scope.dart index ae02e80f..49bbad7f 100644 --- a/sheet/example/lib/examples/route/examples/modal_will_scope.dart +++ b/sheet/example/lib/examples/route/examples/modal_will_scope.dart @@ -7,31 +7,35 @@ class ModalWillScope extends StatelessWidget { @override Widget build(BuildContext context) { return Material( - child: WillPopScope( - onWillPop: () async { - bool shouldClose = true; - await showCupertinoDialog( + child: PopScope( + canPop: false, + onPopInvoked: (didPop) async { + if (didPop) { + return; + } + final sheetNavigator = Navigator.of(context); + showCupertinoDialog( context: context, - builder: (BuildContext context) => CupertinoAlertDialog( - title: const Text('Should Close?'), - actions: [ - CupertinoButton( - child: const Text('Yes'), - onPressed: () { - shouldClose = true; - Navigator.of(context).pop(); - }, - ), - CupertinoButton( - child: const Text('No'), - onPressed: () { - shouldClose = false; - Navigator.of(context).pop(); - }, - ), - ], - )); - return shouldClose; + builder: (BuildContext context) { + return CupertinoAlertDialog( + title: const Text('Should Close?'), + actions: [ + CupertinoButton( + child: const Text('Yes'), + onPressed: () { + Navigator.of(context).pop(); + sheetNavigator.pop(); + }, + ), + CupertinoButton( + child: const Text('No'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }); }, child: CupertinoPageScaffold( navigationBar: CupertinoNavigationBar( diff --git a/sheet/example/lib/examples/sheet/fold_screen_sheet.dart b/sheet/example/lib/examples/sheet/fold_screen_sheet.dart index f238ba84..75d7731b 100644 --- a/sheet/example/lib/examples/sheet/fold_screen_sheet.dart +++ b/sheet/example/lib/examples/sheet/fold_screen_sheet.dart @@ -3,7 +3,7 @@ import 'package:sheet/sheet.dart'; class FoldableScreenFloatingSheet extends StatefulWidget { @override - State createState() => _FitSheetState(); + State createState() => _FitSheetState(); } class _FitSheetState extends State { diff --git a/sheet/example/lib/examples/sheet/sheet_without_momentum.dart b/sheet/example/lib/examples/sheet/sheet_without_momentum.dart index 31814400..d80a47c1 100644 --- a/sheet/example/lib/examples/sheet/sheet_without_momentum.dart +++ b/sheet/example/lib/examples/sheet/sheet_without_momentum.dart @@ -6,7 +6,7 @@ import 'package:sheet/sheet.dart'; class NoMomentumSheet extends StatefulWidget { @override - State createState() => _NoMomentumSheetState(); + State createState() => _NoMomentumSheetState(); } class _NoMomentumSheetState extends State { diff --git a/sheet/example/lib/examples/sheet/snap_sheet.dart b/sheet/example/lib/examples/sheet/snap_sheet.dart index 2ff8e77f..8f32391f 100644 --- a/sheet/example/lib/examples/sheet/snap_sheet.dart +++ b/sheet/example/lib/examples/sheet/snap_sheet.dart @@ -6,7 +6,7 @@ import 'package:sheet/sheet.dart'; class SnapSheet extends StatefulWidget { @override - State createState() => _SnapSheetState(); + State createState() => _SnapSheetState(); } class _SnapSheetState extends State { diff --git a/sheet/example/lib/examples/sheet/text_field.dart b/sheet/example/lib/examples/sheet/text_field.dart index 32b35c7b..fc9cdffb 100644 --- a/sheet/example/lib/examples/sheet/text_field.dart +++ b/sheet/example/lib/examples/sheet/text_field.dart @@ -4,7 +4,7 @@ import 'package:sheet/sheet.dart'; class TextFieldSheet extends StatefulWidget { @override - State createState() => _TextFieldSheetState(); + State createState() => _TextFieldSheetState(); } class _TextFieldSheetState extends State diff --git a/sheet/example/lib/route_example_page.dart b/sheet/example/lib/route_example_page.dart index bb4c3d2a..382e0802 100644 --- a/sheet/example/lib/route_example_page.dart +++ b/sheet/example/lib/route_example_page.dart @@ -234,8 +234,8 @@ class RouteExamplePage extends StatelessWidget { ), ), ListTile( - title: const Text( - 'Cupertino Navigator + Scroll + WillPopScope'), + title: + const Text('Cupertino Navigator + Scroll + PopScope'), onTap: () => Navigator.of(context).push( CupertinoSheetRoute( builder: (BuildContext context) => @@ -244,7 +244,7 @@ class RouteExamplePage extends StatelessWidget { ), ), ListTile( - title: const Text('Modal with WillPopScope'), + title: const Text('Modal with PopScope'), onTap: () => Navigator.of(context).push( CupertinoSheetRoute( builder: (BuildContext context) => @@ -253,7 +253,7 @@ class RouteExamplePage extends StatelessWidget { ), ), ListTile( - title: const Text('Modal Fit with WillPopScope'), + title: const Text('Modal Fit with PopScope'), onTap: () => Navigator.of(context).push( CupertinoSheetRoute( fit: SheetFit.loose, diff --git a/sheet/example/pubspec.lock b/sheet/example/pubspec.lock index ed1dbdb5..90b5b3b7 100644 --- a/sheet/example/pubspec.lock +++ b/sheet/example/pubspec.lock @@ -37,10 +37,10 @@ packages: dependency: "direct main" description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" cupertino_icons: dependency: "direct main" description: @@ -88,6 +88,30 @@ packages: url: "https://pub.dev" source: hosted version: "12.1.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + url: "https://pub.dev" + source: hosted + version: "10.0.0" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + url: "https://pub.dev" + source: hosted + version: "2.0.1" lints: dependency: "direct dev" description: @@ -108,26 +132,26 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.11.0" nested: dependency: transitive description: @@ -140,10 +164,10 @@ packages: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" provider: dependency: "direct main" description: @@ -158,7 +182,7 @@ packages: path: ".." relative: true source: path - version: "1.0.0-pre" + version: "1.0.0" sky_engine: dependency: transitive description: flutter @@ -176,18 +200,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" string_scanner: dependency: transitive description: @@ -208,10 +232,10 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.6.1" vector_math: dependency: transitive description: @@ -220,14 +244,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - web: + vm_service: dependency: transitive description: - name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + name: vm_service + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "13.0.0" sdks: - dart: ">=3.1.0-185.0.dev <4.0.0" + dart: ">=3.3.0 <4.0.0" flutter: ">=3.7.0" diff --git a/sheet/example/pubspec.yaml b/sheet/example/pubspec.yaml index 24bf6c37..b7d2d570 100644 --- a/sheet/example/pubspec.yaml +++ b/sheet/example/pubspec.yaml @@ -4,7 +4,7 @@ publish_to: 'none' version: 1.0.0+1 environment: - sdk: ">=3.19.0 <4.0.0" + sdk: ">=3.3.0 <4.0.0" dependencies: flutter: diff --git a/sheet/lib/src/route/sheet_route.dart b/sheet/lib/src/route/sheet_route.dart index d06e27bf..83cd883a 100644 --- a/sheet/lib/src/route/sheet_route.dart +++ b/sheet/lib/src/route/sheet_route.dart @@ -182,7 +182,8 @@ class SheetRoute extends PageRoute with DelegatedTransitionsRoute { @protected bool shouldPreventPopForExtent(double extent) { return extent < willPopThreshold && - hasScopedWillPopCallback && + (hasScopedWillPopCallback || + popDisposition == RoutePopDisposition.doNotPop) && controller!.velocity <= 0; } @@ -466,20 +467,24 @@ class __SheetRouteContainerState extends State<_SheetRouteContainer> duration: const Duration(milliseconds: 400), curve: Curves.easeInOut, ); - - route.willPop().then( - (RoutePopDisposition disposition) { - if (disposition == RoutePopDisposition.pop) { - _sheetController.relativeAnimateTo( - 0, - duration: const Duration(milliseconds: 400), - curve: Curves.easeInOut, - ); - } else { - _sheetController.position.stopPreventingDrag(); - } - }, - ); + if (route.popDisposition == RoutePopDisposition.doNotPop) { + _sheetController.position.stopPreventingDrag(); + route.onPopInvoked(false); + } else { + route.willPop().then( + (RoutePopDisposition disposition) { + if (disposition == RoutePopDisposition.pop) { + _sheetController.relativeAnimateTo( + 0, + duration: const Duration(milliseconds: 400), + curve: Curves.easeInOut, + ); + } else { + _sheetController.position.stopPreventingDrag(); + } + }, + ); + } } @override