@@ -412,12 +412,9 @@ class _OpenContainerRoute extends ModalRoute<void> {
412
412
// work.
413
413
final GlobalKey _openBuilderKey = GlobalKey ();
414
414
415
- // Defines the position of the (opening) [OpenContainer] within the bounds of
416
- // the enclosing [Navigator].
417
- final RectTween _insetsTween = RectTween (end: Rect .zero);
418
-
419
- // Defines the size of the [OpenContainer].
420
- final SizeTween _sizeTween = SizeTween ();
415
+ // Defines the position and the size of the (opening) [OpenContainer] within
416
+ // the bounds of the enclosing [Navigator].
417
+ final RectTween _rectTween = RectTween ();
421
418
422
419
AnimationStatus _lastAnimationStatus;
423
420
AnimationStatus _currentAnimationStatus;
@@ -465,21 +462,14 @@ class _OpenContainerRoute extends ModalRoute<void> {
465
462
final RenderBox navigator =
466
463
Navigator .of (navigatorContext).context.findRenderObject ();
467
464
final Size navSize = _getSize (navigator);
468
- _sizeTween .end = navSize;
465
+ _rectTween .end = Offset .zero & navSize;
469
466
470
467
void takeMeasurementsInSourceRoute ([Duration _]) {
471
468
if (! navigator.attached || hideableKey.currentContext == null ) {
472
469
return ;
473
470
}
474
- final Rect srcRect = _getRect (hideableKey, navigator);
475
- _sizeTween.begin = srcRect.size;
476
- _insetsTween.begin = Rect .fromLTRB (
477
- srcRect.left,
478
- srcRect.top,
479
- navSize.width - srcRect.right,
480
- navSize.height - srcRect.bottom,
481
- );
482
- hideableKey.currentState.placeholderSize = _sizeTween.begin;
471
+ _rectTween.begin = _getRect (hideableKey, navigator);
472
+ hideableKey.currentState.placeholderSize = _rectTween.begin.size;
483
473
}
484
474
485
475
if (delayForSourceRoute) {
@@ -600,73 +590,70 @@ class _OpenContainerRoute extends ModalRoute<void> {
600
590
assert (false ); // Unreachable.
601
591
break ;
602
592
}
603
- final Rect rect = _insetsTween.evaluate (curvedAnimation);
604
- final Size size = _sizeTween.evaluate (curvedAnimation);
593
+ final Rect rect = _rectTween.evaluate (curvedAnimation);
605
594
return SizedBox .expand (
606
595
child: Container (
607
596
color: scrimTween.evaluate (curvedAnimation),
608
- child: Padding (
609
- padding: EdgeInsets .fromLTRB (
610
- rect.left,
611
- rect.top,
612
- rect.right,
613
- rect.bottom,
614
- ),
615
- child: SizedBox (
616
- width: size.width,
617
- height: size.height,
618
- child: Material (
619
- clipBehavior: Clip .antiAlias,
620
- animationDuration: Duration .zero,
621
- color: colorTween.evaluate (animation),
622
- shape: _shapeTween.evaluate (curvedAnimation),
623
- elevation: _elevationTween.evaluate (curvedAnimation),
624
- child: Stack (
625
- fit: StackFit .passthrough,
626
- children: < Widget > [
627
- // Closed child fading out.
628
- FittedBox (
629
- fit: BoxFit .fitWidth,
630
- alignment: Alignment .topLeft,
631
- child: SizedBox (
632
- width: _sizeTween.begin.width,
633
- height: _sizeTween.begin.height,
634
- child: hideableKey.currentState.isInTree
635
- ? null
636
- : Opacity (
637
- opacity:
638
- closedOpacityTween.evaluate (animation),
639
- child: Builder (
640
- key: closedBuilderKey,
641
- builder: (BuildContext context) {
642
- // Use dummy "open container" callback
643
- // since we are in the process of opening.
644
- return closedBuilder (context, () {});
645
- },
597
+ child: Align (
598
+ alignment: Alignment .topLeft,
599
+ child: Transform .translate (
600
+ offset: Offset (rect.left, rect.top),
601
+ child: SizedBox (
602
+ width: rect.width,
603
+ height: rect.height,
604
+ child: Material (
605
+ clipBehavior: Clip .antiAlias,
606
+ animationDuration: Duration .zero,
607
+ color: colorTween.evaluate (animation),
608
+ shape: _shapeTween.evaluate (curvedAnimation),
609
+ elevation: _elevationTween.evaluate (curvedAnimation),
610
+ child: Stack (
611
+ fit: StackFit .passthrough,
612
+ children: < Widget > [
613
+ // Closed child fading out.
614
+ FittedBox (
615
+ fit: BoxFit .fitWidth,
616
+ alignment: Alignment .topLeft,
617
+ child: SizedBox (
618
+ width: _rectTween.begin.width,
619
+ height: _rectTween.begin.height,
620
+ child: hideableKey.currentState.isInTree
621
+ ? null
622
+ : Opacity (
623
+ opacity: closedOpacityTween
624
+ .evaluate (animation),
625
+ child: Builder (
626
+ key: closedBuilderKey,
627
+ builder: (BuildContext context) {
628
+ // Use dummy "open container" callback
629
+ // since we are in the process of opening.
630
+ return closedBuilder (context, () {});
631
+ },
632
+ ),
646
633
),
647
- ),
634
+ ),
648
635
),
649
- ),
650
-
651
- // Open child fading in.
652
- FittedBox (
653
- fit : BoxFit .fitWidth ,
654
- alignment : Alignment .topLeft,
655
- child : SizedBox (
656
- width : _sizeTween .end.width ,
657
- height : _sizeTween.end.height,
658
- child : Opacity (
659
- opacity : openOpacityTween. evaluate (animation),
660
- child : Builder (
661
- key : _openBuilderKey,
662
- builder : ( BuildContext context) {
663
- return openBuilder (context, closeContainer);
664
- } ,
636
+
637
+ // Open child fading in.
638
+ FittedBox (
639
+ fit : BoxFit .fitWidth,
640
+ alignment : Alignment .topLeft ,
641
+ child : SizedBox (
642
+ width : _rectTween.end.width,
643
+ height : _rectTween .end.height ,
644
+ child : Opacity (
645
+ opacity : openOpacityTween. evaluate (animation),
646
+ child : Builder (
647
+ key : _openBuilderKey,
648
+ builder : ( BuildContext context) {
649
+ return openBuilder ( context, closeContainer);
650
+ },
651
+ ) ,
665
652
),
666
653
),
667
654
),
668
- ) ,
669
- ] ,
655
+ ] ,
656
+ ) ,
670
657
),
671
658
),
672
659
),
0 commit comments