예제 #1
0
        public PopupMenuButton(
            Key key = null,
            PopupMenuItemBuilder <T> itemBuilder = null,
            T initialValue = default,
            PopupMenuItemSelected <T> onSelected = null,
            PopupMenuCanceled onCanceled         = null,
            string tooltip     = null,
            float elevation    = 8.0f,
            EdgeInsets padding = null,
            Widget child       = null,
            Icon icon          = null,
            Offset offset      = null
            ) : base(key: key)
        {
            offset = offset ?? Offset.zero;
            D.assert(itemBuilder != null);
            D.assert(offset != null);
            D.assert(!(child != null && icon != null));

            this.itemBuilder  = itemBuilder;
            this.initialValue = initialValue;
            this.onSelected   = onSelected;
            this.onCanceled   = onCanceled;
            this.tooltip      = tooltip;
            this.elevation    = elevation;
            this.padding      = padding ?? EdgeInsets.all(8.0f);
            this.child        = child;
            this.icon         = icon;
            this.offset       = offset;
        }
예제 #2
0
        public PopupMenuButton(
            Key key = null,
            PopupMenuItemBuilder <T> itemBuilder = null,
            T initialValue = default,
            PopupMenuItemSelected <T> onSelected = null,
            PopupMenuCanceled onCanceled         = null,
            string tooltip             = null,
            float?elevation            = null,
            EdgeInsetsGeometry padding = null,
            Widget child                = null,
            Icon icon                   = null,
            Offset offset               = null,
            bool enabled                = true,
            ShapeBorder shape           = null,
            Color color                 = null,
            bool captureInheritedThemes = true
            ) : base(key: key)
        {
            offset = offset ?? Offset.zero;
            D.assert(itemBuilder != null);
            D.assert(offset != null);
            D.assert(!(child != null && icon != null), () => "You can only pass [child] or [icon], not both.");

            this.itemBuilder            = itemBuilder;
            this.initialValue           = initialValue;
            this.onSelected             = onSelected;
            this.onCanceled             = onCanceled;
            this.tooltip                = tooltip;
            this.elevation              = elevation;
            this.padding                = padding ?? EdgeInsets.all(8.0f);
            this.child                  = child;
            this.icon                   = icon;
            this.offset                 = offset;
            this.enabled                = enabled;
            this.shape                  = shape;
            this.color                  = color;
            this.captureInheritedThemes = captureInheritedThemes;
        }