Committed by
GitHub
Merge pull request #207 from v7lin/master
fix: android edge to edge & clean: dart analysis
Showing
3 changed files
with
24 additions
and
8 deletions
| @@ -7,15 +7,15 @@ import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; | @@ -7,15 +7,15 @@ import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; | ||
| 7 | class AvatarBottomSheet extends StatelessWidget { | 7 | class AvatarBottomSheet extends StatelessWidget { |
| 8 | final Widget child; | 8 | final Widget child; |
| 9 | final Animation<double> animation; | 9 | final Animation<double> animation; |
| 10 | + final SystemUiOverlayStyle? overlayStyle; | ||
| 10 | 11 | ||
| 11 | - const AvatarBottomSheet( | ||
| 12 | - {Key? key, required this.child, required this.animation}) | 12 | + const AvatarBottomSheet({Key? key, required this.child, required this.animation, this.overlayStyle}) |
| 13 | : super(key: key); | 13 | : super(key: key); |
| 14 | 14 | ||
| 15 | @override | 15 | @override |
| 16 | Widget build(BuildContext context) { | 16 | Widget build(BuildContext context) { |
| 17 | return AnnotatedRegion<SystemUiOverlayStyle>( | 17 | return AnnotatedRegion<SystemUiOverlayStyle>( |
| 18 | - value: SystemUiOverlayStyle.light, | 18 | + value: overlayStyle ?? SystemUiOverlayStyle.light, |
| 19 | child: Column( | 19 | child: Column( |
| 20 | mainAxisSize: MainAxisSize.min, | 20 | mainAxisSize: MainAxisSize.min, |
| 21 | crossAxisAlignment: CrossAxisAlignment.start, | 21 | crossAxisAlignment: CrossAxisAlignment.start, |
| @@ -89,6 +89,7 @@ Future<T?> showAvatarModalBottomSheet<T>({ | @@ -89,6 +89,7 @@ Future<T?> showAvatarModalBottomSheet<T>({ | ||
| 89 | bool isDismissible = true, | 89 | bool isDismissible = true, |
| 90 | bool enableDrag = true, | 90 | bool enableDrag = true, |
| 91 | Duration? duration, | 91 | Duration? duration, |
| 92 | + SystemUiOverlayStyle? overlayStyle, | ||
| 92 | }) async { | 93 | }) async { |
| 93 | assert(debugCheckHasMediaQuery(context)); | 94 | assert(debugCheckHasMediaQuery(context)); |
| 94 | assert(debugCheckHasMaterialLocalizations(context)); | 95 | assert(debugCheckHasMaterialLocalizations(context)); |
| @@ -98,6 +99,7 @@ Future<T?> showAvatarModalBottomSheet<T>({ | @@ -98,6 +99,7 @@ Future<T?> showAvatarModalBottomSheet<T>({ | ||
| 98 | containerBuilder: (_, animation, child) => AvatarBottomSheet( | 99 | containerBuilder: (_, animation, child) => AvatarBottomSheet( |
| 99 | child: child, | 100 | child: child, |
| 100 | animation: animation, | 101 | animation: animation, |
| 102 | + overlayStyle: overlayStyle, | ||
| 101 | ), | 103 | ), |
| 102 | bounce: bounce, | 104 | bounce: bounce, |
| 103 | secondAnimationController: secondAnimation, | 105 | secondAnimationController: secondAnimation, |
| @@ -14,6 +14,7 @@ class BarBottomSheet extends StatelessWidget { | @@ -14,6 +14,7 @@ class BarBottomSheet extends StatelessWidget { | ||
| 14 | final Clip? clipBehavior; | 14 | final Clip? clipBehavior; |
| 15 | final double? elevation; | 15 | final double? elevation; |
| 16 | final ShapeBorder? shape; | 16 | final ShapeBorder? shape; |
| 17 | + final SystemUiOverlayStyle? overlayStyle; | ||
| 17 | 18 | ||
| 18 | const BarBottomSheet({ | 19 | const BarBottomSheet({ |
| 19 | Key? key, | 20 | Key? key, |
| @@ -22,12 +23,13 @@ class BarBottomSheet extends StatelessWidget { | @@ -22,12 +23,13 @@ class BarBottomSheet extends StatelessWidget { | ||
| 22 | this.clipBehavior, | 23 | this.clipBehavior, |
| 23 | this.shape, | 24 | this.shape, |
| 24 | this.elevation, | 25 | this.elevation, |
| 26 | + this.overlayStyle, | ||
| 25 | }) : super(key: key); | 27 | }) : super(key: key); |
| 26 | 28 | ||
| 27 | @override | 29 | @override |
| 28 | Widget build(BuildContext context) { | 30 | Widget build(BuildContext context) { |
| 29 | return AnnotatedRegion<SystemUiOverlayStyle>( | 31 | return AnnotatedRegion<SystemUiOverlayStyle>( |
| 30 | - value: SystemUiOverlayStyle.light, | 32 | + value: overlayStyle ?? SystemUiOverlayStyle.light, |
| 31 | child: Column( | 33 | child: Column( |
| 32 | mainAxisSize: MainAxisSize.min, | 34 | mainAxisSize: MainAxisSize.min, |
| 33 | crossAxisAlignment: CrossAxisAlignment.center, | 35 | crossAxisAlignment: CrossAxisAlignment.center, |
| @@ -89,6 +91,7 @@ Future<T?> showBarModalBottomSheet<T>({ | @@ -89,6 +91,7 @@ Future<T?> showBarModalBottomSheet<T>({ | ||
| 89 | Widget? topControl, | 91 | Widget? topControl, |
| 90 | Duration? duration, | 92 | Duration? duration, |
| 91 | RouteSettings? settings, | 93 | RouteSettings? settings, |
| 94 | + SystemUiOverlayStyle? overlayStyle, | ||
| 92 | }) async { | 95 | }) async { |
| 93 | assert(debugCheckHasMediaQuery(context)); | 96 | assert(debugCheckHasMediaQuery(context)); |
| 94 | assert(debugCheckHasMaterialLocalizations(context)); | 97 | assert(debugCheckHasMaterialLocalizations(context)); |
| @@ -103,6 +106,7 @@ Future<T?> showBarModalBottomSheet<T>({ | @@ -103,6 +106,7 @@ Future<T?> showBarModalBottomSheet<T>({ | ||
| 103 | clipBehavior: clipBehavior, | 106 | clipBehavior: clipBehavior, |
| 104 | shape: shape, | 107 | shape: shape, |
| 105 | elevation: elevation, | 108 | elevation: elevation, |
| 109 | + overlayStyle: overlayStyle, | ||
| 106 | ), | 110 | ), |
| 107 | secondAnimationController: secondAnimation, | 111 | secondAnimationController: secondAnimation, |
| 108 | expanded: expand, | 112 | expanded: expand, |
| @@ -91,6 +91,7 @@ Future<T?> showCupertinoModalBottomSheet<T>({ | @@ -91,6 +91,7 @@ Future<T?> showCupertinoModalBottomSheet<T>({ | ||
| 91 | RouteSettings? settings, | 91 | RouteSettings? settings, |
| 92 | Color? transitionBackgroundColor, | 92 | Color? transitionBackgroundColor, |
| 93 | BoxShadow? shadow, | 93 | BoxShadow? shadow, |
| 94 | + SystemUiOverlayStyle? overlayStyle, | ||
| 94 | }) async { | 95 | }) async { |
| 95 | assert(debugCheckHasMediaQuery(context)); | 96 | assert(debugCheckHasMediaQuery(context)); |
| 96 | final hasMaterialLocalizations = | 97 | final hasMaterialLocalizations = |
| @@ -126,7 +127,8 @@ Future<T?> showCupertinoModalBottomSheet<T>({ | @@ -126,7 +127,8 @@ Future<T?> showCupertinoModalBottomSheet<T>({ | ||
| 126 | previousRouteAnimationCurve: previousRouteAnimationCurve, | 127 | previousRouteAnimationCurve: previousRouteAnimationCurve, |
| 127 | duration: duration, | 128 | duration: duration, |
| 128 | settings: settings, | 129 | settings: settings, |
| 129 | - transitionBackgroundColor: transitionBackgroundColor ?? Colors.black), | 130 | + transitionBackgroundColor: transitionBackgroundColor ?? Colors.black, |
| 131 | + overlayStyle: overlayStyle), | ||
| 130 | ); | 132 | ); |
| 131 | return result; | 133 | return result; |
| 132 | } | 134 | } |
| @@ -141,6 +143,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | @@ -141,6 +143,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | ||
| 141 | // Background color behind all routes | 143 | // Background color behind all routes |
| 142 | // Black by default | 144 | // Black by default |
| 143 | final Color? transitionBackgroundColor; | 145 | final Color? transitionBackgroundColor; |
| 146 | + final SystemUiOverlayStyle? overlayStyle; | ||
| 144 | 147 | ||
| 145 | CupertinoModalBottomSheetRoute({ | 148 | CupertinoModalBottomSheetRoute({ |
| 146 | required WidgetBuilder builder, | 149 | required WidgetBuilder builder, |
| @@ -164,6 +167,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | @@ -164,6 +167,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | ||
| 164 | this.transitionBackgroundColor, | 167 | this.transitionBackgroundColor, |
| 165 | this.topRadius = _kDefaultTopRadius, | 168 | this.topRadius = _kDefaultTopRadius, |
| 166 | this.previousRouteAnimationCurve, | 169 | this.previousRouteAnimationCurve, |
| 170 | + this.overlayStyle, | ||
| 167 | }) : super( | 171 | }) : super( |
| 168 | closeProgressThreshold: closeProgressThreshold, | 172 | closeProgressThreshold: closeProgressThreshold, |
| 169 | scrollController: scrollController, | 173 | scrollController: scrollController, |
| @@ -215,6 +219,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | @@ -215,6 +219,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | ||
| 215 | animationCurve: previousRouteAnimationCurve, | 219 | animationCurve: previousRouteAnimationCurve, |
| 216 | topRadius: topRadius, | 220 | topRadius: topRadius, |
| 217 | backgroundColor: transitionBackgroundColor ?? Colors.black, | 221 | backgroundColor: transitionBackgroundColor ?? Colors.black, |
| 222 | + overlayStyle: overlayStyle, | ||
| 218 | ); | 223 | ); |
| 219 | } | 224 | } |
| 220 | } | 225 | } |
| @@ -224,6 +229,7 @@ class _CupertinoModalTransition extends StatelessWidget { | @@ -224,6 +229,7 @@ class _CupertinoModalTransition extends StatelessWidget { | ||
| 224 | final Radius topRadius; | 229 | final Radius topRadius; |
| 225 | final Curve? animationCurve; | 230 | final Curve? animationCurve; |
| 226 | final Color backgroundColor; | 231 | final Color backgroundColor; |
| 232 | + final SystemUiOverlayStyle? overlayStyle; | ||
| 227 | 233 | ||
| 228 | final Widget body; | 234 | final Widget body; |
| 229 | 235 | ||
| @@ -234,6 +240,7 @@ class _CupertinoModalTransition extends StatelessWidget { | @@ -234,6 +240,7 @@ class _CupertinoModalTransition extends StatelessWidget { | ||
| 234 | required this.topRadius, | 240 | required this.topRadius, |
| 235 | this.backgroundColor = Colors.black, | 241 | this.backgroundColor = Colors.black, |
| 236 | this.animationCurve, | 242 | this.animationCurve, |
| 243 | + this.overlayStyle, | ||
| 237 | }) : super(key: key); | 244 | }) : super(key: key); |
| 238 | 245 | ||
| 239 | @override | 246 | @override |
| @@ -251,7 +258,7 @@ class _CupertinoModalTransition extends StatelessWidget { | @@ -251,7 +258,7 @@ class _CupertinoModalTransition extends StatelessWidget { | ||
| 251 | ); | 258 | ); |
| 252 | 259 | ||
| 253 | return AnnotatedRegion<SystemUiOverlayStyle>( | 260 | return AnnotatedRegion<SystemUiOverlayStyle>( |
| 254 | - value: SystemUiOverlayStyle.light, | 261 | + value: overlayStyle ?? SystemUiOverlayStyle.light, |
| 255 | child: AnimatedBuilder( | 262 | child: AnimatedBuilder( |
| 256 | animation: curvedAnimation, | 263 | animation: curvedAnimation, |
| 257 | child: body, | 264 | child: body, |
| @@ -312,12 +319,14 @@ class CupertinoScaffold extends StatefulWidget { | @@ -312,12 +319,14 @@ class CupertinoScaffold extends StatefulWidget { | ||
| 312 | final Widget body; | 319 | final Widget body; |
| 313 | final Radius topRadius; | 320 | final Radius topRadius; |
| 314 | final Color transitionBackgroundColor; | 321 | final Color transitionBackgroundColor; |
| 322 | + final SystemUiOverlayStyle? overlayStyle; | ||
| 315 | 323 | ||
| 316 | const CupertinoScaffold({ | 324 | const CupertinoScaffold({ |
| 317 | Key? key, | 325 | Key? key, |
| 318 | required this.body, | 326 | required this.body, |
| 319 | this.topRadius = _kDefaultTopRadius, | 327 | this.topRadius = _kDefaultTopRadius, |
| 320 | this.transitionBackgroundColor = Colors.black, | 328 | this.transitionBackgroundColor = Colors.black, |
| 329 | + this.overlayStyle, | ||
| 321 | }) : super(key: key); | 330 | }) : super(key: key); |
| 322 | 331 | ||
| 323 | @override | 332 | @override |
| @@ -339,6 +348,7 @@ class CupertinoScaffold extends StatefulWidget { | @@ -339,6 +348,7 @@ class CupertinoScaffold extends StatefulWidget { | ||
| 339 | Duration? duration, | 348 | Duration? duration, |
| 340 | RouteSettings? settings, | 349 | RouteSettings? settings, |
| 341 | BoxShadow? shadow, | 350 | BoxShadow? shadow, |
| 351 | + SystemUiOverlayStyle? overlayStyle, | ||
| 342 | }) async { | 352 | }) async { |
| 343 | assert(debugCheckHasMediaQuery(context)); | 353 | assert(debugCheckHasMediaQuery(context)); |
| 344 | final isCupertinoApp = | 354 | final isCupertinoApp = |
| @@ -371,6 +381,7 @@ class CupertinoScaffold extends StatefulWidget { | @@ -371,6 +381,7 @@ class CupertinoScaffold extends StatefulWidget { | ||
| 371 | previousRouteAnimationCurve: previousRouteAnimationCurve, | 381 | previousRouteAnimationCurve: previousRouteAnimationCurve, |
| 372 | duration: duration, | 382 | duration: duration, |
| 373 | settings: settings, | 383 | settings: settings, |
| 384 | + overlayStyle: overlayStyle, | ||
| 374 | )); | 385 | )); |
| 375 | return result; | 386 | return result; |
| 376 | } | 387 | } |
| @@ -380,8 +391,6 @@ class _CupertinoScaffoldState extends State<CupertinoScaffold> | @@ -380,8 +391,6 @@ class _CupertinoScaffoldState extends State<CupertinoScaffold> | ||
| 380 | with TickerProviderStateMixin { | 391 | with TickerProviderStateMixin { |
| 381 | late AnimationController animationController; | 392 | late AnimationController animationController; |
| 382 | 393 | ||
| 383 | - SystemUiOverlayStyle? lastStyle; | ||
| 384 | - | ||
| 385 | @override | 394 | @override |
| 386 | void initState() { | 395 | void initState() { |
| 387 | animationController = | 396 | animationController = |
| @@ -404,6 +413,7 @@ class _CupertinoScaffoldState extends State<CupertinoScaffold> | @@ -404,6 +413,7 @@ class _CupertinoScaffoldState extends State<CupertinoScaffold> | ||
| 404 | body: widget.body, | 413 | body: widget.body, |
| 405 | topRadius: widget.topRadius, | 414 | topRadius: widget.topRadius, |
| 406 | backgroundColor: widget.transitionBackgroundColor, | 415 | backgroundColor: widget.transitionBackgroundColor, |
| 416 | + overlayStyle: widget.overlayStyle, | ||
| 407 | ), | 417 | ), |
| 408 | ); | 418 | ); |
| 409 | } | 419 | } |
-
Please register or login to post a comment