Roman Rosluk

Added open transition duration param

... ... @@ -81,6 +81,7 @@ Future<T> showAvatarModalBottomSheet<T>({
bool useRootNavigator = false,
bool isDismissible = true,
bool enableDrag = true,
Duration duration,
}) async {
assert(context != null);
assert(builder != null);
... ... @@ -104,6 +105,7 @@ Future<T> showAvatarModalBottomSheet<T>({
isDismissible: isDismissible,
modalBarrierColor: barrierColor,
enableDrag: enableDrag,
duration: duration,
));
return result;
}
... ...
... ... @@ -7,42 +7,42 @@ packages:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
version: "2.0.13"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.2"
version: "1.6.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
version: "2.4.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
version: "2.0.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
version: "1.1.3"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
version: "1.14.12"
convert:
dependency: transitive
description:
... ... @@ -56,7 +56,7 @@ packages:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
version: "2.1.4"
cupertino_icons:
dependency: "direct main"
description:
... ... @@ -85,7 +85,7 @@ packages:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
version: "2.1.12"
matcher:
dependency: transitive
description:
... ... @@ -106,7 +106,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.1.4"
version: "0.1.5"
path:
dependency: transitive
description:
... ... @@ -114,13 +114,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0+1"
petitparser:
dependency: transitive
description:
... ... @@ -141,7 +134,7 @@ packages:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
version: "2.1.3"
sky_engine:
dependency: transitive
description: flutter
... ... @@ -153,7 +146,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.5"
version: "1.7.0"
stack_trace:
dependency: transitive
description:
... ... @@ -188,7 +181,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.11"
version: "0.2.15"
typed_data:
dependency: transitive
description:
... ... @@ -237,7 +230,7 @@ packages:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.5.0"
version: "3.6.1"
sdks:
dart: ">=2.7.0 <3.0.0"
flutter: ">=1.12.8 <2.0.0"
... ...
... ... @@ -60,7 +60,7 @@ class ModalBottomSheet extends StatefulWidget {
final AnimationController animationController;
/// The curve used by the animation showing and dismissing the bottom sheet.
///
///
/// If no curve is provided it falls back to `Curves.easeOutSine`.
final Curve animationCurve;
... ... @@ -108,9 +108,12 @@ class ModalBottomSheet extends StatefulWidget {
/// This API available as a convenience for a Material compliant bottom sheet
/// animation. If alternative animation durations are required, a different
/// animation controller could be provided.
static AnimationController createAnimationController(TickerProvider vsync) {
static AnimationController createAnimationController(
TickerProvider vsync, {
Duration duration,
}) {
return AnimationController(
duration: _bottomSheetDuration,
duration: duration ?? _bottomSheetDuration,
debugLabel: 'BottomSheet',
vsync: vsync,
);
... ...
... ... @@ -120,6 +120,7 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> {
@required this.expanded,
this.bounce = false,
this.animationCurve,
this.duration,
RouteSettings settings,
}) : assert(expanded != null),
assert(isDismissible != null),
... ... @@ -135,11 +136,13 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> {
final bool enableDrag;
final ScrollController scrollController;
final Duration duration;
final AnimationController secondAnimationController;
final Curve animationCurve;
@override
Duration get transitionDuration => _bottomSheetDuration;
Duration get transitionDuration => duration ?? _bottomSheetDuration;
@override
bool get barrierDismissible => isDismissible;
... ... @@ -155,8 +158,10 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> {
@override
AnimationController createAnimationController() {
assert(_animationController == null);
_animationController =
ModalBottomSheet.createAnimationController(navigator.overlay);
_animationController = ModalBottomSheet.createAnimationController(
navigator.overlay,
duration: duration,
);
return _animationController;
}
... ... @@ -218,6 +223,7 @@ Future<T> showCustomModalBottomSheet<T>({
bool isDismissible = true,
bool enableDrag = true,
ScrollController scrollController,
Duration duration,
}) async {
assert(context != null);
assert(builder != null);
... ... @@ -240,6 +246,7 @@ Future<T> showCustomModalBottomSheet<T>({
modalBarrierColor: barrierColor,
enableDrag: enableDrag,
animationCurve: animationCurve,
duration: duration,
));
return result;
}
... ...
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'dart:async';
import '../../modal_bottom_sheet.dart';
import '../bottom_sheet_route.dart';
... ... @@ -9,6 +10,7 @@ class BarBottomSheet extends StatelessWidget {
final Widget child;
const BarBottomSheet({Key key, this.child}) : super(key: key);
@override
Widget build(BuildContext context) {
return AnnotatedRegion<SystemUiOverlayStyle>(
... ... @@ -70,6 +72,7 @@ Future<T> showBarModalBottomSheet<T>({
bool useRootNavigator = false,
bool isDismissible = true,
bool enableDrag = true,
Duration duration,
}) async {
assert(context != null);
assert(builder != null);
... ... @@ -93,6 +96,7 @@ Future<T> showBarModalBottomSheet<T>({
modalBarrierColor: barrierColor,
enableDrag: enableDrag,
animationCurve: animationCurve,
duration: duration,
));
return result;
}
... ...
... ... @@ -78,6 +78,7 @@ Future<T> showCupertinoModalBottomSheet<T>({
bool bounce = true,
bool isDismissible,
bool enableDrag = true,
Duration duration,
}) async {
assert(context != null);
assert(builder != null);
... ... @@ -111,6 +112,7 @@ Future<T> showCupertinoModalBottomSheet<T>({
enableDrag: enableDrag,
animationCurve: animationCurve,
previousRouteAnimationCurve: previousRouteAnimationCurve,
duration: duration,
));
return result;
}
... ... @@ -132,6 +134,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> {
bool isDismissible = true,
bool enableDrag = true,
@required bool expanded,
Duration duration,
RouteSettings settings,
this.previousRouteAnimationCurve,
}) : assert(expanded != null),
... ... @@ -149,6 +152,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> {
expanded: expanded,
settings: settings,
animationCurve: animationCurve,
duration: duration,
);
@override
... ... @@ -286,6 +290,7 @@ class CupertinoScaffold extends StatefulWidget {
bool bounce = true,
bool isDismissible,
bool enableDrag = true,
Duration duration,
}) async {
assert(context != null);
assert(builder != null);
... ... @@ -315,6 +320,7 @@ class CupertinoScaffold extends StatefulWidget {
enableDrag: enableDrag,
animationCurve: animationCurve,
previousRouteAnimationCurve: previousRouteAnimationCurve,
duration: duration,
));
return result;
}
... ...
... ... @@ -18,6 +18,7 @@ Future<T> showMaterialModalBottomSheet<T>({
bool useRootNavigator = false,
bool isDismissible = true,
bool enableDrag = true,
Duration duration,
}) async {
assert(context != null);
assert(builder != null);
... ... @@ -46,6 +47,7 @@ Future<T> showMaterialModalBottomSheet<T>({
modalBarrierColor: barrierColor,
enableDrag: enableDrag,
animationCurve: animationCurve,
duration: duration,
));
return result;
}
... ...
... ... @@ -7,42 +7,42 @@ packages:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
version: "2.0.13"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.2"
version: "1.6.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
version: "2.4.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
version: "2.0.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
version: "1.1.3"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
version: "1.14.12"
convert:
dependency: transitive
description:
... ... @@ -56,7 +56,7 @@ packages:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
version: "2.1.4"
flutter:
dependency: "direct main"
description: flutter
... ... @@ -73,7 +73,7 @@ packages:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
version: "2.1.12"
matcher:
dependency: transitive
description:
... ... @@ -115,7 +115,7 @@ packages:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
version: "2.1.3"
sky_engine:
dependency: transitive
description: flutter
... ... @@ -127,7 +127,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.5"
version: "1.7.0"
stack_trace:
dependency: transitive
description:
... ... @@ -162,7 +162,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.11"
version: "0.2.15"
typed_data:
dependency: transitive
description:
... ... @@ -183,7 +183,7 @@ packages:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.5.0"
version: "3.6.1"
sdks:
dart: ">=2.4.0 <3.0.0"
dart: ">=2.6.0 <3.0.0"
flutter: ">=1.12.0 <2.0.0"
... ...