public FunctionContext(ExpressionCompiler compiler, string name) { _compiler = compiler; _instructions = new List<Instruction>(); _loopLabels = new IndexedStack<Tuple<LabelOperand, LabelOperand>>(); Name = name != null ? _compiler.Identifier(name) : null; Label = _compiler.MakeLabel("function"); IdentifierCount = 0; }
public FunctionContext(ExpressionCompiler compiler, int frameIndex, Scope prevScope, string parentName, string name) { _instructions = new List <Instruction>(); _loopLabels = new IndexedStack <Tuple <LabelOperand, LabelOperand> >(); Compiler = compiler; FrameIndex = frameIndex; Scope = new Scope(frameIndex, prevScope); ParentName = parentName; Name = name; FullName = string.Format("{0}{1}{2}", parentName, string.IsNullOrEmpty(parentName) ? "" : ".", Name ?? ""); AssignedName = name != null?prevScope.Get(name) : null; Label = Compiler.MakeLabel("function"); IdentifierCount = 0; }
public FunctionContext(ExpressionCompiler compiler, int argIndex, int localIndex, Scope prevScope, string parentName, string name) { _instructions = new List<Instruction>(); _loopLabels = new IndexedStack<Tuple<LabelOperand, LabelOperand>>(); Compiler = compiler; ArgIndex = argIndex; LocalIndex = localIndex; Scope = prevScope; ParentName = parentName; Name = name; FullName = string.Format("{0}{1}{2}", parentName, string.IsNullOrEmpty(parentName) ? "" : ".", Name ?? ""); AssignedName = name != null ? prevScope.Get(name) : null; Label = Compiler.MakeLabel("function"); IdentifierCount = 0; }
public override Widget build(BuildContext context) { D.assert(material_.debugCheckHasMaterial(context)); D.assert(material_.debugCheckHasMaterialLocalizations(context)); Orientation?newOrientation = _getOrientation(context); _lastOrientation = _lastOrientation ?? newOrientation; if (newOrientation != _lastOrientation) { _removeDropdownRoute(); _lastOrientation = newOrientation; } List <Widget> items = null; if (_enabled) { items = widget.selectedItemBuilder == null ? new List <Widget>(widget.items) : widget.selectedItemBuilder(context); } else { items = widget.selectedItemBuilder == null ? new List <Widget>() : widget.selectedItemBuilder(context); } int hintIndex = 0; if (widget.hint != null || (!_enabled && widget.disabledHint != null)) { Widget displayedHint = _enabled ? widget.hint : widget.disabledHint ?? widget.hint; if (widget.selectedItemBuilder == null) { displayedHint = new _DropdownMenuItemContainer(child: displayedHint); } hintIndex = items.Count; items.Add(new DefaultTextStyle( style: _textStyle.copyWith(color: Theme.of(context).hintColor), child: new IgnorePointer( child: displayedHint ) )); } EdgeInsetsGeometry padding = ButtonTheme.of(context).alignedDropdown ? material_._kAlignedButtonPadding : material_._kUnalignedButtonPadding; int index = _enabled ? (_selectedIndex ?? hintIndex) : hintIndex; Widget innerItemsWidget = null; if (items.isEmpty()) { innerItemsWidget = new Container(); } else { innerItemsWidget = new IndexedStack( index: index, alignment: AlignmentDirectional.centerStart, children: widget.isDense ? items : LinqUtils <Widget> .SelectList(items, (Widget item) => { return(widget.itemHeight != null ? new SizedBox(height: widget.itemHeight, child: item) : (Widget) new Column(mainAxisSize: MainAxisSize.min, children: new List <Widget>() { item })); })); } Icon defaultIcon = new Icon(Icons.arrow_drop_down); Widget result = new DefaultTextStyle( style: _textStyle, child: new Container( decoration: _showHighlight ?? false ? new BoxDecoration( color: widget.focusColor ?? Theme.of(context).focusColor, borderRadius: BorderRadius.all(Radius.circular(4.0f)) ) : null, padding: padding, height: widget.isDense ? _denseButtonHeight : null, child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.min, children: new List <Widget> { widget.isExpanded ? new Expanded(child: innerItemsWidget) : (Widget)innerItemsWidget, new IconTheme( data: new IconThemeData( color: _iconColor, size: widget.iconSize ), child: widget.icon ?? defaultIcon ) } ) ) ); if (!DropdownButtonHideUnderline.at(context)) { float bottom = widget.isDense || widget.itemHeight == null ? 0.0f : 8.0f; result = new Stack( children: new List <Widget> { result, new Positioned( left: 0.0f, right: 0.0f, bottom: bottom, child: widget.underline ?? new Container( height: 1.0f, decoration: new BoxDecoration( border: new Border( bottom: new BorderSide(color: new Color(0xFFBDBDBD), width: 0.0f)) ) ) ) } ); } return(new Focus( canRequestFocus: _enabled, focusNode: focusNode, autofocus: widget.autofocus, child: new GestureDetector( onTap: _enabled ? (GestureTapCallback)_handleTap : null, behavior: HitTestBehavior.opaque, child: result ) )); }
public override Widget build(BuildContext context) { D.assert(MaterialD.debugCheckHasMaterial(context)); D.assert(MaterialD.debugCheckHasMaterialLocalizations(context)); List <Widget> items = this._enabled ? new List <Widget>(this.widget.items) : new List <Widget>(); int hintIndex = 0; if (this.widget.hint != null || (!this._enabled && this.widget.disabledHint != null)) { Widget emplacedHint = this._enabled ? this.widget.hint : new DropdownMenuItem <Widget>(child: this.widget.disabledHint ?? this.widget.hint); hintIndex = items.Count; items.Add(new DefaultTextStyle( style: this._textStyle.copyWith(color: Theme.of(context).hintColor), child: new IgnorePointer( child: emplacedHint ) )); } EdgeInsets padding = ButtonTheme.of(context).alignedDropdown ? DropdownConstants._kAlignedButtonPadding : DropdownConstants._kUnalignedButtonPadding; IndexedStack innerItemsWidget = new IndexedStack( index: this._enabled ? (this._selectedIndex ?? hintIndex) : hintIndex, alignment: Alignment.centerLeft, children: items ); Widget result = new DefaultTextStyle( style: this._textStyle, child: new Container( padding: padding, height: this.widget.isDense ? this._denseButtonHeight : null, child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.min, children: new List <Widget> { this.widget.isExpanded ? new Expanded(child: innerItemsWidget) : (Widget)innerItemsWidget, new Icon(Icons.arrow_drop_down, size: this.widget.iconSize, color: this._downArrowColor ) } ) ) ); if (!DropdownButtonHideUnderline.at(context)) { float bottom = this.widget.isDense ? 0.0f : 8.0f; result = new Stack( children: new List <Widget> { result, new Positioned( left: 0.0f, right: 0.0f, bottom: bottom, child: new Container( height: 1.0f, decoration: new BoxDecoration( border: new Border( bottom: new BorderSide(color: new Color(0xFFBDBDBD), width: 0.0f)) ) ) ) } ); } return(new GestureDetector( onTap: this._enabled ? (GestureTapCallback)this._handleTap : null, behavior: HitTestBehavior.opaque, child: result )); }