void _handlePressed(bool isExpanded, int index) { if (this.widget.expansionCallback != null) { this.widget.expansionCallback(index, isExpanded); } if (this.widget._allowOnlyOnePanelOpen) { ExpansionPanelRadio pressedChild = (ExpansionPanelRadio)this.widget.children[index]; for (int childIndex = 0; childIndex < this.widget.children.Count; childIndex++) { ExpansionPanelRadio child = (ExpansionPanelRadio)this.widget.children[childIndex]; if (this.widget.expansionCallback != null && childIndex != index && child.value == this._currentOpenPanel?.value) { this.widget.expansionCallback(childIndex, false); } } this._currentOpenPanel = isExpanded ? null : pressedChild; } this.setState(() => { }); }
bool _isChildExpanded(int index) { if (this.widget._allowOnlyOnePanelOpen) { ExpansionPanelRadio radioWidget = (ExpansionPanelRadio)this.widget.children[index]; return(this._currentOpenPanel?.value == radioWidget.value); } return(this.widget.children[index].isExpanded); }
public override void initState() { base.initState(); if (this.widget._allowOnlyOnePanelOpen) { D.assert(this._allIdentifierUnique(), "All object identifiers are not unique!"); foreach (ExpansionPanelRadio child in this.widget.children) { if (this.widget.initialOpenPanelValue != null && child.value == this.widget.initialOpenPanelValue) { this._currentOpenPanel = child; } } } }
public override void initState() { base.initState(); if (widget._allowOnlyOnePanelOpen) { D.assert(_allIdentifierUnique(), () => "All ExpansionPanelRadio identifier values must be unique."); foreach (ExpansionPanelRadio child in widget.children) { if (widget.initialOpenPanelValue != null) { _currentOpenPanel = searchPanelByValue(widget.children.Cast <ExpansionPanelRadio>().ToList(), widget.initialOpenPanelValue); } } } }
public override void didUpdateWidget(StatefulWidget oldWidget) { base.didUpdateWidget(oldWidget); ExpansionPanelList _oldWidget = (ExpansionPanelList)oldWidget; if (widget._allowOnlyOnePanelOpen) { D.assert(_allIdentifierUnique(), () => "All ExpansionPanelRadio identifier values must be unique."); if (!_oldWidget._allowOnlyOnePanelOpen) { _currentOpenPanel = searchPanelByValue(widget.children.Cast <ExpansionPanelRadio>().ToList(), widget.initialOpenPanelValue); } } else { _currentOpenPanel = null; } }
public override void didUpdateWidget(StatefulWidget oldWidget) { base.didUpdateWidget(oldWidget); ExpansionPanelList _oldWidget = (ExpansionPanelList)oldWidget; if (this.widget._allowOnlyOnePanelOpen) { D.assert(this._allIdentifierUnique(), "All object identifiers are not unique!"); foreach (ExpansionPanelRadio newChild in this.widget.children) { if (this.widget.initialOpenPanelValue != null && newChild.value == this.widget.initialOpenPanelValue) { this._currentOpenPanel = newChild; } } } else if (_oldWidget._allowOnlyOnePanelOpen) { this._currentOpenPanel = null; } }