Showing
17 changed files
with
99 additions
and
175 deletions
| @@ -149,27 +149,28 @@ class PhotoShareBottomSheet extends StatelessWidget { | @@ -149,27 +149,28 @@ class PhotoShareBottomSheet extends StatelessWidget { | ||
| 149 | margin: EdgeInsets.symmetric(horizontal: 4), | 149 | margin: EdgeInsets.symmetric(horizontal: 4), |
| 150 | child: Column( | 150 | child: Column( |
| 151 | children: <Widget>[ | 151 | children: <Widget>[ |
| 152 | - if(app.imageUrl != null) | ||
| 153 | - Material( | ||
| 154 | - child: ClipRRect( | ||
| 155 | - child: Container( | ||
| 156 | - height: 60, | ||
| 157 | - width: 60, | ||
| 158 | - decoration: BoxDecoration( | ||
| 159 | - image: DecorationImage( | ||
| 160 | - image: AssetImage(app.imageUrl!), | ||
| 161 | - fit: BoxFit.cover), | ||
| 162 | - color: Colors.white, | ||
| 163 | - borderRadius: | ||
| 164 | - BorderRadius.circular(15)), | 152 | + if (app.imageUrl != null) |
| 153 | + Material( | ||
| 154 | + child: ClipRRect( | ||
| 155 | + child: Container( | ||
| 156 | + height: 60, | ||
| 157 | + width: 60, | ||
| 158 | + decoration: BoxDecoration( | ||
| 159 | + image: DecorationImage( | ||
| 160 | + image: | ||
| 161 | + AssetImage(app.imageUrl!), | ||
| 162 | + fit: BoxFit.cover), | ||
| 163 | + color: Colors.white, | ||
| 164 | + borderRadius: | ||
| 165 | + BorderRadius.circular(15)), | ||
| 166 | + ), | ||
| 165 | ), | 167 | ), |
| 168 | + shape: RoundedRectangleBorder( | ||
| 169 | + borderRadius: | ||
| 170 | + BorderRadius.circular(15)), | ||
| 171 | + elevation: 12, | ||
| 172 | + shadowColor: Colors.black12, | ||
| 166 | ), | 173 | ), |
| 167 | - shape: RoundedRectangleBorder( | ||
| 168 | - borderRadius: | ||
| 169 | - BorderRadius.circular(15)), | ||
| 170 | - elevation: 12, | ||
| 171 | - shadowColor: Colors.black12, | ||
| 172 | - ), | ||
| 173 | SizedBox(height: 8), | 174 | SizedBox(height: 8), |
| 174 | Text( | 175 | Text( |
| 175 | app.title, | 176 | app.title, |
| @@ -185,62 +186,62 @@ class PhotoShareBottomSheet extends StatelessWidget { | @@ -185,62 +186,62 @@ class PhotoShareBottomSheet extends StatelessWidget { | ||
| 185 | ), | 186 | ), |
| 186 | ), | 187 | ), |
| 187 | SliverPadding( | 188 | SliverPadding( |
| 188 | - padding: EdgeInsets.symmetric(horizontal: 18, vertical: 6), | ||
| 189 | - sliver: SliverList( | ||
| 190 | - delegate: SliverChildListDelegate.fixed( | ||
| 191 | - List<Widget>.from(actions.map( | ||
| 192 | - (action) => Container( | ||
| 193 | - padding: EdgeInsets.symmetric( | ||
| 194 | - vertical: 16, horizontal: 16), | ||
| 195 | - child: Text( | ||
| 196 | - action.title, | ||
| 197 | - style: CupertinoTheme.of(context) | ||
| 198 | - .textTheme | ||
| 199 | - .textStyle, | ||
| 200 | - )), | ||
| 201 | - )).addItemInBetween(Divider( | ||
| 202 | - height: 1, | ||
| 203 | - ))), | ||
| 204 | - )), | ||
| 205 | - | 189 | + padding: |
| 190 | + EdgeInsets.symmetric(horizontal: 18, vertical: 6), | ||
| 191 | + sliver: SliverList( | ||
| 192 | + delegate: SliverChildListDelegate.fixed( | ||
| 193 | + List<Widget>.from(actions.map( | ||
| 194 | + (action) => Container( | ||
| 195 | + padding: EdgeInsets.symmetric( | ||
| 196 | + vertical: 16, horizontal: 16), | ||
| 197 | + child: Text( | ||
| 198 | + action.title, | ||
| 199 | + style: CupertinoTheme.of(context) | ||
| 200 | + .textTheme | ||
| 201 | + .textStyle, | ||
| 202 | + )), | ||
| 203 | + )).addItemInBetween(Divider( | ||
| 204 | + height: 1, | ||
| 205 | + ))), | ||
| 206 | + )), | ||
| 206 | SliverPadding( | 207 | SliverPadding( |
| 207 | - padding: EdgeInsets.symmetric(horizontal: 18, vertical: 6), | ||
| 208 | - sliver: SliverList( | ||
| 209 | - delegate: SliverChildListDelegate.fixed( | ||
| 210 | - List<Widget>.from(actions1.map( | ||
| 211 | - (action) => Container( | ||
| 212 | - padding: EdgeInsets.symmetric( | ||
| 213 | - vertical: 16, horizontal: 16), | ||
| 214 | - child: Text( | ||
| 215 | - action.title, | ||
| 216 | - style: CupertinoTheme.of(context) | ||
| 217 | - .textTheme | ||
| 218 | - .textStyle, | ||
| 219 | - )), | ||
| 220 | - )).addItemInBetween(Divider( | ||
| 221 | - height: 1, | ||
| 222 | - ))), | ||
| 223 | - ) | ||
| 224 | - ), | 208 | + padding: |
| 209 | + EdgeInsets.symmetric(horizontal: 18, vertical: 6), | ||
| 210 | + sliver: SliverList( | ||
| 211 | + delegate: SliverChildListDelegate.fixed( | ||
| 212 | + List<Widget>.from(actions1.map( | ||
| 213 | + (action) => Container( | ||
| 214 | + padding: EdgeInsets.symmetric( | ||
| 215 | + vertical: 16, horizontal: 16), | ||
| 216 | + child: Text( | ||
| 217 | + action.title, | ||
| 218 | + style: CupertinoTheme.of(context) | ||
| 219 | + .textTheme | ||
| 220 | + .textStyle, | ||
| 221 | + )), | ||
| 222 | + )).addItemInBetween(Divider( | ||
| 223 | + height: 1, | ||
| 224 | + ))), | ||
| 225 | + )), | ||
| 225 | SliverPadding( | 226 | SliverPadding( |
| 226 | - padding: EdgeInsets.symmetric(horizontal: 18, vertical: 4), | ||
| 227 | - sliver: SliverList( | ||
| 228 | - delegate: SliverChildListDelegate.fixed( | ||
| 229 | - List<Widget>.from(actions2.map( | ||
| 230 | - (action) => Container( | ||
| 231 | - padding: EdgeInsets.symmetric( | ||
| 232 | - vertical: 16, horizontal: 16), | ||
| 233 | - child: Text( | ||
| 234 | - action.title, | ||
| 235 | - style: CupertinoTheme.of(context) | ||
| 236 | - .textTheme | ||
| 237 | - .textStyle, | ||
| 238 | - )), | ||
| 239 | - )).addItemInBetween(Divider( | ||
| 240 | - height: 1, | ||
| 241 | - ))), | ||
| 242 | - ) | ||
| 243 | - ), | 227 | + padding: |
| 228 | + EdgeInsets.symmetric(horizontal: 18, vertical: 4), | ||
| 229 | + sliver: SliverList( | ||
| 230 | + delegate: SliverChildListDelegate.fixed( | ||
| 231 | + List<Widget>.from(actions2.map( | ||
| 232 | + (action) => Container( | ||
| 233 | + padding: EdgeInsets.symmetric( | ||
| 234 | + vertical: 16, horizontal: 16), | ||
| 235 | + child: Text( | ||
| 236 | + action.title, | ||
| 237 | + style: CupertinoTheme.of(context) | ||
| 238 | + .textTheme | ||
| 239 | + .textStyle, | ||
| 240 | + )), | ||
| 241 | + )).addItemInBetween(Divider( | ||
| 242 | + height: 1, | ||
| 243 | + ))), | ||
| 244 | + )), | ||
| 244 | SliverSafeArea( | 245 | SliverSafeArea( |
| 245 | top: false, | 246 | top: false, |
| 246 | sliver: SliverPadding( | 247 | sliver: SliverPadding( |
| @@ -268,19 +269,19 @@ class PhotoShareBottomSheet extends StatelessWidget { | @@ -268,19 +269,19 @@ class PhotoShareBottomSheet extends StatelessWidget { | ||
| 268 | margin: EdgeInsets.symmetric(horizontal: 4), | 269 | margin: EdgeInsets.symmetric(horizontal: 4), |
| 269 | child: Column( | 270 | child: Column( |
| 270 | children: <Widget>[ | 271 | children: <Widget>[ |
| 271 | - if(person.imageUrl != null) | ||
| 272 | - Material( | ||
| 273 | - child: CircleAvatar( | ||
| 274 | - backgroundImage: AssetImage( | ||
| 275 | - person.imageUrl!, | 272 | + if (person.imageUrl != null) |
| 273 | + Material( | ||
| 274 | + child: CircleAvatar( | ||
| 275 | + backgroundImage: AssetImage( | ||
| 276 | + person.imageUrl!, | ||
| 277 | + ), | ||
| 278 | + radius: 30, | ||
| 279 | + backgroundColor: Colors.white, | ||
| 276 | ), | 280 | ), |
| 277 | - radius: 30, | ||
| 278 | - backgroundColor: Colors.white, | 281 | + shape: CircleBorder(), |
| 282 | + elevation: 12, | ||
| 283 | + shadowColor: Colors.black12, | ||
| 279 | ), | 284 | ), |
| 280 | - shape: CircleBorder(), | ||
| 281 | - elevation: 12, | ||
| 282 | - shadowColor: Colors.black12, | ||
| 283 | - ), | ||
| 284 | SizedBox(height: 8), | 285 | SizedBox(height: 8), |
| 285 | Text( | 286 | Text( |
| 286 | person.title, | 287 | person.title, |
| @@ -2,14 +2,14 @@ import 'dart:math'; | @@ -2,14 +2,14 @@ import 'dart:math'; | ||
| 2 | 2 | ||
| 3 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
| 4 | import 'package:flutter/services.dart'; | 4 | import 'package:flutter/services.dart'; |
| 5 | -import 'package:flutter/widgets.dart'; | ||
| 6 | import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; | 5 | import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; |
| 7 | 6 | ||
| 8 | class AvatarBottomSheet extends StatelessWidget { | 7 | class AvatarBottomSheet extends StatelessWidget { |
| 9 | final Widget child; | 8 | final Widget child; |
| 10 | final Animation<double> animation; | 9 | final Animation<double> animation; |
| 11 | 10 | ||
| 12 | - const AvatarBottomSheet({Key? key, required this.child, required this.animation}) | 11 | + const AvatarBottomSheet( |
| 12 | + {Key? key, required this.child, required this.animation}) | ||
| 13 | : super(key: key); | 13 | : super(key: key); |
| 14 | 14 | ||
| 15 | @override | 15 | @override |
| @@ -83,12 +83,6 @@ Future<T?> showAvatarModalBottomSheet<T>({ | @@ -83,12 +83,6 @@ Future<T?> showAvatarModalBottomSheet<T>({ | ||
| 83 | bool enableDrag = true, | 83 | bool enableDrag = true, |
| 84 | Duration? duration, | 84 | Duration? duration, |
| 85 | }) async { | 85 | }) async { |
| 86 | - assert(context != null); | ||
| 87 | - assert(builder != null); | ||
| 88 | - assert(expand != null); | ||
| 89 | - assert(useRootNavigator != null); | ||
| 90 | - assert(isDismissible != null); | ||
| 91 | - assert(enableDrag != null); | ||
| 92 | assert(debugCheckHasMediaQuery(context)); | 86 | assert(debugCheckHasMediaQuery(context)); |
| 93 | assert(debugCheckHasMaterialLocalizations(context)); | 87 | assert(debugCheckHasMaterialLocalizations(context)); |
| 94 | final result = await Navigator.of(context, rootNavigator: useRootNavigator) | 88 | final result = await Navigator.of(context, rootNavigator: useRootNavigator) |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | -import 'package:flutter/widgets.dart'; | ||
| 3 | import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; | 2 | import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; |
| 4 | 3 | ||
| 5 | class FloatingModal extends StatelessWidget { | 4 | class FloatingModal extends StatelessWidget { |
| @@ -2,8 +2,6 @@ import 'package:flutter/cupertino.dart'; | @@ -2,8 +2,6 @@ import 'package:flutter/cupertino.dart'; | ||
| 2 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
| 3 | 3 | ||
| 4 | class SimpleModal extends StatelessWidget { | 4 | class SimpleModal extends StatelessWidget { |
| 5 | - | ||
| 6 | - | ||
| 7 | const SimpleModal({Key? key}) : super(key: key); | 5 | const SimpleModal({Key? key}) : super(key: key); |
| 8 | 6 | ||
| 9 | @override | 7 | @override |
| 1 | import 'package:flutter/cupertino.dart'; | 1 | import 'package:flutter/cupertino.dart'; |
| 2 | import 'package:flutter/foundation.dart'; | 2 | import 'package:flutter/foundation.dart'; |
| 3 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
| 4 | -import 'package:flutter/rendering.dart'; | ||
| 5 | import 'package:url_launcher/url_launcher.dart'; | 4 | import 'package:url_launcher/url_launcher.dart'; |
| 6 | 5 | ||
| 7 | class WebFrame extends StatelessWidget { | 6 | class WebFrame extends StatelessWidget { |
| @@ -3,12 +3,8 @@ | @@ -3,12 +3,8 @@ | ||
| 3 | // found in the LICENSE file. | 3 | // found in the LICENSE file. |
| 4 | 4 | ||
| 5 | import 'dart:async'; | 5 | import 'dart:async'; |
| 6 | -import 'package:flutter/cupertino.dart'; | ||
| 7 | -import 'package:flutter/foundation.dart'; | ||
| 8 | import 'package:flutter/gestures.dart'; | 6 | import 'package:flutter/gestures.dart'; |
| 9 | import 'package:flutter/material.dart'; | 7 | import 'package:flutter/material.dart'; |
| 10 | -import 'package:flutter/scheduler.dart'; | ||
| 11 | -import 'package:flutter/widgets.dart'; | ||
| 12 | import 'package:modal_bottom_sheet/src/utils/scroll_to_top_status_bar.dart'; | 8 | import 'package:modal_bottom_sheet/src/utils/scroll_to_top_status_bar.dart'; |
| 13 | 9 | ||
| 14 | import 'package:modal_bottom_sheet/src/utils/bottom_sheet_suspended_curve.dart'; | 10 | import 'package:modal_bottom_sheet/src/utils/bottom_sheet_suspended_curve.dart'; |
| @@ -49,10 +45,7 @@ class ModalBottomSheet extends StatefulWidget { | @@ -49,10 +45,7 @@ class ModalBottomSheet extends StatefulWidget { | ||
| 49 | required this.expanded, | 45 | required this.expanded, |
| 50 | required this.onClosing, | 46 | required this.onClosing, |
| 51 | required this.child, | 47 | required this.child, |
| 52 | - }) : assert(enableDrag != null), | ||
| 53 | - assert(onClosing != null), | ||
| 54 | - assert(child != null), | ||
| 55 | - super(key: key); | 48 | + }) : super(key: key); |
| 56 | 49 | ||
| 57 | /// The closeProgressThreshold parameter | 50 | /// The closeProgressThreshold parameter |
| 58 | /// specifies when the bottom sheet will be dismissed when user drags it. | 51 | /// specifies when the bottom sheet will be dismissed when user drags it. |
| @@ -488,5 +481,4 @@ PointerDeviceKind defaultPointerDeviceKind(BuildContext context) { | @@ -488,5 +481,4 @@ PointerDeviceKind defaultPointerDeviceKind(BuildContext context) { | ||
| 488 | case TargetPlatform.fuchsia: | 481 | case TargetPlatform.fuchsia: |
| 489 | return PointerDeviceKind.unknown; | 482 | return PointerDeviceKind.unknown; |
| 490 | } | 483 | } |
| 491 | - return PointerDeviceKind.unknown; | ||
| 492 | } | 484 | } |
| 1 | import 'dart:async'; | 1 | import 'dart:async'; |
| 2 | 2 | ||
| 3 | -import 'package:flutter/cupertino.dart'; | ||
| 4 | -import 'package:flutter/foundation.dart'; | ||
| 5 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
| 6 | -import 'package:modal_bottom_sheet/src/utils/modal_scroll_controller.dart'; | ||
| 7 | 4 | ||
| 8 | import '../modal_bottom_sheet.dart'; | 5 | import '../modal_bottom_sheet.dart'; |
| 9 | 6 | ||
| @@ -19,9 +16,7 @@ class _ModalBottomSheet<T> extends StatefulWidget { | @@ -19,9 +16,7 @@ class _ModalBottomSheet<T> extends StatefulWidget { | ||
| 19 | this.expanded = false, | 16 | this.expanded = false, |
| 20 | this.enableDrag = true, | 17 | this.enableDrag = true, |
| 21 | this.animationCurve, | 18 | this.animationCurve, |
| 22 | - }) : assert(expanded != null), | ||
| 23 | - assert(enableDrag != null), | ||
| 24 | - super(key: key); | 19 | + }) : super(key: key); |
| 25 | 20 | ||
| 26 | final double? closeProgressThreshold; | 21 | final double? closeProgressThreshold; |
| 27 | final ModalBottomSheetRoute<T> route; | 22 | final ModalBottomSheetRoute<T> route; |
| @@ -143,10 +138,7 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> { | @@ -143,10 +138,7 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> { | ||
| 143 | this.animationCurve, | 138 | this.animationCurve, |
| 144 | this.duration, | 139 | this.duration, |
| 145 | RouteSettings? settings, | 140 | RouteSettings? settings, |
| 146 | - }) : assert(expanded != null), | ||
| 147 | - assert(isDismissible != null), | ||
| 148 | - assert(enableDrag != null), | ||
| 149 | - super(settings: settings); | 141 | + }) : super(settings: settings); |
| 150 | 142 | ||
| 151 | final double? closeProgressThreshold; | 143 | final double? closeProgressThreshold; |
| 152 | final WidgetWithChildBuilder? containerBuilder; | 144 | final WidgetWithChildBuilder? containerBuilder; |
| @@ -247,13 +239,6 @@ Future<T?> showCustomModalBottomSheet<T>({ | @@ -247,13 +239,6 @@ Future<T?> showCustomModalBottomSheet<T>({ | ||
| 247 | Duration? duration, | 239 | Duration? duration, |
| 248 | RouteSettings? settings, | 240 | RouteSettings? settings, |
| 249 | }) async { | 241 | }) async { |
| 250 | - assert(context != null); | ||
| 251 | - assert(builder != null); | ||
| 252 | - assert(containerWidget != null); | ||
| 253 | - assert(expand != null); | ||
| 254 | - assert(useRootNavigator != null); | ||
| 255 | - assert(isDismissible != null); | ||
| 256 | - assert(enableDrag != null); | ||
| 257 | assert(debugCheckHasMediaQuery(context)); | 242 | assert(debugCheckHasMediaQuery(context)); |
| 258 | assert(debugCheckHasMaterialLocalizations(context)); | 243 | assert(debugCheckHasMaterialLocalizations(context)); |
| 259 | final hasMaterialLocalizations = | 244 | final hasMaterialLocalizations = |
| @@ -90,12 +90,6 @@ Future<T?> showBarModalBottomSheet<T>({ | @@ -90,12 +90,6 @@ Future<T?> showBarModalBottomSheet<T>({ | ||
| 90 | Duration? duration, | 90 | Duration? duration, |
| 91 | RouteSettings? settings, | 91 | RouteSettings? settings, |
| 92 | }) async { | 92 | }) async { |
| 93 | - assert(context != null); | ||
| 94 | - assert(builder != null); | ||
| 95 | - assert(expand != null); | ||
| 96 | - assert(useRootNavigator != null); | ||
| 97 | - assert(isDismissible != null); | ||
| 98 | - assert(enableDrag != null); | ||
| 99 | assert(debugCheckHasMediaQuery(context)); | 93 | assert(debugCheckHasMediaQuery(context)); |
| 100 | assert(debugCheckHasMaterialLocalizations(context)); | 94 | assert(debugCheckHasMaterialLocalizations(context)); |
| 101 | final result = await Navigator.of(context, rootNavigator: useRootNavigator) | 95 | final result = await Navigator.of(context, rootNavigator: useRootNavigator) |
| @@ -5,8 +5,6 @@ | @@ -5,8 +5,6 @@ | ||
| 5 | import 'dart:async'; | 5 | import 'dart:async'; |
| 6 | 6 | ||
| 7 | import 'package:flutter/cupertino.dart' show CupertinoTheme, CupertinoApp; | 7 | import 'package:flutter/cupertino.dart' show CupertinoTheme, CupertinoApp; |
| 8 | -import 'package:flutter/foundation.dart'; | ||
| 9 | -import 'package:flutter/gestures.dart'; | ||
| 10 | import 'package:flutter/material.dart' | 8 | import 'package:flutter/material.dart' |
| 11 | show | 9 | show |
| 12 | Colors, | 10 | Colors, |
| @@ -17,12 +15,12 @@ import 'package:flutter/services.dart'; | @@ -17,12 +15,12 @@ import 'package:flutter/services.dart'; | ||
| 17 | import 'package:flutter/widgets.dart'; | 15 | import 'package:flutter/widgets.dart'; |
| 18 | 16 | ||
| 19 | import '../../modal_bottom_sheet.dart'; | 17 | import '../../modal_bottom_sheet.dart'; |
| 20 | -import '../bottom_sheet_route.dart'; | ||
| 21 | 18 | ||
| 22 | const double _kPreviousPageVisibleOffset = 10; | 19 | const double _kPreviousPageVisibleOffset = 10; |
| 23 | 20 | ||
| 24 | const Radius _kDefaultTopRadius = Radius.circular(12); | 21 | const Radius _kDefaultTopRadius = Radius.circular(12); |
| 25 | -const BoxShadow _kDefaultBoxShadow = BoxShadow(blurRadius: 10, color: Colors.black12, spreadRadius: 5); | 22 | +const BoxShadow _kDefaultBoxShadow = |
| 23 | + BoxShadow(blurRadius: 10, color: Colors.black12, spreadRadius: 5); | ||
| 26 | 24 | ||
| 27 | /// Cupertino Bottom Sheet Container | 25 | /// Cupertino Bottom Sheet Container |
| 28 | /// | 26 | /// |
| @@ -43,14 +41,13 @@ class _CupertinoBottomSheetContainer extends StatelessWidget { | @@ -43,14 +41,13 @@ class _CupertinoBottomSheetContainer extends StatelessWidget { | ||
| 43 | this.shadow, | 41 | this.shadow, |
| 44 | }) : super(key: key); | 42 | }) : super(key: key); |
| 45 | 43 | ||
| 46 | - | ||
| 47 | @override | 44 | @override |
| 48 | Widget build(BuildContext context) { | 45 | Widget build(BuildContext context) { |
| 49 | final topSafeAreaPadding = MediaQuery.of(context).padding.top; | 46 | final topSafeAreaPadding = MediaQuery.of(context).padding.top; |
| 50 | final topPadding = _kPreviousPageVisibleOffset + topSafeAreaPadding; | 47 | final topPadding = _kPreviousPageVisibleOffset + topSafeAreaPadding; |
| 51 | 48 | ||
| 52 | final _shadow = shadow ?? _kDefaultBoxShadow; | 49 | final _shadow = shadow ?? _kDefaultBoxShadow; |
| 53 | - BoxShadow(blurRadius: 10, color: Colors.black12, spreadRadius: 5); | 50 | + BoxShadow(blurRadius: 10, color: Colors.black12, spreadRadius: 5); |
| 54 | final _backgroundColor = | 51 | final _backgroundColor = |
| 55 | backgroundColor ?? CupertinoTheme.of(context).scaffoldBackgroundColor; | 52 | backgroundColor ?? CupertinoTheme.of(context).scaffoldBackgroundColor; |
| 56 | return Padding( | 53 | return Padding( |
| @@ -95,11 +92,6 @@ Future<T?> showCupertinoModalBottomSheet<T>({ | @@ -95,11 +92,6 @@ Future<T?> showCupertinoModalBottomSheet<T>({ | ||
| 95 | Color? transitionBackgroundColor, | 92 | Color? transitionBackgroundColor, |
| 96 | BoxShadow? shadow, | 93 | BoxShadow? shadow, |
| 97 | }) async { | 94 | }) async { |
| 98 | - assert(context != null); | ||
| 99 | - assert(builder != null); | ||
| 100 | - assert(expand != null); | ||
| 101 | - assert(useRootNavigator != null); | ||
| 102 | - assert(enableDrag != null); | ||
| 103 | assert(debugCheckHasMediaQuery(context)); | 95 | assert(debugCheckHasMediaQuery(context)); |
| 104 | final hasMaterialLocalizations = | 96 | final hasMaterialLocalizations = |
| 105 | Localizations.of<MaterialLocalizations>(context, MaterialLocalizations) != | 97 | Localizations.of<MaterialLocalizations>(context, MaterialLocalizations) != |
| @@ -144,7 +136,6 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | @@ -144,7 +136,6 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | ||
| 144 | 136 | ||
| 145 | final Curve? previousRouteAnimationCurve; | 137 | final Curve? previousRouteAnimationCurve; |
| 146 | 138 | ||
| 147 | - | ||
| 148 | final BoxShadow? boxShadow; | 139 | final BoxShadow? boxShadow; |
| 149 | 140 | ||
| 150 | // Background color behind all routes | 141 | // Background color behind all routes |
| @@ -173,10 +164,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | @@ -173,10 +164,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | ||
| 173 | this.transitionBackgroundColor, | 164 | this.transitionBackgroundColor, |
| 174 | this.topRadius = _kDefaultTopRadius, | 165 | this.topRadius = _kDefaultTopRadius, |
| 175 | this.previousRouteAnimationCurve, | 166 | this.previousRouteAnimationCurve, |
| 176 | - }) : assert(expanded != null), | ||
| 177 | - assert(isDismissible != null), | ||
| 178 | - assert(enableDrag != null), | ||
| 179 | - super( | 167 | + }) : super( |
| 180 | closeProgressThreshold: closeProgressThreshold, | 168 | closeProgressThreshold: closeProgressThreshold, |
| 181 | scrollController: scrollController, | 169 | scrollController: scrollController, |
| 182 | containerBuilder: containerBuilder, | 170 | containerBuilder: containerBuilder, |
| @@ -201,8 +189,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | @@ -201,8 +189,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | ||
| 201 | Widget child, | 189 | Widget child, |
| 202 | ) { | 190 | ) { |
| 203 | final paddingTop = MediaQuery.of(context).padding.top; | 191 | final paddingTop = MediaQuery.of(context).padding.top; |
| 204 | - final distanceWithScale = | ||
| 205 | - (paddingTop + _kPreviousPageVisibleOffset) * 0.9; | 192 | + final distanceWithScale = (paddingTop + _kPreviousPageVisibleOffset) * 0.9; |
| 206 | final offsetY = secondaryAnimation.value * (paddingTop - distanceWithScale); | 193 | final offsetY = secondaryAnimation.value * (paddingTop - distanceWithScale); |
| 207 | final scale = 1 - secondaryAnimation.value / 10; | 194 | final scale = 1 - secondaryAnimation.value / 10; |
| 208 | return AnimatedBuilder( | 195 | return AnimatedBuilder( |
| @@ -237,7 +224,6 @@ class _CupertinoModalTransition extends StatelessWidget { | @@ -237,7 +224,6 @@ class _CupertinoModalTransition extends StatelessWidget { | ||
| 237 | final Radius topRadius; | 224 | final Radius topRadius; |
| 238 | final Curve? animationCurve; | 225 | final Curve? animationCurve; |
| 239 | final Color backgroundColor; | 226 | final Color backgroundColor; |
| 240 | - final BoxShadow? boxShadow; | ||
| 241 | 227 | ||
| 242 | final Widget body; | 228 | final Widget body; |
| 243 | 229 | ||
| @@ -248,7 +234,6 @@ class _CupertinoModalTransition extends StatelessWidget { | @@ -248,7 +234,6 @@ class _CupertinoModalTransition extends StatelessWidget { | ||
| 248 | required this.topRadius, | 234 | required this.topRadius, |
| 249 | this.backgroundColor = Colors.black, | 235 | this.backgroundColor = Colors.black, |
| 250 | this.animationCurve, | 236 | this.animationCurve, |
| 251 | - this.boxShadow, | ||
| 252 | }) : super(key: key); | 237 | }) : super(key: key); |
| 253 | 238 | ||
| 254 | @override | 239 | @override |
| @@ -355,11 +340,6 @@ class CupertinoScaffold extends StatefulWidget { | @@ -355,11 +340,6 @@ class CupertinoScaffold extends StatefulWidget { | ||
| 355 | RouteSettings? settings, | 340 | RouteSettings? settings, |
| 356 | BoxShadow? shadow, | 341 | BoxShadow? shadow, |
| 357 | }) async { | 342 | }) async { |
| 358 | - assert(context != null); | ||
| 359 | - assert(builder != null); | ||
| 360 | - assert(expand != null); | ||
| 361 | - assert(useRootNavigator != null); | ||
| 362 | - assert(enableDrag != null); | ||
| 363 | assert(debugCheckHasMediaQuery(context)); | 343 | assert(debugCheckHasMediaQuery(context)); |
| 364 | final isCupertinoApp = | 344 | final isCupertinoApp = |
| 365 | context.findAncestorWidgetOfExactType<CupertinoApp>() != null; | 345 | context.findAncestorWidgetOfExactType<CupertinoApp>() != null; |
| @@ -22,12 +22,6 @@ Future<T?> showMaterialModalBottomSheet<T>({ | @@ -22,12 +22,6 @@ Future<T?> showMaterialModalBottomSheet<T>({ | ||
| 22 | Duration? duration, | 22 | Duration? duration, |
| 23 | RouteSettings? settings, | 23 | RouteSettings? settings, |
| 24 | }) async { | 24 | }) async { |
| 25 | - assert(context != null); | ||
| 26 | - assert(builder != null); | ||
| 27 | - assert(expand != null); | ||
| 28 | - assert(useRootNavigator != null); | ||
| 29 | - assert(isDismissible != null); | ||
| 30 | - assert(enableDrag != null); | ||
| 31 | assert(debugCheckHasMediaQuery(context)); | 25 | assert(debugCheckHasMediaQuery(context)); |
| 32 | assert(debugCheckHasMaterialLocalizations(context)); | 26 | assert(debugCheckHasMaterialLocalizations(context)); |
| 33 | final result = await Navigator.of(context, rootNavigator: useRootNavigator) | 27 | final result = await Navigator.of(context, rootNavigator: useRootNavigator) |
| 1 | import 'package:flutter/cupertino.dart'; | 1 | import 'package:flutter/cupertino.dart'; |
| 2 | -import 'package:flutter/foundation.dart'; | ||
| 3 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
| 4 | 3 | ||
| 5 | import '../modal_bottom_sheet.dart'; | 4 | import '../modal_bottom_sheet.dart'; |
| @@ -15,10 +14,7 @@ class MaterialWithModalsPageRoute<T> extends MaterialPageRoute<T> { | @@ -15,10 +14,7 @@ class MaterialWithModalsPageRoute<T> extends MaterialPageRoute<T> { | ||
| 15 | RouteSettings? settings, | 14 | RouteSettings? settings, |
| 16 | bool maintainState = true, | 15 | bool maintainState = true, |
| 17 | bool fullscreenDialog = false, | 16 | bool fullscreenDialog = false, |
| 18 | - }) : assert(builder != null), | ||
| 19 | - assert(maintainState != null), | ||
| 20 | - assert(fullscreenDialog != null), | ||
| 21 | - super( | 17 | + }) : super( |
| 22 | settings: settings, | 18 | settings: settings, |
| 23 | fullscreenDialog: fullscreenDialog, | 19 | fullscreenDialog: fullscreenDialog, |
| 24 | builder: builder, | 20 | builder: builder, |
| @@ -30,8 +30,7 @@ class BottomSheetSuspendedCurve extends Curve { | @@ -30,8 +30,7 @@ class BottomSheetSuspendedCurve extends Curve { | ||
| 30 | const BottomSheetSuspendedCurve( | 30 | const BottomSheetSuspendedCurve( |
| 31 | this.startingPoint, { | 31 | this.startingPoint, { |
| 32 | this.curve = Curves.easeOutCubic, | 32 | this.curve = Curves.easeOutCubic, |
| 33 | - }) : assert(startingPoint != null), | ||
| 34 | - assert(curve != null); | 33 | + }); |
| 35 | 34 | ||
| 36 | /// The progress value at which [curve] should begin. | 35 | /// The progress value at which [curve] should begin. |
| 37 | /// | 36 | /// |
| @@ -16,8 +16,7 @@ class ModalScrollController extends InheritedWidget { | @@ -16,8 +16,7 @@ class ModalScrollController extends InheritedWidget { | ||
| 16 | Key? key, | 16 | Key? key, |
| 17 | required this.controller, | 17 | required this.controller, |
| 18 | required Widget child, | 18 | required Widget child, |
| 19 | - }) : assert(controller != null), | ||
| 20 | - super( | 19 | + }) : super( |
| 21 | key: key, | 20 | key: key, |
| 22 | child: PrimaryScrollController( | 21 | child: PrimaryScrollController( |
| 23 | controller: controller, | 22 | controller: controller, |
| @@ -50,7 +50,7 @@ class _ScrollToTopStatusBarState extends State<ScrollToTopStatusBarHandler> { | @@ -50,7 +50,7 @@ class _ScrollToTopStatusBarState extends State<ScrollToTopStatusBarHandler> { | ||
| 50 | 50 | ||
| 51 | void _handleStatusBarTap(BuildContext context) { | 51 | void _handleStatusBarTap(BuildContext context) { |
| 52 | final controller = widget.scrollController; | 52 | final controller = widget.scrollController; |
| 53 | - if (controller != null && controller.hasClients) { | 53 | + if (controller.hasClients) { |
| 54 | controller.animateTo( | 54 | controller.animateTo( |
| 55 | 0.0, | 55 | 0.0, |
| 56 | duration: const Duration(milliseconds: 300), | 56 | duration: const Duration(milliseconds: 300), |
-
Please register or login to post a comment