@@ -15,17 +15,16 @@ import 'bottom_sheet_theme.dart';
1515import 'color_scheme.dart' ;
1616import 'colors.dart' ;
1717import 'constants.dart' ;
18- import 'curves.dart' ;
1918import 'debug.dart' ;
2019import 'material.dart' ;
2120import 'material_localizations.dart' ;
22- import 'material_state .dart' ;
21+ import 'motion .dart' ;
2322import 'scaffold.dart' ;
2423import 'theme.dart' ;
2524
2625const Duration _bottomSheetEnterDuration = Duration (milliseconds: 250 );
2726const Duration _bottomSheetExitDuration = Duration (milliseconds: 200 );
28- const Curve _modalBottomSheetCurve = decelerateEasing ;
27+ const Curve _modalBottomSheetCurve = Easing .legacyDecelerate ;
2928const double _minFlingVelocity = 700.0 ;
3029const double _closeProgressThreshold = 0.5 ;
3130const double _defaultScrollControlDisabledMaxHeightRatio = 9.0 / 16.0 ;
@@ -266,11 +265,11 @@ class _BottomSheetState extends State<BottomSheet> {
266265
267266 bool get _dismissUnderway => widget.animationController! .status == AnimationStatus .reverse;
268267
269- Set <MaterialState > dragHandleMaterialState = < MaterialState > {};
268+ Set <WidgetState > dragHandleStates = < WidgetState > {};
270269
271270 void _handleDragStart (DragStartDetails details) {
272271 setState (() {
273- dragHandleMaterialState .add (MaterialState .dragged);
272+ dragHandleStates .add (WidgetState .dragged);
274273 });
275274 widget.onDragStart? .call (details);
276275 }
@@ -297,7 +296,7 @@ class _BottomSheetState extends State<BottomSheet> {
297296 return ;
298297 }
299298 setState (() {
300- dragHandleMaterialState .remove (MaterialState .dragged);
299+ dragHandleStates .remove (WidgetState .dragged);
301300 });
302301 bool isClosing = false ;
303302 if (details.velocity.pixelsPerSecond.dy > _minFlingVelocity) {
@@ -335,12 +334,12 @@ class _BottomSheetState extends State<BottomSheet> {
335334 }
336335
337336 void _handleDragHandleHover (bool hovering) {
338- if (hovering != dragHandleMaterialState .contains (MaterialState .hovered)) {
337+ if (hovering != dragHandleStates .contains (WidgetState .hovered)) {
339338 setState (() {
340339 if (hovering){
341- dragHandleMaterialState .add (MaterialState .hovered);
340+ dragHandleStates .add (WidgetState .hovered);
342341 } else {
343- dragHandleMaterialState .remove (MaterialState .hovered);
342+ dragHandleStates .remove (WidgetState .hovered);
344343 }
345344 });
346345 }
@@ -361,11 +360,11 @@ class _BottomSheetState extends State<BottomSheet> {
361360 final bool showDragHandle = widget.showDragHandle ?? (widget.enableDrag && (bottomSheetTheme.showDragHandle ?? false ));
362361
363362 Widget ? dragHandle;
364- if (showDragHandle){
363+ if (showDragHandle) {
365364 dragHandle = _DragHandle (
366365 onSemanticsTap: widget.onClosing,
367366 handleHover: _handleDragHandleHover,
368- materialState : dragHandleMaterialState ,
367+ states : dragHandleStates ,
369368 dragHandleColor: widget.dragHandleColor,
370369 dragHandleSize: widget.dragHandleSize,
371370 );
@@ -431,20 +430,18 @@ class _BottomSheetState extends State<BottomSheet> {
431430
432431// See scaffold.dart
433432
434- typedef _SizeChangeCallback <Size > = void Function (Size size);
435-
436433class _DragHandle extends StatelessWidget {
437434 const _DragHandle ({
438435 required this .onSemanticsTap,
439436 required this .handleHover,
440- required this .materialState ,
437+ required this .states ,
441438 this .dragHandleColor,
442439 this .dragHandleSize,
443440 });
444441
445442 final VoidCallback ? onSemanticsTap;
446443 final ValueChanged <bool > handleHover;
447- final Set <MaterialState > materialState ;
444+ final Set <WidgetState > states ;
448445 final Color ? dragHandleColor;
449446 final Size ? dragHandleSize;
450447
@@ -470,8 +467,8 @@ class _DragHandle extends StatelessWidget {
470467 width: handleSize.width,
471468 decoration: BoxDecoration (
472469 borderRadius: BorderRadius .circular (handleSize.height/ 2 ),
473- color: MaterialStateProperty .resolveAs <Color ?>(dragHandleColor, materialState )
474- ?? MaterialStateProperty .resolveAs <Color ?>(bottomSheetTheme.dragHandleColor, materialState )
470+ color: WidgetStateProperty .resolveAs <Color ?>(dragHandleColor, states )
471+ ?? WidgetStateProperty .resolveAs <Color ?>(bottomSheetTheme.dragHandleColor, states )
475472 ?? m3Defaults.dragHandleColor,
476473 ),
477474 ),
@@ -491,7 +488,7 @@ class _BottomSheetLayoutWithSizeListener extends SingleChildRenderObjectWidget {
491488 super .child,
492489 });
493490
494- final _SizeChangeCallback <Size > onChildSizeChanged;
491+ final ValueChanged <Size > onChildSizeChanged;
495492 final double animationValue;
496493 final bool isScrollControlled;
497494 final double scrollControlDisabledMaxHeightRatio;
@@ -518,7 +515,7 @@ class _BottomSheetLayoutWithSizeListener extends SingleChildRenderObjectWidget {
518515class _RenderBottomSheetLayoutWithSizeListener extends RenderShiftedBox {
519516 _RenderBottomSheetLayoutWithSizeListener ({
520517 RenderBox ? child,
521- required _SizeChangeCallback <Size > onChildSizeChanged,
518+ required ValueChanged <Size > onChildSizeChanged,
522519 required double animationValue,
523520 required bool isScrollControlled,
524521 required double scrollControlDisabledMaxHeightRatio,
@@ -530,9 +527,9 @@ class _RenderBottomSheetLayoutWithSizeListener extends RenderShiftedBox {
530527
531528 Size _lastSize = Size .zero;
532529
533- _SizeChangeCallback <Size > get onChildSizeChanged => _onChildSizeChanged;
534- _SizeChangeCallback <Size > _onChildSizeChanged;
535- set onChildSizeChanged (_SizeChangeCallback <Size > newCallback) {
530+ ValueChanged <Size > get onChildSizeChanged => _onChildSizeChanged;
531+ ValueChanged <Size > _onChildSizeChanged;
532+ set onChildSizeChanged (ValueChanged <Size > newCallback) {
536533 if (_onChildSizeChanged == newCallback) {
537534 return ;
538535 }
@@ -574,50 +571,20 @@ class _RenderBottomSheetLayoutWithSizeListener extends RenderShiftedBox {
574571 markNeedsLayout ();
575572 }
576573
577- Size _getSize (BoxConstraints constraints) {
578- return constraints.constrain (constraints.biggest);
579- }
580-
581574 @override
582- double computeMinIntrinsicWidth (double height) {
583- final double width = _getSize (BoxConstraints .tightForFinite (height: height)).width;
584- if (width.isFinite) {
585- return width;
586- }
587- return 0.0 ;
588- }
575+ double computeMinIntrinsicWidth (double height) => 0.0 ;
589576
590577 @override
591- double computeMaxIntrinsicWidth (double height) {
592- final double width = _getSize (BoxConstraints .tightForFinite (height: height)).width;
593- if (width.isFinite) {
594- return width;
595- }
596- return 0.0 ;
597- }
578+ double computeMaxIntrinsicWidth (double height) => 0.0 ;
598579
599580 @override
600- double computeMinIntrinsicHeight (double width) {
601- final double height = _getSize (BoxConstraints .tightForFinite (width: width)).height;
602- if (height.isFinite) {
603- return height;
604- }
605- return 0.0 ;
606- }
581+ double computeMinIntrinsicHeight (double width) => 0.0 ;
607582
608583 @override
609- double computeMaxIntrinsicHeight (double width) {
610- final double height = _getSize (BoxConstraints .tightForFinite (width: width)).height;
611- if (height.isFinite) {
612- return height;
613- }
614- return 0.0 ;
615- }
584+ double computeMaxIntrinsicHeight (double width) => 0.0 ;
616585
617586 @override
618- Size computeDryLayout (BoxConstraints constraints) {
619- return _getSize (constraints);
620- }
587+ Size computeDryLayout (BoxConstraints constraints) => constraints.biggest;
621588
622589 @override
623590 double ? computeDryBaseline (covariant BoxConstraints constraints, TextBaseline baseline) {
@@ -631,7 +598,7 @@ class _RenderBottomSheetLayoutWithSizeListener extends RenderShiftedBox {
631598 return null ;
632599 }
633600 final Size childSize = childConstraints.isTight ? childConstraints.smallest : child.getDryLayout (childConstraints);
634- return result + _getPositionForChild (_getSize ( constraints) , childSize).dy;
601+ return result + _getPositionForChild (constraints.biggest , childSize).dy;
635602 }
636603
637604 BoxConstraints _getConstraintsForChild (BoxConstraints constraints) {
@@ -650,7 +617,7 @@ class _RenderBottomSheetLayoutWithSizeListener extends RenderShiftedBox {
650617
651618 @override
652619 void performLayout () {
653- size = _getSize ( constraints) ;
620+ size = constraints.biggest ;
654621 final RenderBox ? child = this .child;
655622 if (child == null ) {
656623 return ;
@@ -1137,11 +1104,11 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> {
11371104
11381105 @override
11391106 Widget buildModalBarrier () {
1140- if (barrierColor.alpha != 0 && ! offstage) { // changedInternalState is called if barrierColor or offstage updates
1141- assert (barrierColor != barrierColor.withOpacity ( 0.0 ));
1107+ if (barrierColor.a != 0 && ! offstage) { // changedInternalState is called if barrierColor or offstage updates
1108+ assert (barrierColor != barrierColor.withValues (alpha : 0.0 ));
11421109 final Animation <Color ?> color = animation! .drive (
11431110 ColorTween (
1144- begin: barrierColor.withOpacity ( 0.0 ),
1111+ begin: barrierColor.withValues (alpha : 0.0 ),
11451112 end: barrierColor, // changedInternalState is called if barrierColor updates
11461113 ).chain (CurveTween (curve: barrierCurve)), // changedInternalState is called if barrierCurve updates
11471114 );
0 commit comments