diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c0e1292..a863244a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,4 +12,10 @@ ## [0.1.6] - New custom params - Use `duration` to define the opening duration of the modal - Change the top radius of the cupertino bottom sheet -Thanks to @bierbaumtim @troyanskiy @rodineijf for the contributions \ No newline at end of file +Thanks to @bierbaumtim @troyanskiy @rodineijf for the contributions + + +## [0.2.0] - New Cool Features +- Added support for scroll-to-top by tapping the status bar on iOS devices. +- Use `curveAnimation` to define a custom curve animation for the modal transition +- Bug fixes releated to horizontal scroll, clamping physics and othes. \ No newline at end of file diff --git a/example/lib/examples/cupertino_share.dart b/example/lib/examples/cupertino_share.dart index 727af475..9e060e6c 100644 --- a/example/lib/examples/cupertino_share.dart +++ b/example/lib/examples/cupertino_share.dart @@ -8,7 +8,6 @@ import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; class CupertinoSharePage extends StatelessWidget { @override Widget build(BuildContext context) { - return Scaffold( appBar: appBar(context), body: CupertinoPageScaffold( diff --git a/example/lib/modals/modal_inside_modal.dart b/example/lib/modals/modal_inside_modal.dart index ac61cbb0..384a91b8 100644 --- a/example/lib/modals/modal_inside_modal.dart +++ b/example/lib/modals/modal_inside_modal.dart @@ -35,7 +35,8 @@ class ModalInsideModal extends StatelessWidget { backgroundColor: Colors.transparent, builder: (context, scrollController) => ModalInsideModal( - scrollController: scrollController, reverse: reverse), + scrollController: scrollController, + reverse: reverse), )), )).toList(), ), diff --git a/example/pubspec.lock b/example/pubspec.lock index e90a7e0c..282a7457 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -1,20 +1,6 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.13" - args: - dependency: transitive - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.0" async: dependency: transitive description: @@ -29,34 +15,34 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.0" - charcode: + characters: dependency: transitive description: - name: charcode + name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" - collection: + version: "1.0.0" + charcode: dependency: transitive description: - name: collection + name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.14.12" - convert: + version: "1.1.3" + clock: dependency: transitive description: - name: convert + name: clock url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" - crypto: + version: "1.0.1" + collection: dependency: transitive description: - name: crypto + name: collection url: "https://pub.dartlang.org" source: hosted - version: "2.1.4" + version: "1.14.13" cupertino_icons: dependency: "direct main" description: @@ -64,6 +50,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.3" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" flutter: dependency: "direct main" description: flutter @@ -79,20 +72,13 @@ packages: description: flutter source: sdk version: "0.0.0" - image: - dependency: transitive - description: - name: image - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.12" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.6" + version: "0.12.8" meta: dependency: transitive description: @@ -106,21 +92,14 @@ packages: path: ".." relative: true source: path - version: "0.1.6" + version: "0.2.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" - petitparser: - dependency: transitive - description: - name: petitparser - url: "https://pub.dartlang.org" - source: hosted - version: "2.4.0" + version: "1.7.0" plugin_platform_interface: dependency: transitive description: @@ -128,13 +107,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.2" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.3" sky_engine: dependency: transitive description: flutter @@ -181,7 +153,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.15" + version: "0.2.17" typed_data: dependency: transitive description: @@ -224,13 +196,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.8" - xml: - dependency: transitive - description: - name: xml - url: "https://pub.dartlang.org" - source: hosted - version: "3.6.1" sdks: - dart: ">=2.7.0 <3.0.0" + dart: ">=2.9.0-14.0.dev <3.0.0" flutter: ">=1.12.8 <2.0.0" diff --git a/lib/src/bottom_sheet.dart b/lib/src/bottom_sheet.dart index 645139a5..dd6005d7 100644 --- a/lib/src/bottom_sheet.dart +++ b/lib/src/bottom_sheet.dart @@ -13,7 +13,6 @@ import 'package:flutter/widgets.dart'; import 'package:modal_bottom_sheet/src/utils/primary_scroll_status_bar.dart'; import 'package:modal_bottom_sheet/src/utils/bottom_sheet_suspended_curve.dart'; -import 'package:modal_bottom_sheet/src/utils/primary_scroll_status_bar.dart'; const Curve _decelerateEasing = Cubic(0.0, 0.0, 0.2, 1.0); diff --git a/lib/src/bottom_sheet_route.dart b/lib/src/bottom_sheet_route.dart index 4836a08d..c9a14b85 100644 --- a/lib/src/bottom_sheet_route.dart +++ b/lib/src/bottom_sheet_route.dart @@ -39,6 +39,9 @@ class _ModalBottomSheetState extends State<_ModalBottomSheet> { final platform = Theme.of(context)?.platform ?? defaultTargetPlatform; switch (platform) { case TargetPlatform.iOS: + case TargetPlatform.linux: + case TargetPlatform.macOS: + case TargetPlatform.windows: return ''; case TargetPlatform.android: case TargetPlatform.fuchsia: diff --git a/lib/src/bottom_sheets/cupertino_bottom_sheet.dart b/lib/src/bottom_sheets/cupertino_bottom_sheet.dart index b4e3aa87..1c02d36b 100644 --- a/lib/src/bottom_sheets/cupertino_bottom_sheet.dart +++ b/lib/src/bottom_sheets/cupertino_bottom_sheet.dart @@ -187,18 +187,17 @@ class CupertinoModalBottomSheetRoute extends ModalBottomSheetRoute { (paddingTop + _behind_widget_visible_height) * 0.9; final offsetY = secondaryAnimation.value * (paddingTop - distanceWithScale); final scale = 1 - secondaryAnimation.value / 10; - return AnimatedBuilder( - builder: (context, child) => Transform.translate( - offset: Offset(0, offsetY), - child: Transform.scale( - scale: scale, - child: child, - alignment: Alignment.topCenter, - ), + return AnimatedBuilder( + builder: (context, child) => Transform.translate( + offset: Offset(0, offsetY), + child: Transform.scale( + scale: scale, + child: child, + alignment: Alignment.topCenter, ), - child: child, - animation: secondaryAnimation, - + ), + child: child, + animation: secondaryAnimation, ); } @@ -279,7 +278,6 @@ class _CupertinoModalTransition extends StatelessWidget { } } - class _CupertinoScaffold extends InheritedWidget { final AnimationController animation; @@ -339,7 +337,7 @@ class CupertinoScaffold extends StatefulWidget { assert(enableDrag != null); assert(debugCheckHasMediaQuery(context)); final isCupertinoApp = Theme.of(context, shadowThemeOnly: true) == null; - String barrierLabel = ''; + var barrierLabel = ''; if (!isCupertinoApp) { assert(debugCheckHasMaterialLocalizations(context)); barrierLabel = MaterialLocalizations.of(context).modalBarrierDismissLabel; diff --git a/lib/src/utils/bottom_sheet_suspended_curve.dart b/lib/src/utils/bottom_sheet_suspended_curve.dart index a445ecc6..31551651 100644 --- a/lib/src/utils/bottom_sheet_suspended_curve.dart +++ b/lib/src/utils/bottom_sheet_suspended_curve.dart @@ -54,8 +54,8 @@ class BottomSheetSuspendedCurve extends ParametricCurve { return t; } - final double curveProgress = (t - startingPoint) / (1 - startingPoint); - final double transformed = curve.transform(curveProgress); + final curveProgress = (t - startingPoint) / (1 - startingPoint); + final transformed = curve.transform(curveProgress); return lerpDouble(startingPoint, 1, transformed); } diff --git a/pubspec.yaml b/pubspec.yaml index 3ae7a261..bf4b9a17 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: modal_bottom_sheet description: 'Create awesome and powerful modal bottom sheets. Material, Cupertino iOS 13 or create your own style' -version: 0.1.6 +version: 0.2.0 homepage: 'https://github.com/jamesblasco/modal_bottom_sheet' environment: