コード例 #1
0
 public override Widget build(BuildContext context)
 {
     return(new Expanded(
                flex: flex,
                child: SizedBox.shrink()
                ));
 }
コード例 #2
0
ファイル: visibility.cs プロジェクト: JC-ut0/CubeGame
 public Visibility(
     Key key                    = null,
     Widget child               = null,
     Widget replacement         = null,
     bool visible               = true,
     bool maintainState         = false,
     bool maintainAnimation     = false,
     bool maintainSize          = false,
     bool maintainInteractivity = false
     ) : base(key: key)
 {
     D.assert(child != null);
     D.assert(maintainState == true || maintainAnimation == false,
              () => "Cannot maintain animations if the state is not also maintained.");
     D.assert(maintainAnimation == true || maintainSize == false,
              () => "Cannot maintain size if animations are not maintained.");
     D.assert(maintainSize == true || maintainInteractivity == false,
              () => "Cannot maintain interactivity if size is not maintained.");
     this.replacement           = replacement ?? SizedBox.shrink();
     this.child                 = child;
     this.visible               = visible;
     this.maintainState         = maintainState;
     this.maintainAnimation     = maintainAnimation;
     this.maintainSize          = maintainSize;
     this.maintainInteractivity = maintainInteractivity;
 }
コード例 #3
0
        Widget _buildDrawer(BuildContext context)
        {
            bool          drawerIsStart = widget.alignment == DrawerAlignment.start;
            EdgeInsets    padding       = MediaQuery.of(context).padding;
            TextDirection textDirection = Directionality.of(context);

            float?dragAreaWidth = widget.edgeDragWidth;

            if (widget.edgeDragWidth == null)
            {
                switch (textDirection)
                {
                case TextDirection.ltr:
                    dragAreaWidth = DrawerUtils._kEdgeDragWidth +
                                    (drawerIsStart ? padding.left : padding.right);
                    break;

                case TextDirection.rtl:
                    dragAreaWidth = DrawerUtils._kEdgeDragWidth +
                                    (drawerIsStart ? padding.right : padding.left);
                    break;
                }
            }

            if (_controller.status == AnimationStatus.dismissed)
            {
                if (widget.enableOpenDragGesture ?? false)
                {
                    return(new Align(
                               alignment: _drawerOuterAlignment,
                               child: new GestureDetector(
                                   key: _gestureDetectorKey,
                                   onHorizontalDragUpdate: _move,
                                   onHorizontalDragEnd: _settle,
                                   behavior: HitTestBehavior.translucent,
                                   dragStartBehavior: widget.dragStartBehavior ?? DragStartBehavior.down,
                                   child: new Container(width: dragAreaWidth)
                                   )
                               ));
                }
                else
                {
                    return(SizedBox.shrink());
                }
            }
            else
            {
                bool?platformHasBackButton = null;
                switch (Theme.of(context).platform)
                {
                case RuntimePlatform.Android:
                    platformHasBackButton = true;
                    break;

                case RuntimePlatform.IPhonePlayer:
                case RuntimePlatform.OSXEditor:
                case RuntimePlatform.OSXPlayer:
                case RuntimePlatform.LinuxEditor:
                case RuntimePlatform.LinuxPlayer:
                case RuntimePlatform.WindowsEditor:
                case RuntimePlatform.WindowsPlayer:
                    platformHasBackButton = false;
                    break;
                }

                D.assert(platformHasBackButton != null);
                return(new GestureDetector(
                           key: _gestureDetectorKey,
                           onHorizontalDragDown: _handleDragDown,
                           onHorizontalDragUpdate: _move,
                           onHorizontalDragEnd: _settle,
                           onHorizontalDragCancel: _handleDragCancel,
                           dragStartBehavior: widget.dragStartBehavior ?? DragStartBehavior.down,
                           child: new RepaintBoundary(
                               child: new Stack(
                                   children: new List <Widget> {
                    new GestureDetector(
                        onTap: close,
                        child: new MouseRegion(
                            opaque: true,
                            child: new Container(             // The drawer's "scrim"
                                color: _scrimColorTween.evaluate(_controller)
                                )
                            )
                        ),
                    new Align(
                        alignment: _drawerOuterAlignment,
                        child: new Align(
                            alignment: _drawerInnerAlignment,
                            widthFactor: _controller.value,
                            child: new RepaintBoundary(
                                child: new FocusScope(
                                    key: _drawerKey,
                                    node: _focusScopeNode,
                                    child: widget.child
                                    )
                                )
                            )
                        )
                }
                                   )
                               )
                           ));
            }
        }