hasFlex method
check if a widget have flex or flexMode set. This essentially means the widget already handles this themselves already
Implementation
bool hasFlex(Widget widget) {
if (widget is DataScopeWidget) {
widget = widget.child;
}
// legacy widgets
if (widget is HasController && widget.controller is WidgetController) {
return (widget.controller as WidgetController).flex != null ||
(widget.controller as WidgetController).flexMode != null ||
(widget.controller as WidgetController).expanded;
}
// new widgets
else if (widget is EnsembleWidget &&
widget.controller is EnsembleWidgetController) {
return (widget.controller as EnsembleWidgetController).flex != null ||
(widget.controller as EnsembleWidgetController).flexMode != null;
}
return false;
}