v7lin

Merge remote-tracking branch 'upstream/master'

# Conflicts:
#	example/lib/modals/circular_modal.dart
#	lib/src/bottom_sheet.dart
#	lib/src/bottom_sheets/bar_bottom_sheet.dart
#	lib/src/bottom_sheets/cupertino_bottom_sheet.dart
#	lib/src/utils/modal_scroll_controller.dart
... ... @@ -15,10 +15,12 @@
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Visual Studio Code related
.classpath
.project
.settings/
.vscode/*
# Flutter/Dart/Pub related
**/doc/api/
... ...
## 2.0.1 - Small fixes
+ Fixes bug with will pop scope
+ Replaces VelocityTracker deprecated constructor
+ Add optional RouteSettings to all showModal methods
## 2.0.0-nullsafety.1 - Null Safety support
+ Fixes #119 & #113
... ...
include: package:pedantic/analysis_options.yaml
enable-experiment:
- extension-methods
\ No newline at end of file
... ... @@ -149,27 +149,28 @@ class PhotoShareBottomSheet extends StatelessWidget {
margin: EdgeInsets.symmetric(horizontal: 4),
child: Column(
children: <Widget>[
if(app.imageUrl != null)
Material(
child: ClipRRect(
child: Container(
height: 60,
width: 60,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(app.imageUrl!),
fit: BoxFit.cover),
color: Colors.white,
borderRadius:
BorderRadius.circular(15)),
if (app.imageUrl != null)
Material(
child: ClipRRect(
child: Container(
height: 60,
width: 60,
decoration: BoxDecoration(
image: DecorationImage(
image:
AssetImage(app.imageUrl!),
fit: BoxFit.cover),
color: Colors.white,
borderRadius:
BorderRadius.circular(15)),
),
),
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(15)),
elevation: 12,
shadowColor: Colors.black12,
),
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(15)),
elevation: 12,
shadowColor: Colors.black12,
),
SizedBox(height: 8),
Text(
app.title,
... ... @@ -185,62 +186,62 @@ class PhotoShareBottomSheet extends StatelessWidget {
),
),
SliverPadding(
padding: EdgeInsets.symmetric(horizontal: 18, vertical: 6),
sliver: SliverList(
delegate: SliverChildListDelegate.fixed(
List<Widget>.from(actions.map(
(action) => Container(
padding: EdgeInsets.symmetric(
vertical: 16, horizontal: 16),
child: Text(
action.title,
style: CupertinoTheme.of(context)
.textTheme
.textStyle,
)),
)).addItemInBetween(Divider(
height: 1,
))),
)),
padding:
EdgeInsets.symmetric(horizontal: 18, vertical: 6),
sliver: SliverList(
delegate: SliverChildListDelegate.fixed(
List<Widget>.from(actions.map(
(action) => Container(
padding: EdgeInsets.symmetric(
vertical: 16, horizontal: 16),
child: Text(
action.title,
style: CupertinoTheme.of(context)
.textTheme
.textStyle,
)),
)).addItemInBetween(Divider(
height: 1,
))),
)),
SliverPadding(
padding: EdgeInsets.symmetric(horizontal: 18, vertical: 6),
sliver: SliverList(
delegate: SliverChildListDelegate.fixed(
List<Widget>.from(actions1.map(
(action) => Container(
padding: EdgeInsets.symmetric(
vertical: 16, horizontal: 16),
child: Text(
action.title,
style: CupertinoTheme.of(context)
.textTheme
.textStyle,
)),
)).addItemInBetween(Divider(
height: 1,
))),
)
),
padding:
EdgeInsets.symmetric(horizontal: 18, vertical: 6),
sliver: SliverList(
delegate: SliverChildListDelegate.fixed(
List<Widget>.from(actions1.map(
(action) => Container(
padding: EdgeInsets.symmetric(
vertical: 16, horizontal: 16),
child: Text(
action.title,
style: CupertinoTheme.of(context)
.textTheme
.textStyle,
)),
)).addItemInBetween(Divider(
height: 1,
))),
)),
SliverPadding(
padding: EdgeInsets.symmetric(horizontal: 18, vertical: 4),
sliver: SliverList(
delegate: SliverChildListDelegate.fixed(
List<Widget>.from(actions2.map(
(action) => Container(
padding: EdgeInsets.symmetric(
vertical: 16, horizontal: 16),
child: Text(
action.title,
style: CupertinoTheme.of(context)
.textTheme
.textStyle,
)),
)).addItemInBetween(Divider(
height: 1,
))),
)
),
padding:
EdgeInsets.symmetric(horizontal: 18, vertical: 4),
sliver: SliverList(
delegate: SliverChildListDelegate.fixed(
List<Widget>.from(actions2.map(
(action) => Container(
padding: EdgeInsets.symmetric(
vertical: 16, horizontal: 16),
child: Text(
action.title,
style: CupertinoTheme.of(context)
.textTheme
.textStyle,
)),
)).addItemInBetween(Divider(
height: 1,
))),
)),
SliverSafeArea(
top: false,
sliver: SliverPadding(
... ... @@ -268,19 +269,19 @@ class PhotoShareBottomSheet extends StatelessWidget {
margin: EdgeInsets.symmetric(horizontal: 4),
child: Column(
children: <Widget>[
if(person.imageUrl != null)
Material(
child: CircleAvatar(
backgroundImage: AssetImage(
person.imageUrl!,
if (person.imageUrl != null)
Material(
child: CircleAvatar(
backgroundImage: AssetImage(
person.imageUrl!,
),
radius: 30,
backgroundColor: Colors.white,
),
radius: 30,
backgroundColor: Colors.white,
shape: CircleBorder(),
elevation: 12,
shadowColor: Colors.black12,
),
shape: CircleBorder(),
elevation: 12,
shadowColor: Colors.black12,
),
SizedBox(height: 8),
Text(
person.title,
... ...
... ... @@ -2,8 +2,6 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class SimpleModal extends StatelessWidget {
const SimpleModal({Key? key}) : super(key: key);
@override
... ...
... ... @@ -7,42 +7,42 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0-nullsafety.3"
version: "2.8.2"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.3"
version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.5"
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.3"
version: "1.3.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.3"
version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0-nullsafety.5"
version: "1.15.0"
cupertino_icons:
dependency: "direct main"
description:
... ... @@ -56,7 +56,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.3"
version: "1.2.0"
flutter:
dependency: "direct main"
description: flutter
... ... @@ -67,41 +67,60 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.4"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10-nullsafety.3"
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.6"
version: "1.7.0"
modal_bottom_sheet:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "2.0.0-nullsafety.1"
version: "2.0.1"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety.3"
version: "1.8.1"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.1"
version: "2.1.2"
sky_engine:
dependency: transitive
description: flutter
... ... @@ -113,91 +132,105 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety.4"
version: "1.8.2"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0-nullsafety.6"
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.3"
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.3"
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.3"
version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19-nullsafety.6"
typed_data:
version: "0.4.9"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.20"
url_launcher_android:
dependency: transitive
description:
name: typed_data
name: url_launcher_android
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.5"
url_launcher:
dependency: "direct main"
version: "6.0.15"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher
name: url_launcher_ios
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.0-nullsafety.1"
version: "6.0.15"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0-nullsafety.1"
version: "3.0.0"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0-nullsafety.1"
version: "3.0.0"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0-nullsafety.1"
version: "2.0.5"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.9"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0-nullsafety.1"
version: "3.0.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.5"
version: "2.1.2"
sdks:
dart: ">=2.12.0-29.10.beta <3.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"
dart: ">=2.16.0-100.0.dev <3.0.0"
flutter: ">=2.10.0"
... ...
... ... @@ -19,7 +19,7 @@ environment:
dependencies:
flutter:
sdk: flutter
url_launcher: 6.0.0-nullsafety.1
url_launcher: ^6.0.20
modal_bottom_sheet:
path: '../'
... ...
... ... @@ -45,7 +45,7 @@ class ModalBottomSheet extends StatefulWidget {
required this.expanded,
required this.onClosing,
required this.child,
}) : super(key: key);
}) : super(key: key);
/// The closeProgressThreshold parameter
/// specifies when the bottom sheet will be dismissed when user drags it.
... ... @@ -225,7 +225,7 @@ class _ModalBottomSheetState extends State<ModalBottomSheet>
_bounceDragController.reverse();
var canClose = true;
if (widget.shouldClose != null && hasReachedWillPopThreshold) {
if (widget.shouldClose != null) {
_cancelClose();
canClose = await shouldClose();
}
... ... @@ -291,9 +291,8 @@ class _ModalBottomSheetState extends State<ModalBottomSheet>
// Otherwise the calculate the velocity with a VelocityTracker
if (_velocityTracker == null) {
//final pointerKind = defaultPointerDeviceKind(context);
// ignore: deprecated_member_use
_velocityTracker = VelocityTracker();
final pointerKind = defaultPointerDeviceKind(context);
_velocityTracker = VelocityTracker.withKind(pointerKind);
_startTime = DateTime.now();
}
... ... @@ -482,5 +481,4 @@ PointerDeviceKind defaultPointerDeviceKind(BuildContext context) {
case TargetPlatform.fuchsia:
return PointerDeviceKind.unknown;
}
return PointerDeviceKind.unknown;
}
... ...
... ... @@ -237,6 +237,7 @@ Future<T?> showCustomModalBottomSheet<T>({
bool isDismissible = true,
bool enableDrag = true,
Duration? duration,
RouteSettings? settings,
}) async {
assert(debugCheckHasMediaQuery(context));
assert(debugCheckHasMaterialLocalizations(context));
... ... @@ -260,6 +261,7 @@ Future<T?> showCustomModalBottomSheet<T>({
enableDrag: enableDrag,
animationCurve: animationCurve,
duration: duration,
settings: settings,
));
return result;
}
... ...
... ... @@ -90,6 +90,7 @@ Future<T?> showBarModalBottomSheet<T>({
bool enableDrag = true,
Widget? topControl,
Duration? duration,
RouteSettings? settings,
SystemUiOverlayStyle? overlayStyle,
}) async {
assert(debugCheckHasMediaQuery(context));
... ... @@ -115,6 +116,7 @@ Future<T?> showBarModalBottomSheet<T>({
enableDrag: enableDrag,
animationCurve: animationCurve,
duration: duration,
settings: settings,
));
return result;
}
... ...
... ... @@ -19,7 +19,8 @@ import '../../modal_bottom_sheet.dart';
const double _kPreviousPageVisibleOffset = 10;
const Radius _kDefaultTopRadius = Radius.circular(12);
const BoxShadow _kDefaultBoxShadow = BoxShadow(blurRadius: 10, color: Colors.black12, spreadRadius: 5);
const BoxShadow _kDefaultBoxShadow =
BoxShadow(blurRadius: 10, color: Colors.black12, spreadRadius: 5);
/// Cupertino Bottom Sheet Container
///
... ... @@ -40,14 +41,13 @@ class _CupertinoBottomSheetContainer extends StatelessWidget {
this.shadow,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final topSafeAreaPadding = MediaQuery.of(context).padding.top;
final topPadding = _kPreviousPageVisibleOffset + topSafeAreaPadding;
final _shadow = shadow ?? _kDefaultBoxShadow;
BoxShadow(blurRadius: 10, color: Colors.black12, spreadRadius: 5);
BoxShadow(blurRadius: 10, color: Colors.black12, spreadRadius: 5);
final _backgroundColor =
backgroundColor ?? CupertinoTheme.of(context).scaffoldBackgroundColor;
return Padding(
... ... @@ -138,7 +138,6 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> {
final Curve? previousRouteAnimationCurve;
final BoxShadow? boxShadow;
// Background color behind all routes
... ... @@ -169,7 +168,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> {
this.topRadius = _kDefaultTopRadius,
this.previousRouteAnimationCurve,
this.overlayStyle,
}) : super(
}) : super(
closeProgressThreshold: closeProgressThreshold,
scrollController: scrollController,
containerBuilder: containerBuilder,
... ... @@ -194,8 +193,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> {
Widget child,
) {
final paddingTop = MediaQuery.of(context).padding.top;
final distanceWithScale =
(paddingTop + _kPreviousPageVisibleOffset) * 0.9;
final distanceWithScale = (paddingTop + _kPreviousPageVisibleOffset) * 0.9;
final offsetY = secondaryAnimation.value * (paddingTop - distanceWithScale);
final scale = 1 - secondaryAnimation.value / 10;
return AnimatedBuilder(
... ... @@ -231,7 +229,6 @@ class _CupertinoModalTransition extends StatelessWidget {
final Radius topRadius;
final Curve? animationCurve;
final Color backgroundColor;
final BoxShadow? boxShadow;
final SystemUiOverlayStyle? overlayStyle;
final Widget body;
... ... @@ -243,7 +240,6 @@ class _CupertinoModalTransition extends StatelessWidget {
required this.topRadius,
this.backgroundColor = Colors.black,
this.animationCurve,
this.boxShadow,
this.overlayStyle,
}) : super(key: key);
... ...
... ... @@ -20,6 +20,7 @@ Future<T?> showMaterialModalBottomSheet<T>({
bool isDismissible = true,
bool enableDrag = true,
Duration? duration,
RouteSettings? settings,
}) async {
assert(debugCheckHasMediaQuery(context));
assert(debugCheckHasMaterialLocalizations(context));
... ... @@ -44,6 +45,7 @@ Future<T?> showMaterialModalBottomSheet<T>({
enableDrag: enableDrag,
animationCurve: animationCurve,
duration: duration,
settings: settings,
));
return result;
}
... ...
... ... @@ -16,7 +16,7 @@ class ModalScrollController extends InheritedWidget {
Key? key,
required this.controller,
required Widget child,
}) : super(
}) : super(
key: key,
child: PrimaryScrollController(
controller: controller,
... ...
... ... @@ -7,49 +7,49 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0-nullsafety.3"
version: "2.8.2"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.3"
version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.5"
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.3"
version: "1.3.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.3"
version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0-nullsafety.5"
version: "1.15.0"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.3"
version: "1.2.0"
flutter:
dependency: "direct main"
description: flutter
... ... @@ -66,21 +66,28 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10-nullsafety.3"
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.6"
version: "1.7.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety.3"
version: "1.8.1"
pedantic:
dependency: "direct dev"
description:
... ... @@ -99,56 +106,49 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety.4"
version: "1.8.2"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0-nullsafety.6"
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.3"
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.3"
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.3"
version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19-nullsafety.6"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.5"
version: "0.4.9"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.5"
version: "2.1.2"
sdks:
dart: ">=2.12.0-29.10.beta <3.0.0"
flutter: ">=1.12.0 <2.0.0"
dart: ">=2.14.0 <3.0.0"
flutter: ">=2.0.0"
... ...
name: modal_bottom_sheet
description: 'Create awesome and powerful modal bottom sheets. Material, Cupertino iOS 13 or create your own style'
version: 2.0.0-nullsafety.1
version: 2.0.1
homepage: 'https://github.com/jamesblasco/modal_bottom_sheet'
environment:
sdk: ">=2.12.0-29.10.beta <3.0.0"
flutter: ">=1.12.0 <2.0.0"
sdk: ">=2.12.0 <3.0.0"
flutter: ">=2.0.0"
dependencies:
flutter:
... ...